Commit in lcsim/src/org/lcsim/recon/muon on MAIN
BarrelCalSegmentFinder.java+36-231.21 -> 1.22
Modified by Judith Odili - 06/22/06 - To get the readout information of the detector compact.xml file by calling Samplexmlclass

lcsim/src/org/lcsim/recon/muon
BarrelCalSegmentFinder.java 1.21 -> 1.22
diff -u -r1.21 -r1.22
--- BarrelCalSegmentFinder.java	16 Jun 2006 20:42:39 -0000	1.21
+++ BarrelCalSegmentFinder.java	22 Jun 2006 21:47:24 -0000	1.22
@@ -3,8 +3,10 @@
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
 import org.lcsim.event.*;
+import java.io.*;
 import java.util.*;
 import org.lcsim.util.step.TrackStepper;  //  C.M. Stepper
+import org.lcsim.recon.cluster.util.Samplexmlclass;
 import org.lcsim.util.step.DeDx;
 import org.lcsim.util.aida.AIDA;
 import org.lcsim.geometry.Detector;
@@ -14,7 +16,15 @@
 import org.lcsim.geometry.util.IDDescriptor;
 import org.lcsim.geometry.layer.LayerSlice;
 import org.lcsim.recon.cluster.util.CalHitMapMgr;
-
+/**
+ @author Rich Markeloff, 
+ Modified by Caroline Milstene - January-02-04 - To include the electromagnetic calorimeter
+ and to include the loss of energy by the De/Dx and the effect of the magnetic field by using
+ stepper - January-05. 
+ 
+ New modifications by Judith Odili - 06/22/06 - For the lcsim format - To read the detector information directly from the \
+ Compact.xml file by calling the Samplexmlclass methods
+ */
 // Muon Segment Finder for barrel calorimeter
 // Modified to include the EM Calorimeter- C.Milstene
 // Modified to use the Stepper.class in org.lcsim.util.step,
@@ -39,7 +49,7 @@
         // Get the parameters that describe this detector component
         det = aDet;
         String a_nam = det.getHeader().getDetectorName();
