3 modified files
lcsim-contrib/src/main/java/org/lcsim/contrib/Mbussonn/JetFinder
diff -u -r1.1 -r1.2
--- Wrapper.java 29 Jun 2009 18:13:08 -0000 1.1
+++ Wrapper.java 2 Jul 2009 17:52:50 -0000 1.2
@@ -15,15 +15,28 @@
* @author matthiasbussonnier
*/
public class Wrapper extends Driver{
- public String outputFile="foobar.slcio";
- public String plotsFile="myplots.aida";
- protected String stgfile="chose";
+ public static boolean alreadyCreated = false;
+ public static boolean analyse = false;
+ public String outputFile = "foobar.slcio";
+ public String plotsFile = "myplots.aida";
+ protected String stgfile = "chose";
public Wrapper()
{
- System.out.println("Wrapper"+this.toString()+" launched by "+super.toString()+" and add a new jet finder");
- add(new JetDriverExtended());
- add(new TrackReconstructionDriver());
- add(JetFinder.defaultInstance());
+ 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());
+ }
+ alreadyCreated=true;
+ }else{
+ System.out.println("driver already created...don't add any driver to super");
+
+ }
}
@@ -32,7 +45,7 @@
LCIODriver lcio = new LCIODriver(outputFile);
//lcio.setWriteOnlyCollection("trackToMCRelationTable");
String[] ignoreCollections = {"HelicalTrackHitRelation","HelicalTrackHitRelations","VtxBarrHits","SCTShortEndcapHits","SCTShortBarrHits","MCParticleEndPointEnergy","MCParticleTree","VtxEndcapHits"};
- //lcio.setIgnoreCollections(ignoreCollections);
+ lcio.setIgnoreCollections(ignoreCollections);
add(lcio);
}
public void setPlotsFile(String plotsFile) {
lcsim-contrib/src/main/java/org/lcsim/contrib/Mbussonn/JetFinder
diff -u -r1.2 -r1.3
--- JetDriverExtended.java 30 Jun 2009 18:44:56 -0000 1.2
+++ JetDriverExtended.java 2 Jul 2009 17:52:50 -0000 1.3
@@ -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.2 2009/06/30 18:44:56 mbussonn Exp $
+ * @version $Id: JetDriverExtended.java,v 1.3 2009/07/02 17:52:50 mbussonn Exp $
*/
public class JetDriverExtended extends Driver
{
@@ -34,6 +34,7 @@
private static final String defaultOutputCollectionName = "Jets";
private String inputCollectionName;
private String outputCollectionName = defaultOutputCollectionName;
+ public boolean draw = false;
private JetFinder finder = defaultJetFinder();
List<LCRelation> rc2mc = new ArrayList<LCRelation>();
List<ReconstructedParticle> collectionOfRCP;
@@ -142,7 +143,7 @@
- //if (hist)
+ if (draw) // don't draw when on noric
{
AIDA aida = AIDA.defaultInstance();
aida.cloud1D("JDE/JetDriver/sumE").fill(totalEnergy);
@@ -166,7 +167,7 @@
aida.cloud1D("JDE/One particle/jet |H4|").fill(finder.jet(i).magnitude());
aida.cloud1D("JDE/One particle/jet pr").fill(pr);
aida.cloud1D("JDE/One particle/jet pz").fill(pz);
- //aida.cloud2D("One particle/jet direction").fill(pz,pr);
+ //aida.cloud2D("One particle/jet direction").fill(pz,pr);
}else{
@@ -205,7 +206,7 @@
}
// Add the list of jets to the event
-
+ System.out.println("collection of rcp size:"+collectionOfRCP.size());
event.put("collectionOfRCP",collectionOfRCP,ReconstructedParticle.class,0);//the collection which is sometime empty
event.put(outputCollectionName, output, ReconstructedParticle.class, 0); //another collection which always works
event.put("rc2mc", rc2mc, LCRelation.class, 0); //the array of relationship sometimes empty
lcsim-contrib/src/main/java/org/lcsim/contrib/Mbussonn/JetFinder
diff -u -r1.2 -r1.3
--- JetFinder.java 30 Jun 2009 18:44:56 -0000 1.2
+++ JetFinder.java 2 Jul 2009 17:52:50 -0000 1.3
@@ -3,10 +3,14 @@
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
+import hep.aida.IAnalysisFactory;
import org.lcsim.contrib.Mbussonn.*;
import hep.aida.IHistogram1D;
import hep.aida.IHistogramFactory;
import hep.aida.IProfile1D;
+import hep.aida.ITree;
+import hep.aida.ITuple;
+import hep.aida.ITupleFactory;
import hep.physics.vec.Hep3Vector;
import java.io.IOException;
import java.util.HashSet;
@@ -38,6 +42,16 @@
*/
public class JetFinder extends Driver{
private AIDA aida = AIDA.defaultInstance();
+ IAnalysisFactory af = IAnalysisFactory.create();
+ ITree tree = af.createTreeFactory().create();
+ ITupleFactory tf = af.createTupleFactory(tree);
+
+ //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";
+ ITuple tuple = tf.create("tuple", "MyNtule", columnString);
+
private static JetFinder defaultInstance;
public String outputPlots="myplots.aida";
private IProfile1D gx=null;
@@ -103,6 +117,7 @@
List<MCParticle> mcplist = new LinkedList<MCParticle>();
FindableTrack findable = new FindableTrack(event);
for(ReconstructedParticle jet : jets){
+
double jpx = jet.getMomentum().x();
double jpy = jet.getMomentum().y();
double jpz = jet.getMomentum().z();
@@ -113,6 +128,9 @@
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.cloud1D("nParticles").fill(listOfParticles.size());
for(ReconstructedParticle rcpInJet : listOfParticles){
MCParticle mcpp = (MCParticle) rc2mc.to(rcpInJet);
@@ -177,6 +195,7 @@
}
aida.cloud1D("angle").fill(angle);
+ tuple.fill(2, angle);
gy.fill(angle);
gx.fill(angle,wgt);
gxnarrow.fill(angle,wgt);
CVSspam 0.2.8