...
No Format |
---|
import java.util.List; import org.lcsim.event.EventHeader; import org.lcsim.event.EventHeader.LCMetaData; import org.lcsim.event.SimTrackerHit; import org.lcsim.geometry.TrackerIDDecoderIDDecoder; import org.lcsim.util.Driver; import org.lcsim.util.aida.AIDA; import hep.aida.ITree; /* * TrackerHitAccessDriver.java * * Created on July 31, 2005, 3:03 PM * */ /** * * @author Norman A. Graf */ public class TrackerHitAccessDriver extends Driver { private AIDA aida = AIDA.defaultInstance(); private ITree _tree; public TrackerHitAccessDriver() { _tree = aida.tree(); } protected void process(EventHeader event) { List<List<SimTrackerHit>> simTrackerHitCollections = event.get(SimTrackerHit.class); for ( List<SimTrackerHit> simTrackerHits : simTrackerHitCollections ) { LCMetaData meta = event.getMetaData(simTrackerHits); TrackerIDDecoderIDDecoder decoder = (TrackerIDDecoder) meta.getIDDecoder(); for (SimTrackerHit trackerHit : simTrackerHits) { decoder.setID(trackerHit.getCellID() ); int layer = decoder.getLayer(); double[] pos = trackerHit.getPoint(); aida.cloud2D(meta.getName()+" layer "+layer+" x vs y").fill(pos[0], pos[1]); } } } } |
...
No Format |
---|
aida.cloud2D(meta.getName()+" layer "+layer+" x vs y").fill(pos[0], pos[1]); |
This one line contains a lot of functionality, so merits some extra attention.
Wiki Markup
First, a cloud2D is a two-dimensional tuple. The cloud2D method of the AIDA object takes a string which is the title. We construct the title from the name of the tracker collection (obtained from the metadata via its getName() method) and add the layer number as well. For example, we might end up with a tuple titled *"TkrBarrHits layer 0 x vs y"* for the x,y hit position of SimTrackerHits on layer 0 of the collection TkrBarrHits. If this cloud does not already exist, it will be created, else the instance is returned. We then fill the tuple with the cloud2D fill() method, where pos\[0\] and pos\[1\] are understood to be the x and y position, respectively.
Here is an example plot showing the x vs y hit position for layer 0 of a silicon strip barrel detector:
Not too exciting, but now you know how to access the tracker hit information in an event.