lcsim-contrib/src/main/java/org/lcsim/contrib/Mbussonn
diff -u -r1.4 -r1.5
--- JetFinder.java 19 Jun 2009 19:15:23 -0000 1.4
+++ JetFinder.java 23 Jun 2009 01:17:46 -0000 1.5
@@ -3,6 +3,8 @@
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
+import hep.aida.IHistogramFactory;
+import hep.aida.IProfile1D;
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
import java.util.ArrayList;
@@ -35,12 +37,16 @@
*/
public class JetFinder extends Driver{
private AIDA aida = AIDA.defaultInstance();
+ private IProfile1D gx;
public JetFinder()
{
//super.add(new MCFast());
- super.add(new JetDriverExtended());
- super.add(new TrackReconstructionDriver());
-
+ super.add(new JetDriverExtended());
+ super.add(new TrackReconstructionDriver());
+ IHistogramFactory hf = aida.histogramFactory();
+ gx = hf.createProfile1D("track finding efficiency vs angle ",18,-6.0,6.0);
+ gx.fill(1,1);
+ int i;
}
@Override
@@ -49,12 +55,12 @@
{
super.process(event);
List<ReconstructedParticle> jets = event.get(ReconstructedParticle.class,"Jets");
- aida.cloud1D("nJets").fill(jets.size());
- for (ReconstructedParticle jet : jets)
- {
- List<ReconstructedParticle> particlesInJet = jet.getParticles();
- aida.cloud1D("nParticles").fill(particlesInJet.size());
- }
+ // aida.cloud1D("nJets").fill(jets.size());
+ //for (ReconstructedParticle jet : jets)
+ //{
+ // List<ReconstructedParticle> particlesInJet = jet.getParticles();
+ // aida.cloud1D("nParticles").fill(particlesInJet.size());
+ //}
RelationalTable hittomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
RelationalTable trktomc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
List<LCRelation> mcrelations = event.get(LCRelation.class, "HelicalTrackMCRelations");
@@ -79,8 +85,6 @@
double ptotal = Math.sqrt(px*px+py*py+pz*pz);
double ptcut = 50.;
-
-
if(track.getCharge()==0)
continue;
if( ptotal < ptcut)
@@ -88,95 +92,114 @@
if (mcp != null)
trktomc.add(track, mcp);
}
- String sfile = StrategyXMLUtils.getDefaultStrategiesPrefix() + "sATLASFull-JeffMarch26.xml";
- List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromResource(sfile);
- FindableTrack findable = new FindableTrack(event);
+// String sfile = StrategyXMLUtils.getDefaultStrategiesPrefix() + "sATLASFull-JeffMarch26.xml";
+// List<SeedStrategy> slist = StrategyXMLUtils.getStrategyListFromResource(sfile);
+// FindableTrack findable = new FindableTrack(event);
List<MCParticle> mcplist = new LinkedList<MCParticle>();//event.getMCParticles();
- //mcplist.clear();
for(ReconstructedParticle jet : jets){
double jpx = jet.getMomentum().x();
double jpy = jet.getMomentum().y();
- double jpz = jet.getMomentum().z();
+// double jpz = jet.getMomentum().z();
double jpt = Math.sqrt(jpx*jpx +jpy*jpy);
if (jpt <150)continue;
- aida.cloud1D("jet direction r z").fill(jpz,jpt);
+// aida.cloud2D("jet direction r z").fill(jpz,jpt);
List<ReconstructedParticle> listOfParticles = jet.getParticles();
for(ReconstructedParticle rcpInJet : listOfParticles){
MCParticle mcpp = (MCParticle) rc2mc.to(rcpInJet);
- System.out.println("one more mcp");
+
//MCParticleExtended mcpe = new MCParticleExtended(mcpp,event);
if(mcpp != null)
mcplist.add(mcpp);
}
Hep3Vector jetMomentum = jet.getMomentum();
- System.out.println("mcp in jet : "+mcplist.size());
- int ntracks=0;
+ //System.out.println("mcp in jet : "+mcplist.size());
+// int ntracks=0;
for(MCParticle mcp : mcplist){
MCParticleExtended mcpx = new MCParticleExtended(mcp,event);
Set<Track> setOfTrack= trktomc.allTo(mcp);
Hep3Vector mmt = mcp.getMomentum();
- double angle = getAngle(jetMomentum,mmt);
- aida.cloud1D("angle").fill(angle);
+// double angle = getAngle(jetMomentum,mmt);
+// aida.cloud1D("angle").fill(angle);
double ptotal = mcpx.getPTotal();
double ptcut=50.;
+// int nhits = findable.LayersHit(mcpx);
+// aida.cloud1D("nhits for MCparticles").fill(nhits);
if( ptotal < ptcut
//||(mcp.getPDGID()!=13 && mcp.getPDGID()!=-13)
||mcp.getGeneratorStatus()!= MCParticleExtended.FINAL_STATE
||Math.abs(mcpx.getEta())>2.5)
{continue;}
else{
+ gx.fill(1,2);
if(setOfTrack.size()>1){
- aida.cloud1D("track with more than 1 mcp").fill(setOfTrack.size()); continue;
+// aida.cloud1D("track with more than 1 mcp").fill(setOfTrack.size()); continue;
}
else if(setOfTrack.size()==0) {
- double weight=0.;
- int nhits = findable.LayersHit(mcpx);
- aida.cloud1D("mcp/eta for non-finded particle").fill(mcpx.getEta());
- aida.cloud1D("mcp/theta for non-finded particle").fill(mcpx.getTheta());
- aida.cloud1D("nhits for non-finded muons").fill(nhits);
+ double wgt = 0.0;
+ double angle3 = getAngle(mmt,jetMomentum);
+ gx.fill(1,4);
+ //gx.fill(angle3,wgt);
+ //System.out.println("0 : "+mmt);
+ System.out.println("0 weight : "+wgt);
+ //System.out.println("0 angle : "+angle3);
+ gx.fill(1,1);
+
+
+// aida.cloud1D("mcp/eta for non-finded particle").fill(mcpx.getEta());
+// aida.cloud1D("mcp/theta for non-finded particle").fill(mcpx.getTheta());
+// aida.cloud1D("nhits for non-finded particles").fill(nhits);
+
}else if (setOfTrack.size()==1){
- ntracks++;
+// ntracks++;
//System.out.println("tracktomcp : "+setOfTx.size()+" Vs "+setOfTrack.size());
- System.out.println("rcp associed with mcp "+rc2mc.allTo(mcpx).size());
+// System.out.println("rcp associed with mcp "+rc2mc.allTo(mcpx).size());
double weight=1;
Track track = setOfTrack.iterator().next();
- double d0 = track.getTrackParameter(HelicalTrackFit.dcaIndex);
- double z0 = track.getTrackParameter(HelicalTrackFit.z0Index);
- double px = track.getPX();
- double py = track.getPY();
- double pz = track.getPZ();
- double pt = Math.sqrt(px*px+py*py);
- double ps = Math.sqrt(px*px+py*py+pz*pz);
+// double d0 = track.getTrackParameter(HelicalTrackFit.dcaIndex);
+// double z0 = track.getTrackParameter(HelicalTrackFit.z0Index);
+// double px = track.getPX();
+// double py = track.getPY();
+// double pz = track.getPZ();
+// double pt = Math.sqrt(px*px+py*py);
+// double ps = Math.sqrt(px*px+py*py+pz*pz);
double p[] = track.getMomentum();
Hep3Vector h3vp = new BasicHep3Vector(p[0],p[1],p[2]);
double trackangle = getAngle(h3vp,jetMomentum);
- aida.cloud1D("track angle").fill(trackangle);
-// double bfield = event.getDetector().getFieldMap().getField(new BasicHep3Vector(0., 0., 0.)).z();
-// HelixParamCalculator helix = new HelixParamCalculator(mcp, bfield);
-// double d0mc = helix.getDCA();
-// double z0mc = helix.getZ0();
- aida.cloud1D("track/d0").fill(d0);
- aida.cloud1D("track/z0").fill(z0);
- aida.cloud2D("track/do VS Z0").fill(z0, d0);
- aida.cloud1D("track/tr momentum").fill(pt);
- //aida.cloud1D("track/scalar momentum").fill(ps);
- aida.cloud1D("track/residual t momentum").fill(mcpx.getPR()-pt);
- aida.cloud1D("track/residual d0").fill(d0-mcpx.getDCA());
- aida.cloud1D("track/residual z0").fill(z0-mcpx.getZ0());
- aida.cloud1D("track/number of Tracker hits").fill(track.getTrackerHits().size());
- aida.cloud1D("track/number of mcp hits").fill(findable.LayersHit(mcp));
- aida.cloud1D("track/chiSquared").fill(track.getChi2());
+// aida.cloud1D("track angle").fill(trackangle);
+ //double angle2 = getAngle(mmt,jetMomentum);
+ double wgt = 1.0;
+ gx.fill(1,3);
+ //gx.fill(angle2,wgt);
+ gx.fill(1,0);
+
+ //System.out.println("1 : "+mmt);
+ System.out.println("1 weight: "+wgt);
+ //System.out.println("1 angle: "+angle2);
+ System.out.println("1 track angle: "+trackangle);
+
+
+
+// aida.cloud1D("track/d0").fill(d0);
+// aida.cloud1D("track/z0").fill(z0);
+// aida.cloud2D("track/do VS Z0").fill(z0, d0);
+// aida.cloud1D("track/tr momentum").fill(pt);
+// //aida.cloud1D("track/scalar momentum").fill(ps);
+// aida.cloud1D("track/residual t momentum").fill(mcpx.getPR()-pt);
+// aida.cloud1D("track/residual d0").fill(d0-mcpx.getDCA());
+// aida.cloud1D("track/residual z0").fill(z0-mcpx.getZ0());
+// aida.cloud1D("track/number of Tracker hits").fill(track.getTrackerHits().size());
+// aida.cloud1D("track/number of mcp hits").fill(findable.LayersHit(mcp));
+// aida.cloud1D("track/chiSquared").fill(track.getChi2());
}//ed loop through mcp
- aida.cloud2D("ntrack vs nMCP in jet").fill(mcplist.size(),ntracks);
- aida.cloud2D("nTrack vs nRCP in jet").fill(listOfParticles.size(), ntracks);
+// aida.cloud2D("nTrack vs nRCP in jet").fill(listOfParticles.size(), ntracks);
}
}
mcplist.clear();
}
- super.printStatistics(System.out);
+ //super.printStatistics(System.out);
}
private double getAngle(Hep3Vector h1, Hep3Vector h2){
double ca = VectorArithmetic.dot(h1, h2)/(h1.magnitude()*h2.magnitude());