lcsim/src/org/lcsim/recon/muon
diff -u -r1.1 -r1.2
--- MuonCalSegmentFinder.java 1 Jun 2005 18:12:31 -0000 1.1
+++ MuonCalSegmentFinder.java 31 Oct 2005 22:31:25 -0000 1.2
@@ -1,12 +1,11 @@
package org.lcsim.recon.muon;
import org.lcsim.geometry.*;
-import org.lcsim.recon.tracking.*;
-import org.lcsim.event.*;
-import java.util.*;
-import org.lcsim.util.step.*; // C.M. Stepper
-import org.lcsim.material.Material;
+import org.lcsim.util.step.TrackStepper; // C.M. Stepper
import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.field.Solenoid;
+import org.lcsim.geometry.FieldMap;
+
/**
* Muon Segment Finder for muon calorimeter
@@ -26,13 +25,13 @@
// Set the nearest neighbor cuts to default values
setPhiNNCut(3);
setThetaNNCut(2);
-
-
+
+
// The following kludge is required to get inner radius of the
// solenoid because the Coil class does not implement the
// DetectorComponent interface. Hence we must look through all
// components to find the coil
- coilRadius = 271.0;
+ coilRadius = 2500.0;
// FIXME: need to get coilRadius from some detector class...
// if(detName.contains("SDJan03")) coilRadius = 271.0;
@@ -49,6 +48,7 @@
// }
}
+
public void findSegment(EventHeader event, TrackStepper inStpr)
//----------------------------------!!!
@@ -60,39 +60,48 @@
double tmpxyz; double tmpp;
double rNow ; double xNSteps;
double r;
- numLayersHit = 0;
+ double[] pos; double[] field;
+ numLayersHit = 0;
+ double rr=0.;
+ double zmxCoil= 0.;
+ FieldMap fm = det.getFieldMap();
+ if( fm instanceof Solenoid)
+ {
+ Solenoid sol = (Solenoid) fm;
+ zmxCoil= sol.getZMax();
+ rr = Math.sqrt(sol.getOuterRadius2());
+ System.out.println("MCSF: Coil outer_radius="+rr+" zmxCoil="+zmxCoil);
+ }
+ //coilRadius = rr;
// Forms a muon segment by looking for calorimeter hits that match
// cells which the track passes through
- rpVect = stpr.getNewRp();
- rstep = stpr.getRAfterStep();
- System.out.println("spot 1: rstep[2]="+rstep[2]+", zmax="+zmax+", nr="+nr);
-
+ rpVect = stpr.getNewRp();
//First in the Air Before the COIL
- rNow = Math.sqrt(rstep[0]*rstep[0]+rstep[1]*rstep[1]);
+ rNow = Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]);
r=coilRadius;
xNSteps=((r-rNow)>1.)? ((r-rNow)*10.):10.; //C.M. step 1/10 of the range
- double[] pos = new double[]{coilRadius, 0.0, 0.0};
- double[] field = det.getFieldMap().getField(pos); // C.M.-June-03
+ 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
stpr.tkSteps(r,zmax,stepConditions); //goes up to the coil
- rstep =stpr.getRAfterStep(); // get coordinates
- System.out.println("spot 1a: rstep[2]="+rstep[2]+", zmax="+zmax+", nr="+nr);
+ 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=s.getZMax();
int atZMax = stpr.getAtZmax();
boolean hitsCoil;
- if(rstep[2]== zmax||stpr.getAtZmax()==1||stpr.getStopTkELow())
+ if(rpVect[2]== zmxCoil||stpr.getAtZmax()==1||stpr.getStopTkELow())
{
hitsCoil = false;
return; // does not hit the coil
@@ -102,26 +111,26 @@
r = r + 50.; // Coil Thickness 50cm
- double[] posmu = new double[]{rmin, 0.0, 0.0};
+ double[] posmu = new double[]{rpVect[0], rpVect[1], rpVect[2]};
field = det.getFieldMap().getField(posmu); // C.M.-June-03
System.out.println("MuonCalSegFinder: muonRadius="+rmin+", field="+muField);
muField = field[2];
- stepConditions = steprConditions(10.,muField,(4.36E-03*50.));
+ stepConditions = steprConditions(10.,muField,(4.36E-03*500.));
stpr.tkSteps(r,zmax,stepConditions);
- rstep = stpr.getRAfterStep();
- System.out.println("spot 2: rstep[2]="+rstep[2]+", zmax="+zmax+", nr="+nr);
+ rpVect = stpr.getNewRp();
+ //System.out.println("spot 2: rpVect[2]="+rpVect[2]+", zmax="+zmax+", nr="+nr);
- if(rstep[2]==zmax|| stpr.getAtZmax()==1||stpr.getStopTkELow())
+ if(rpVect[2]==zmxCoil|| stpr.getAtZmax()==1||stpr.getStopTkELow())
hitsCoil = false;
else
{
hitsCoil = true;
- zCoil = rstep[2];
+ zCoil = rpVect[2];
}
if(!hitsCoil)return;
- rNow=Math.sqrt(rstep[0]*rstep[0]+rstep[1]*rstep[1]);
+ rNow=Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]);
// Air after the COIL
@@ -129,26 +138,26 @@
stepConditions = steprConditions(xNSteps,muField,0.);
r= r + (rmin-rNow);
stpr.tkSteps(r,zmax,stepConditions);
- rstep=stpr.getRAfterStep();
- System.out.println("spot 3: rstep[2]="+rstep[2]+", zmax="+zmax+", nr="+nr);
+ rpVect=stpr.getNewRp();
+ System.out.println("spot 3: rpVect[2]="+rpVect[2]+", zmax="+zmax+", nr="+nr);
r = rmin + 0.5*dr;
- rNow=Math.sqrt(rstep[0]*rstep[0]+rstep[1]*rstep[1]);
+ rNow=Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]);
xNSteps = (r-rNow)*10.;
double muFieldNorm = 0.;
stepConditions = steprConditions(xNSteps,muFieldNorm,meanDEdxPerLay(aname));
stpr.tkSteps(r,zmax,stepConditions);
- rstep = stpr.getRAfterStep();
+ 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
int activLayers=32;
- System.out.println("Problem: rstep2="+rstep[2]+", zmax="+zmax+", nr="+nr);
- while (Math.abs(rstep[2]) < zmax && nr < activLayers )
+ System.out.println("Problem: rpVect2="+rpVect[2]+", zmax="+zmax+", nr="+nr);
+ while (Math.abs(rpVect[2]) < zmax && nr < activLayers )
{
// Add cell to list
- int iphi = xyzToPhiBin(rstep);
- int itheta = xyzToThetaBin(rstep);
+ 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);
@@ -160,10 +169,10 @@
// Go on to the next layer
if(nr!=(activLayers-1)) r = r + dr;
else {r=r+0.5*dr;}
- xNSteps=(r-Math.sqrt(rstep[0]*rstep[0]+rstep[1]*rstep[1]))*10.;
+ xNSteps=(r-Math.sqrt(rpVect[0]*rpVect[0]+rpVect[1]*rpVect[1]))*10.;
stepConditions = steprConditions(xNSteps,muFieldNorm,meanDEdxPerLay(aname));
stpr.tkSteps(r,zmax,stepConditions);
- rstep = stpr.getRAfterStep();
+ rpVect = stpr.getNewRp();
nr++;
}
@@ -179,7 +188,7 @@
matchHitsFast(segm, dataMgr.getCollHitMap(muonName) );
// HistogramFolder.setDefaultFolder(".."); // C.M.-27Jan03- Folder
}
-
+
private double coilRadius;
private static double materDedxMudet; // C.M. get the dEdx
private String muonName = "MuonBarrHits";