Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/sATLAS on MAIN
TrackAnalysisDriver.java+102-371.2 -> 1.3
sATLASDigiDriver.java+17-31.1 -> 1.2
+119-40
2 modified files
added some plots and output settings

lcsim-contrib/src/main/java/org/lcsim/contrib/sATLAS
TrackAnalysisDriver.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- TrackAnalysisDriver.java	6 May 2009 01:00:17 -0000	1.2
+++ TrackAnalysisDriver.java	6 May 2009 23:28:43 -0000	1.3
@@ -10,6 +10,7 @@
 import org.lcsim.contrib.mgraham.sATLASDigi.*;
 import hep.aida.IHistogram1D;
 import hep.aida.IHistogramFactory;
+import hep.aida.IProfile1D;
 import hep.physics.matrix.SymmetricMatrix;
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
@@ -79,6 +80,10 @@
     private IHistogram1D fakes;
     private IHistogram1D nfakes;
     private IHistogram1D etafake;
+    public String outputPlots="myplots.aida";
+    Map<String, IProfile1D> clsizeMap = new HashMap<String, IProfile1D>();
+    String[] detNames = {"VtxPixelBarrel", "VtxPixelEndcap", "SCTShortBarrel", "SCTLongBarrel", "SCTShortEndcap", "SCTLongEndcap"};
+    Integer[] nlayers = {4, 6, 3, 2, 5, 5};
     int trk_count = 0;
     int nevt = 0;
     int _nmcTrk = 0;
@@ -111,20 +116,32 @@
         fakes = hf.createHistogram1D("Number of mis-matched hits (unnormalized)", "", 10, 0., 10.);
         nfakes = hf.createHistogram1D("Number of mis-matched hits (normalized)", "", 10, 0., 10.);
         etafake = hf.createHistogram1D("Fake rate vs eta", "", 50, -2.5, 2.5, "type=efficiency");
+        int i, j;
+        for (i = 0; i < 6; i++) {
+            for (j = 0; j < nlayers[i]; j++) {
+                int laynum = j + 1;
+                String profname = detNames[i] + "_layer" + laynum + " cluster size vs eta";
+                String key = detNames[i] + "_layer" + laynum;
+                clsizeMap.put(key, hf.createProfile1D(profname, 50, -2.5, 2.5));
+            }
+        }
+
     }
 
     @Override
-    public void process(EventHeader event) {
+    public void process(
+            EventHeader event) {
 
         //  Increment the event counter
         nevt++;
         String resDir = "residualsPlots/";
         String simDir = "STHitPlots/";
         String debugDir = "debugPlots/";
+        String occDir = "occupancyPlots/";
         //  Get the magnetic field
         Hep3Vector IP = new BasicHep3Vector(0., 0., 0.);
         double bfield = event.getDetector().getFieldMap().getField(IP).z();
-        String[] detNames = {"VtxPixelBarrel", "VtxPixelEndcap", "SCTShortBarrel", "SCTLongBarrel", "SCTShortEndcap", "SCTLongEndcap"};
+
 
         // dump SThit information
         String[] input_hit_collections = {"VtxBarrHits", "VtxEndcapHits", "SCTShortBarrHits", "SCTLongBarrHits", "SCTShortEndcapHits", "SCTLongEndcapHits"};
@@ -162,9 +179,6 @@
         List<RawTrackerHit> rawHits = event.get(RawTrackerHit.class, "RawTrackerHitMaker_RawTrackerHits");
         List<HelicalTrackHit> hthits = event.get(HelicalTrackHit.class, "HelicalTrackHits");
 
-//        int<String> occupancy;
-//         Map occupancyMap;
-
         Map<String, Integer> occupancyMap = new HashMap<String, Integer>();
         for (RawTrackerHit rh : rawHits) {
             IDetectorElement rhDetE = rh.getDetectorElement();
@@ -186,10 +200,59 @@
                 }
             }
         }
