Print

Print


Commit in lcsim/src/org/lcsim/util/step on MAIN
StepConditions.java+73-191.3 -> 1.4
C. Milstene-10Oct-2006-extension to the endcaps

lcsim/src/org/lcsim/util/step
StepConditions.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- StepConditions.java	8 Sep 2006 18:22:14 -0000	1.3
+++ StepConditions.java	11 Oct 2006 00:56:09 -0000	1.4
@@ -20,12 +20,13 @@
 import org.lcsim.material.*;
 import org.lcsim.geometry.field.FieldOverlay;
 import org.lcsim.recon.muon.CoilSubLayer;
-import org.lcsim.geometry.subdetector.MultiLayerTracker;
+//import org.lcsim.geometry.subdetector.MultiLayerTracker;
 import org.lcsim.geometry.layer.*;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.util.aida.*;
 import org.lcsim.geometry.layer.*;
 import org.lcsim.geometry.Layered;
+import org.lcsim.geometry.subdetector.*;
 //import org.lcsim.material.Material;
 
 /**
@@ -39,9 +40,10 @@
 {
 	public Detector det;
         public CylindricalBarrelCalorimeter calsub;
-        public String subdetName, materialName, sublayerMat, name;
+        public CylindricalEndcapCalorimeter endcapCal;
+        public String subdetName, materialName, sublayerMat, name,barrEndc;
 	public int layerN, sliceN;
-	public double rNow, rToGo, layerthickness,materialthickness,coilthickness, totaldedx= 0., layerDEdx=0., matterDEdx = 0., mass, charge, distance;
+	public double rNow, ToGoPos, layerthickness,materialthickness,coilthickness, totaldedx= 0., layerDEdx=0., matterDEdx = 0., mass, charge, distance;
 	public Map<String, Double> materials;
         public DeDx dedx;
         public double []rpVect       = new double[8] ;
@@ -57,7 +59,7 @@
         public double rmin,  rLayer0Mid, rmax,  nLayers, zmax;
 
 	/**
-         Constructor for the Subdetectors
+         Constructor for the Subdetectors-- Taking care of the coil!!
          @param det The Detector
          */
         public StepConditions(Detector det)
@@ -88,28 +90,37 @@
 
         }
         /**
-         Constructor for the Subdetectors
+         Constructor for the Subdetectors --- Taking care of the Layers
 
          @param rpvect Array containing the postion, momentum , mass and charge of the particle reconstructed.
          @param det The Detector
          @param subdetName The subdetector  name, EMBarrel, HCALBarrel, MuonBarrel
          @param layerN The layer number in the subdetector.
          */
-	public StepConditions(double r, double []rpvect, Detector det, String subdetName, int layerN )
+	public StepConditions(double steppingVar, double []rpvect, Detector det, String subdetName, int layerN )
 	{
 		this.rpVect = rpvect;
                 this.subdetName = subdetName;
 		this.layerN = layerN;
                 this.det = det;
                 name = subdetName;
-                this.rNow = stpr.partR(rpVect);
-                layerthickness =Math.abs(r - rNow);
-
+                Layering layers ;
+                if (name.endsWith("Barrel"))
+                {
+                    this.rNow = stpr.partR(rpVect);
+                    layerthickness = Math.abs(steppingVar - rNow);
+                    calsub = (CylindricalBarrelCalorimeter)det.getSubdetectors().get(subdetName);
+                    layers = ((Layered) calsub).getLayering();
+                }
+                else
+                {
+                   layerthickness = Math.abs(steppingVar - rpVect[2]);
+                   endcapCal = (CylindricalEndcapCalorimeter)det.getSubdetectors().get(subdetName);
+                   layers = ((Layered) endcapCal).getLayering();
 
-                calsub = (CylindricalBarrelCalorimeter)det.getSubdetectors().get(subdetName);
+                }
+                 materials = new HashMap<String, Double>();
 
-                materials = new HashMap<String, Double>();
-		Layering layers = ((Layered) calsub).getLayering();
                 for ( LayerSlice ls : layers.getLayerStack().getLayer(layerN).getSlices() )
                 {
                     sublayerMat = ls.getMaterial().getName();
@@ -149,21 +160,62 @@
 
 	}
         /**
-         Constructor for the Materials between the subdetectors.
+         Constructor for the Materials between the subdetectors -- Taking care of the material
 
          @param rpvect Array containing the postion, momentum , mass and charge of the particle reconstructed.
          @param det The Detector
          @param materialName The name of the material e.g Air, Aluminum
-         @param rToGo The radius to reach.
+         @param ToGoPos The radius to reach.
          */
-       	public StepConditions(double []rpvect, Detector det, String materialName, double rToGo)
+       	public StepConditions(double []rpvect, String barrEndc, String materialName, double ToGoPos)
 	{
 		this.materialName = materialName;
+                this.barrEndc = barrEndc;
                 this.det = det;
-		this.rToGo = rToGo;
+		this.ToGoPos = ToGoPos;
                 name = materialName;
+
                 this.rpVect = rpvect;
-                this.rNow = stpr.partR(rpVect);
+                if (this.barrEndc.endsWith("Barrel"))
+                {
+                    System.out.println(" HERE in Stepcond ");
+                   this.rNow = stpr.partR(rpVect);
+                   this.distance = Math.abs(ToGoPos - rNow);
+                   try
+				     {
+				        manager = MaterialManager.instance();
+				        material = manager.findMaterial(materialName);
+				        matterDEdx = MaterialCalculator.computeBetheBloch(material, pp, mass, charge, distance);
+				        //System.out.println("....... mass " + mass +  " charge  " + charge + " D " + distance);
+				        //System.out.print("MATTER DEDX....." + matterDEdx + "MATERIAL .... " + materialName);
+				        //System.out.println("Momentum ...  ." + stpr.partPabs(rpVect));
+				       }
+				         catch (MaterialNotFoundException e)
+				       {
+				               System.out.println("Error: "+e);
+
+	                    }
+                }
+                else if (this.barrEndc.endsWith("Endcap"))
+                {
+                    this.distance = Math.abs(ToGoPos - rpVect[2]);
+
+      try
+                    {
+                        manager = MaterialManager.instance();
+                        material = manager.findMaterial(materialName);
+                        matterDEdx = MaterialCalculator.computeBetheBloch(material, pp, mass, charge, distance);
+                        //System.out.println("....... mass " + mass +  " charge  " + charge + " D " + distance);
+                        //System.out.print("MATTER DEDX....." + matterDEdx + "MATERIAL .... " + materialName);
+                        //System.out.println("Momentum ...  ." + stpr.partPabs(rpVect));
+                    }
+                    catch (MaterialNotFoundException e)
+                    {
+                        System.out.println("Error: "+e);
+
+                    }
+
+                }
                 int i = 0; int j=3;//px = rpvect[3]
                 for (i=0; i<3; i++)
                 {
@@ -172,7 +224,7 @@
                 }
                 mass = rpVect[6];
                 charge = rpVect[7];
-                this.distance = Math.abs(rToGo - rNow);
+
                 try
                     {
                         manager = MaterialManager.instance();
@@ -187,7 +239,7 @@
                         System.out.println("Error: "+e);
 
                     }
-	}
+	        }
 
         /**
 
@@ -279,4 +331,6 @@
                  totaldedx = slice.getdEdx() * coilthickness;
                  return totaldedx;
          }
+
+
 }
\ No newline at end of file
CVSspam 0.2.8