Commit in lcsim/sandbox on MAIN | |||
CalHitStepPosTest.java | -103 | 1.1 removed |
diff -N CalHitStepPosTest.java --- CalHitStepPosTest.java 12 Jan 2012 00:15:27 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,103 +0,0 @@
-package org.lcsim; - -import hep.physics.vec.BasicHep3Vector; -import hep.physics.vec.Hep3Vector; -import hep.physics.vec.VecOp; - -import java.io.File; -import java.io.IOException; -import java.util.List; - -import junit.framework.TestCase; - -import org.freehep.record.loop.LoopException; -import org.lcsim.event.EventHeader; -import org.lcsim.event.SimCalorimeterHit; -import org.lcsim.geometry.IDDecoder; -import org.lcsim.job.EventMarkerDriver; -import org.lcsim.util.Driver; -import org.lcsim.util.loop.LCSimLoop; - -public class CalHitStepPosTest extends TestCase -{ - //String fileName = "/u1/projects/SimDist/HEAD/panpyqqbar-0-1000_SLIC-v2r10p7_geant4-v9r4p2_QGSP_BERT_caltest.slcio"; - String fileName = "/u1/projects/lcsim/HEAD/muons500_Theta4-176_1-10GeV_SLIC-v2r11p2_geant4-v9r4p2_QGSP_BERT_sidloi3.slcio"; - - public void testIt() - { - //System.out.println("testIt..."); - File file = new File(fileName); - LCSimLoop loop = new LCSimLoop(); - loop.add(new EventMarkerDriver()); - //loop.add(new StepPosCheckDriver()); - loop.add(new CellPlotDriver()); - try - { - loop.setLCIORecordSource(file); - } - catch (IOException x) - { - throw new RuntimeException(x); - } - try - { - loop.loop(-1, null); - } - catch (LoopException x) - { - throw new RuntimeException(x); - } - catch (IOException x) - { - throw new RuntimeException(x); - } - System.out.println("ran over " + loop.getTotalSupplied() + " records"); - loop.dispose(); - } - - /* - static class StepPosCheckDriver extends Driver - { - public void process(EventHeader event) - { - System.out.println("proc event = " + event.getEventNumber()); - List<List<SimCalorimeterHit>> hitCollections = - event.get(SimCalorimeterHit.class); - for (List<SimCalorimeterHit> hits : hitCollections) - { - System.out.println("collection = " + event.getMetaData(hits).getName()); - for (SimCalorimeterHit hit : hits) - { - int ncontrib = hit.getMCParticleCount(); - for (int i=0; i<ncontrib; i++) - { - float steppos[] = hit.getStepPosition(i); - System.out.println("steppos = { " + ", " + steppos[0] + ", " + steppos[1] + ", " + steppos[2] + " }"); - } - } - } - } - } - */ - - static class CellPlotDriver extends Driver - { - public void process(EventHeader event) - { - List<SimCalorimeterHit> hits = event.get(SimCalorimeterHit.class, "HcalBarrelHits"); - IDDecoder decoder = event.getMetaData(hits).getIDDecoder(); - for (SimCalorimeterHit hit : hits) - { - decoder.setID(hit.getCellID()); - Hep3Vector cellPos = decoder.getPositionVector(); - int ncontribs = hit.getMCParticleCount(); - for (int i=0; i<ncontribs; i++) - { - float stepPos[] = hit.getStepPosition(i); - Hep3Vector stepVec = new BasicHep3Vector(stepPos[0], stepPos[1], stepPos[2]); - System.out.println("cell pos = " + VecOp.sub(stepVec, cellPos)); - } - } - } - } -}
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1