LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  November 2014

HPS-SVN November 2014

Subject:

r1491 - in /java/trunk/analysis/src/main/java/org/hps/analysis: dataquality/FinalStateMonitoring.java dataquality/TrackMCEfficiency.java examples/TrackAnalysis.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Tue, 11 Nov 2014 02:24:56 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (534 lines)

Author: [log in to unmask]
Date: Mon Nov 10 18:24:53 2014
New Revision: 1491

Log:
Modifications to analysis classes to let us use HPS style HelicalTrackHit2D and non-bend only fits

Modified:
    java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java
    java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackMCEfficiency.java
    java/trunk/analysis/src/main/java/org/hps/analysis/examples/TrackAnalysis.java

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/FinalStateMonitoring.java	Mon Nov 10 18:24:53 2014
@@ -40,7 +40,7 @@
 
     String finalStateParticlesColName = "FinalStateParticles";
 
-    String[] fpQuantNames = {"nEle_per_Event", "nPos_per_Event", "nPhoton_per_Event", "nUnAssociatedTracks_per_Event", "avg_delX_at_ECal", "avg_delY_at_ECal", "avg_E_Over_P","avg_mom_beam_elec","sig_mom_beam_elec"};
+    String[] fpQuantNames = {"nEle_per_Event", "nPos_per_Event", "nPhoton_per_Event", "nUnAssociatedTracks_per_Event", "avg_delX_at_ECal", "avg_delY_at_ECal", "avg_E_Over_P", "avg_mom_beam_elec", "sig_mom_beam_elec"};
     //some counters
     int nRecoEvents = 0;
     int nTotEle = 0;
@@ -206,10 +206,9 @@
         IFitter fitter = fitFactory.createFitter("chi2");
         IHistogram1D beamE = aida.histogram1D(plotDir + "Beam Electrons Pz (GeV)");
         IFitResult result = fitBeamEnergyPeak(beamE, fitter, "range=\"(-10.0,10.0)\"");
-        double[] pars=result.fittedParameters();
-        for (int i = 0; i < 5; i++) {           
+        double[] pars = result.fittedParameters();
+        for (int i = 0; i < 5; i++)
             System.out.println("Beam Energy Peak:  " + result.fittedParameterNames()[i] + " = " + pars[i]);
-        }
 
         monitoredQuantityMap.put(fpQuantNames[0], (double) nTotEle / nRecoEvents);
         monitoredQuantityMap.put(fpQuantNames[1], (double) nTotPos / nRecoEvents);
@@ -225,14 +224,15 @@
         IPlotterStyle pstyle = plotter.style();
         pstyle.legendBoxStyle().setVisible(false);
         pstyle.dataStyle().fillStyle().setColor("green");
-        pstyle.dataStyle().lineStyle().setColor("black");        
-        plotter.region(0).plot(beamE);              
+        pstyle.dataStyle().lineStyle().setColor("black");
+        plotter.region(0).plot(beamE);
         plotter.region(0).plot(result.fittedFunction());
-        try {
-            plotter.writeToFile("beamEnergyElectrons.png");
-        } catch (IOException ex) {
-            Logger.getLogger(FinalStateMonitoring.class.getName()).log(Level.SEVERE, null, ex);
-        }
+        if (outputPlots)
+            try {
+                plotter.writeToFile(outputPlotDir + "beamEnergyElectrons.png");
+            } catch (IOException ex) {
+                Logger.getLogger(FinalStateMonitoring.class.getName()).log(Level.SEVERE, null, ex);
+            }
     }
 
     @Override
@@ -243,9 +243,9 @@
 
     IFitResult fitBeamEnergyPeak(IHistogram1D h1d, IFitter fitter, String range) {
 //        return fitter.fit(h1d, "g", range);
-   
+
 //        return fitter.fit(h1d, "g+p1", init, range);
-  double[] init = {20.0, 2.2, 0.12, 10, 0.0};
+        double[] init = {20.0, 2.2, 0.12, 10, 0.0};
 //        double[] init = {20.0, 2.2, 0.1};
         return fitter.fit(h1d, "g+p1", init);
     }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackMCEfficiency.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackMCEfficiency.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/dataquality/TrackMCEfficiency.java	Mon Nov 10 18:24:53 2014
@@ -1,5 +1,6 @@
 package org.hps.analysis.dataquality;
 
+import hep.aida.IHistogram1D;
 import hep.aida.IHistogramFactory;
 import hep.aida.IProfile1D;
 import hep.physics.vec.BasicHep3Vector;