-
         Set<String> mykeyset = (Set<String>) occupancyMap.keySet();
         for (String keys : mykeyset) {
-            aida.cloud1D("occupancyPlots/" + keys + " # of hits").fill(occupancyMap.get(keys));
+            aida.cloud1D(occDir + keys + " # of hits").fill(occupancyMap.get(keys));
+        }
+        int detNum = 0;
+        int layerNum = 0;
+
+        for (SiTrackerHitPixel stripCluster : pixelHits) {
+            Hep3Vector strCluPos = stripCluster.getPositionAsVector();
+            double rHit = Math.sqrt(strCluPos.x() * strCluPos.x() + strCluPos.y() * strCluPos.y());
+            double zHit = strCluPos.z();
+            double etaHit = -Math.log(Math.tan(Math.atan2(rHit, zHit) / 2));
+            List<RawTrackerHit> rthList = stripCluster.getRawHits();
+            int nhits = rthList.size();
+            String detlayer = "Foobar";
+            for (RawTrackerHit rth : rthList) {
+                IDetectorElement rhDetE = rth.getDetectorElement();
+                String rhDetName = rhDetE.getName();
+                int rhLayer = rth.getLayerNumber();
+                for (String myname : detNames) {
+                    if (rhDetName.contains(myname)) {
+                        detlayer = myname + "_layer" + rhLayer;
+                    }
+                }
+            }
+//            System.out.println(detlayer);
+            clsizeMap.get(detlayer).fill(etaHit, nhits);
+            aida.cloud1D(occDir + detlayer + " cluster size").fill(nhits);
+//            ClusterSize[detNum][layerNum].fill(etaHit, nhits);
+
+        }
+
+        for (SiTrackerHitStrip1D stripCluster : stripHits) {
+            Hep3Vector strCluPos = stripCluster.getPositionAsVector();
+            double rHit = Math.sqrt(strCluPos.x() * strCluPos.x() + strCluPos.y() * strCluPos.y());
+            double zHit = strCluPos.z();
+            double etaHit = -Math.log(Math.tan(Math.atan2(rHit, zHit) / 2));
+            List<RawTrackerHit> rthList = stripCluster.getRawHits();
+            int nhits = rthList.size();
+            String detlayer = "Foobar";
+            for (RawTrackerHit rth : rthList) {
+                IDetectorElement rhDetE = rth.getDetectorElement();
+                String rhDetName = rhDetE.getName();
+                int rhLayer = rth.getLayerNumber();
+                for (String myname : detNames) {
+                    if (rhDetName.contains(myname)) {
+                        detlayer = myname + "_layer" + rhLayer;
+                    }
+                }
+            }
+//               System.out.println(detlayer);
+            clsizeMap.get(detlayer).fill(etaHit, nhits);
+            aida.cloud1D(occDir + detlayer + " cluster size").fill(nhits);
         }
 
         for (HelicalTrackHit HelTrHit : hthits) {
@@ -306,7 +369,6 @@
                         }
 
 