-        System.out.println("              DETECTOR "+a_nam);
+        //System.out.println("              DETECTOR "+a_nam);
         calsub = (CylindricalBarrelCalorimeter)det.getSubdetectors().get(subdetName);
 
         /** NEXT:to be done This will be part of new class StepperConditions.java located in
@@ -92,26 +102,27 @@
 	// <detector>/compact.xml for descriptions (under EcalBarrHits and
 	//similars)
 	// This is sidaug05 description (for all cal components)-from GL
- 	String sidaug05_tcmt = "layer:7,system:6,barrel:3,phi:32:16,z:-16";
-	String sidaug05 = "layer:7,system:6,barrel:3,theta:32:11,phi:11";
-
+        //The purpose of this statement is to specify the xml file the data should be read from
+        String filename = "C:\\work\\LCDetectors\\detectors\\" + a_nam +"\\compact.xml";
+        File f = new File(filename);
+   	xmlReader.declarefile(f);
+        String readoutseg = xmlReader.getReadoutId(subdetName);
 	try {
-	  IDDescriptor desc = new IDDescriptor(sidaug05_tcmt);
-	  encoder = new IDEncoder(desc);
-	}
+	  IDDescriptor desc = new IDDescriptor(readoutseg);
+          encoder = new IDEncoder(desc);
+          }
 	catch(Exception e) {
 	  System.out.println("Some exception caught! "+e);
 	}
 	// Set system and barrel/endcap values
 	int sys = 0;
-	System.out.println("BCSF constructor: subdetName="+subdetName);
-	if( subdetName.equals(ecalSubdetName) ) sys = 2;
-	if( subdetName.equals(hcalSubdetName) ) sys = 3;
-	if( subdetName.equals(muSubdetName) ) sys = 4;
-	encoder.setValue("system", sys);
+	if(debug)System.out.println("BCSF constructor: subdetName="+subdetName);
+        sys = xmlReader.getSubdetId(subdetName);
+        encoder.setValue("system", sys);
 	encoder.setValue("barrel", 0);
 	// set system/barrel bits in Segmentation object
 	segm.setID(encoder.getID());
+        
     }
 
     //----------------------------------!!!
@@ -132,7 +143,7 @@
         r=rmin;
         // UPDATE Phase-Space
         rpVect  = stpr.getNewRp();
-	    System.out.println("findSegment: subd="+subdetName);
+	if(debug) System.out.println("findSegment: subd="+subdetName);
         if(stpr.getStopTkELow())return;
         double[] field = det.getFieldMap().getField(rpVect); // C.M.-June-03
 	    BField = field[2];
@@ -144,9 +155,9 @@
         double dtTracker=stpr.getDTOF();
 	    stepConditions = steprConditions(dTracker,BField,0.,dtTracker);
 	    stpr.tkSteps( r, zmax,stepConditions);
-	    System.out.println("Tracker r=" +r+" zmax="+zmax+"Barrel:out of Tracker");
+	    if(debug)System.out.println("Tracker r=" +r+" zmax="+zmax+"Barrel:out of Tracker");
 	    rpVect   = stpr.getNewRp();
-        System.out.println(" CHECK NOW at Exit of Tracker rmin="+rmin+" dr="+dr) ;
+        if(debug)System.out.println(" CHECK NOW at Exit of Tracker rmin="+rmin+" dr="+dr) ;
         if(r<(rmin-dr))return; // does not enter ECAL
         }
         if(subdetName.equals(hcalSubdetName))
@@ -157,17 +168,17 @@
 	    double d_EMHD = Math.abs(r-stpr.partR(rpVect));
         stpr.setDTOF(rpVect,d_EMHD);
         double dt_EMHD=stpr.getDTOF();
-	    System.out.println(" distance between calorimeters EM-HD "+d_EMHD);
+	    if(debug)System.out.println(" distance between calorimeters EM-HD "+d_EMHD);
 	    stepConditions = steprConditions(d_EMHD,BField,0.,dt_EMHD);
 	    stpr.tkSteps(r,zmax,stepConditions);
 	    rpVect  = stpr.getNewRp();
         // if(r<(rmin-dr))return; // does not enter HCAL
         }
-        System.out.println("Stepper pos ENTRY of:("+subdetName+" "+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), r="+stpr.partR(rpVect));
+        if(debug)System.out.println("Stepper pos ENTRY of:("+subdetName+" "+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), r="+stpr.partR(rpVect));
         stpr.setDTOF(rpVect,dr);
         double dt_r=stpr.getDTOF();
         stepConditions = steprConditions(dr,BField,meanDEdxPerLay(subdetName),dt_r);
-        System.out.println("ENTRY CALOS Barrel:MeanDEdxPerLay="+meanDEdxPerLay(subdetName)+ subdetName);
+        if(debug)System.out.println("ENTRY CALOS Barrel:MeanDEdxPerLay="+meanDEdxPerLay(subdetName)+ subdetName);
         // Forms a muon segment by looking for calorimeter hits that match
         // cells which the track passes through
         // Begin by finding intersection of track with innermost layer
@@ -175,7 +186,7 @@
         r          = rLayer0Mid;
         stpr.tkSteps(r, zmax,stepConditions);
         rpVect  = stpr.getNewRp();
-        System.out.println(subdetName+" !!!!!! rmin="+rmin);
+        if(debug)System.out.println(subdetName+" !!!!!! rmin="+rmin);
         // Get intersections with successive layers as long as track is
         // within the detector, and create a list of the cells that
         // the track passes through
@@ -188,7 +199,7 @@
 
             if(stpr.getCurlBack())
             {
-               System.out.println("!!!BCF:CURLINGBACK old r="+r+" New r="+(r-dr));
+                if(debug)System.out.println("!!!BCF:CURLINGBACK old r="+r+" New r="+(r-dr));
              r=r-dr   ;
             } else if(nr!=(nLayers-1)) r = r + dr;
 	      else {
@@ -204,7 +215,7 @@
         }
         // Save number of layers track passed through
         numLayersHit = nr;
-	    System.out.println("Stepper pos EXIT of:("+subdetName+" "+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), r="+stpr.partR(rpVect));
+	     if(debug)System.out.println("Stepper pos EXIT of:("+subdetName+" "+rpVect[0]+"; "+rpVect[1]+"; "+rpVect[2]+"), r="+stpr.partR(rpVect));
         rpVect= stpr.getNewRp();
         if((rpVect[2]>=zmax)||stpr.getStopTkELow())
         {// Record Last Layer and Info at Break
@@ -364,7 +375,8 @@
 				 Map<Long,CalorimeterHit> calHits,
 				 boolean debug)
     {
-      AIDA aida = AIDA.defaultInstance();
+       if(debug)System.out.println("Segm:::: "  + cell);
+        AIDA aida = AIDA.defaultInstance();
       int nhitsTotal = 0;
 //       ProjectiveCylinder projCal = (ProjectiveCylinder)segm;
       if(debug) System.out.println("matchhits: nhits = "+calHits.size());
@@ -474,6 +486,7 @@
     protected TrackStepper stpr     = new TrackStepper(); //C.M.-Stepper Instance
     protected double [] stepConditions = new double[4];
     protected Map<String, Double> materials;
+    public static Samplexmlclass xmlReader = new Samplexmlclass();
     private int phiNNCut;
     private int thetaNNCut;
 }
CVSspam 0.2.8