Print

Print


Commit in lcsim/src/org/lcsim/contrib/CarstenHensel on MAIN
EMClusterIDAnalyzer.java+51-181.1 -> 1.2
FixedConeClustererAnalyzer.java+6-51.1 -> 1.2
MainLoop.java+2-21.1 -> 1.2
+59-25
3 modified files
back up

lcsim/src/org/lcsim/contrib/CarstenHensel
EMClusterIDAnalyzer.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- EMClusterIDAnalyzer.java	21 Aug 2005 21:28:19 -0000	1.1
+++ EMClusterIDAnalyzer.java	22 Aug 2005 03:58:10 -0000	1.2
@@ -17,20 +17,18 @@
 
 import java.util.*;
 import org.lcsim.event.*;
-import org.lcsim.event.util.CalorimeterHitEsort;
 import org.lcsim.geometry.CalorimeterIDDecoder;
 import org.lcsim.spacegeom.PrincipalAxesLineFitter;
-import org.lcsim.recon.cluster.nn.NearestNeighborClusterer;
 import org.lcsim.recon.cluster.fixedcone.FixedConeClusterer;
-import org.lcsim.recon.cluster.util.CalorimeterCluster;
 import org.lcsim.recon.cluster.util.BasicCluster;
 import org.lcsim.util.Driver;
 import org.lcsim.util.aida.AIDA;
 import org.lcsim.util.fourvec.*;
 import hep.aida.*;
+import hep.aida.ICloud2D;
 import hep.aida.ref.tree.TreeObjectAlreadyExistException;
 import java.text.*;
-import hep.physics.vec.*;
+
 
 /**
  * Reconstruction: Clusters
@@ -46,6 +44,8 @@
 public class EMClusterIDAnalyzer extends Driver {
     // This is convenient for creating and filling histograms "on-the-fly".
     private AIDA aida = AIDA.defaultInstance();
+    private IAnalysisFactory af;
+    private IHistogramFactory hf; 
     private ITree tree;
     private DecimalFormat df;
     private static final double SAMP_FRAC = 0.012;
@@ -55,15 +55,26 @@
     private static final int debug = 0;
     private static final int histoLevel = 0;
     private static final double interactionRadius = 1260.0;
-
+    private static int eventCounter = 0;
+    private static int passedEvents = 0;
+    
+    //carsten's histograms:
+    private ICloud2D angleVSk;
+    private IHistogram2D angleVSkHist;
+    
     // Constructor: Initialize the class. This is the only constructor, and
     // it requires no inputs.
     //
     public EMClusterIDAnalyzer() {
-	tree = aida.tree();
-	df = new DecimalFormat();
+	this.tree = aida.tree();
+	this.df = new DecimalFormat();
+        this.angleVSk = aida.cloud2D("angle vs k");
+        FixedConeClustererAnalyzer  fixedConeClustererAnalyzer = new FixedConeClustererAnalyzer(this.tree);
+        fixedConeClustererAnalyzer.setAttributes(this.SAMP_FRAC, this.debug, this.interactionRadius);
+        this.add(fixedConeClustererAnalyzer);
     }
 
+    
     // Method calcVec: Calculate the four-vector for a given cluster with hits
     // that must be decoded by the given decoder.
     //
@@ -182,11 +193,12 @@
     // Fill a histogram with 1 if this cluster is efficient,
     // 0 if not.
     //
-    public void testEfficiency(double eInit, double eMostEnergetic, double eMax) {
+    public void testEfficiency(double eInit, double eMostEnergetic, double eMax, double angle) {
 	double[] K = {0.10,0.25,0.5,1.0,2.0,3.0};
 	StringBuffer buf = new StringBuffer();
 
-	for (double k : K) {
+	//for (double k : K) {
+        for (double k = 0.1; k < 2.0; k += 0.1) {
 	    buf.delete(0, buf.length());
 	    buf.insert(0, "k_");
 	    df.setMaximumFractionDigits(2);
@@ -205,6 +217,9 @@
 
 	    if (eMostEnergetic > effMinVal) {
 		effHist.fill(1.0);
+                this.angleVSk.fill(angle, k, 1.0);
+                
+                
 		if (this.debug > 0)
 		    System.out.println("Filled efficiency with 1");
 	    }
@@ -263,6 +278,11 @@
 	// particle. It looks as if for theta=90 we can get the initial state
 	// energy fairly accurately from the final state energy.
 
+        
+        this.eventCounter++;
+        if (this.eventCounter % 50 == 0) 
+            System.out.println(this.eventCounter + " events read");
+        
 	List<MCParticle> mcParticles = event.getMCParticles();
 	double eInit = 0.;
 	boolean neutron = false;
@@ -272,9 +292,13 @@
             if (mcParticle.getGeneratorStatus() == MCParticle.FINAL_STATE) {
 		aida.cloud1D("Radius of interaction").fill(mcParticle.getEndPoint().magnitude());
  
-		// Rejects photons with radius < 1260. Here, radius is not an
-		// angle but is an actual radius.
-		//
+		/*
+                 * Rejects photons with radius < 1260. Here, radius is not an
+                 * angle but is an actual radius.
+		 *
+                 * 'pre-selection'
+                 */
+                
 		if (mcParticle.getType().getName().equals("gamma")
 		    && mcParticle.getEndPoint().magnitude() < this.interactionRadius) {
 		    aida.cloud1D("Rejected Particles").fill(0);
@@ -284,13 +308,17 @@
 
 		    return;
 		}
