lcsim/src/org/lcsim/recon/util
diff -u -r1.1 -r1.2
--- CalorimeterInformation.java 12 Jan 2010 22:59:10 -0000 1.1
+++ CalorimeterInformation.java 3 Feb 2010 19:44:40 -0000 1.2
@@ -8,8 +8,12 @@
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.Calorimeter;
import org.lcsim.geometry.IDDecoder;
+import org.lcsim.geometry.layer.Layer;
+import org.lcsim.geometry.layer.LayerSlice;
+import org.lcsim.material.Material;
import org.lcsim.geometry.compact.Subdetector;
import org.lcsim.geometry.subdetector.*;
+import org.lcsim.util.step.DeDx;
public class CalorimeterInformation
{
@@ -28,8 +32,12 @@
private double[] rmax;
private double[] zmin;
private double[] zmax;
+ private List[] de;
+ private List[] nrad;
+ private List[] nlam;
private Map<Calorimeter.CalorimeterType,Integer> indexmap;
private int index;
+ private DeDx materialDatabase;
public CalorimeterInformation()
{
theCalorimeterInformation = this;
@@ -44,6 +52,7 @@
*/
protected void init(Detector d)
{
+ materialDatabase = DeDx.instance();
sublist = new ArrayList<Subdetector>();
for(Subdetector s:d.getSubdetectors().values())
{
@@ -73,6 +82,9 @@
rmax = new double[ncal];
zmin = new double[ncal];
zmax = new double[ncal];
+ de = new List[ncal];
+ nrad = new List[ncal];
+ nlam = new List[ncal];
indexmap = new HashMap<Calorimeter.CalorimeterType,Integer>();
for(int i=0;i<ncal;i++)
{
@@ -87,6 +99,27 @@
if(idd[i] == null)System.out.println("null IDDecoder for subdector "+subdetector[i].getName());
collname[i] = subdetector[i].getReadout().getName();
digicollname[i] = new String(collname[i]).replace("Hits","DigiHits");
+ nrad[i] = new ArrayList<Double>();
+ nlam[i] = new ArrayList<Double>();
+ de[i] = new ArrayList<Double>();
+ for(int j=0;j<nlayers[i];j++)
+ {
+ Layer layer = s.getLayering().getLayer(j);
+ double xrad = 0.;
+ double xlam = 0.;
+ double xde = 0.;
+ for(LayerSlice slice:layer.getSlices())
+ {
+ Material m = slice.getMaterial();
+ double dx = slice.getThickness();
+ xrad += dx/m.getRadiationLengthWithDensity();
+ xlam += dx/m.getNuclearInteractionLengthWithDensity();
+ xde += dx*materialDatabase.getDeDx(m.getName());
+ }
+ nrad[i].add(new Double(xrad/10.));
+ nlam[i].add(new Double(xlam/10.));
+ de[i].add(new Double(xde/10.));
+ }
if(s.isBarrel())
{
if(s instanceof CylindricalBarrelCalorimeter)
@@ -477,4 +510,175 @@
index = ind.intValue();
return zmax[index];
}
+ /**
+ *
+ * @param String representation of Calorimeter type
+ * @return the mean minI energy loss at normal incidence
+ * for each layer
+ */
+ public List<Double> getMeanDe(String s)
+ {
+ return getMeanDe(Calorimeter.CalorimeterType.fromString(s));
+ }
+ /**
+ *
+ * @param CalorimetType representation from
+ * Calorimeter.CalorimeterType
+ * @return the mean minI energy loss at normal incidence
+ * for each layer
+ */
+ public List<Double> getMeanDe(Calorimeter.CalorimeterType s)
+ {
+ Integer ind = indexmap.get(s);
+ if(ind == null)
+ {
+ System.out.println("Type "+s+" did not map to a CalorimeterType");
+ return null;
+ }
+ index = ind.intValue();
+ return de[index];
+ }
+ /**
+ *
+ * @param String representation of Calorimeter type
+ * @return the number of radiation lengths at normal incidence
+ * for each layer
+ */
+ public List<Double> getNRad(String s)
+ {
+ return getNRad(Calorimeter.CalorimeterType.fromString(s));
+ }
+ /**
+ *
+ * @param CalorimetType representation from
+ * Calorimeter.CalorimeterType
+ * @return the number of radiation lengths at normal incidence
+ * for each layer
+ */
+ public List<Double> getNRad(Calorimeter.CalorimeterType s)
+ {
+ Integer ind = indexmap.get(s);
+ if(ind == null)
+ {
+ System.out.println("Type "+s+" did not map to a CalorimeterType");
+ return null;
+ }
+ index = ind.intValue();
+ return nrad[index];
+ }
+ /**
+ *
+ * @param String representation of Calorimeter type
+ * @return the number of interaction lengths at normal incidence
+ * for each layer
+ */
+ public List<Double> getNLam(String s)
+ {
+ return getNLam(Calorimeter.CalorimeterType.fromString(s));
+ }
+ /**
+ *
+ * @param CalorimetType representation from
+ * Calorimeter.CalorimeterType
+ * @return the number of interaction lengths at normal incidence
+ * for each layer
+ */
+ public List<Double> getNLam(Calorimeter.CalorimeterType s)
+ {
+ Integer ind = indexmap.get(s);
+ if(ind == null)
+ {
+ System.out.println("Type "+s+" did not map to a CalorimeterType");
+ return null;
+ }
+ index = ind.intValue();
+ return nlam[index];
+ }
+ /**
+ *
+ * @param String representation of Calorimeter type
+ * @param int layer
+ * @return the mean minI energy loss at normal incidence
+ * for a layer
+ */
+ public double getMeanDe(String s, int l)
+ {
+ return getMeanDe(Calorimeter.CalorimeterType.fromString(s),l);
+ }
+ /**
+ *
+ * @param CalorimetType representation from
+ * Calorimeter.CalorimeterType
+ * @param int layer
+ * @return the mean minI energy loss at normal incidence
+ * for a layer
+ */
+ public double getMeanDe(Calorimeter.CalorimeterType s, int l)
+ {
+ List<Double> t = getMeanDe(s);
+ if( (l < 0)||(l >= t.size()) )
+ {
+ System.out.println("Layer "+l+" out of range for "+s);
+ return 0.;
+ }
+ return t.get(l).doubleValue();
+ }
+ /**
+ *
+ * @param String representation of Calorimeter type
+ * @param int layer
+ * @return the number of radiation lengths at normal incidence
+ * for a layer
+ */
+ public double getNRad(String s, int l)
+ {
+ return getNRad(Calorimeter.CalorimeterType.fromString(s),l);
+ }
+ /**
+ *
+ * @param CalorimetType representation from
+ * Calorimeter.CalorimeterType
+ * @param int layer
+ * @return the number of radiation lengths at normal incidence
+ * for a layer
+ */
+ public double getNRad(Calorimeter.CalorimeterType s, int l)
+ {
+ List<Double> t = getNRad(s);
+ if( (l < 0)||(l >= t.size()) )
+ {
+ System.out.println("Layer "+l+" out of range for "+s);
+ return 0.;
+ }
+ return t.get(l).doubleValue();
+ }
+ /**
+ *
+ * @param String representation of Calorimeter type
+ * @param int layer
+ * @return the number of interaction lengths at normal incidence
+ * for a layer
+ */
+ public double getNLam(String s, int l)
+ {
+ return getNLam(Calorimeter.CalorimeterType.fromString(s),l);
+ }
+ /**
+ *
+ * @param CalorimetType representation from
+ * Calorimeter.CalorimeterType
+ * @param int layer
+ * @return the number of interaction lengths at normal incidence
+ * for a layer
+ */
+ public double getNLam(Calorimeter.CalorimeterType s, int l)
+ {
+ List<Double> t = getNLam(s);
+ if( (l < 0)||(l >= t.size()) )
+ {
+ System.out.println("Layer "+l+" out of range for "+s);
+ return 0.;
+ }
+ return t.get(l).doubleValue();
+ }
}