-                        aida.cloud2D(debugDir + hit.Detector() + "clusterSize vs eta").fill(etaHit, nstrips);
                         //                        System.out.println("filling...");
                         if (umc != -999999) {
                             aida.cloud2D(debugDir + hit.Detector() + "cluster vs STHit dedx").fill(stenergy, charge);
@@ -367,8 +429,8 @@
             int nbad = tkanal.getNBadHits();
             int nhits = tkanal.getNHits();
             double purity = tkanal.getPurity();
-            aida.histogram1D("Mis-matched hits for all tracks", 10, 0., 10.).fill(nbad);
-            aida.histogram1D("Mis-matched hits " + nhits + " hit tracks", 10, 0., 10.).fill(nbad);
+            aida.cloud1D("Mis-matched hits for all tracks").fill(nbad);
+            aida.cloud1D("Mis-matched hits " + nhits + " hit tracks").fill(nbad);
 
             //  Generate a normalized histogram after 1000 events
             trk_count++;
@@ -378,28 +440,28 @@
 
             //  Make plots for fake, non-fake, and all tracks
             if (purity < 0.5) {
-                aida.histogram1D("Hits for fake tracks", 20, 0., 20.).fill(nhits);
-                aida.histogram1D("pT for fake tracks", 100, 0., 10.).fill(pt);
-                aida.histogram1D("cos(theta) for fake tracks", 100, -1., 1.).fill(cth);
-                aida.histogram1D("d0 for fake tracks", 50, -10., 10.).fill(d0);
-                aida.histogram1D("z0 for fake tracks", 50, -10., 10.).fill(z0);
-                aida.histogram1D("eta for fake tracks", 100, -2., 2.).fill(eta);
+                aida.cloud1D("Hits for fake tracks").fill(nhits);
+                aida.cloud1D("pT for fake tracks").fill(pt);
+                aida.cloud1D("cos(theta) for fake tracks").fill(cth);
+                aida.cloud1D("d0 for fake tracks").fill(d0);
+                aida.cloud1D("z0 for fake tracks").fill(z0);
+                aida.cloud1D("eta for fake tracks").fill(eta);
                 etafake.fill(eta, 1.0);
             } else {
-                aida.histogram1D("Hits for non-fake tracks", 20, 0., 20.).fill(nhits);
-                aida.histogram1D("pT for non-fake tracks", 100, 0., 10.).fill(pt);
-                aida.histogram1D("cos(theta) for non-fake tracks", 100, -1., 1.).fill(cth);
-                aida.histogram1D("d0 for non-fake tracks", 50, -10., 10.).fill(d0);
-                aida.histogram1D("z0 for non-fake tracks", 50, -10., 10.).fill(z0);
-                aida.histogram1D("eta for non-fake tracks", 100, -2., 2.).fill(eta);
+                aida.cloud1D("Hits for non-fake tracks").fill(nhits);
+                aida.cloud1D("pT for non-fake tracks").fill(pt);
+                aida.cloud1D("cos(theta) for non-fake tracks").fill(cth);
+                aida.cloud1D("d0 for non-fake tracks").fill(d0);
+                aida.cloud1D("z0 for non-fake tracks").fill(z0);
+                aida.cloud1D("eta for non-fake tracks").fill(eta);
                 etafake.fill(eta, 0.0);
             }
-            aida.histogram1D("Hits for all tracks", 20, 0., 20.).fill(nhits);
-            aida.histogram1D("pT for all tracks", 100, 0., 10.).fill(pt);
-            aida.histogram1D("cos(theta) for all tracks", 100, -1., 1.).fill(cth);
-            aida.histogram1D("d0 for all tracks", 50, -10., 10.).fill(d0);
-            aida.histogram1D("z0 for all tracks", 50, -10., 10.).fill(z0);
-            aida.histogram1D("eta for all tracks", 100, -2., 2.).fill(eta);
+            aida.cloud1D("Hits for all tracks").fill(nhits);
+            aida.cloud1D("pT for all tracks").fill(pt);
+            aida.cloud1D("cos(theta) for all tracks").fill(cth);
+            aida.cloud1D("d0 for all tracks").fill(d0);
+            aida.cloud1D("z0 for all tracks").fill(z0);
+            aida.cloud1D("eta for all tracks").fill(eta);
             aida.cloud2D("Hits vs eta for all tracks").fill(eta, nhits);
             //  Now analyze MC Particles on this track
             MCParticle mcp = tkanal.getMCParticle();
@@ -435,8 +497,8 @@
                             100, 0., 5., 100, 0., 5.).fill(ptmc, pttk);
                     aida.histogram2D(resDir + "d0 MC vs d0 Reco for 0 Bad Hits",
                             100, -0.2, 0.2, 100, -0.2, 0.2).fill(d0mc, d0tk);
-                    aida.histogram1D(resDir + "pT Pull for 0 Bad Hits", 100, -10., 10.).fill(ptpull);
-                    aida.histogram1D(resDir + "d0 pull for 0 Bad Hits", 100, -10., 10.).fill(d0pull);
+                    aida.cloud1D(resDir + "pT Pull for 0 Bad Hits").fill(ptpull);
+                    aida.cloud1D(resDir + "d0 pull for 0 Bad Hits").fill(d0pull);
                     aida.cloud1D(resDir + "pT Residual for 0 Bad Hits").fill(ptresid);
                     aida.cloud1D(resDir + "d0 Residual for 0 Bad Hits").fill(d0resid);
                     aida.cloud1D(resDir + "1/pT  for 0 Bad Hits").fill(1 / pttk);
@@ -446,8 +508,8 @@
                             100, 0., 5., 100, 0., 5.).fill(ptmc, pttk);
                     aida.histogram2D(resDir + "d0 MC vs d0 Reco for 0.5 < purity < 1",
                             100, -0.2, 0.2, 100, -0.2, 0.2).fill(d0mc, d0tk);
