Print

Print


Commit in lcsim/src/org/lcsim/contrib/SteveMagill on MAIN
PhoCompDriver.java+42-411.2 -> 1.3


lcsim/src/org/lcsim/contrib/SteveMagill
PhoCompDriver.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- PhoCompDriver.java	29 May 2008 22:38:31 -0000	1.2
+++ PhoCompDriver.java	20 Aug 2008 20:22:53 -0000	1.3
@@ -43,17 +43,19 @@
   public void process(EventHeader event) 
   {
       List<CheatCluster> chclusters = event.get(CheatCluster.class,"PerfectCheatClusters");
+      List<ReconstructedParticle> perfrps = event.get(ReconstructedParticle.class,"PerfectRecoParticles");
       List<BasicCluster> phoclusters = event.get(BasicCluster.class,_phnames);
 //      Map<Track, SpacePoint> trposmap = (Map<Track, SpacePoint>) event.get("TrackPosMap");
 
-      int NPhoClhits = 0;
+      int nhitsp = 0;
+      int nhitspmc = 0;
       double EPhoClus = 0;
       
       //  check found photon clusters
       for (BasicCluster phoclus : phoclusters)
       {
           int nphclhits = phoclus.getSize();
-          NPhoClhits += nphclhits;
+          nhitsp += phoclus.getSize();
           EPhoClus += phoclus.getEnergy();
           int nmchits = 0;
           int nphomchits = 0;
@@ -70,6 +72,7 @@
 //              {
 //                  int mcid = hit.getPDG(i);
                   if (mcid == 22) nphomchits++;
+                  if (mcid == 22) nhitspmc++;
                   if (mcch == 0.) nneumchits++;
 //              }
 //              nmchits += nmchit;
@@ -82,46 +85,44 @@
               double dnneumchits = nneumchits;
               double hrat = dnphomchits/dnmchits;
               double nrat = dnneumchits/nmchits;
-              aida.cloud2D("NClus hits vs NMC hits Photon").fill(nmchits,nphomchits);
-              aida.cloud1D("MC Particle Purity per Photon Clus").fill(hrat);
+              aida.cloud2D("NClus hits vs NMC hits per PhoClus").fill(nmchits,nphomchits);
+              aida.cloud1D("MC Particle Purity per PhoClus").fill(hrat);
               aida.cloud1D("MC Particle Purity per Neutral Clus").fill(nrat);
 //              if (nmchits>nphomchits) aida.cloud1D("MC P Count gt 1 Photons").fill(hrat);              
           }
       }