-
-		eInit = mcParticle.getEnergy();
+                // count events which passed 'pre-selection
+		this.passedEvents++;
+                
+                
+                eInit = mcParticle.getEnergy();
 		aida.cloud1D("eInit").fill(eInit);
 		if (mcParticle.getType().getName().equals("n"))
 		    neutron = true;	       
 	    }
 	}
+       
 
         List<CalorimeterHit> ecalBarrHits = event.get(CalorimeterHit.class,"EcalBarrHits");
         List<CalorimeterHit> endcapHits = event.get(CalorimeterHit.class,"EcalEndcapHits");
@@ -351,7 +379,7 @@
 
 	StringBuffer buf = new StringBuffer(); 
 
-	for (double radius = 0.03; radius <= 0.09; radius += 0.03) {
+	for (double radius = 0.01; radius <= 0.09; radius += 0.01) {
 	    // Create new AIDA directory for the radius.
 	    // Ensure that radius directory has two figures after decimal pt.
 
@@ -464,7 +492,7 @@
 	    }
 
 	    // Test the efficiency of the clusterer.
-	    this.testEfficiency(eInit, eMostEnergetic, eMax);
+	    this.testEfficiency(eInit, eMostEnergetic, eMax, radius);
 
 	    aida.cloud1D("Number of clusters with ncell>10").fill(ctr);
 	    if ((debug > 0) && (ctr >= 2)) {
@@ -490,8 +518,13 @@
     }
 
     protected void endOfData() {
-        aida.cloud1D("test").fill(-999);
-        System.out.println("do some clean up");
+        super.endOfData();
+        System.out.println("Events analyzed " + this.eventCounter);
+        System.out.println("Events passed pre-selection " + this.passedEvents);
+        //this.angleVSk.convert(10, 0.0, 1.0, 20, 0.0, 2.0);
+        //this.angleVSkHist = this.angleVSk.histogram();  
+        //this.angleVSkHist.scale(1./this.passedEvents);
+        
     }
 }
 

lcsim/src/org/lcsim/contrib/CarstenHensel
FixedConeClustererAnalyzer.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- FixedConeClustererAnalyzer.java	22 Aug 2005 02:35:21 -0000	1.1
+++ FixedConeClustererAnalyzer.java	22 Aug 2005 03:58:10 -0000	1.2
@@ -27,6 +27,7 @@
 public class FixedConeClustererAnalyzer extends Driver{
     private AIDA aida = AIDA.defaultInstance();
     private ITree tree;
+    private String treePath = "";
     private DecimalFormat df;
     private double SAMP_FRAC;
     private double radiusCut;
@@ -36,13 +37,14 @@
     /** Creates a new instance of FixedConeClustererAnalyzer */
     public FixedConeClustererAnalyzer() {
 	this.df = new DecimalFormat();  
-        
+        if (this.treePath == "")    
+            this.treePath = this.toString();
     }
     
     public FixedConeClustererAnalyzer(ITree tree) {
         this();
         this.tree = tree;
-        this.tree.mkdir(this.toString());
+        this.tree.mkdir(this.treePath);
     }
     
     public void setAttributes(double samplingFraction, int debug, double radiusCut){
@@ -75,13 +77,12 @@
     }   
     
     public void process(EventHeader event) {
-        aida.cloud1D("FCCA").fill(1.0);
         List<MCParticle> mcParticles = event.getMCParticles();
         if (!this.eventPassed(mcParticles)) {
             return;
         } else {
         this.eventCounter++;
-        
+        aida.cloud1D("FCCA").fill(1.0);
         } 
     }
     
@@ -123,7 +124,7 @@
 	}
     }
      
-     public void endOfData() {
+     protected void endOfData() {
         System.out.println(this.eventCounter + " events analyzed by FCCA");
      }
     

lcsim/src/org/lcsim/contrib/CarstenHensel
MainLoop.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- MainLoop.java	21 Aug 2005 21:28:19 -0000	1.1
+++ MainLoop.java	22 Aug 2005 03:58:10 -0000	1.2
@@ -37,9 +37,9 @@
       loop.add(new EMClusterIDAnalyzer());
 //      File output = new File("exampleAnalysisJava.slcio");
 //      loop.add(new LCIODriver(output));
-      loop.loop(-1);
+      loop.loop(200);
       loop.dispose();
-      AIDA.defaultInstance().saveAs("exampleAnalysisJava.aida");
+      AIDA.defaultInstance().saveAs("/home/carsten/LC/Output/exampleAnalysisJava.aida");
    }
 }
 
CVSspam 0.2.8