Print

Print


Commit in GeomConverter/src/org/lcsim/geometry/compact/converter/pandora on MAIN
Main.java+26-61.10 -> 1.11
add mipEnergy to subdetector element from CalorimeterCalibration conditions

GeomConverter/src/org/lcsim/geometry/compact/converter/pandora
Main.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- Main.java	19 May 2010 21:00:03 -0000	1.10
+++ Main.java	19 May 2010 22:26:06 -0000	1.11
@@ -45,7 +45,7 @@
  * geometry input format.
  * 
  * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: Main.java,v 1.10 2010/05/19 21:00:03 jeremy Exp $
+ * @version $Id: Main.java,v 1.11 2010/05/19 22:26:06 jeremy Exp $
  */
 public class Main implements Converter
 {
@@ -123,6 +123,7 @@
     {
         SamplingLayers samplingLayers;
         String name;
+        double mipEnergy;
 
         public String toString()
         {
@@ -252,6 +253,20 @@
 
                 ++samplingIndex;
             }
+            
+            // MIP energy.
+            String mipCondition = null;
+            if (calorimeter.getCalorimeterType() == CalorimeterType.EM_BARREL || 
+                    calorimeter.getCalorimeterType() == CalorimeterType.EM_ENDCAP)
+            {
+                mipCondition = "ECalMip_MPV";
+            }
+            else if (calorimeter.getCalorimeterType() == CalorimeterType.HAD_BARREL ||
+                    calorimeter.getCalorimeterType() == CalorimeterType.HAD_ENDCAP)
+            {
+                mipCondition = "HCalMip_MPV";
+            }                                                
+            mipEnergy = conditions.getDouble(mipCondition);
         }
 
         public SamplingLayerRange getSamplingLayerRange(int layer)
@@ -263,6 +278,11 @@
             }
             return null;
         }
+        
+        public double getMipEnergy()
+        {
+            return mipEnergy;
+        }
     }
 
     public void convert(String inputFileName, InputStream in, OutputStream out) throws Exception
@@ -354,11 +374,12 @@
                         layerD = polycal.getInnerZ();
                     }
 
-                    CalorimeterConditions subdetectorCalorimeterConditions = new CalorimeterConditions(
-                                                                                                       (Calorimeter) subdetector,
-                                                                                                       calorimeterCalibration);
+                    CalorimeterConditions subdetectorCalorimeterConditions 
+                        = new CalorimeterConditions((Calorimeter) subdetector, calorimeterCalibration);
 
                     //System.out.println(subdetectorCalorimeterConditions.toString());
+                    
+                    calorimeter.setAttribute("mipEnergy", xfrac.format(subdetectorCalorimeterConditions.getMipEnergy()));
 
                     for (int i = 0; i < layers.getNumberOfLayers(); i++)
                     {
@@ -504,5 +525,4 @@
             return "Pandora Geometry file (*.xml)";
         }
     }
-
-}
+}
\ No newline at end of file
CVSspam 0.2.8