-      //  Check distance between tracks at ECAL and cheated photon clusters (diag only)
-//      for (Track itr : trposmap.keySet())
-//      {
-//          SpacePoint trsp = trposmap.get(itr);
-//          double trth = trsp.theta();
-//          if (trth<0) trth+= Math.PI;
-//          double trph = trsp.phi();
-//          if (trph<0) trph+=2*Math.PI;
-//          aida.cloud2D("Theta vs Phi of Track in PhoComp").fill(trph,trth);
-          //  now get cheated clusters to compare to track
-//          for (CheatCluster phclus : chclusters)
-//          {
-//              if (phclus.getMCParticle().getPDGID() == 22)
-//              {
-//                  double phclp[] = phclus.getPosition();
-//                  double phclx = phclp[0];
-//                  double phcly = phclp[1];
-//                  double phclz = phclp[2];
-//                  double phclR = Math.sqrt(phclx*phclx+phcly*phcly);
-//                  double phclth = Math.atan(phclR/phclz);
-//                  if (phclth<0) phclth+=Math.PI;
-//                  double phclph = Math.atan2(phcly,phclx);
-//                  if (phclph<0) phclph+=2*Math.PI;
-//                  aida.cloud2D("Theta vs Phi of Cheated PhoCluster").fill(phclph,phclth);
-//                  double distth = Math.abs(phclth-trth);
-//                  double distph = Math.abs(phclph-trph);
-//                  if (distph>Math.PI) distph=2*Math.PI-distph;
-//                  aida.cloud1D("Theta distance Track Cheated Pho Cluster").fill(distth);
-//                  aida.cloud1D("Phi distance Track Cheated Pho Cluster").fill(distph);
-//                  double disttrcl = Math.sqrt(distth*distth+distph*distph);
-//                  aida.cloud1D("Distance Track Cheated Pho Clus").fill(disttrcl);
-//              }
-//          }
-//      }
+
+      //  get cheated clusters from perfect reco list
+      int nhitsccc = 0;
+      double Eccc = 0.;
+      for (ReconstructedParticle perfrp : perfrps)
+      {
+          double rpmass = perfrp.getMass();
+          double rpcharge = perfrp.getCharge();
+          int rppid = perfrp.getParticleIDUsed().getPDG();
+          if (rpcharge == 0 && rpmass == 0 && rppid == 22)
+          {
+              List<Cluster> rpclusters = perfrp.getClusters();
+              if (rpclusters.size()>0)
+              {
+                  for (Cluster rpclus : rpclusters)
+                  {
+//                  BasicCluster rpclus = (BasicCluster) rpclusters.get(0);
+                      nhitsccc += rpclus.getSize();
+//                      Eccc += perfrp.getEnergy();
+                      Eccc += rpclus.getEnergy();
+                  }
+              }
+          }
+      }      
+      double dnhitsccc = nhitsccc;  // number of photon hits in all cheated photon clusters
+      double dnhitspc = nhitsp;  // number of hits in found photon clusters
+      double dnhitspmc = nhitspmc; // number of photon hits in found photon clusters
+      aida.cloud1D("Purity of PhoClusters").fill(dnhitspmc/dnhitspc);
+      aida.cloud1D("Efficiency of PhoClusters").fill(dnhitspmc/dnhitsccc);
+      aida.cloud2D("Pur vs Eff PhoClusters").fill(dnhitspmc/dnhitsccc,dnhitspmc/dnhitspc);
+      aida.cloud1D("Number of hits missing from PhoClusters").fill(dnhitsccc-dnhitspmc);
+      aida.cloud1D("Diff Num Ch hits and Num found hits PhoClusters").fill(dnhitsccc-dnhitspc);
       
       //  Check the cheated clusters also
       double chclusE = 0;
@@ -161,16 +162,16 @@
               aida.cloud1D("Diff Pho ClE MC E single chClus").fill((EPhoClus-MCPhoE)/Math.sqrt(MCPhoE));
           }
       }
-      double dNPhoClhits = NPhoClhits;
+      double dnhitsp = nhitsp;
       double dNPhoChClhits = NPhoChClhits;
       if (NPhoChClhits>10 && PerfPhoClE>.25)
       {
-          double heff = dNPhoClhits/dNPhoChClhits;
+          double heff = dnhitsp/dNPhoChClhits;
           aida.cloud1D("PhoClus Hit Efficiency").fill(heff);
           aida.cloud1D("PhoClus E Efficiency").fill(EPhoClus/PerfPhoClE);
 //          if (NPhoChClhits>NPhoClhits) aida.cloud1D("PhoClus Hit Efficiency").fill(heff);
 //          if (NPhoChClhits==NPhoClhits) aida.cloud1D("PhoClus Hit Efficiency").fill(heff);
-          if (NPhoChClhits<NPhoClhits) aida.cloud1D("PhoClus Extra Hits").fill(heff);
+          if (NPhoChClhits<nhitsp) aida.cloud1D("PhoClus Extra Hits").fill(heff);
 //          if (NPhoChClhits>NPhoClhits) aida.cloud1D("PhoClus E Efficiency").fill(EPhoClus/PerfPhoClE);
 //          if (NPhoChClhits==NPhoClhits) aida.cloud1D("PhoClus E Efficiency").fill(EPhoClus/PerfPhoClE);        
           aida.cloud1D("Cheated Photon Cluster E").fill(PerfPhoClE);
CVSspam 0.2.8