-                    aida.histogram1D(resDir + "pT Pull for 0.5 < purity < 1", 100, -10., 10.).fill(ptpull);
-                    aida.histogram1D(resDir + "d0 pull for 0.5 < purity < 1", 100, -10., 10.).fill(d0pull);
+                    aida.cloud1D(resDir + "pT Pull for 0.5 < purity < 1").fill(ptpull);
+                    aida.cloud1D(resDir + "d0 pull for 0.5 < purity < 1").fill(d0pull);
                     aida.cloud1D(resDir + "pT Residual for 0.5 < purity < 1").fill(ptresid);
                     aida.cloud1D(resDir + "d0 Residual for 0.5 < purity < 1").fill(d0resid);
                     aida.cloud1D(resDir + "1/pT  for 0.5 < purity < 1").fill(1 / pttk);
@@ -456,8 +518,8 @@
                             100, 0., 5., 100, 0., 5.).fill(ptmc, pttk);
                     aida.histogram2D(resDir + "d0 MC vs d0 Reco for purity <= 0.5",
                             100, -0.2, 0.2, 100, -0.2, 0.2).fill(d0mc, d0tk);
-                    aida.histogram1D(resDir + "pT Pull for purity <= 0.5", 100, -10., 10.).fill(ptpull);
-                    aida.histogram1D(resDir + "d0 pull for purity <= 0.5", 100, -10., 10.).fill(d0pull);
+                    aida.cloud1D(resDir + "pT Pull for purity <= 0.5").fill(ptpull);
+                    aida.cloud1D(resDir + "d0 pull for purity <= 0.5").fill(d0pull);
                     aida.cloud1D(resDir + "pT Residual for purity <= 0.5").fill(ptresid);
                     aida.cloud1D(resDir + "d0 Residial for purity <= 0.5").fill(d0resid);
                     aida.cloud1D(resDir + "1/pT  for purity <= 0.5").fill(1 / pttk);
@@ -575,8 +637,8 @@
                 double wgt = 0.0;
                 if (ntrk > 0) {
                     wgt = 1.0;
-//                    System.out.println("found track!");
-                      System.out.println("Found this track! eta = " + eta + "; pT = " + pt + "; z0 = " + z0 + "; d0 = " + d0);
+//                    System.out.println("found track!");a
+                    System.out.println("Found this track! eta = " + eta + "; pT = " + pt + "; z0 = " + z0 + "; d0 = " + d0);
                 } else {
                     System.out.println("Missed this track! eta = " + eta + "; pT = " + pt + "; z0 = " + z0 + "; d0 = " + d0);
                 }
@@ -711,13 +773,16 @@
     @Override
     public void endOfData() {
         try {
-            aida.saveAs("myplots.aida");
+            aida.saveAs(outputPlots);
         } catch (IOException ex) {
             Logger.getLogger(TrackAnalysisDriver.class.getName()).log(Level.SEVERE, null, ex);
         }
         System.out.println("# of reco tracks = " + _nrecTrk + "; # of MC tracks = " + _nmcTrk + "; Efficiency = " + _nrecTrk / _nmcTrk);
     }
+    public void setOutputPlots(String output){
+        this.outputPlots=output;
 
+    }
     private double getr(double x, double y) {
         return Math.sqrt(x * x + y * y);
     }

lcsim-contrib/src/main/java/org/lcsim/contrib/sATLAS
sATLASDigiDriver.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- sATLASDigiDriver.java	28 Apr 2009 21:18:08 -0000	1.1
+++ sATLASDigiDriver.java	6 May 2009 23:28:43 -0000	1.2
@@ -1,19 +1,33 @@
 /*
  * sATLASDigiDriver class
  */
-
 package org.lcsim.contrib.sATLAS;
 
 import org.lcsim.util.Driver;
+import org.lcsim.util.loop.LCIODriver;
 
 /**
  *  Driver for track reconstruction and analysis of sATLAS detector
  *
  * @author M. Graham and R. Partridge
  */
+
 public class sATLASDigiDriver extends Driver {
-    public sATLASDigiDriver(){
+    public String outputFile="foobar.slcio";
+     public String plotsFile="myplots.aida";
+    TrackAnalysisDriver tad;
+    public sATLASDigiDriver() {
         add(new TrackReconstructionDriver());
-        add(new TrackAnalysisDriver());
+        tad=new TrackAnalysisDriver();
+        add(tad);
+    }
+
+    public void setOutputFile(String outputFile) {
+        System.out.println("Will output events to " + outputFile);
+        add(new LCIODriver(outputFile));
+    }
+       public void setPlotsFile(String plotsFile) {
+        System.out.println("Will output plots to " + plotsFile);
+        tad.setOutputPlots(plotsFile);
     }
 }
CVSspam 0.2.8