lcsim-cal-calib/src/org/lcsim/cal/calib
diff -u -r1.3 -r1.4
--- SamplingFractionAnalysisDriver.java 21 May 2008 20:30:20 -0000 1.3
+++ SamplingFractionAnalysisDriver.java 27 May 2008 18:08:46 -0000 1.4
@@ -3,7 +3,7 @@
*
* Created on May 19, 2008, 11:54 AM
*
- * $Id: SamplingFractionAnalysisDriver.java,v 1.3 2008/05/21 20:30:20 ngraf Exp $
+ * $Id: SamplingFractionAnalysisDriver.java,v 1.4 2008/05/27 18:08:46 ngraf Exp $
*/
package org.lcsim.cal.calib;
@@ -27,6 +27,9 @@
import static java.lang.Math.abs;
import static java.lang.Math.sqrt;
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.conditions.ConditionsManager.ConditionsSetNotFoundException;
+import org.lcsim.conditions.ConditionsSet;
/**
*
@@ -34,7 +37,7 @@
*/
public class SamplingFractionAnalysisDriver extends Driver
{
-
+ private ConditionsSet _cond;
// we will accumulate the raw energy values in three depths:
// 1. Layers (0)1 through (20)21 of the EM calorimeter (note that if layer 0 is massless, SF==1.)
// 2. last ten layers of the EM calorimeter
@@ -52,6 +55,14 @@
private boolean _initialized;
+ // TODO fix this dependence on EM calorimeter geometry
+ boolean skipFirstLayer = false;
+ int firstEmStartLayer = 0;
+ int secondEmStartLayer = 20;
+
+ double emCalInnerRadius = 0.;
+ double emCalInnerZ = 0.;
+
/** Creates a new instance of SamplingFractionAnalysisDriver */
public SamplingFractionAnalysisDriver()
{
@@ -61,29 +72,35 @@
protected void process(EventHeader event)
{
+ super.process(event);
+ System.out.println("processing SamplingFractionAnalysisDriver");
// TODO make these values runtime definable
String[] det = {"EMBarrel","EMEndcap"};
- String[] collNames = {"EcalBarrHits", "EcalEndcapHits", "HcalBarrHits", "HcalEndcapHits"};
- double[] mipHistMaxBinVal = {.0005, .0005, .005, .005};
- double timeCut = 100.; // cut on energy depositions coming more than 100 ns late
- double ECalMipCut = .0001/3.; // determined from silicon using muons at normal incidence
- double HCalMipCut = .0008/3.; // determined from scintillator using muons at normal incidence
- double[] mipCut = {ECalMipCut, ECalMipCut, HCalMipCut, HCalMipCut};
+// String[] collNames = {"EcalBarrHits", "EcalEndcapHits", "HcalBarrHits", "HcalEndcapHits"};
+// double[] mipHistMaxBinVal = {.0005, .0005, .005, .005};
+// double timeCut = 100.; // cut on energy depositions coming more than 100 ns late
+// double ECalMipCut = .0001/3.; // determined from silicon using muons at normal incidence
+// double HCalMipCut = .0008/3.; // determined from scintillator using muons at normal incidence
+// double[] mipCut = {ECalMipCut, ECalMipCut, HCalMipCut, HCalMipCut};
- // TODO fix this dependence on EM calorimeter geometry
- boolean skipFirstLayer = false;
- int firstEmStartLayer = 0;
- int secondEmStartLayer = 19;
- double emCalInnerRadius = 0.;
- double emCalInnerZ = 0.;
if(!_initialized)
{
+ ConditionsManager mgr = ConditionsManager.defaultInstance();
+ try
+ {
+ _cond = mgr.getConditions("CalorimeterCalibration");
+ }
+ catch(ConditionsSetNotFoundException e)
+ {
+ System.out.println("ConditionSet CalorimeterCalibration not found for detector "+mgr.getDetector());
+ System.out.println("Please check that this properties file exists for this detector ");
+ }
double radius = .5;
double seed = 0.;//.1;
double minE = .05; //.25;
_fcc = new FixedConeClusterer(radius, seed, minE, FixedConeDistanceMetric.DPHIDTHETA);
- _initialized = true;
+
// detector geometries here...
// barrel
CylindricalCalorimeter calsubBarrel = (CylindricalCalorimeter)event.getDetector().getSubdetectors().get(det[0]);
@@ -113,7 +130,10 @@
if(skipFirstLayer) System.out.println("processing "+event.getDetectorName()+" with an em calorimeter with a massless first gap");
System.out.println("Calorimeter bounds: r= "+emCalInnerRadius+ " z= "+emCalInnerZ);
System.out.println("initialized...");
+
+ _initialized = true;
}
+
// organize the histogram tree by species and energy
List<MCParticle> mcparts = event.getMCParticles();
MCParticle mcpart = mcparts.get(mcparts.size()-1);
@@ -145,37 +165,45 @@
if(radius<emCalInnerRadius && abs(z) < emCalInnerZ) doit = false;
if(doit)
{
- // now let's check the em calorimeters...
- // get all of the calorimeter hits...
- List<CalorimeterHit> allHits = new ArrayList<CalorimeterHit>();
- // and the list after cuts.
- List<CalorimeterHit> hitsToCluster = new ArrayList<CalorimeterHit>();
- int i = 0;
- for(String name : collNames)
- {
-// System.out.println("fetching "+name+" from the event");
- List<CalorimeterHit> hits = event.get(CalorimeterHit.class, name);
-// System.out.println(name+ " has "+hits.size()+" hits");
- // let's look at the hits and see if we need to cut on energy or time...
- for(CalorimeterHit hit: hits)
- {
- aida.histogram1D(name+" raw calorimeter cell energy",100, 0., mipHistMaxBinVal[i]).fill(hit.getRawEnergy());
- aida.histogram1D(name+" raw calorimeter cell energy full range",100, 0., 0.2).fill(hit.getRawEnergy());
-// aida.cloud1D(name+" raw calorimeter cell energies").fill(hit.getRawEnergy());
- aida.histogram1D(name+" calorimeter cell time",100,0., 200.).fill(hit.getTime());
- if(hit.getTime()<timeCut)
- {
- if(hit.getRawEnergy()>mipCut[i])
- {
- hitsToCluster.add(hit);
- }
- }
- }
- allHits.addAll(hits);
- ++i;
- }
+// // now let's check the em calorimeters...
+// // get all of the calorimeter hits...
+// List<CalorimeterHit> allHits = new ArrayList<CalorimeterHit>();
+// // and the list after cuts.
+// List<CalorimeterHit> hitsToCluster = new ArrayList<CalorimeterHit>();
+// int i = 0;
+// for(String name : collNames)
+// {
+//// System.out.println("fetching "+name+" from the event");
+// List<CalorimeterHit> hits = event.get(CalorimeterHit.class, name);
+//// System.out.println(name+ " has "+hits.size()+" hits");
+// // let's look at the hits and see if we need to cut on energy or time...
+// for(CalorimeterHit hit: hits)
+// {
+// aida.histogram1D(name+" raw calorimeter cell energy",100, 0., mipHistMaxBinVal[i]).fill(hit.getRawEnergy());
+// aida.histogram1D(name+" raw calorimeter cell energy full range",100, 0., 0.2).fill(hit.getRawEnergy());
+//// aida.cloud1D(name+" raw calorimeter cell energies").fill(hit.getRawEnergy());
+// aida.histogram1D(name+" calorimeter cell time",100,0., 200.).fill(hit.getTime());
+// if(hit.getTime()<timeCut)
+// {
+// if(hit.getRawEnergy()>mipCut[i])
+// {
+// hitsToCluster.add(hit);
+// }
+// }
+// }
+// allHits.addAll(hits);
+// ++i;
+// }
// System.out.println("ready to cluster "+hitsToCluster.size()+ " hits");
+ String processedHitsName = _cond.getString("ProcessedHitsCollectionName");
+ List<CalorimeterHit> hitsToCluster = event.get(CalorimeterHit.class, processedHitsName);
+ // quick check
+ for(CalorimeterHit hit : hitsToCluster)
+ {
+ System.out.println("hit ");
+ System.out.println(hit.getLCMetaData().getName());
+ }
// cluster the hits
List<Cluster> clusters = _fcc.createClusters(hitsToCluster);
// System.out.println("found "+clusters.size()+" clusters");
@@ -187,8 +215,8 @@
}
// proceed only if we found a single cluster above threshold
- // too restrictive! simply take the highest energy cluster
- if(clusters.size()>0)
+ // too restrictive! simply take the highest energy cluster
+ if(clusters.size()>0)
{
Cluster c = clusters.get(0);
@@ -234,7 +262,7 @@
type = 2;
}
clusterRawEnergy += hit.getRawEnergy();
- vals[type]+=hit.getRawEnergy();
+ vals[type] += hit.getRawEnergy();
} // end of loop over hits in cluster
// set up linear least squares:
// expectedEnergy = a*E1 + b*E2 +c*E3
@@ -248,8 +276,8 @@
}
} // end of single cluster cut
- event.put("All Calorimeter Hits",allHits);
- event.put("Hits To Cluster",hitsToCluster);
+// event.put("All Calorimeter Hits",allHits);
+// event.put("Hits To Cluster",hitsToCluster);
event.put("Found Clusters",clusters);
}// end of check on decays outside tracker volume
_tree.cd("/");
@@ -295,6 +323,5 @@
e2.printStackTrace();
}
}
-
}
-}
+}
\ No newline at end of file