Print

Print


Commit in lcsim/src/org/lcsim/recon/muon on MAIN
MuonCalSegmentFinder.java+70-921.9 -> 1.10
C. Milstene & T. Johnson-01-2006- To include the reconstructed tracks into Wired-

lcsim/src/org/lcsim/recon/muon
MuonCalSegmentFinder.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- MuonCalSegmentFinder.java	27 Jan 2006 20:33:44 -0000	1.9
+++ MuonCalSegmentFinder.java	16 Jun 2006 20:43:08 -0000	1.10
@@ -22,23 +22,22 @@
  * elements as well and to replace the Inner Class Extrapolate
  * of the Class MuonCalSegmentFinder- C. Milstene-January-02-04
  */
-
 final public class MuonCalSegmentFinder extends BarrelCalSegmentFinder
 {
-    
+
     public MuonCalSegmentFinder(Detector det, String subdetectorName)
     {
         super(det, subdetectorName);
-        
+
         // Set the nearest neighbor cuts to default values
-        setPhiNNCut(0);//2
-        setThetaNNCut(0);//2
-       
+        setPhiNNCut(2);//2
+        setThetaNNCut(2);//2
+
 	// getting info from the coil
 	MultiLayerTracker coilsub = (MultiLayerTracker)det.getSubdetectors().get("SolenoidCoilBarrel");
 
-        /** 
-         * Get materials from MultiLayerTracker class. 
+        /**NEXT: to be done -part of the StepperConditons.class (see BarrelCalSegmentFinder)
+         * Get materials from MultiLayerTracker class.
          *
          * WARNING: This approach is prone to error, because the slices are
          * not guaranteed to be the same thickness in every layer.
@@ -63,8 +62,8 @@
 	  }
 	}
     }
-     
-    
+
+
     public void findSegment(EventHeader event, TrackStepper inStpr)
     //----------------------------------!!!
     {
@@ -76,10 +75,10 @@
         double rNow  ;  double xNSteps;
         double r;
         double[] pos;  double[] field;
-        
+         if(stpr.getStopTkELow()) return;
         numLayersHit = 0;
         double rr=0.;
-	FieldMap fm = det.getFieldMap();
+	    FieldMap fm = det.getFieldMap();
         if( fm instanceof Solenoid)
         {
            Solenoid sol = (Solenoid) fm;
@@ -89,29 +88,27 @@
 
         // Forms a muon segment by looking for calorimeter hits that match
         // cells which the track passes through
-        
-        rpVect = stpr.getNewRp();        
 
-        //First in the Air Before the COIL        
+        rpVect = stpr.getNewRp();
+
+        //First in the Air Before the COIL
         rNow = Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]);
         r = coilSlices.get(0).getRmin();
-        xNSteps=((r-rNow)>1.)? ((r-rNow)*10.):10.; //C.M. step 1/10 of the range
-
-	pos = new double[]{rpVect[0], rpVect[1], rpVect[2]};
-	field = det.getFieldMap().getField(pos); // C.M.-June-03
-	System.out.println("COIL BField: ("+field[0]+", "+field[1]+", "+field[2]+")");
-	BField = field[2];
-        stepConditions =steprConditions(xNSteps,BField,0.);  // C.M. Information for he stepper
+	   pos = new double[]{rpVect[0], rpVect[1], rpVect[2]};
+	   field = det.getFieldMap().getField(pos); // C.M.-June-03
+	   System.out.println("COIL BField: ("+field[0]+", "+field[1]+", "+field[2]+")");
+	   BField = field[2];
+        double dist= Math.abs(r-stpr.partR(rpVect));
+        stpr.setDTOF(rpVect,dist);
+        double dt_dist=stpr.getDTOF();
+        stepConditions =steprConditions(dist,BField,0.,dt_dist);  // C.M. Information for he stepper
         stpr.tkSteps(r,zmax,stepConditions);                 //goes up to the coil
         rpVect =stpr.getNewRp();                         // get coordinates
-	//System.out.println("spot 1a: rpVect[2]="+rpVect[2]+", zmax="+zmax+", nr="+nr);
-        
-        
         // From the COIL on
-        
+
         double muField =-0.6;
         double zCoil;
-	double zmxCoil = coilSlices.get(0).getZmax();
+	    double zmxCoil = coilSlices.get(0).getZmax();
         int atZMax = stpr.getAtZmax();
         boolean hitsCoil;
         if(rpVect[2]== zmxCoil||stpr.getAtZmax()==1||stpr.getStopTkELow())
@@ -120,11 +117,11 @@
 	    System.out.println("*** Aborting at the coil");
             return;    // does not hit the coil
         }
-        
-        // In the COIL
-	int islice = 0;
 
-	for(int ii=0; ii<coilSlices.size(); ++ii) {
+        // In the COIL
+	    int islice = 0;
+        double dt_r;
+	    for(int ii=0; ii<coilSlices.size(); ++ii) {
 	    CoilSubLayer slice = coilSlices.get(ii);
 	    if(stpr.getStopTkELow()) {
 		return; // C.M.
@@ -133,37 +130,39 @@
 	    double rminSlice = slice.getRmin();
 	    dr = slice.getThickness();
 	    double totalDedx = slice.getdEdx() * dr;
-
+            stpr.setDTOF(rpVect,dr);
+            dt_r=stpr.getDTOF();
 	    if( Math.abs(rpVect[2])>zmaxSlice ) break;
 	    // Go on to the next layer
 	    r = r + dr;
-	    xNSteps=(r-Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]))*10.;
-
+            xNSteps= dr;
 	    field = det.getFieldMap().getField( rpVect );  // C.M.-June-03
 	    double radius = Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]);
-// 	    System.out.println("slice "+islice+", mat="+slice.getMaterial()
-// 			       +", r="+r
-// 			       +", zmax="+zmaxSlice+", rmin="+rminSlice
-// 			       +", dr="+dr
-// 			       +", totalDedx="+totalDedx
-// 			       +", field="+field[2]
-// 			       +", rad="+radius+", z="+rpVect[2] );
+ 	    System.out.println("slice "+islice+", mat="+slice.getMaterial()
+ 			       +", r="+r
+ 			       +", zmax="+zmaxSlice+", rmin="+rminSlice
+ 			       +", dr="+dr
+ 			       +", totalDedx="+totalDedx
+ 			       +", field="+field[2]
+ 			       +", rad="+radius+", z="+rpVect[2] );
 
-	    stepConditions = steprConditions(xNSteps, field[2], totalDedx);
+	    stepConditions = steprConditions(dr, field[2], totalDedx,dt_r);
 	    stpr.tkSteps(r,zmaxSlice,stepConditions);
 	    rpVect   = stpr.getNewRp();
 	    ++islice;
 	}
 
 	field = det.getFieldMap().getField(rpVect);	     // C.M.-June-03
-	System.out.println("MuonCalSegFinder: muonRadius="+rmin+", field="+muField);
+	if(debug)System.out.println("MuonCalSegFinder: muonRadius="+rmin+", field="+muField);
 
 	muField = field[2];
-        stepConditions = steprConditions(10.,muField,(4.36E-03*500.));
+        double d0=10.;
+        stpr.setDTOF(rpVect,d0);
+        double dt0=stpr.getDTOF();
+        stepConditions = steprConditions(10.,muField,(4.36E-03*500.),dt0);
         stpr.tkSteps(r,zmax,stepConditions);
         rpVect          = stpr.getNewRp();
-	//System.out.println("spot 2: rpVect[2]="+rpVect[2]+", zmax="+zmax+", nr="+nr);
-        
+
         if(rpVect[2]>=zmxCoil|| stpr.getAtZmax()==1||stpr.getStopTkELow())
             hitsCoil = false;
         else
@@ -177,84 +176,63 @@
 	}
 
         rNow=Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]);
-        
         // Air after the COIL
-        
-        xNSteps=(rmin-rNow>=1.)? (rmin-rNow)*10.:10.;
-        stepConditions = steprConditions(xNSteps,muField,0.);
-        r= r + (rmin-rNow);
+        xNSteps=rmin-stpr.partR(rpVect);
+        stpr.setDTOF(rpVect,xNSteps);
+        dt_r=stpr.getDTOF();
+        stepConditions = steprConditions(xNSteps,muField,0.,dt_r);
+        r= r + (rmin-stpr.partR(rpVect));
         stpr.tkSteps(r,zmax,stepConditions);
         rpVect=stpr.getNewRp();
-        
         r = rLayer0Mid;
-	System.out.println("spot 3: rpVect[2]="+rpVect[2]+", zmax="+zmax+", nr="+nr+", rLay0mid="+r);
+        if(debug)
+	    System.out.println("spot 3: rpVect[2]="+rpVect[2]+", zmax="+zmax+", nr="+nr+", rLay0mid="+r);
 
-        rNow=Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]);
-        xNSteps = (r-rNow)*10.;
         double muFieldNorm = 0.;
-        stepConditions = steprConditions(xNSteps,muFieldNorm,meanDEdxPerLay(subdetName));
+        dist =r-stpr.partR(rpVect);
+        stpr.setDTOF(rpVect,dist);
+        dt_r=stpr.getDTOF();
+        stepConditions = steprConditions(dist,muFieldNorm,meanDEdxPerLay(subdetName),dt_r);
         stpr.tkSteps(r,zmax,stepConditions);
         rpVect          = stpr.getNewRp();
         // Get intersections with succesive layers as long as track is
-        // within the detector, and create a list of the cells that
-        // the track passes through
+        // within the detector
         //int activLayers=32;
-	System.out.println("Problem: rpVect2="+rpVect[2]+", zmax="+zmax+", nr="+nr);
+	    if(debug)System.out.println("Problem: rpVect2="+rpVect[2]+", zmax="+zmax+", nr="+nr);
         while (Math.abs(rpVect[2]) < zmax && nr < nLayers )
         {
            Hep3Vector v = new BasicHep3Vector(rpVect[0],rpVect[1],rpVect[2]);
            hitPos.add(v);
-//             // Add cell to list            
-// 	    int iphi = xyzToPhiBin(rpVect);
-// 	    int itheta = xyzToThetaBin(rpVect);
-// 	    System.out.println("Loop: ir="+nr+", itheta="+itheta+", iphi="+iphi);
-// 	    encoder.setValue("layer", nr);
-// 	    encoder.setValue("theta", itheta);
-// 	    encoder.setValue("phi", iphi);
-// 	    Long cellid = encoder.getID();
-
-	    // more general way
-//	    long virtualID = segm.findCellContainingXYZ( rpVect );
-	    // this works for projective geometries only
-// 	    assert cellid == virtualID
-// 		: "*** virtual cell problem: "
-// 		+" cellID="+MyTools.printID(cellid)
-// 		+", virtualID="+MyTools.printID(virtualID);
-
-//	    System.out.println("adding virtual hit: cellid="
-//			       +MyTools.printID(virtualID));
-//	    cellList.add(virtualID);
 
 	    if(stpr.getStopTkELow())break; // C.M.
 	    // Go on to the next layer
 	    if(nr!=(nLayers-1)) r = r + dr;
 	    else              { r = rmin + nLayers*dr; }
-	    xNSteps=(r-Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]))*10.;
-	    stepConditions = steprConditions(xNSteps,muFieldNorm,meanDEdxPerLay(subdetName));
+            dist=(nr!=(nLayers-1))?dr:(dr+dr-(rLayer0Mid-rmin));
+	    stepConditions = steprConditions(dist,muFieldNorm,meanDEdxPerLay(subdetName),dt_r);
 	    stpr.tkSteps(r,zmax,stepConditions);
 	    rpVect   = stpr.getNewRp();
 	    nr++;
         }
-        
+
         // Save number of layers track passed through
-        
         numLayersHit = nr;
         rpVect=stpr.getNewRp();
-        if((nr==nLayers)|| (rpVect[2]>=zmax))
+        if((rpVect[2]>=zmax)||stpr.getStopTkELow())
         {
            Hep3Vector v = new BasicHep3Vector(rpVect[0],rpVect[1],rpVect[2]);
-           hitPos.add(v);   
+           hitPos.add(v);
         }
         // Now match the cells on this list to calorimeter hits
-        
-        //		HistogramFolder.setDefaultFolder("/MUDet");		// C.M.-27Jan03- Folder
-        
+
+
+
         Map<Long,CalorimeterHit> muhits = dataMgr.getCollHitMap(muonName);
-	System.out.println("# muon hits: "+muhits.size());
-//	matchHitsFast( segm, dataMgr.getCollHitMap(muonName), true );
-        //		HistogramFolder.setDefaultFolder("..");			// C.M.-27Jan03- Folder
+	    if(debug)System.out.println("# muon hits: "+muhits.size());
+        matchHitsFast( segm, dataMgr.getCollHitMap(muonName), true );
     }
-   
+
+
     private double coilRadius;
     private  static double materDedxMudet;  // C.M. get the dEdx
     private String muonName = "MuonBarrHits";
CVSspam 0.2.8