lcsim/src/org/lcsim/contrib/CosminDeaconu
diff -u -r1.1 -r1.2
--- OuterTrackFinder.java 18 Jul 2007 19:01:06 -0000 1.1
+++ OuterTrackFinder.java 19 Jul 2007 00:05:14 -0000 1.2
@@ -22,9 +22,7 @@
import org.lcsim.fit.circle.CircleFit;
import org.lcsim.fit.circle.CircleFitter;
-import org.lcsim.contrib.CosminDeaconu.HelicalTrackFit;
-import org.lcsim.contrib.CosminDeaconu.HelicalTrackFitter;
-
+import org.lcsim.contrib.tracking.ZSeg;
import org.lcsim.geometry.Detector;
import org.lcsim.detector.converter.compact.DeDetector;
import org.lcsim.geometry.subdetector.MultiLayerTracker;
@@ -38,7 +36,7 @@
import java.util.*;
import java.lang.Math;
-import org.lcsim.contrib.tracking.StandaloneAxialBarrelTrack1;
+
import org.lcsim.contrib.JanStrube.tracking.Helix;
/**
@@ -140,6 +138,8 @@
private boolean _phi_cut = false; //whether or not to use the phicut
+ private boolean _zseg = false; //whether or not to use z segmentation (Lori's Code)
+
/**
* Creates a new instance of AxialBarrelTrackFinder1
*/
@@ -189,8 +189,6 @@
//get nlayers ~Cosmin
//--------------------------------------------------------------////
-
-
for (String s : _subdetectors)
{
if (detector.getSubdetector(s).isEndcap()) //for tracker forward or endcap
@@ -470,7 +468,7 @@
{
for (int layer3 = layer2-1; layer3 >= 0; layer3 --)
{
- // Vector<SimTrackerHit> hitset = new Vector<SimTrackerHit>();
+ Vector<TrackerHit> hitset = new Vector<TrackerHit>();
Set<Integer> used_layers = new HashSet<Integer>();
gotHere(4.900001);
List<TrackerHit> hits1 = _hitsbylayer.get(layer1);
@@ -498,7 +496,7 @@
if (_hit_separation.get(hit2) < _seedhit_isolation) continue; // require well-separated hits
if (_used_hits.contains(hit1)) break;
if (_used_hits.contains(hit2)) continue; // skip used hits
- if ((hit2.getPosition()[2] > 0.0) != zpos) continue; //require same side in z
+ if ((hit2.getPosition()[2] > 0.0) != zpos && !_zseg) continue; //require same side in z, except with zseg
//if (Math.abs(hit2.getPoint()[2] - zrel*radius[layer2]) > _module_length/2.0) continue;
x[1] = hit2.getPosition()[0];
y[1] = hit2.getPosition()[1];
@@ -510,7 +508,7 @@
if (_hit_separation.get(hit3) < _seedhit_isolation) continue; // require well-separated hits
if (_used_hits.contains(hit2)) break;
if (_used_hits.contains(hit3)) continue; // skip used hits
- if ((hit3.getPosition()[2] > 0.0) != zpos) continue; // require same side in z
+ if ((hit3.getPosition()[2] > 0.0) != zpos && !_zseg) continue; // require same side in z, except with zseg
//if (Math.abs(hit3.getPoint()[2] - zrel*radius[layer3]) > _module_length/2.0) continue;
x[2] = hit3.getPosition()[0];
y[2] = hit3.getPosition()[1];
@@ -519,13 +517,26 @@
// Perform circle fit with these three points, marking layers as used
int nhits = 3;
- Vector<TrackerHit> hitset = new Vector<TrackerHit>();
+ //Vector<TrackerHit> hitset = new Vector<TrackerHit>();
hitset.setSize(nlayers);
- //hitset.clear(); hitset.setSize(nlayers);
+ hitset.clear(); hitset.setSize(nlayers);
hitset.setElementAt(hit1,layer1);
hitset.setElementAt(hit2,layer2);
hitset.setElementAt(hit3,layer3);
+ if (_zseg) //z segmentation check
+ {
+ SimTrackerHit[] zseg_hit_list = new SimTrackerHit[hitset.size()];
+
+ for (int i = 0; i<hitset.size(); i++) //get simtrackerhits from hitlist tracker hits for ZSeg
+ {
+ if (hitset.get(i)==null) break;
+ zseg_hit_list[i] = ((BaseTrackerHitMC)hitset.get(i)).getSimHits().get(0);
+ }
+
+ if (!ZSeg.zCheck(zseg_hit_list)) continue;
+ }
+
used_layers.clear();
used_layers.add(layer1);
used_layers.add(layer2);
@@ -538,14 +549,21 @@
if (!fitok) System.out.println("Warning: seed fit failed!");
//_fit = _fitter.getfit();
_hfit = _hfitter.getFit();
+
+
+ gotHere(4.990001);
+
+ if (_make_histograms)
+ {
+ _aida.cloud1D("LineChisQ").fill(_hfit.chisq()[1]);
+ _aida.cloud1D("CircChisQ").fill(_hfit.chisq()[0]);
+ }
+
+
// If close to IP, loop over other layers from outside-in and attach unambiguous hits
//Require the fitted transverse momentum of the seed is of appropriate magnitude *Tyler
- //double pc = (0.00029979*b_field)/(_fit.curvature());
double pc = (0.00029979*b_field)/(_hfit.parameters()[2]);
- //if (Math.abs(_fit.dca()) <_seed_ip_dca && Math.abs(pc) > _min_seed_pt )
- gotHere(4.990001);
- _aida.cloud1D("LineChisQ").fill(_hfit.chisq()[1]);
- _aida.cloud1D("CircChisQ").fill(_hfit.chisq()[0]);
+
if (Math.abs(_hfit.parameters()[0]) < _seed_ip_dca && Math.abs(pc) > _min_seed_pt && _hfit.chisq()[1]/3.0<_h_chisq_dof[1])
{
//System.out.println("Passed chisq cut");
@@ -577,10 +595,31 @@
{
gotHere(5.29);
if (_used_hits.contains(hit)) continue; // skip used hits
- if ((hit.getPosition()[2] > 0.0) != zpos) continue; // require same side in z
+ if ((hit.getPosition()[2] > 0.0) != zpos && !_zseg) continue; // require same side in z
+
+ if (_zseg) //z segmentation check
+ {
+ SimTrackerHit[] zseg_hit_list = new SimTrackerHit[hitset.size()];
+
+ int max = 0;
+
+ for (int i = 0; i<hitset.size(); i++) //get simtrackerhits from hitlist tracker hits for ZSeg
+ {
+ if (hitset.get(i)==null) break;
+ zseg_hit_list[i] = ((BaseTrackerHitMC)hitset.get(i)).getSimHits().get(0);
+ max = i;
+ }
+
+ if (!ZSeg.zCheck(zseg_hit_list))
+ {
+ hitset.set(max,null); //deletes latest addition if ZSeg check fails
+ continue;
+ }
+ }
+
//if (Math.abs(hit.getPoint()[2] - zrel*radius[layer]) > 50.0) continue;
- //_fit = _fitter.propagatefit(hit.getPoint()[0],hit.getPoint()[1]);
- //if (Math.abs(_fit.dca()) < nearest_dist)
+
+
gotHere(5.295);
Helix h = _hfit.getHelix();
BasicHep3Vector p = new BasicHep3Vector(hit.getPosition());
@@ -652,10 +691,29 @@
for (TrackerHit hit : hits)
{
if (_used_hits.contains(hit)) continue; // skip used hits
- if ((hit.getPosition()[2] > 0.0) != zpos) continue; // require same side in z
+ if ((hit.getPosition()[2] > 0.0) != zpos && !_zseg) continue; // require same side in z
+
+ if (_zseg) //z segmentation check
+ {
+ SimTrackerHit[] zseg_hit_list = new SimTrackerHit[hitset.size()];
+
+ int max = 0;
+
+ for (int i = 0; i<hitset.size(); i++) //get simtrackerhits from hitlist tracker hits for ZSeg
+ {
+ if (hitset.get(i)==null) break;
+ zseg_hit_list[i] = ((BaseTrackerHitMC)hitset.get(i)).getSimHits().get(0);
+ max = i;
+ }
+
+ if (!ZSeg.zCheck(zseg_hit_list))
+ {
+ hitset.set(max,null); //deletes latest addition if ZSeg check fails
+ continue;
+ }
+ }
+
//if (Math.abs(hit.getPoint()[2] - zrel*radius[layer]) > 50.0) continue;
- //_fit = _fitter.propagatefit(hit.getPoint()[0],hit.getPoint()[1]);
- //if (Math.abs(_fit.dca()) < nearest_dist)
gotHere(6.9);
double distance = Math.abs(_hfit.getHelix().getSignedClosestDifferenceToPoint(new SpacePoint(new BasicHep3Vector(hit.getPosition()))));
if( distance < nearest_dist)
@@ -872,7 +930,7 @@
unused_hits.remove(hit);
}
- event.put(_output_hit_collection, unused_hits, TrackerHit.class, 0, "TkrBarrHits");
+ event.put(_output_hit_collection, unused_hits, TrackerHit.class, 0);
}
}
@@ -1074,7 +1132,7 @@
/**
- * Use the default Forward tracking settings
+ * Use the default forward tracking settings
*/
public void useDefaultForwardSettings()//~Cosmin
{
@@ -1084,15 +1142,43 @@
setCombinedLayers(new int[][]{{4,6}});
setInputHits(new String[]{"TkrForwardHits","TkrEndcapHits"});
setSubdetectors(new String[]{"TrackerForward","TrackerEndcap"});
+ _phi_cut=true;
+ _zseg=false;
}
-
- public void useDefaultBarrelSettings()
+
+ /**
+ * Use the default barrel tracking settings
+ */
+ public void useDefaultBarrelSettings() //~Cosmin
{
_useAllLayers=true;
setInputHits("TkrBarrelHits");
setSubdetectors(new String[]{"TrackerBarrel"});
+ _phi_cut = true;
+ _h_chisq_dof[1]=10000000000000000000000000000000000000000.0; // emulate circle fit by setting ridiculously high line chisq cutoff for helical fit.
+ _zseg=true;
}
+ /**
+ * Enable/Disable using the phi cut
+ *
+ * @param usePhiCut true to use phicut, false otherwise. default = ??????
+ *
+ */
+ public void usePhiCut(boolean usePhiCut)
+ {_phi_cut = usePhiCut;}
+
+
+ /**
+ * Enable/Disable using zSegmentation
+ *
+ * @param usePhiCut true to use zseg, false otherwise. autoset true by useDefaultBarrelSettings()
+ *
+ */
+ public void useZSeg(boolean useZSeg)
+ {_zseg = useZSeg;}
+
+
/**
* Set maximum helical chisq/nhits to create tracks (default = {10.0,10.0}). The first element is the circle fitter chisq, the second element is the line fitter chisq.
*