@@ -8,11 +9,9 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import org.hps.analysis.examples.LCIOTrackAnalysis;
 import org.hps.analysis.examples.TrackAnalysis;
 import org.hps.recon.tracking.FindableTrack;
 import org.hps.recon.tracking.FittedRawTrackerHit;
-import org.lcsim.detector.tracker.silicon.SiSensor;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.LCRelation;
 import org.lcsim.event.MCParticle;
@@ -20,14 +19,13 @@
 import org.lcsim.event.RelationalTable;
 import org.lcsim.event.SimTrackerHit;
 import org.lcsim.event.Track;
+import org.lcsim.event.TrackState;
 import org.lcsim.event.TrackerHit;
 import org.lcsim.event.base.BaseRelationalTable;
 import org.lcsim.fit.helicaltrack.HelicalTrackCross;
 import org.lcsim.fit.helicaltrack.HelixParamCalculator;
 import org.lcsim.geometry.Detector;
 import org.lcsim.geometry.IDDecoder;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHit;
-import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
 
 /**
  * DQM driver for the monte carlo track efficiency; makes a bunch of efficiency
@@ -41,15 +39,14 @@
 public class TrackMCEfficiency extends DataQualityMonitor {
 
     private String rawTrackerHitCollectionName = "SVTRawTrackerHits";
-    private String helicalTrackHitCollectionName = "HelicalTrackHits";
-    private String fittedTrackerHitCollectionName = "SVTFittedRawTrackerHits";
+    private String trackHitCollectionName = "RotatedHelicalTrackHits";
+    private String fittedSVTHitCollectionName = "SVTFittedRawTrackerHits";
     private String trackerHitCollectionName = "TrackerHits";
     private String siClusterCollectionName = "StripClusterer_SiTrackerHitStrip1D";
-    private String rotatedMCRelationsCollectionName = "RotatedHelicalTrackMCRelations";
-    private final String helicalTrackHitRelationsCollectionName = "HelicalTrackHitRelations";
-    private final String rotatedHelicalTrackHitRelationsCollectionName = "RotatedHelicalTrackHitRelations";
+    private String trackHitMCRelationsCollectionName = "RotatedHelicalTrackMCRelations";
+    private String detectorFrameHitRelationsCollectionName = "HelicalTrackHitRelations";
+    private String trackHitRelationsCollectionName = "RotatedHelicalTrackHitRelations";
     private String trackCollectionName = "MatchedTracks";
-    private String trackerName = "Tracker";
     private Detector detector = null;
     IDDecoder dec;
     private IProfile1D peffFindable;
@@ -65,13 +62,25 @@
     int findableelectrons = 0;
     int findableTracks = 0;
     double foundTracks = 0;
-    private static final String nameStrip = "Tracker_TestRunModule_";
-    private List<SiSensor> sensors;
-    private boolean debugTrackEfficiency = false;
+    private boolean debugTrackEfficiency = true;
     private String plotDir = "TrackMCEfficiency/";
-
-    public void setHelicalTrackHitCollectionName(String helicalTrackHitCollectionName) {
-        this.helicalTrackHitCollectionName = helicalTrackHitCollectionName;
+    private String resDir = "TrackMCResolution/";
+    private String misidDir = "TrackMCMisId/";
+
+    public void setTrackHitCollectionName(String trackHitCollectionName) {
+        this.trackHitCollectionName = trackHitCollectionName;
+    }
+
+    public void setTrackHitMCRelationsCollectionName(String trackHitMCRelationsCollectionName) {
+        this.trackHitMCRelationsCollectionName = trackHitMCRelationsCollectionName;
+    }
+
+    public void setDetectorFrameHitRelationsCollectionName(String detectorFrameHitRelationsCollectionName) {
+        this.detectorFrameHitRelationsCollectionName = detectorFrameHitRelationsCollectionName;
+    }
+
+    public void setTrackHitRelationsCollectionName(String trackHitRelationsCollectionName) {
+        this.trackHitRelationsCollectionName = trackHitRelationsCollectionName;
     }
 
     public void setTrackCollectionName(String trackCollectionName) {
@@ -86,17 +95,23 @@
     protected void detectorChanged(Detector detector) {
         this.detector = detector;
         aida.tree().mkdir(plotDir);
+        aida.tree().mkdir(resDir);
+        aida.tree().mkdir(misidDir);
         aida.tree().cd("/");
         IHistogramFactory hf = aida.histogramFactory();
 
         peffFindable = hf.createProfile1D(plotDir + "Findable Efficiency vs p", "", 20, 0., beamP);
         phieffFindable = hf.createProfile1D(plotDir + "Findable Efficiency vs phi", "", 25, -0.25, 0.25);
         ctheffFindable = hf.createProfile1D(plotDir + "Findable Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
-
         peffElectrons = hf.createProfile1D(plotDir + "Electrons Efficiency vs p", "", 20, 0., beamP);
         phieffElectrons = hf.createProfile1D(plotDir + "Electrons Efficiency vs phi", "", 25, -0.25, 0.25);
         ctheffElectrons = hf.createProfile1D(plotDir + "Electrons Efficiency vs cos(theta)", "", 25, -0.25, 0.25);
 
+        IHistogram1D pMCRes = hf.createHistogram1D(resDir + "Momentum Resolution", 50, -0.5, 0.5);
+        IHistogram1D phi0MCRes = hf.createHistogram1D(resDir + "phi0 Resolution", 50, -0.1, 0.1);
+        IHistogram1D d0MCRes = hf.createHistogram1D(resDir + "d0 Resolution", 50, -0.5, 0.5);
+        IHistogram1D z0MCRes = hf.createHistogram1D(resDir + "z0 Resolution", 50, -1.0,1.0);
+        IHistogram1D tanLambdaMCRes = hf.createHistogram1D(resDir + "tanLambda Resolution", 50, -0.1, 0.1);
     }
 
     @Override
@@ -106,22 +121,28 @@
 
         //make sure the required collections exist
         if (!event.hasCollection(RawTrackerHit.class, rawTrackerHitCollectionName)) {
-            return;
-        }
-        if (!event.hasCollection(LCRelation.class, fittedTrackerHitCollectionName)) {
+            System.out.println(this.getClass().getSimpleName() + ": no collection found " + rawTrackerHitCollectionName);
+            return;
+        }
+        if (!event.hasCollection(LCRelation.class, fittedSVTHitCollectionName)) {
+            System.out.println(this.getClass().getSimpleName() + ": no collection found " + fittedSVTHitCollectionName);
             return;
         }
         if (!event.hasCollection(Track.class, trackCollectionName)) {
-            return;
-        }
-        if (!event.hasCollection(LCRelation.class, rotatedMCRelationsCollectionName)) {
+            System.out.println(this.getClass().getSimpleName() + ": no collection found " + trackCollectionName);
+            return;
+        }
+        if (!event.hasCollection(LCRelation.class, trackHitMCRelationsCollectionName)) {
+            System.out.println(this.getClass().getSimpleName() + ": no collection found " + trackHitMCRelationsCollectionName);
             return;
         }
         if (!event.hasCollection(TrackerHit.class, siClusterCollectionName)) {
+            System.out.println(this.getClass().getSimpleName() + ": no collection found " + siClusterCollectionName);
             return;
         }
 
         if (!event.hasCollection(SimTrackerHit.class, trackerHitCollectionName)) {
+            System.out.println(this.getClass().getSimpleName() + ": no collection found " + trackerHitCollectionName);
             return;
         }
         //
@@ -131,33 +152,27 @@
         //make some maps and relation tables        
         Map<Track, TrackAnalysis> tkanalMap = new HashMap<Track, TrackAnalysis>();
         RelationalTable hittomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        List<LCRelation> mcrelations = event.get(LCRelation.class, rotatedMCRelationsCollectionName);
-        for (LCRelation relation : mcrelations) {
-            if (relation != null && relation.getFrom() != null && relation.getTo() != null) {
+        List<LCRelation> mcrelations = event.get(LCRelation.class, trackHitMCRelationsCollectionName);
+        System.out.println(this.getClass().getSimpleName() + ": number of MC relations = " + mcrelations.size());
+        for (LCRelation relation : mcrelations)
+            if (relation != null && relation.getFrom() != null && relation.getTo() != null)
                 hittomc.add(relation.getFrom(), relation.getTo());
-            }
-        }
-
+        System.out.println(this.getClass().getSimpleName() + ": number of hittomc relations = " + hittomc.size());
         RelationalTable mcHittomcP = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
         //  Get the collections of SimTrackerHits
         List<List<SimTrackerHit>> simcols = event.get(SimTrackerHit.class);
         //  Loop over the SimTrackerHits and fill in the relational table
-        for (List<SimTrackerHit> simlist : simcols) {
-            for (SimTrackerHit simhit : simlist) {
-                if (simhit.getMCParticle() != null) {
+        for (List<SimTrackerHit> simlist : simcols)
+            for (SimTrackerHit simhit : simlist)
+                if (simhit.getMCParticle() != null)
                     mcHittomcP.add(simhit, simhit.getMCParticle());
-                }
-            }
-        }
         RelationalTable trktomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
         RelationalTable rawtomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
         if (event.hasCollection(LCRelation.class, "SVTTrueHitRelations")) {
             List<LCRelation> trueHitRelations = event.get(LCRelation.class, "SVTTrueHitRelations");
-            for (LCRelation relation : trueHitRelations) {
-                if (relation != null && relation.getFrom() != null && relation.getTo() != null) {
+            for (LCRelation relation : trueHitRelations)
+                if (relation != null && relation.getFrom() != null && relation.getTo() != null)
                     rawtomc.add(relation.getFrom(), relation.getTo());
-                }
-            }
         }
         // make relational table for strip clusters to mc particle
         List<TrackerHit> siClusters = event.get(TrackerHit.class, siClusterCollectionName);
@@ -166,54 +181,46 @@
             List<RawTrackerHit> rawHits = cluster.getRawHits();
             for (RawTrackerHit rth : rawHits) {
                 Set<SimTrackerHit> simTrackerHits = rawtomc.allFrom(rth);
-                if (simTrackerHits != null) {
-                    for (SimTrackerHit simhit : simTrackerHits) {
+                if (simTrackerHits != null)
+                    for (SimTrackerHit simhit : simTrackerHits)
                         clustertosimhit.add(cluster, simhit);
-                    }
-                }
             }
         }
         //relational tables from mc particle to raw and fitted tracker hits
         RelationalTable fittomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        List<LCRelation> fittedTrackerHits = event.get(LCRelation.class, fittedTrackerHitCollectionName);
+        List<LCRelation> fittedTrackerHits = event.get(LCRelation.class, fittedSVTHitCollectionName);
         for (LCRelation hit : fittedTrackerHits) {
             RawTrackerHit rth = FittedRawTrackerHit.getRawTrackerHit(hit);
             Set<SimTrackerHit> simTrackerHits = rawtomc.allFrom(rth);
-            if (simTrackerHits != null) {
-                for (SimTrackerHit simhit : simTrackerHits) {
-                    if (simhit.getMCParticle() != null) {
+            if (simTrackerHits != null)
+                for (SimTrackerHit simhit : simTrackerHits)
+                    if (simhit.getMCParticle() != null)
                         fittomc.add(hit, simhit.getMCParticle());
-                    }
-                }
-            }
         }
 
         RelationalTable hittostrip = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
-        List<LCRelation> hitrelations = event.get(LCRelation.class, helicalTrackHitRelationsCollectionName);
-        for (LCRelation relation : hitrelations) {
-            if (relation != null && relation.getFrom() != null && relation.getTo() != null) {
+        List<LCRelation> hitrelations = event.get(LCRelation.class, detectorFrameHitRelationsCollectionName);
+        for (LCRelation relation : hitrelations)
+            if (relation != null && relation.getFrom() != null && relation.getTo() != null)
                 hittostrip.add(relation.getFrom(), relation.getTo());
-            }
-        }
 
         RelationalTable hittorotated = new BaseRelationalTable(RelationalTable.Mode.ONE_TO_ONE, RelationalTable.Weighting.UNWEIGHTED);
-        List<LCRelation> rotaterelations = event.get(LCRelation.class, rotatedHelicalTrackHitRelationsCollectionName);
-        for (LCRelation relation : rotaterelations) {
-            if (relation != null && relation.getFrom() != null && relation.getTo() != null) {
+        List<LCRelation> rotaterelations = event.get(LCRelation.class, trackHitRelationsCollectionName);
+        for (LCRelation relation : rotaterelations)
+            if (relation != null && relation.getFrom() != null && relation.getTo() != null)
                 hittorotated.add(relation.getFrom(), relation.getTo());
-            }
-        }
 
         //  Instantiate the class that determines if a track is "findable"
         FindableTrack findable = new FindableTrack(event);
 
         List<Track> tracks = event.get(Track.class, trackCollectionName);
+        System.out.println(this.getClass().getSimpleName() + ": nTracks = " + tracks.size());
         for (Track trk : tracks) {
             TrackAnalysis tkanal = new TrackAnalysis(trk, hittomc, rawtomc, hittostrip, hittorotated);
             tkanalMap.put(trk, tkanal);
             MCParticle mcp = tkanal.getMCParticleNew();
-            if (mcp != null) //  Create a map between the tracks found and the assigned MC particle
-            {
+            if (mcp != null) {//  Create a map between the tracks found and the assigned MC particle            
+                System.out.println(this.getClass().getSimpleName() + ": found MCP match");
                 trktomc.add(trk, tkanal.getMCParticleNew());
             }
         }
@@ -235,7 +242,7 @@
             double eta = -Math.log(Math.tan(Math.atan2(pt, pz) / 2));
             double phi = Math.atan2(px, pz);
             //  Find the number of layers hit by this mc particle
-//            System.out.println("MC pt=" + pt);
+            System.out.println("MC pt=" + pt);
             int nhits = findable.LayersHit(mcp);
             boolean isFindable = findable.InnerTrackerIsFindable(mcp, nlayers - 2);
 
@@ -256,17 +263,14 @@
                 //it's the A'...let's see if we found both tracks.
                 List<MCParticle> daughters = mcp.getDaughters();
                 for (MCParticle d : daughters) {
-                    if (trktomc.allTo(d).isEmpty()) {
+                    if (trktomc.allTo(d).isEmpty())
                         bothreco = false;
-                    }
-                    if (!findable.InnerTrackerIsFindable(d, nlayers - 2)) {
+                    if (!findable.InnerTrackerIsFindable(d, nlayers - 2))
                         bothfindable = false;
-                    }
                 }
                 double vtxWgt = 0;
-                if (bothreco) {
+                if (bothreco)
                     vtxWgt = 1.0;
-                }
 //                VxEff.fill(mcp.getOriginX(), vtxWgt);
 //                VyEff.fill(mcp.getOriginY(), vtxWgt);
 //                VzEff.fill(mcp.getOriginZ(), vtxWgt);
@@ -282,23 +286,22 @@
                 _nchMCP++;
                 findableTracks++;
                 double wgt = 0.;
-                if (ntrk > 0) {
+                if (ntrk > 0)
                     wgt = 1.;
-                }
                 foundTracks += wgt;
                 peffFindable.fill(p, wgt);
                 phieffFindable.fill(phi, wgt);
                 ctheffFindable.fill(cth, wgt);
 
                 if (wgt == 0) {
+
                     Set<SimTrackerHit> mchitlist = mcHittomcP.allTo(mcp);
                     Set<HelicalTrackCross> hitlist = hittomc.allTo(mcp);
                     Set<FittedRawTrackerHit> fitlist = fittomc.allTo(mcp);
                     if (debugTrackEfficiency) {
-                        System.out.println("TrackMCEfficiencyMonitoring::  Missed a findable track with MC p = " + p);
-                        if (!hasHTHInEachLayer(hitlist, fitlist)) {
-                            System.out.println("This track failed becasue it's missing a helical track hit");
-                        }
+                        System.out.println(this.getClass().getSimpleName() + ":  Missed a findable track with MC p = " + p);
+                            if (!hasHTHInEachLayer(hitlist, fitlist))
+                                System.out.println("\t\tThis track failed becasue it's missing a helical track hit");
                     }
                 }
 
@@ -307,13 +310,26 @@
                 totelectrons++;
 //                    findableelectrons++;
                 double wgt = 0.;
-                if (ntrk > 0) {
+                if (ntrk > 0)
                     wgt = 1.;
-                }
                 foundelectrons += wgt;
                 peffElectrons.fill(p, wgt);
                 phieffElectrons.fill(phi, wgt);
                 ctheffElectrons.fill(cth, wgt);
+                if (ntrk == 1) {
+                    Track trk = (Track) trklist.toArray()[0];
+                    TrackState ts = trk.getTrackStates().get(0);
+                    double deld0 = d0 - ts.getD0();
+                    double delz0 = z0 - ts.getZ0();
+                    double delp = p - calcMagnitude(ts.getMomentum());
+                    double delphi0 = phi - ts.getPhi();
+                    double deltanlam = cth - ts.getTanLambda();
+                    aida.histogram1D(resDir + "Momentum Resolution").fill(delp);
+                    aida.histogram1D(resDir + "z0 Resolution").fill(delz0);
+                    aida.histogram1D(resDir + "d0 Resolution").fill(deld0);
+                    aida.histogram1D(resDir + "phi0 Resolution").fill(delphi0);
+                    aida.histogram1D(resDir + "tanLambda Resolution").fill(deltanlam);
+                }
 
                 //               }
             }
@@ -338,13 +354,15 @@
     }
 
     private boolean hasHTHInEachLayer(Set<HelicalTrackCross> list, Set<FittedRawTrackerHit> fitlist) {
+        if(list.size()==0)
+            return false;
+        if(!(list.toArray()[0] instanceof HelicalTrackCross))
+            return false;
         for (int layer = 1; layer < nlayers - 2; layer += 2) {
-            boolean hasThisLayer = false;
-            for (HelicalTrackCross hit : list) {
-                if (hit.Layer() == layer) {
+            boolean hasThisLayer = false;            
+            for (HelicalTrackCross hit : list)
+                if (hit.Layer() == layer)
                     hasThisLayer = true;
-                }
-            }
             if (!hasThisLayer) {
                 System.out.println("Missing reconstructed hit in layer = " + layer);
                 boolean hasFitHitSL1 = false;
@@ -366,12 +384,10 @@
 
                     }
                 }
-                if (!hasFitHitSL1) {
+                if (!hasFitHitSL1)
                     System.out.println("MISSING a hit in SL1!!!");
-                }
-                if (!hasFitHitSL2) {
+                if (!hasFitHitSL2)
                     System.out.println("MISSING a hit in SL2!!!");
-                }
 
                 return false;
             }
@@ -379,4 +395,8 @@
         return true;
     }
 
+    private double calcMagnitude(double[] vec) {
+        return Math.sqrt(vec[0] * vec[0] + vec[1] * vec[1] + vec[2] * vec[2]);
+    }
+
 }

Modified: java/trunk/analysis/src/main/java/org/hps/analysis/examples/TrackAnalysis.java
 =============================================================================
--- java/trunk/analysis/src/main/java/org/hps/analysis/examples/TrackAnalysis.java	(original)
+++ java/trunk/analysis/src/main/java/org/hps/analysis/examples/TrackAnalysis.java	Mon Nov 10 18:24:53 2014
@@ -6,9 +6,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeMap;
-
-import hep.physics.matrix.BasicMatrix;
 import hep.physics.matrix.SymmetricMatrix;
 import hep.physics.vec.BasicHep3Matrix;
 import hep.physics.vec.BasicHep3Vector;
@@ -16,11 +13,11 @@
 import hep.physics.vec.VecOp;
 
 import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
 import org.apache.commons.math3.linear.EigenDecomposition;
 import org.apache.commons.math3.linear.RealMatrix;
 
 import org.lcsim.detector.tracker.silicon.HpsSiSensor; 
+import org.hps.recon.tracking.axial.HelicalTrack2DHit;
 import org.lcsim.detector.identifier.IIdentifier;
 import org.lcsim.detector.identifier.Identifier;
 import org.lcsim.event.MCParticle;
@@ -29,15 +26,11 @@
 import org.lcsim.event.SimTrackerHit;
 import org.lcsim.event.Track;
 import org.lcsim.event.TrackerHit;
-import org.lcsim.fit.helicaltrack.HelicalTrack2DHit;
-import org.lcsim.fit.helicaltrack.HelicalTrack3DHit;
 import org.lcsim.fit.helicaltrack.HelicalTrackCross;
-import org.lcsim.fit.helicaltrack.HelicalTrackHit;
 import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
 
 //===> import org.hps.conditions.deprecated.SvtUtils;
 import static org.hps.recon.tracking.CoordinateTransformations.transformVectorToTracking;
-import org.hps.recon.tracking.TrackerHitUtils;
 
 /**
  *
@@ -97,7 +90,6 @@
         _hasLayerOne = false;
         //  Loop over the hits on the track and make sure we have HelicalTrackHits (which contain the MC particle)
         for (TrackerHit hit : trk.getTrackerHits()) {
-
             //  get the set of MCParticles associated with this hit and update the hit count for each MCParticle
             Set<MCParticle> mclist = hittomc.allFrom(hit);
             for (MCParticle mcp : mclist) {
@@ -107,7 +99,6 @@
                 mchits++;
                 mcmap.put(mcp, mchits);
             }
-
             if (hit instanceof HelicalTrackCross)
                 countHit((HelicalTrackCross) hit);
             else if (hit instanceof HelicalTrack2DHit)

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use