lcsim/src/org/lcsim/contrib/uiowa/MuonFinder
diff -u -r1.1 -r1.2
--- MuonFinderDriver.java 24 Nov 2008 22:29:14 -0000 1.1
+++ MuonFinderDriver.java 26 Nov 2008 22:30:41 -0000 1.2
@@ -37,10 +37,12 @@
protected String _muonlist;
protected double _bestmatch = 0.8;
protected boolean _debug = false;
+ protected boolean _debug1 = false;
protected boolean _useFirstTwoLayer = true;
EventHeader m_event;
- protected HelixExtrapolator _findCluster = new org.lcsim.recon.pfa.identifier.TrackHelixPlusHitExtrapolator();
+ //protected HelixExtrapolator _findCluster = new org.lcsim.recon.pfa.identifier.TrackHelixPlusHitExtrapolator();
+ protected HelixExtrapolator _findCluster = new org.lcsim.recon.pfa.identifier.TrackHelixExtrapolator();
public MuonFinderDriver(String tracklist, String muonlist){
_tracklist = tracklist;
@@ -101,6 +103,7 @@
aida.cloud1D("muon/muon mip size").fill(muonmips.size());
}
for(Cluster mumip : muonmips){
+ System.out.println("Candidate Muon");
if( mumip.getCalorimeterHits().size() > 1){
Hep3Vector muonpos0 = new BasicHep3Vector();
Hep3Vector muonpos1 = new BasicHep3Vector();
@@ -152,6 +155,7 @@
Track bestTrack = null;
Cluster bestmipc = null;
for(Track tr : trackList){
+ if(_debug) System.out.println(" Candidate Track");
Hep3Vector track = (new BasicHep3Vector(tr.getMomentum()));
double p = track.magnitude();
double pT = Math.sqrt(track.x()*track.x() + track.y()*track.y());
@@ -167,7 +171,7 @@
boolean muon = false;
int isolated = 0;
if(calmip == null || result == null) {
- if(_debug) System.out.println("Null mip or extrapolation");
+ if(_debug) System.out.println(" REASON: Null mip or extrapolation");
continue;
}else if(calmip.getCalorimeterHits().size() > 0){
CalorimeterHit hit = calmip.getCalorimeterHits().get(calmip.getCalorimeterHits().size()-1);
@@ -215,7 +219,6 @@
}
}
if(tpoint == null) {
- if(_debug) System.out.println("Null extrapolated track point");
hasLastPoint = false;
break;
}
@@ -236,26 +239,32 @@
lastUnit = VecOp.unit(last);
}
double rpos = Math.sqrt(tpoint.x()*tpoint.x() + tpoint.y()*tpoint.y());
- if(_debug) System.out.println("Extrapolated track at " + endingLayer + " : r= "+rpos+" z= "+tpoint.z() + " hit= " + count );
+ if(_debug1) System.out.println("Extrapolated track at " + endingLayer + " : r= "+rpos+" z= "+tpoint.z() + " hit= " + count );
if(endingLayer == 0){
endingLayer = 40;
isBarrel = false;
}
if(count > 0 && count < 3) isolated++;
}
- if(!hasLastPoint) continue;
+ if(!hasLastPoint){
+ if(_debug) System.out.println(" REASON: Null extrapolated track last point");
+ continue;
+ }
} else {
- if(_debug) System.out.println("Error: Has both mipcluster and extrapolation but no tangent");
+ if(_debug) System.out.println(" REASON: Has both mipcluster and extrapolation but no tangent");
continue;
}
//Require last position or 7 isolated layer in last 10 layers obtained by extrapolated track.
//This helps remove pion which is showering in CAL and also take the MIP which is contaminated by
//other shower so it stopped in the middle of CAL.
- if(!(muon || (isolated > 6) )) continue;
+ //if(isolated > 6) {
+ // if(_debug) System.out.println("Isolation cut failed");
+ // continue;
+ //}
if (!muon) {
// Skip these cases to avoid pion contamination.
- if(_debug) System.out.println("Mip doesn't reach in last 10 layers");
+ if(_debug) System.out.println(" REASON: Mip doesn't reach in last 10 layers");
continue;
}
Hep3Vector link = VecOp.sub(muonpos0, lastpoint);
@@ -272,13 +281,13 @@
aida.cloud1D("muon/cos_extrapolatedtrack_link").fill(cos1);
aida.cloud1D("muon/cos_muon_link").fill(cos2);
aida.cloud1D("muon/combined cos").fill(cos);
- System.out.println("cos0= " + cos0 + " cos1= " + cos1 + " cos2= " + cos2);
- System.out.println("average cos= " + cos);
+ System.out.println(" cos0= " + cos0 + " cos1= " + cos1 + " cos2= " + cos2 + " average cos= " + cos);
+ System.out.println(" This is possible MUON Track!");
}
bestmatch = cos;
bestTrack = tr;
bestmipc = calmip;
- }
+ }else { if(_debug) System.out.println(" This is NOT possible muon Track!"); }
}
if(bestmatch > _bestmatch){
Set<Cluster> c = outputmap.get(bestTrack);
@@ -291,11 +300,10 @@
c.add(mumip);
}else {
if(_debug) {
- System.out.println("Warning: This cluster in MuDet has no track matched!");
- System.out.println("best match= " + bestmatch);
+ System.out.println(" REASONG: This cluster in MuDet has no track matched!" + " due to " + bestmatch);
}
}
- }else { if(_debug) System.out.println ("Warning: This muon mip has 0 number of hits!");}
+ }else { if(_debug) System.out.println (" REASON: This muon mip has 0 number of hits!");}
}
List<CalorimeterHit> muonclustershits= new Vector<CalorimeterHit>();
@@ -324,8 +332,11 @@
HitMap muonMap = new HitMap(muonclustershits);
List<Track> muonTracks = new Vector<Track>(MuonMapTrackToCluster.keySet());
+ List<Cluster> muonClusters = new Vector<Cluster>(MuonMapTrackToCluster.values());
int flag = 1<<LCIOConstants.CLBIT_HITS;
event.put(_muonlist, muonTracks, Track.class, flag);
+ if(_debug) event.put("MuonClusters", muonClusters, Cluster.class, flag );
+ if(_debug) System.out.println("Muon size= " + muonTracks.size());
}
public Hep3Vector getHitMeanPosition(Collection<CalorimeterHit> hits){