Author: [log in to unmask] Date: Fri Aug 28 12:08:13 2015 New Revision: 3434 Log: Modify GBLOutputDriver to use all track collections in event; modify the recon drivers to call GBLOutputDriver. Add all tracking collections to the MC pass2 driver. Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullReconMC_Pass2.lcsim java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullRecon_Pass2.lcsim java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLOutputDriver.java Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullReconMC_Pass2.lcsim ============================================================================= --- java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullReconMC_Pass2.lcsim (original) +++ java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullReconMC_Pass2.lcsim Fri Aug 28 12:08:13 2015 @@ -13,17 +13,46 @@ <driver name="RawTrackerHitSensorSetup"/> <driver name="RawTrackerHitFitterDriver" /> <driver name="TrackerHitDriver"/> - <driver name="HelicalTrackHitDriver"/> - <driver name="TrackerReconDriver"/> + <driver name="HelicalTrackHitDriver"/> + <!-- + Will run track finding algorithm using layers 345 as a seed, + layer 2 to confirm and layers 1 and 6 to extend. The collection + name of the tracks found with this strategy will be "MatchedTracks". + --> + <driver name="TrackReconSeed345Conf2Extd16"/> + <!-- + Will run track finding algorithm using layers 456 as a seed, + layer 3 to confirm and layers 2 and 1 to extend. The collection + name of the tracks found with this strategy will be + "Tracks_s456_c3_e21" + --> + <driver name="TrackReconSeed456Conf3Extd21"/> + <!-- + Will run track finding algorithm using layers 123 as a seed, + layer 4 to confirm and layers 5 and 6 to extend. The collection + name of the tracks found with this strategy will be + "Tracks_s123_c4_e56" + --> + <driver name="TrackReconSeed123Conf4Extd56"/> + <!-- + Will run track finding algorithm using layers 123 as a seed, + layer 5 to confirm and layers 4 and 6 to extend. The collection + name of the tracks found with this strategy will be + "Tracks_s123_c5_e46" + --> + <driver name="TrackReconSeed123Conf5Extd46"/> + <!-- + TrackDataDriver needs to be run before ReconParticleDriver so the + ReconstructedParticle types are properly set. + --> <driver name="EcalRawConverter" /> <driver name="ReconClusterer" /> <driver name="GTPOnlineClusterer" /> <driver name="CopyCluster" /> <driver name="ReconParticle" /> <driver name="TrackDataDriver" /> - <driver name="GBLDriver"/> + <driver name="GBLOutputDriver"/> <driver name="LCIOWriter"/> - <driver name="CleanupDriver"/> </execute> <drivers> @@ -57,17 +86,34 @@ <debug>false</debug> <clusterTimeCut>12.0</clusterTimeCut> <maxDt>16.0</maxDt> + <clusterAmplitudeCut>400.0</clusterAmplitudeCut> </driver> - <driver name="TrackerReconDriver" type="org.hps.recon.tracking.TrackerReconDriver"> - <strategyResource>HPS-Full.xml</strategyResource> + <!-- SVT Track finding --> + <driver name="TrackReconSeed345Conf2Extd16" type="org.hps.recon.tracking.TrackerReconDriver"> + <trackCollectionName>MatchedTracks</trackCollectionName> + <strategyResource>HPS_s345_c2_e16.xml</strategyResource> <debug>false</debug> <rmsTimeCut>8.0</rmsTimeCut> - </driver> - <driver name="GBLDriver" type="org.hps.recon.tracking.gbl.GBLOutputDriver"> - <debug>0</debug> - <isMC>false</isMC> - <gblFileName></gblFileName> - </driver> + </driver> + <driver name="TrackReconSeed456Conf3Extd21" type="org.hps.recon.tracking.TrackerReconDriver"> + <trackCollectionName>Tracks_s456_c3_e21</trackCollectionName> + <strategyResource>HPS_s456_c3_e21.xml</strategyResource> + <debug>false</debug> + <rmsTimeCut>8.0</rmsTimeCut> + </driver> + <driver name="TrackReconSeed123Conf4Extd56" type="org.hps.recon.tracking.TrackerReconDriver"> + <trackCollectionName>Tracks_s123_c4_e56</trackCollectionName> + <strategyResource>HPS_s123_c4_e56.xml</strategyResource> + <debug>false</debug> + <rmsTimeCut>8.0</rmsTimeCut> + </driver> + <driver name="TrackReconSeed123Conf5Extd46" type="org.hps.recon.tracking.TrackerReconDriver"> + <trackCollectionName>Tracks_s123_c5_e46</trackCollectionName> + <strategyResource>HPS_s123_c5_e46.xml</strategyResource> + <debug>false</debug> + <rmsTimeCut>8.0</rmsTimeCut> + </driver> + <driver name="GBLOutputDriver" type="org.hps.recon.tracking.gbl.GBLOutputDriver"/> <driver name="EcalRawConverter" type="org.hps.recon.ecal.EcalRawConverterDriver"> <ecalCollectionName>EcalCalHits</ecalCollectionName> <use2014Gain>false</use2014Gain> Modified: java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullRecon_Pass2.lcsim ============================================================================= --- java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullRecon_Pass2.lcsim (original) +++ java/trunk/steering-files/src/main/resources/org/hps/steering/recon/EngineeringRun2015FullRecon_Pass2.lcsim Fri Aug 28 12:08:13 2015 @@ -25,7 +25,7 @@ layer 2 to confirm and layers 1 and 6 to extend. The collection name of the tracks found with this strategy will be "MatchedTracks". --> - <driver name="TrackReconSeed345Conf2Extd16"/> + <driver name="TrackReconSeed345Conf2Extd16"/> <!-- Will run track finding algorithm using layers 456 as a seed, layer 3 to confirm and layers 2 and 1 to extend. The collection @@ -52,8 +52,8 @@ ReconstructedParticle types are properly set. --> <driver name="TrackDataDriver" /> + <driver name="GBLOutputDriver" /> <driver name="ReconParticleDriver" /> - <driver name="GBLOutputDriver"/> <driver name="LCIOWriter"/> <driver name="CleanupDriver"/> </execute> @@ -159,11 +159,7 @@ </driver> <driver name="TrackDataDriver" type="org.hps.recon.tracking.TrackDataDriver" /> <driver name="ReconParticleDriver" type="org.hps.recon.particle.HpsReconParticleDriver" /> - <driver name="GBLOutputDriver" type="org.hps.recon.tracking.gbl.GBLOutputDriver"> - <debug>0</debug> - <isMC>false</isMC> - <gblFileName>${outputFile}.gbl</gblFileName> - </driver> + <driver name="GBLOutputDriver" type="org.hps.recon.tracking.gbl.GBLOutputDriver"/> <driver name="LCIOWriter" type="org.lcsim.util.loop.LCIODriver"> <outputFilePath>${outputFile}.slcio</outputFilePath> </driver> Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLOutputDriver.java ============================================================================= --- java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLOutputDriver.java (original) +++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/gbl/GBLOutputDriver.java Fri Aug 28 12:08:13 2015 @@ -23,16 +23,18 @@ import org.lcsim.util.aida.AIDA; /** -* This driver class is used to -* 1) write lcio collection of GBL info objects OR -* 2) write GBL info into a unstructures text-based output -* -* It uses a helper class that does the actual work. We will port GBL to java and that will replace this driver. -* -* @author Per Hansson Adrian <[log in to unmask]> -* @version $Id: GBLOutputDriver.java,v 1.9 2013/11/07 03:54:58 phansson Exp $ $Date: 2013/11/07 03:54:58 $ $Author: phansson $ -* -*/ + * This driver class is used to + * 1) write lcio collection of GBL info objects OR + * 2) write GBL info into a unstructures text-based output + * + * It uses a helper class that does the actual work. We will port GBL to java + * and that will replace this driver. + * + * @author Per Hansson Adrian <[log in to unmask]> + * @version $Id: GBLOutputDriver.java,v 1.9 2013/11/07 03:54:58 phansson Exp $ + * $Date: 2013/11/07 03:54:58 $ $Author: phansson $ + * + */ public class GBLOutputDriver extends Driver { private AIDA aida = AIDA.defaultInstance(); @@ -40,27 +42,24 @@ GBLOutput gbl = null; TruthResiduals truthRes = null; private String gblFileName = ""; - private String outputPlotFileName=""; - private String MCParticleCollectionName = "MCParticle"; + private String outputPlotFileName = ""; + private String MCParticleCollectionName = "MCParticle"; private int _debug = 0; - private boolean isMC = true; - private int totalTracks=0; - private int totalTracksProcessed=0; + private boolean isMC = false; + private int totalTracks = 0; + private int totalTracksProcessed = 0; private int iTrack = 0; private int iEvent = 0; - - - + public GBLOutputDriver() { } - @Override public void detectorChanged(Detector detector) { Hep3Vector bfield = detector.getFieldMap().getField(new BasicHep3Vector(0., 0., 1.)); - + // Create the class that handles all the GBL output - gbl = new GBLOutput(gblFileName,bfield); // if filename is empty no text file is written + gbl = new GBLOutput(gblFileName, bfield); // if filename is empty no text file is written gbl.setDebug(_debug); gbl.buildModel(detector); gbl.setAPrimeEventFlag(false); @@ -71,85 +70,82 @@ //truthRes.setDebug(_debug); //truthRes.setHideFrame(hideFrame); } - - - + @Override - public void process(EventHeader event) { - - - List<Track> tracklist = null; - if(event.hasCollection(Track.class,"MatchedTracks")) { - tracklist = event.get(Track.class, "MatchedTracks"); - if(_debug>0) { - System.out.printf("%s: Event %d has %d tracks\n", this.getClass().getSimpleName(),event.getEventNumber(),tracklist.size()); - } - } + public void process(EventHeader event) { + // Check if the event contains a collection of the type Track. If it + // doesn't skip the event. + if (!event.hasCollection(Track.class)) + return; + + // Get all collections of the type Track from the event. This is + // required since the event contains a track collection for each of the + // different tracking strategies. + List<List<Track>> trackCollections = event.get(Track.class); + if (_debug > 0) + System.out.printf("%s: Event %d has %d tracks\n", this.getClass().getSimpleName(), event.getEventNumber(), trackCollections.size()); List<SiTrackerHitStrip1D> stripHits = event.get(SiTrackerHitStrip1D.class, "StripClusterer_SiTrackerHitStrip1D"); - if(_debug>0) System.out.printf("%s: Got %d SiTrackerHitStrip1D in this event\n", stripHits.size()); - - + if (_debug > 0) + System.out.printf("%s: Got %d SiTrackerHitStrip1D in this event\n", stripHits.size()); List<MCParticle> mcParticles = new ArrayList<MCParticle>(); - if(event.hasCollection(MCParticle.class,this.MCParticleCollectionName)) { - mcParticles = event.get(MCParticle.class,this.MCParticleCollectionName); - } + if (event.hasCollection(MCParticle.class, this.MCParticleCollectionName)) + mcParticles = event.get(MCParticle.class, this.MCParticleCollectionName); List<SimTrackerHit> simTrackerHits = new ArrayList<SimTrackerHit>(); - if (event.hasCollection(SimTrackerHit.class, "TrackerHits")) { - simTrackerHits = event.get(SimTrackerHit.class, "TrackerHits"); - } - - if(isMC) { - if(truthRes != null) { - truthRes.processSim(mcParticles, simTrackerHits); - } - } - - - List<Track> selected_tracks = new ArrayList<Track>(); - for (Track trk : tracklist) { - totalTracks++; - if(TrackUtils.isGoodTrack(trk, tracklist, EventQuality.Quality.NONE)) { - if(_debug>0) System.out.printf("%s: Track failed selection\n", this.getClass().getSimpleName()); - selected_tracks.add(trk); + if (event.hasCollection(SimTrackerHit.class, "TrackerHits")) + simTrackerHits = event.get(SimTrackerHit.class, "TrackerHits"); + + if (isMC) + if (truthRes != null) + truthRes.processSim(mcParticles, simTrackerHits); + // Loop over each of the track collections retrieved from the event + List<Track> selected_tracks = new ArrayList<Track>(); + for (List<Track> tracklist : trackCollections) { + for (Track trk : tracklist) { + totalTracks++; + if (TrackUtils.isGoodTrack(trk, tracklist, EventQuality.Quality.NONE)) { + if (_debug > 0) + System.out.printf("%s: Track failed selection\n", this.getClass().getSimpleName()); + selected_tracks.add(trk); + } } } - // GBLData // containers and data - List<GBLEventData> gblEventData = new ArrayList<GBLEventData>(); - gblEventData.add(new GBLEventData(event.getEventNumber(),gbl.get_B().z())); - List<GBLTrackData> gblTrackDataList = new ArrayList<GBLTrackData>(); - List<GBLStripClusterData> gblStripDataListAll = new ArrayList<GBLStripClusterData>(); - List<GBLStripClusterData> gblStripDataList = new ArrayList<GBLStripClusterData>(); + List<GBLEventData> gblEventData = new ArrayList<GBLEventData>(); + gblEventData.add(new GBLEventData(event.getEventNumber(), gbl.get_B().z())); + List<GBLTrackData> gblTrackDataList = new ArrayList<GBLTrackData>(); + List<GBLStripClusterData> gblStripDataListAll = new ArrayList<GBLStripClusterData>(); + List<GBLStripClusterData> gblStripDataList = new ArrayList<GBLStripClusterData>(); List<LCRelation> gblTrackToStripClusterRelationListAll = new ArrayList<LCRelation>(); List<LCRelation> trackToGBLTrackRelationListAll = new ArrayList<LCRelation>(); - - gbl.printNewEvent(iEvent,gbl.get_B().z()); + + gbl.printNewEvent(iEvent, gbl.get_B().z()); iTrack = 0; for (Track trk : selected_tracks) { - if(_debug>0) System.out.printf("%s: Print GBL output for this track\n", this.getClass().getSimpleName()); - + if (_debug > 0) + System.out.printf("%s: Print GBL output for this track\n", this.getClass().getSimpleName()); + //GBLDATA GBLTrackData gblTrackData = new GBLTrackData(iTrack); - gblTrackDataList.add(gblTrackData); - + gblTrackDataList.add(gblTrackData); + //print to text file gbl.printTrackID(iTrack); - gbl.printGBL(trk, stripHits, gblTrackData,gblStripDataList,mcParticles,simTrackerHits,this.isMC); - + gbl.printGBL(trk, stripHits, gblTrackData, gblStripDataList, mcParticles, simTrackerHits, this.isMC); + //GBLDATA //add relation to normal track object - trackToGBLTrackRelationListAll.add(new MyLCRelation(trk,gblTrackData)); + trackToGBLTrackRelationListAll.add(new MyLCRelation(trk, gblTrackData)); // add strip clusters to lists - for(GBLStripClusterData gblStripClusterData : gblStripDataList) { + for (GBLStripClusterData gblStripClusterData : gblStripDataList) { // add all strip clusters from this track to output list gblStripDataListAll.add(gblStripClusterData); // add LC relations between cluster and track - gblTrackToStripClusterRelationListAll.add(new MyLCRelation(gblTrackData,gblStripClusterData)); + gblTrackToStripClusterRelationListAll.add(new MyLCRelation(gblTrackData, gblStripClusterData)); } // clear list of strips for next track gblStripDataList.clear(); @@ -157,50 +153,48 @@ totalTracksProcessed++; ++iTrack; } - - // Put GBL info into event - event.put("GBLEventData", gblEventData, GBLEventData.class, 0); - event.put("GBLTrackData", gblTrackDataList, GBLTrackData.class, 0); - event.put("GBLStripClusterData", gblStripDataListAll, GBLStripClusterData.class, 0); - event.put("GBLTrackToStripData", gblTrackToStripClusterRelationListAll, LCRelation.class, 0); - event.put("TrackToGBLTrack", trackToGBLTrackRelationListAll, LCRelation.class, 0); + + event.put("GBLEventData" , gblEventData, GBLEventData.class, 0); + event.put("GBLTrackData" , gblTrackDataList, GBLTrackData.class, 0); + event.put("GBLStripClusterData" , gblStripDataListAll, GBLStripClusterData.class, 0); + event.put("GBLTrackToStripData" , gblTrackToStripClusterRelationListAll, LCRelation.class, 0); + event.put("TrackToGBLTrack" , trackToGBLTrackRelationListAll, LCRelation.class, 0); ++iEvent; - + } @Override public void endOfData() { - if(gbl!=null) + if (gbl != null) gbl.close(); - - if (!"".equals(outputPlotFileName)) { + + if (!"".equals(outputPlotFileName)) try { aida.saveAs(outputPlotFileName); } catch (IOException ex) { Logger.getLogger(GBLOutputDriver.class.getName()).log(Level.SEVERE, "Couldn't save aida plots to file " + outputPlotFileName, ex); } - } - System.out.println(this.getClass().getSimpleName() + ": Total Number of Events = "+iEvent); - System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks = "+totalTracks); - System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Processed = "+totalTracksProcessed); - - - } - + System.out.println(this.getClass().getSimpleName() + ": Total Number of Events = " + iEvent); + System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks = " + totalTracks); + System.out.println(this.getClass().getSimpleName() + ": Total Number of Tracks Processed = " + totalTracksProcessed); + + } + public void setDebug(int v) { this._debug = v; } + public void setGblFileName(String filename) { gblFileName = filename; } + public void setOutputPlotFileName(String filename) { outputPlotFileName = filename; - } + } + public void setIsMC(boolean isMC) { this.isMC = isMC; } - - }