lcsim-contrib/src/main/java/org/lcsim/contrib/Mbussonn/JetFinder
diff -u -r1.2 -r1.3
--- Wrapper.java 2 Jul 2009 17:52:50 -0000 1.2
+++ Wrapper.java 6 Jul 2009 18:02:11 -0000 1.3
@@ -24,14 +24,14 @@
{
if(!alreadyCreated){
System.out.println("Wrapper"+this.toString()+" launched by "+super.toString()+" and add a new jet finder");
- JetDriverExtended Jde = new JetDriverExtended();
- add(new TrackReconstructionDriver());
-
- add(Jde);
+
if(analyse){
- Jde.draw=true;
add(JetFinder.defaultInstance());
- }
+ }
+ else{
+ add(new TrackReconstructionDriver());
+ add(new JetDriverExtended());
+ }
alreadyCreated=true;
}else{
System.out.println("driver already created...don't add any driver to super");
@@ -44,13 +44,13 @@
System.out.println("Will output events to " + outputFile);
LCIODriver lcio = new LCIODriver(outputFile);
//lcio.setWriteOnlyCollection("trackToMCRelationTable");
- String[] ignoreCollections = {"HelicalTrackHitRelation","HelicalTrackHitRelations","VtxBarrHits","SCTShortEndcapHits","SCTShortBarrHits","MCParticleEndPointEnergy","MCParticleTree","VtxEndcapHits"};
- lcio.setIgnoreCollections(ignoreCollections);
+ //String[] ignoreCollections = {"HelicalTrackHitRelation","HelicalTrackHitRelations","VtxBarrHits","SCTShortEndcapHits","SCTShortBarrHits","MCParticleEndPointEnergy","MCParticleTree","VtxEndcapHits"};
+ //lcio.setIgnoreCollections(ignoreCollections);
add(lcio);
}
public void setPlotsFile(String plotsFile) {
- System.out.println("Will output plots to " + plotsFile);
- JetFinder.defaultInstance().setOutputPlots(plotsFile);
+ // System.out.println("Will output plots to " + plotsFile);
+ // JetFinder.defaultInstance().setOutputPlots(plotsFile);
}
lcsim-contrib/src/main/java/org/lcsim/contrib/Mbussonn/JetFinder
diff -u -r1.3 -r1.4
--- JetDriverExtended.java 2 Jul 2009 17:52:50 -0000 1.3
+++ JetDriverExtended.java 6 Jul 2009 18:02:11 -0000 1.4
@@ -26,7 +26,7 @@
* A simple driver which can be used to find jets from ReconstructedParticles.
* The resuslting jets are stored in a new collection of ReconstructedParticles.
* @author tonyj
- * @version $Id: JetDriverExtended.java,v 1.3 2009/07/02 17:52:50 mbussonn Exp $
+ * @version $Id: JetDriverExtended.java,v 1.4 2009/07/06 18:02:11 mbussonn Exp $
*/
public class JetDriverExtended extends Driver
{
@@ -47,7 +47,8 @@
public String getInputCollectionName()
{
- return inputCollectionName;
+ return inputCollectionName;
+
}
/**
@@ -112,11 +113,12 @@
//List<LCRelation> mcrelations = event.get(LCRelation.class, "HelicalTrackMCRelations");
for(MCParticle mcp : event.getMCParticles()){
- if(mcp.getGeneratorStatus()==MCParticle.FINAL_STATE){
+ if(mcp.getGeneratorStatus()==MCParticle.FINAL_STATE && mcp != null){
MCReconstructedParticle rcp = new MCReconstructedParticle(mcp); // reconstruct particle from mcp
input.add(rcp); // for further treatment in this driver
MyLCRelation lcr = new MyLCRelation(rcp, mcp); // new relation ship
- rc2mc.add(lcr); // array of relationship written on this file line 213
+ if(lcr != null){
+ rc2mc.add(lcr);} // array of relationship written on this file line 213
collectionOfRCP.add(rcp); // list of rcp written line 211
//System.out.println("lcr to string mcp :"+lcr.getTo().toString()+" rcp "+lcr.getFrom().getClass());
totalEnergy += mcp.getEnergy();
lcsim-contrib/src/main/java/org/lcsim/contrib/Mbussonn/JetFinder
diff -u -r1.3 -r1.4
--- JetFinder.java 2 Jul 2009 17:52:50 -0000 1.3
+++ JetFinder.java 6 Jul 2009 18:02:11 -0000 1.4
@@ -45,11 +45,28 @@
IAnalysisFactory af = IAnalysisFactory.create();
ITree tree = af.createTreeFactory().create();
ITupleFactory tf = af.createTupleFactory(tree);
+ private static int xxx;
+ private static int JetZDirection = 0;
+ private static int JetTDirection = 1;
+ private static int NumberOfParticlePerJet = 2;
+ private static int All_Angle = 3;
+ private static int NumberOfTrackWitMoreThanOneMCP = 4;
+ private static int NotFound_numberOfHits = 5;
+ private static int NotFound_Eta = 6;
+ private static int NotFound_Angle = 7;
+
//aida.cloud2D("jet direction r z").fill(jpz,jpt);
//aida.cloud1D("nParticles").fill(listOfParticles.size());
- String columnString = "double JetPz=0 , double JetPt=0,double angle=0";
+ String columnString = "double jetPz,"+
+ "double jetPt," +
+ "int numberOfParticlesPerJet," +
+ "double allparticles_Angle," +
+ "int numberOfTrackWithMoreThanOneMcp," +
+ "double notfoundnumberofhits," +
+ "double notfoudeta," +
+ "double notfoundangle";
ITuple tuple = tf.create("tuple", "MyNtule", columnString);
private static JetFinder defaultInstance;
@@ -59,6 +76,9 @@
private IHistogram1D gy= null;
private JetFinder()
{
+ System.out.println("=============================================");
+ System.out.println("= creating jetfinderExtended =");
+ System.out.println("=============================================");
IHistogramFactory hf = aida.histogramFactory();
if(gx == null){
gx = hf.createProfile1D("track finding efficiency vs angle ",35,0.0,.7);
@@ -70,7 +90,7 @@
public static JetFinder defaultInstance()
{
if (defaultInstance == null){ defaultInstance = new JetFinder();}
- else{System.out.println("singleton return itself");}
+ else{System.out.println(" ========= singleton return itself ============");}
return defaultInstance;
}
@@ -78,6 +98,9 @@
@SuppressWarnings("unchecked")
protected void process(EventHeader event)
{
+ System.out.println("=============================================");
+ System.out.println("=processing event "+event.getEventNumber());
+ System.out.println("=============================================");
System.out.println("processing "+this.getName());
List<ReconstructedParticle> jets = event.get(ReconstructedParticle.class,"Jets");
//aida.cloud1D("nJets").fill(jets.size());
@@ -91,9 +114,15 @@
//******ajoute une ralation entre reconstructed particle and mcp ********//
RelationalTable rc2mc = new BaseRelationalTable(RelationalTable.Mode.MANY_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
List<LCRelation> rcmcfe = event.get(LCRelation.class, "rc2mc");//collection of relation is onyread once here
- for (LCRelation relation : rcmcfe) { // the collection of rcp is not load anywhere
+
+ for (LCRelation relation : rcmcfe) { // the collection of rcp is not load anywhere
+ if(relation.getFrom()==null)
+ {continue;}
+ if(relation.getTo()==null)
+ {continue;}
rc2mc.add(relation.getFrom(), relation.getTo());
}
+ System.out.println("nombre de relation :"+rc2mc.size());
for (Track track : tracklist) {//<editor-fold desc="//construc a relation between track and mcp">
TrackAnalysis tkanal = new TrackAnalysis(track, hittomc);
@@ -117,7 +146,7 @@
List<MCParticle> mcplist = new LinkedList<MCParticle>();
FindableTrack findable = new FindableTrack(event);
for(ReconstructedParticle jet : jets){
-
+ System.out.println("processing jet...");
double jpx = jet.getMomentum().x();
double jpy = jet.getMomentum().y();
double jpz = jet.getMomentum().z();
@@ -127,11 +156,12 @@
njets++;
List<ReconstructedParticle> listOfParticles = jet.getParticles();
if(listOfParticles.size()<2){continue;}
- aida.cloud2D("jet direction r z").fill(jpz,jpt);
tuple.addRow();
- tuple.fill(0,jpz);
- tuple.fill(1,jpt);
+ aida.cloud2D("jet direction r z").fill(jpz,jpt);
+ tuple.fill(JetZDirection,jpz);
+ tuple.fill(JetTDirection,jpt);
aida.cloud1D("nParticles").fill(listOfParticles.size());
+ tuple.fill(NumberOfParticlePerJet,listOfParticles.size());
for(ReconstructedParticle rcpInJet : listOfParticles){
MCParticle mcpp = (MCParticle) rc2mc.to(rcpInJet);
if(mcpp != null)
@@ -141,23 +171,31 @@
int ntracks=0;
int nfindableMCP=0;
MCParticleExtended mcpx = new MCParticleExtended();
+ System.out.println("processing "+mcplist.size()+" mcp");
for(MCParticle mcp : mcplist){
+
+ tuple.addRow();
mcpx.RecycleWithMCParticleAndEvent(mcp, event);//try not to allocate new object inside a tight loop = new MCParticleExtended(mcp,event);
Set<Track> setOfTrack = trktomc.allTo(mcp);
Hep3Vector mmt = mcp.getMomentum();
double ptotal = mcpx.getPTotal();
- double ptcut = 10.0;
+ double ptcut = 0.0;
if( ptotal < ptcut
||findable.LayersHit(mcp)<7
||mcp.getGeneratorStatus()!= MCParticleExtended.FINAL_STATE
||Math.abs(mcpx.getEta())>2.5)
- {continue;}
+ {
+ System.out.println("skip mcp "+ptotal+" nhits"+findable.LayersHit(mcp));
+ continue;}
nfindableMCP++;
double angle = getAngle(mmt,jetMomentum);
double wgt = 0.0;
aida.cloud1D("all/angle").fill(angle);
+ tuple.fill(All_Angle,angle);
+
if(setOfTrack.size()>1){
aida.cloud1D("track with more than 1 mcp").fill(setOfTrack.size());
+ tuple.fill(NumberOfTrackWitMoreThanOneMCP,setOfTrack.size());
continue;
}
else if(setOfTrack.size()==0) {
@@ -165,6 +203,9 @@
aida.cloud1D("not found/nhits").fill(findable.LayersHit(mcp));
aida.cloud1D("not found/eta") .fill(mcpx.getEta());
aida.cloud1D("not found/angle").fill(angle);
+ tuple.fill(NotFound_numberOfHits,findable.LayersHit(mcp));
+ tuple.fill(NotFound_Eta,mcpx.getEta());
+ tuple.fill(NotFound_Angle,angle);
}else if (setOfTrack.size()==1){
ntracks++;
wgt = 1.0;
@@ -195,7 +236,7 @@
}
aida.cloud1D("angle").fill(angle);
- tuple.fill(2, angle);
+ //tuple.fill(2, angle);
gy.fill(angle);
gx.fill(angle,wgt);
gxnarrow.fill(angle,wgt);
@@ -218,19 +259,5 @@
}
- @Override
- public void endOfData() {
- try {
- aida.saveAs(outputPlots);
- }
- catch (IOException ex) {
- Logger.getLogger(Muons.class.getName()).log(Level.SEVERE, null, ex);
- }
- //System.out.println("# of reco tracks = " + _nrecTrk + "; # of MC tracks = " + _nmcTrk + "; Efficiency = " + _nrecTrk / _nmcTrk);
- }
- public void setOutputPlots(String output){
- this.outputPlots=output;
- }
-
}