16 added + 16 removed, total 32 files
lcsim/resources/org/lcsim/plugin/web/examples
diff -N Analysis101.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Analysis101.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,34 @@
+import org.lcsim.util.aida.AIDA;
+import hep.physics.vec.VecOp;
+import java.util.List;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.util.Driver;
+
+/*
+ * An example showing how to access MCParticles from the EventHeader and
+ * make some simple histograms from the data.
+ *
+ * @author Norman Graf
+ * @version $Id: Analysis101.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ *
+ */
+public class Analysis101 extends Driver
+{
+ private AIDA aida = AIDA.defaultInstance();
+
+ protected void process(EventHeader event)
+ {
+ // Get the list of MCParticles from the event
+ List<MCParticle> particles = event.get(MCParticle.class,event.MC_PARTICLES);
+ // Histogram the number of particles per event
+ aida.cloud1D("nTracks").fill(particles.size());
+ // Loop over the particles
+ for (MCParticle particle : particles)
+ {
+ aida.cloud1D("energy").fill(particle.getEnergy());
+ aida.cloud1D("cosTheta").fill(VecOp.cosTheta(particle.getMomentum()));
+ aida.cloud1D("phi").fill(VecOp.phi(particle.getMomentum()));
+ }
+ }
+}
\ No newline at end of file
lcsim/resources/org/lcsim/plugin/web/examples
diff -N Analysis102.py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Analysis102.py 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,23 @@
+from org.lcsim.util.aida import AIDA
+from hep.physics.vec import VecOp
+from org.lcsim.event import MCParticle
+from org.lcsim.util import Driver
+
+class Analysis102(Driver):
+ def __init__(self):
+ self.aida = AIDA.defaultInstance()
+
+ def process(self, event):
+ # only necessary when adding Drivers to __this__ class.
+ # in this case process() shouldn't do anything else
+ #Driver.invokeChildren(self, event)
+ # Get the list of MCParticles from the event
+ particles = event.get(MCParticle.class, event.MC_PARTICLES)
+ # Histogram the number of particles per event
+ self.aida.cloud1D("nTracks").fill(particles.size())
+ # Loop over the particles
+ for iParticle in range(particles.size()):
+ particle = particles.get(iParticle)
+ self.aida.cloud1D("mass").fill(particle.getMass())
+ self.aida.cloud1D("pSquared").fill(particle.getMomentum().magnitudeSquared())
+
lcsim/resources/org/lcsim/plugin/web/examples
diff -N BooleanCondition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ BooleanCondition.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,41 @@
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+
+/**
+ * An example showing how to set and retrieve a boolean value from the EventHeader.
+ *
+ * @author Jeremy McCormick
+ * @version $Id: BooleanCondition.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class BooleanCondition extends Driver
+{
+ public BooleanCondition()
+ {
+ add(new SetBoolean());
+ add(new GetBoolean());
+ }
+
+ public class SetBoolean extends Driver
+ {
+ protected void process(EventHeader event)
+ {
+ // Put a random boolean value into the EventHeader.
+ event.put("MyBool", getRandom().nextBoolean());
+ }
+ }
+
+ public class GetBoolean extends Driver
+ {
+ protected void process(EventHeader event)
+ {
+ // Get the boolean from EventHeader added by SetBoolean.
+ Boolean bool = (Boolean)event.get("MyBool");
+
+ // Condition based on the boolean value.
+ if (bool)
+ System.out.println("MyBool is TRUE");
+ else
+ System.out.println("MyBool is FALSE");
+ }
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N Cheater.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Cheater.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,16 @@
+import org.lcsim.recon.cheater.ReconCheater;
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+
+public class Cheater extends Driver
+{
+ public Cheater()
+ {
+ add(new ReconCheater());
+ }
+
+ protected void process(EventHeader event)
+ {
+ super.process(event);
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N ClusterFinding.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ClusterFinding.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,88 @@
+import java.util.List;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.EventHeader;
+import org.lcsim.recon.cluster.nn.NearestNeighborClusterDriver;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * An example that shows how to find clusters and make some simple plots
+ * of the results.
+ *
+ * @author Norman Graf
+ * @version $Id: ClusterFinding.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ *
+ */
+public class ClusterFinding extends Driver
+{
+//
+// Use the "convenient" method of generating AIDA plots
+//
+ private AIDA aida = AIDA.defaultInstance();
+
+ public ClusterFinding()
+ {
+//
+// Add a cluster Driver with required parameters
+//
+ int minCells = 5;
+ add(new NearestNeighborClusterDriver(minCells));
+ }
+//
+// Process an event
+//
+ protected void process(EventHeader event)
+ {
+//
+// Make clusters
+//
+ super.process(event);
+//
+// Find all the cluster Lists
+//
+ List<List<Cluster>> clusterSets = event.get(Cluster.class);
+ aida.cloud1D("clusterSets").fill(clusterSets.size());
+//
+// Loop over all the cluster Lists
+//
+ for (List<Cluster> clusters : clusterSets)
+ {
+//
+// Get the ClusterList name
+//
+ String name = event.getMetaData(clusters).getName() + "/";
+//
+// Histogram the number of clusters in the List
+//
+ aida.cloud1D(name+"clusters").fill(clusters.size());
+//
+// Loop over all the clusters in a List
+//
+ for (Cluster cluster : clusters)
+ {
+//
+// Histogram the "corrected" energy
+//
+ aida.cloud1D(name+"energy").fill(cluster.getEnergy());
+//
+// Histogram the position as R vs Z
+//
+ double[] pos = cluster.getPosition();
+ double R = Math.sqrt(pos[0]*pos[0] + pos[1]*pos[1]);
+ aida.cloud2D(name+"Position:R vs Z").fill(pos[2],R);
+//
+// Histogram the computed direction
+//
+ aida.cloud1D(name+"Direction: theta").fill(cluster.getITheta());
+ aida.cloud1D(name+"Direction: phi").fill(cluster.getIPhi());
+//
+// Histogram the difference in direction and position theta,phi
+//
+ double posphi = Math.atan2(pos[1],pos[0]);
+ aida.cloud1D(name+"delta phi").fill(posphi - cluster.getIPhi());
+ double postheta = Math.PI/2. - Math.atan2(pos[2],R);
+ aida.cloud1D(name+"delta theta").fill(postheta - cluster.getITheta());
+ }
+ }
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N DigiSimExample.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DigiSimExample.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,52 @@
+import org.lcsim.recon.cluster.util.CalHitMapDriver;
+import org.lcsim.digisim.DigiSimDriver;
+import org.lcsim.digisim.CalorimeterHitsDriver;
+import org.lcsim.digisim.SimCalorimeterHitsDriver;
+import org.lcsim.util.Driver;
+
+/**
+ * An example showing how to use the DigiSim package.
+ *
+ * @see org.lcsim.digisim
+ *
+ * @author Guilherme Lima
+ * @version $Id: DigiSimExample.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class DigiSimExample extends Driver
+{
+ public DigiSimExample()
+ {
+ // CalHitMapDriver is needed by DigiSim
+ add(new CalHitMapDriver());
+
+ // DigiSim: SimCalHits -> RawCalHits
+ _digi = new DigiSimDriver();
+
+ // Turn on diagnostic histograms
+// _digi.setHistogramLevel(1);
+
+ // Choose a steering file
+// _digi.setSteeringFile("minimal.steer");
+
+ // Set some modifiers to debug mode.
+ // Format is "A:B", where A is digitizer name and B is modifier name
+// _digi.setDebug("EcalBarrDigitizer:EMBDigiIdentity", 1);
+// _digi.setDebug("EcalEndcapDigitizer:EMECDigiIdentity", 1);
+// _digi.setDebug("HcalBarrDigitizer:HBDigiIdentity", 1);
+// _digi.setDebug("HcalEndcapDigitizer:HECDigiIdentity", 1);
+
+ add(_digi);
+
+ // RawCalHits -> CalorimeterHits
+// add( new CalorimeterHitsDriver() );
+
+ // RawCalHits -> SimCalorimeterHits
+ add( new SimCalorimeterHitsDriver() );
+ }
+
+ public void setSteeringFile(String file) {
+ _digi.setSteeringFile(file);
+ }
+
+ DigiSimDriver _digi;
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N EventGenerator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ EventGenerator.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,19 @@
+import org.lcsim.event.util.LCSimEventGenerator;
+
+/*
+ * A basic example of event generation using the diagnostic particle generator.
+ *
+ * @author Norman Graf
+ * @version $Id: EventGenerator.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class EventGenerator extends LCSimEventGenerator
+{
+ public EventGenerator()
+ {
+ super("sdjan03");
+
+ setMomentumRange(10,20);
+ setNumberOfParticles(10);
+ setParticleType(getParticlePropertyProvider().get(22));
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N FastMC.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ FastMC.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,23 @@
+import org.lcsim.mc.fast.MCFast;
+import org.lcsim.util.Driver;
+
+/**
+ * An example that shows how to use the Fast Monte Carlo.
+ *
+ * @see org.lcsim.mc.fast
+ *
+ * @author Norman Graf
+ * @version $Id: FastMC.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class FastMC extends Driver
+{
+ public FastMC()
+ {
+ // Create MCFast with standard options
+ Driver fast = new MCFast();
+ // Turn on diagnostic histograms
+ fast.setHistogramLevel(HLEVEL_NORMAL);
+ // Add as sub-driver
+ add(fast);
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N HeprepPoints.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HeprepPoints.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,31 @@
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import java.util.ArrayList;
+import java.util.List;
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+
+/**
+ * An example that shows how to add points to the WIRED display.
+ *
+ * @author tonyj
+ * @version $Id: HeprepPoints.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class HeprepPoints extends Driver
+{
+ public void process(EventHeader e)
+ {
+ List<Hep3Vector> list = new ArrayList<Hep3Vector>();
+ // Make some (example) points and add to event
+ for (double p = 0; p < Math.PI*2; p += Math.PI/50)
+ {
+ double r = 1000;
+ double x = r*Math.sin(p);
+ double y = r*Math.cos(p);
+ double z = 0;
+ Hep3Vector v = new BasicHep3Vector(x,y,z);
+ list.add(v);
+ }
+ e.put("MyPoints",list);
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N JetFinding.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ JetFinding.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,36 @@
+import java.util.List;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.util.JetDriver;
+import org.lcsim.mc.fast.MCFast;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+/**
+ * An example showing how to use the Jet Finder.
+ *
+ * @author Tony Johnson
+ * @version $Id: JetFinding.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ *
+ */
+public class JetFinding extends Driver
+{
+ private AIDA aida = AIDA.defaultInstance();
+ public JetFinding()
+ {
+ add(new MCFast());
+ add(new JetDriver());
+ }
+
+ protected void process(EventHeader event)
+ {
+ 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());
+ }
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N LCIOOutput.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ LCIOOutput.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,24 @@
+import java.io.File;
+import org.lcsim.mc.fast.MCFast;
+import org.lcsim.util.Driver;
+import org.lcsim.util.loop.LCIODriver;
+
+/**
+ * A example of writing LCIO output.
+ *
+ * @see org.lcsim.util.loop.LCIODriver
+ *
+ * @author Tony Johnson
+ * @version $Id: LCIOOutput.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class LCIOOutput extends Driver
+{
+ public LCIOOutput()
+ {
+ // Create MCFast with standard options
+ add(new MCFast());
+ // Write the file in users home directory
+ File output = new File(System.getProperty("user.home"),"fastmc.slcio");
+ add(new LCIODriver(output));
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N NestedDriverExample.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ NestedDriverExample.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,33 @@
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+
+/**
+ * An example showing how to nest drivers inside a parent driver.
+ *
+ * @author Jan Strube
+ * @version $Id: NestedDriverExample.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class NestedDriverExample extends Driver
+{
+ public NestedDriverExample()
+ {
+ add(new A());
+ add(new B());
+ }
+ private class A extends Driver
+ {
+ protected void process(EventHeader event)
+ {
+ super.process(event);
+ System.out.println("Hello from a");
+ }
+ }
+ private class B extends Driver
+ {
+ protected void process(EventHeader event)
+ {
+ super.process(event);
+ System.out.println("Hello from b");
+ }
+ }
+}
\ No newline at end of file
lcsim/resources/org/lcsim/plugin/web/examples
diff -N PrintEventHeader.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PrintEventHeader.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,20 @@
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+
+/**
+ * A simple example that prints the EventHeader to the JAS console.
+ *
+ * @see org.lcsim.event.EventHeader
+ *
+ * @author Norman Graf
+ * @version $Id: PrintEventHeader.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class PrintEventHeader extends Driver
+{
+ // This method will be called for each event
+ protected void process(EventHeader event)
+ {
+ // Just print the event header to the JAS console
+ System.out.println(event);
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N SkipEvent.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SkipEvent.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,23 @@
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+
+/**
+ * A example Driver that only processes evenly numbered events.
+ *
+ * @author jeremym
+ * @version $Id: SkipEvent.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class SkipEvent extends Driver
+{
+ protected void process(EventHeader event)
+ {
+ if (event.getEventNumber() % 2 != 0)
+ {
+ throw new Driver.NextEventException();
+ }
+ else {
+ super.process(event);
+ }
+ }
+
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N TrivialPFA.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ TrivialPFA.java 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,104 @@
+import org.lcsim.util.hitmap.*;
+import org.lcsim.util.*;
+import org.lcsim.event.*;
+import org.lcsim.event.util.*;
+import java.util.*;
+
+import org.lcsim.recon.cluster.util.CalHitMapDriver;
+import org.lcsim.digisim.DigiSimDriver;
+import org.lcsim.digisim.CalorimeterHitsDriver;
+import org.lcsim.util.hitmap.HitListToHitMapDriver;
+import org.lcsim.util.hitmap.HitMapToHitListDriver;
+import org.lcsim.event.util.CreateFinalStateMCParticleList;
+import org.lcsim.recon.cluster.cheat.PerfectClusterer;
+import org.lcsim.recon.pfa.cheat.PerfectIdentifier;
+import org.lcsim.recon.pfa.output.EnergySumPlotter;
+import org.lcsim.recon.pfa.output.CorrectedEnergySumPlotter;
+
+/**
+ * A very simple cheating PFA, to serve as a worked example.
+ *
+ * @version $Id: TrivialPFA.java,v 1.1 2008/10/30 23:38:19 jeremy Exp $
+ */
+public class TrivialPFA extends Driver
+{
+ /**
+ * Constructor. This sets up all of the daughter drivers.
+ */
+ public TrivialPFA()
+ {
+ // Set up and run DigiSim, based on org.lcsim.plugin.web.examples.DigiSimExample:
+ // CalHitMapDriver is needed by DigiSim
+ add(new org.lcsim.recon.cluster.util.CalHitMapDriver());
+ // DigiSim: SimCalHits -> RawCalHits
+ org.lcsim.digisim.DigiSimDriver digi = new org.lcsim.digisim.DigiSimDriver();
+ add(digi);
+ // RawCalHits -> SimCalorimeterHits
+ add( new org.lcsim.digisim.SimCalorimeterHitsDriver() );
+
+ // Set up a hitmap for the raw hits
+ HitListToHitMapDriver rawHitMap = new HitListToHitMapDriver();
+ rawHitMap.addInputList("EcalBarrHits");
+ rawHitMap.addInputList("EcalEndcapHits");
+ rawHitMap.addInputList("HcalBarrHits");
+ rawHitMap.addInputList("HcalEndcapHits");
+ rawHitMap.setOutput("raw hitmap");
+ add(rawHitMap);
+
+ // Set up a hitmap for the digisim output hits
+ HitListToHitMapDriver digiHitMap = new HitListToHitMapDriver();
+ digiHitMap.addInputList("EcalBarrDigiHits");
+ digiHitMap.addInputList("EcalEndcapDigiHits");
+ digiHitMap.addInputList("HcalBarrDigiHits");
+ digiHitMap.addInputList("HcalEndcapDigiHits");
+ digiHitMap.setOutput("digi hitmap");
+ add(digiHitMap);
+
+ // Do hit map -> hit list conversion
+ HitMapToHitListDriver rawConverterDriver = new HitMapToHitListDriver();
+ rawConverterDriver.setInputHitMap("raw hitmap");
+ rawConverterDriver.setOutputList("raw hits (displayable)");
+ add(rawConverterDriver);
+ HitMapToHitListDriver digiConverterDriver = new HitMapToHitListDriver();
+ digiConverterDriver.setInputHitMap("digi hitmap");
+ digiConverterDriver.setOutputList("digi hits (displayable)");
+ add(digiConverterDriver);
+
+ // Set up the MC list
+ CreateFinalStateMCParticleList mcListMakerGen = new CreateFinalStateMCParticleList("Gen");
+ CreateFinalStateMCParticleList mcListMakerSim = new CreateFinalStateMCParticleList("Sim");
+ add(mcListMakerGen);
+ add(mcListMakerSim);
+ String mcListGen = "GenFinalStateParticles";
+ String mcListSim = "SimFinalStateParticles";
+ String mcList = mcListGen; // Can choose the Gen or Sim list here
+
+ // Cluster the hits (perfect pattern recognition)
+ PerfectClusterer clusterer = new PerfectClusterer();
+ clusterer.setInputHitMap("digi hitmap");
+ clusterer.setOutputHitMap("leftover hits");
+ clusterer.setOutputClusterList("perfect clusters");
+ clusterer.setMCParticleList(mcList);
+ add(clusterer);
+
+ // Find tracks
+ // Output: List<Track> saved as EventHeader.TRACKS
+ add (new org.lcsim.mc.fast.tracking.MCFastTracking());
+
+ // ID the clusters and create reconstructed particles
+ PerfectIdentifier id = new PerfectIdentifier();
+ id.setInputClusterList("perfect clusters");
+ id.setOutputParticleList("perfect particles");
+ id.setMCParticleList(mcList);
+ id.setInputTrackList(EventHeader.TRACKS);
+ add(id);
+
+ // Plot the total energy (using only particles with
+ // clusters in the calorimeter)
+ add(new EnergySumPlotter("perfect particles", "perfect.aida"));
+
+ // Plot the total energy (correcting for particles which didn't
+ // leave any hits in the calorimeter)
+ add(new CorrectedEnergySumPlotter("digi hitmap", "perfect particles", mcList, "corrected.aida"));
+ }
+}
lcsim/resources/org/lcsim/plugin/web/examples
diff -N mainLoop.py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ mainLoop.py 30 Oct 2008 23:38:19 -0000 1.1
@@ -0,0 +1,28 @@
+#! /usr/bin/env jython
+
+###
+# mainLoop.py
+# Wrapper to enable running outside of JAS3
+# 03-AUG-2005 Jan Strube
+###
+from java.io import File
+from org.lcsim.util.aida import AIDA
+from org.lcsim.util.loop import LCSimLoop
+## importing the Java analysis module
+import Analysis101
+## if Analysis102 cannot be found, please uncomment and modify
+## the following two lines to tell Jython where to find it
+# import sys
+# sys.path.append('full path to Python module')
+# importing the Analysis102 class in the Jython module Analysis102
+from Analysis102 import Analysis102
+
+loop = LCSimLoop()
+input = File("psiMuMu.slcio")
+loop.setLCIORecordSource(input)
+loop.add(Analysis101())
+loop.add(Analysis102())
+# loop over all events with -1 or over any other positive number
+loop.loop(-1)
+loop.dispose()
+
lcsim/src/org/lcsim/plugin/web/examples
diff -N Analysis101.java
--- Analysis101.java 14 Feb 2006 19:45:11 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,34 +0,0 @@
-import org.lcsim.util.aida.AIDA;
-import hep.physics.vec.VecOp;
-import java.util.List;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.util.Driver;
-
-/*
- * An example showing how to access MCParticles from the EventHeader and
- * make some simple histograms from the data.
- *
- * @author Norman Graf
- * @version $Id: Analysis101.java,v 1.3 2006/02/14 19:45:11 jeremy Exp $
- *
- */
-public class Analysis101 extends Driver
-{
- private AIDA aida = AIDA.defaultInstance();
-
- protected void process(EventHeader event)
- {
- // Get the list of MCParticles from the event
- List<MCParticle> particles = event.get(MCParticle.class,event.MC_PARTICLES);
- // Histogram the number of particles per event
- aida.cloud1D("nTracks").fill(particles.size());
- // Loop over the particles
- for (MCParticle particle : particles)
- {
- aida.cloud1D("energy").fill(particle.getEnergy());
- aida.cloud1D("cosTheta").fill(VecOp.cosTheta(particle.getMomentum()));
- aida.cloud1D("phi").fill(VecOp.phi(particle.getMomentum()));
- }
- }
-}
\ No newline at end of file
lcsim/src/org/lcsim/plugin/web/examples
diff -N Analysis102.py
--- Analysis102.py 3 Aug 2005 18:53:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-from org.lcsim.util.aida import AIDA
-from hep.physics.vec import VecOp
-from org.lcsim.event import MCParticle
-from org.lcsim.util import Driver
-
-class Analysis102(Driver):
- def __init__(self):
- self.aida = AIDA.defaultInstance()
-
- def process(self, event):
- # only necessary when adding Drivers to __this__ class.
- # in this case process() shouldn't do anything else
- #Driver.invokeChildren(self, event)
- # Get the list of MCParticles from the event
- particles = event.get(MCParticle.class, event.MC_PARTICLES)
- # Histogram the number of particles per event
- self.aida.cloud1D("nTracks").fill(particles.size())
- # Loop over the particles
- for iParticle in range(particles.size()):
- particle = particles.get(iParticle)
- self.aida.cloud1D("mass").fill(particle.getMass())
- self.aida.cloud1D("pSquared").fill(particle.getMomentum().magnitudeSquared())
-
lcsim/src/org/lcsim/plugin/web/examples
diff -N BooleanCondition.java
--- BooleanCondition.java 14 Feb 2006 19:45:11 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,41 +0,0 @@
-import org.lcsim.event.EventHeader;
-import org.lcsim.util.Driver;
-
-/**
- * An example showing how to set and retrieve a boolean value from the EventHeader.
- *
- * @author Jeremy McCormick
- * @version $Id: BooleanCondition.java,v 1.3 2006/02/14 19:45:11 jeremy Exp $
- */
-public class BooleanCondition extends Driver
-{
- public BooleanCondition()
- {
- add(new SetBoolean());
- add(new GetBoolean());
- }
-
- public class SetBoolean extends Driver
- {
- protected void process(EventHeader event)
- {
- // Put a random boolean value into the EventHeader.
- event.put("MyBool", getRandom().nextBoolean());
- }
- }
-
- public class GetBoolean extends Driver
- {
- protected void process(EventHeader event)
- {
- // Get the boolean from EventHeader added by SetBoolean.
- Boolean bool = (Boolean)event.get("MyBool");
-
- // Condition based on the boolean value.
- if (bool)
- System.out.println("MyBool is TRUE");
- else
- System.out.println("MyBool is FALSE");
- }
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N Cheater.java
--- Cheater.java 14 Feb 2006 19:42:28 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-import org.lcsim.recon.cheater.ReconCheater;
-import org.lcsim.event.EventHeader;
-import org.lcsim.util.Driver;
-
-public class Cheater extends Driver
-{
- public Cheater()
- {
- add(new ReconCheater());
- }
-
- protected void process(EventHeader event)
- {
- super.process(event);
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N ClusterFinding.java
--- ClusterFinding.java 14 Feb 2006 19:45:11 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,88 +0,0 @@
-import java.util.List;
-import org.lcsim.event.Cluster;
-import org.lcsim.event.EventHeader;
-import org.lcsim.recon.cluster.nn.NearestNeighborClusterDriver;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-
-/**
- * An example that shows how to find clusters and make some simple plots
- * of the results.
- *
- * @author Norman Graf
- * @version $Id: ClusterFinding.java,v 1.5 2006/02/14 19:45:11 jeremy Exp $
- *
- */
-public class ClusterFinding extends Driver
-{
-//
-// Use the "convenient" method of generating AIDA plots
-//
- private AIDA aida = AIDA.defaultInstance();
-
- public ClusterFinding()
- {
-//
-// Add a cluster Driver with required parameters
-//
- int minCells = 5;
- add(new NearestNeighborClusterDriver(minCells));
- }
-//
-// Process an event
-//
- protected void process(EventHeader event)
- {
-//
-// Make clusters
-//
- super.process(event);
-//
-// Find all the cluster Lists
-//
- List<List<Cluster>> clusterSets = event.get(Cluster.class);
- aida.cloud1D("clusterSets").fill(clusterSets.size());
-//
-// Loop over all the cluster Lists
-//
- for (List<Cluster> clusters : clusterSets)
- {
-//
-// Get the ClusterList name
-//
- String name = event.getMetaData(clusters).getName() + "/";
-//
-// Histogram the number of clusters in the List
-//
- aida.cloud1D(name+"clusters").fill(clusters.size());
-//
-// Loop over all the clusters in a List
-//
- for (Cluster cluster : clusters)
- {
-//
-// Histogram the "corrected" energy
-//
- aida.cloud1D(name+"energy").fill(cluster.getEnergy());
-//
-// Histogram the position as R vs Z
-//
- double[] pos = cluster.getPosition();
- double R = Math.sqrt(pos[0]*pos[0] + pos[1]*pos[1]);
- aida.cloud2D(name+"Position:R vs Z").fill(pos[2],R);
-//
-// Histogram the computed direction
-//
- aida.cloud1D(name+"Direction: theta").fill(cluster.getITheta());
- aida.cloud1D(name+"Direction: phi").fill(cluster.getIPhi());
-//
-// Histogram the difference in direction and position theta,phi
-//
- double posphi = Math.atan2(pos[1],pos[0]);
- aida.cloud1D(name+"delta phi").fill(posphi - cluster.getIPhi());
- double postheta = Math.PI/2. - Math.atan2(pos[2],R);
- aida.cloud1D(name+"delta theta").fill(postheta - cluster.getITheta());
- }
- }
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N DigiSimExample.java
--- DigiSimExample.java 14 Feb 2006 19:45:11 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,52 +0,0 @@
-import org.lcsim.recon.cluster.util.CalHitMapDriver;
-import org.lcsim.digisim.DigiSimDriver;
-import org.lcsim.digisim.CalorimeterHitsDriver;
-import org.lcsim.digisim.SimCalorimeterHitsDriver;
-import org.lcsim.util.Driver;
-
-/**
- * An example showing how to use the DigiSim package.
- *
- * @see org.lcsim.digisim
- *
- * @author Guilherme Lima
- * @version $Id: DigiSimExample.java,v 1.5 2006/02/14 19:45:11 jeremy Exp $
- */
-public class DigiSimExample extends Driver
-{
- public DigiSimExample()
- {
- // CalHitMapDriver is needed by DigiSim
- add(new CalHitMapDriver());
-
- // DigiSim: SimCalHits -> RawCalHits
- _digi = new DigiSimDriver();
-
- // Turn on diagnostic histograms
-// _digi.setHistogramLevel(1);
-
- // Choose a steering file
-// _digi.setSteeringFile("minimal.steer");
-
- // Set some modifiers to debug mode.
- // Format is "A:B", where A is digitizer name and B is modifier name
-// _digi.setDebug("EcalBarrDigitizer:EMBDigiIdentity", 1);
-// _digi.setDebug("EcalEndcapDigitizer:EMECDigiIdentity", 1);
-// _digi.setDebug("HcalBarrDigitizer:HBDigiIdentity", 1);
-// _digi.setDebug("HcalEndcapDigitizer:HECDigiIdentity", 1);
-
- add(_digi);
-
- // RawCalHits -> CalorimeterHits
-// add( new CalorimeterHitsDriver() );
-
- // RawCalHits -> SimCalorimeterHits
- add( new SimCalorimeterHitsDriver() );
- }
-
- public void setSteeringFile(String file) {
- _digi.setSteeringFile(file);
- }
-
- DigiSimDriver _digi;
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N EventGenerator.java
--- EventGenerator.java 23 May 2008 03:12:10 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-import org.lcsim.event.util.LCSimEventGenerator;
-
-/*
- * A basic example of event generation using the diagnostic particle generator.
- *
- * @author Norman Graf
- * @version $Id: EventGenerator.java,v 1.2 2008/05/23 03:12:10 jeremy Exp $
- */
-public class EventGenerator extends LCSimEventGenerator
-{
- public EventGenerator()
- {
- super("sdjan03");
-
- setMomentumRange(10,20);
- setNumberOfParticles(10);
- setParticleType(getParticlePropertyProvider().get(22));
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N FastMC.java
--- FastMC.java 3 Apr 2007 18:02:34 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-import org.lcsim.mc.fast.MCFast;
-import org.lcsim.util.Driver;
-
-/**
- * An example that shows how to use the Fast Monte Carlo.
- *
- * @see org.lcsim.mc.fast
- *
- * @author Norman Graf
- * @version $Id: FastMC.java,v 1.2 2007/04/03 18:02:34 tonyj Exp $
- */
-public class FastMC extends Driver
-{
- public FastMC()
- {
- // Create MCFast with standard options
- Driver fast = new MCFast();
- // Turn on diagnostic histograms
- fast.setHistogramLevel(HLEVEL_NORMAL);
- // Add as sub-driver
- add(fast);
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N HeprepPoints.java
--- HeprepPoints.java 14 Feb 2006 19:45:11 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import java.util.ArrayList;
-import java.util.List;
-import org.lcsim.event.EventHeader;
-import org.lcsim.util.Driver;
-
-/**
- * An example that shows how to add points to the WIRED display.
- *
- * @author tonyj
- * @version $Id: HeprepPoints.java,v 1.1 2006/02/14 19:45:11 jeremy Exp $
- */
-public class HeprepPoints extends Driver
-{
- public void process(EventHeader e)
- {
- List<Hep3Vector> list = new ArrayList<Hep3Vector>();
- // Make some (example) points and add to event
- for (double p = 0; p < Math.PI*2; p += Math.PI/50)
- {
- double r = 1000;
- double x = r*Math.sin(p);
- double y = r*Math.cos(p);
- double z = 0;
- Hep3Vector v = new BasicHep3Vector(x,y,z);
- list.add(v);
- }
- e.put("MyPoints",list);
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N JetFinding.java
--- JetFinding.java 14 Feb 2006 19:45:11 -0000 1.5
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-import java.util.List;
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.ReconstructedParticle;
-import org.lcsim.event.util.JetDriver;
-import org.lcsim.mc.fast.MCFast;
-import org.lcsim.util.Driver;
-import org.lcsim.util.aida.AIDA;
-/**
- * An example showing how to use the Jet Finder.
- *
- * @author Tony Johnson
- * @version $Id: JetFinding.java,v 1.5 2006/02/14 19:45:11 jeremy Exp $
- *
- */
-public class JetFinding extends Driver
-{
- private AIDA aida = AIDA.defaultInstance();
- public JetFinding()
- {
- add(new MCFast());
- add(new JetDriver());
- }
-
- protected void process(EventHeader event)
- {
- 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());
- }
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N LCIOOutput.java
--- LCIOOutput.java 14 Feb 2006 19:45:11 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,24 +0,0 @@
-import java.io.File;
-import org.lcsim.mc.fast.MCFast;
-import org.lcsim.util.Driver;
-import org.lcsim.util.loop.LCIODriver;
-
-/**
- * A example of writing LCIO output.
- *
- * @see org.lcsim.util.loop.LCIODriver
- *
- * @author Tony Johnson
- * @version $Id: LCIOOutput.java,v 1.1 2006/02/14 19:45:11 jeremy Exp $
- */
-public class LCIOOutput extends Driver
-{
- public LCIOOutput()
- {
- // Create MCFast with standard options
- add(new MCFast());
- // Write the file in users home directory
- File output = new File(System.getProperty("user.home"),"fastmc.slcio");
- add(new LCIODriver(output));
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N NestedDriverExample.java
--- NestedDriverExample.java 14 Feb 2006 19:45:11 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,33 +0,0 @@
-import org.lcsim.event.EventHeader;
-import org.lcsim.util.Driver;
-
-/**
- * An example showing how to nest drivers inside a parent driver.
- *
- * @author Jan Strube
- * @version $Id: NestedDriverExample.java,v 1.2 2006/02/14 19:45:11 jeremy Exp $
- */
-public class NestedDriverExample extends Driver
-{
- public NestedDriverExample()
- {
- add(new A());
- add(new B());
- }
- private class A extends Driver
- {
- protected void process(EventHeader event)
- {
- super.process(event);
- System.out.println("Hello from a");
- }
- }
- private class B extends Driver
- {
- protected void process(EventHeader event)
- {
- super.process(event);
- System.out.println("Hello from b");
- }
- }
-}
\ No newline at end of file
lcsim/src/org/lcsim/plugin/web/examples
diff -N PrintEventHeader.java
--- PrintEventHeader.java 14 Feb 2006 19:45:12 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
-import org.lcsim.event.EventHeader;
-import org.lcsim.util.Driver;
-
-/**
- * A simple example that prints the EventHeader to the JAS console.
- *
- * @see org.lcsim.event.EventHeader
- *
- * @author Norman Graf
- * @version $Id: PrintEventHeader.java,v 1.1 2006/02/14 19:45:12 jeremy Exp $
- */
-public class PrintEventHeader extends Driver
-{
- // This method will be called for each event
- protected void process(EventHeader event)
- {
- // Just print the event header to the JAS console
- System.out.println(event);
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N SkipEvent.java
--- SkipEvent.java 9 Feb 2006 19:37:20 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-import org.lcsim.event.EventHeader;
-import org.lcsim.util.Driver;
-
-/**
- * A example Driver that only processes evenly numbered events.
- *
- * @author jeremym
- * @version $Id: SkipEvent.java,v 1.1 2006/02/09 19:37:20 jeremy Exp $
- */
-public class SkipEvent extends Driver
-{
- protected void process(EventHeader event)
- {
- if (event.getEventNumber() % 2 != 0)
- {
- throw new Driver.NextEventException();
- }
- else {
- super.process(event);
- }
- }
-
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N TrivialPFA.java
--- TrivialPFA.java 3 Oct 2006 21:32:27 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,104 +0,0 @@
-import org.lcsim.util.hitmap.*;
-import org.lcsim.util.*;
-import org.lcsim.event.*;
-import org.lcsim.event.util.*;
-import java.util.*;
-
-import org.lcsim.recon.cluster.util.CalHitMapDriver;
-import org.lcsim.digisim.DigiSimDriver;
-import org.lcsim.digisim.CalorimeterHitsDriver;
-import org.lcsim.util.hitmap.HitListToHitMapDriver;
-import org.lcsim.util.hitmap.HitMapToHitListDriver;
-import org.lcsim.event.util.CreateFinalStateMCParticleList;
-import org.lcsim.recon.cluster.cheat.PerfectClusterer;
-import org.lcsim.recon.pfa.cheat.PerfectIdentifier;
-import org.lcsim.recon.pfa.output.EnergySumPlotter;
-import org.lcsim.recon.pfa.output.CorrectedEnergySumPlotter;
-
-/**
- * A very simple cheating PFA, to serve as a worked example.
- *
- * @version $Id: TrivialPFA.java,v 1.2 2006/10/03 21:32:27 mcharles Exp $
- */
-public class TrivialPFA extends Driver
-{
- /**
- * Constructor. This sets up all of the daughter drivers.
- */
- public TrivialPFA()
- {
- // Set up and run DigiSim, based on org.lcsim.plugin.web.examples.DigiSimExample:
- // CalHitMapDriver is needed by DigiSim
- add(new org.lcsim.recon.cluster.util.CalHitMapDriver());
- // DigiSim: SimCalHits -> RawCalHits
- org.lcsim.digisim.DigiSimDriver digi = new org.lcsim.digisim.DigiSimDriver();
- add(digi);
- // RawCalHits -> SimCalorimeterHits
- add( new org.lcsim.digisim.SimCalorimeterHitsDriver() );
-
- // Set up a hitmap for the raw hits
- HitListToHitMapDriver rawHitMap = new HitListToHitMapDriver();
- rawHitMap.addInputList("EcalBarrHits");
- rawHitMap.addInputList("EcalEndcapHits");
- rawHitMap.addInputList("HcalBarrHits");
- rawHitMap.addInputList("HcalEndcapHits");
- rawHitMap.setOutput("raw hitmap");
- add(rawHitMap);
-
- // Set up a hitmap for the digisim output hits
- HitListToHitMapDriver digiHitMap = new HitListToHitMapDriver();
- digiHitMap.addInputList("EcalBarrDigiHits");
- digiHitMap.addInputList("EcalEndcapDigiHits");
- digiHitMap.addInputList("HcalBarrDigiHits");
- digiHitMap.addInputList("HcalEndcapDigiHits");
- digiHitMap.setOutput("digi hitmap");
- add(digiHitMap);
-
- // Do hit map -> hit list conversion
- HitMapToHitListDriver rawConverterDriver = new HitMapToHitListDriver();
- rawConverterDriver.setInputHitMap("raw hitmap");
- rawConverterDriver.setOutputList("raw hits (displayable)");
- add(rawConverterDriver);
- HitMapToHitListDriver digiConverterDriver = new HitMapToHitListDriver();
- digiConverterDriver.setInputHitMap("digi hitmap");
- digiConverterDriver.setOutputList("digi hits (displayable)");
- add(digiConverterDriver);
-
- // Set up the MC list
- CreateFinalStateMCParticleList mcListMakerGen = new CreateFinalStateMCParticleList("Gen");
- CreateFinalStateMCParticleList mcListMakerSim = new CreateFinalStateMCParticleList("Sim");
- add(mcListMakerGen);
- add(mcListMakerSim);
- String mcListGen = "GenFinalStateParticles";
- String mcListSim = "SimFinalStateParticles";
- String mcList = mcListGen; // Can choose the Gen or Sim list here
-
- // Cluster the hits (perfect pattern recognition)
- PerfectClusterer clusterer = new PerfectClusterer();
- clusterer.setInputHitMap("digi hitmap");
- clusterer.setOutputHitMap("leftover hits");
- clusterer.setOutputClusterList("perfect clusters");
- clusterer.setMCParticleList(mcList);
- add(clusterer);
-
- // Find tracks
- // Output: List<Track> saved as EventHeader.TRACKS
- add (new org.lcsim.mc.fast.tracking.MCFastTracking());
-
- // ID the clusters and create reconstructed particles
- PerfectIdentifier id = new PerfectIdentifier();
- id.setInputClusterList("perfect clusters");
- id.setOutputParticleList("perfect particles");
- id.setMCParticleList(mcList);
- id.setInputTrackList(EventHeader.TRACKS);
- add(id);
-
- // Plot the total energy (using only particles with
- // clusters in the calorimeter)
- add(new EnergySumPlotter("perfect particles", "perfect.aida"));
-
- // Plot the total energy (correcting for particles which didn't
- // leave any hits in the calorimeter)
- add(new CorrectedEnergySumPlotter("digi hitmap", "perfect particles", mcList, "corrected.aida"));
- }
-}
lcsim/src/org/lcsim/plugin/web/examples
diff -N mainLoop.py
--- mainLoop.py 3 Aug 2005 18:53:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,28 +0,0 @@
-#! /usr/bin/env jython
-
-###
-# mainLoop.py
-# Wrapper to enable running outside of JAS3
-# 03-AUG-2005 Jan Strube
-###
-from java.io import File
-from org.lcsim.util.aida import AIDA
-from org.lcsim.util.loop import LCSimLoop
-## importing the Java analysis module
-import Analysis101
-## if Analysis102 cannot be found, please uncomment and modify
-## the following two lines to tell Jython where to find it
-# import sys
-# sys.path.append('full path to Python module')
-# importing the Analysis102 class in the Jython module Analysis102
-from Analysis102 import Analysis102
-
-loop = LCSimLoop()
-input = File("psiMuMu.slcio")
-loop.setLCIORecordSource(input)
-loop.add(Analysis101())
-loop.add(Analysis102())
-# loop over all events with -1 or over any other positive number
-loop.loop(-1)
-loop.dispose()
-
CVSspam 0.2.8