8 modified files
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.3 -r1.4
--- CalorimeterHitPlots.java 29 Jul 2005 02:53:20 -0000 1.3
+++ CalorimeterHitPlots.java 1 Aug 2005 06:33:50 -0000 1.4
@@ -29,33 +29,44 @@
ICloud1D mcpPDG;
ICloud1D mcpSingleContribPDG;
+ List<SimCalorimeterHit> hits;
+
String collName;
/** Creates a new instance of CalorimeterHitPlots */
public CalorimeterHitPlots(LCMetaData meta)
{
- collName = meta.getName();
-
+ super(meta.getName());
definePlots();
}
- private void definePlots()
+ public void setSimCalorimeterHitList(List<SimCalorimeterHit> hits)
+ {
+ this.hits = hits;
+ }
+
+ public void definePlots()
{
- makeAidaDir("/" + collName);
- tree.cd("/" + collName);
-
- mcpCountPerHit = aida.cloud1D(collName + "_mcpPerHit");
- mcpPDG = aida.cloud1D(collName + "_mcpPDGID");
- mcpSingleContribPDG = aida.cloud1D(collName + "_mcpSingleContribPDGID");
-
- tree.cd("..");
+ super.definePlots();
+
+ mcpCountPerHit = aida.cloud1D(getName() + "_mcpPerHit");
+ mcpPDG = aida.cloud1D(getName() + "_mcpPDGID");
+ mcpSingleContribPDG = aida.cloud1D(getName() + "_mcpSingleContribPDGID");
}
- public void fill(List<SimCalorimeterHit> hits)
+ public void fill()
{
+ super.fill();
+ if ( this.hits != null )
+ {
+ fill(this.hits);
+ }
+ }
+
+ private void fill(List<SimCalorimeterHit> hits)
+ {
if ( hits.size() > 0 )
{
- tree.cd("/" + collName);
for ( SimCalorimeterHit hit : hits)
{
int nmcp = hit.getMCParticleCount();
@@ -73,7 +84,6 @@
mcpSingleContribPDG.fill(hit.getMCParticle(0).getPDGID());
}
}
- tree.cd("..");
}
}
}
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.1 -r1.2
--- EventSummaryPlots.java 29 Jul 2005 02:53:20 -0000 1.1
+++ EventSummaryPlots.java 1 Aug 2005 06:33:51 -0000 1.2
@@ -37,26 +37,42 @@
int trackerHitCount = 0;
int calorimeterHitCount = 0;
+ EventHeader event;
+
EventSummaryPlots()
{
+ super("Event");
definePlots();
}
- private final void definePlots()
+ public void setEventHeader(EventHeader event)
{
- makeAidaDir("/Event");
- tree.cd("/Event");
+ this.event = event;
+ }
+
+ public void definePlots()
+ {
+ super.definePlots();
+
eventTotalEnergy = aida.cloud1D("event_energy");
eventHits = aida.cloud1D("event_hits");
eventTrackerHits = aida.cloud1D("event_trackerHits");
eventCalorimeterHits = aida.cloud1D("event_calorimeterHits");
eventTrackerEnergy = aida.cloud1D("event_trackerEnergy");
eventCalorimeterEnergy = aida.cloud1D("event_calorimeterEnergy");
- tree.cd("..");
}
- protected void fill(EventHeader event)
- {
+ public void fill()
+ {
+ super.fill();
+ if ( event != null )
+ {
+ fill(event);
+ }
+ }
+
+ private void fill(EventHeader event)
+ {
trackerTotalEnergy = calorimeterTotalEnergy = 0;
trackerHitCount = calorimeterHitCount = 0;
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.3 -r1.4
--- GenericHit.java 29 Jul 2005 02:53:20 -0000 1.3
+++ GenericHit.java 1 Aug 2005 06:33:51 -0000 1.4
@@ -10,7 +10,7 @@
*
* @author jeremym
*/
-class GenericHit
+public class GenericHit
{
private double energy;
private double[] position;
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.5 -r1.6
--- GenericHitPlots.java 29 Jul 2005 02:53:20 -0000 1.5
+++ GenericHitPlots.java 1 Aug 2005 06:33:51 -0000 1.6
@@ -1,13 +1,9 @@
package org.lcsim.slic.diagnostics;
import java.util.List;
-
-import org.lcsim.util.aida.AIDA;
import hep.aida.IHistogram1D;
import hep.aida.ICloud1D;
import hep.aida.ICloud2D;
-import hep.aida.ITree;
-import org.lcsim.event.EventHeader;
import org.lcsim.event.EventHeader.LCMetaData;
import org.lcsim.geometry.subdetector.SubdetectorIDDecoder;
@@ -16,7 +12,7 @@
* @author jeremym
*/
class GenericHitPlots extends PlotsBase
-{
+{
/* plots */
ICloud1D energy;
ICloud1D energyEvent;
@@ -28,59 +24,62 @@
ICloud1D hitCount;
ICloud1D hitAvgEnergy;
ICloud1D layerEnergy;
- ICloud1D layerHitCount;
-
- String collName;
-
+ ICloud1D layerHitCount;
+
int nlayers = 0;
- double eventTotEnergy = 0;
-
- LCMetaData meta;
+ double eventTotEnergy = 0;
+
+ List<GenericHit> hits;
/** Creates a new instance of SingleHitCollectionPlots */
public GenericHitPlots(LCMetaData meta)
{
- /* set MetaData ref */
- this.meta = meta;
-
- /* set name */
- this.collName = meta.getName();
-
+ super(meta.getName());
+
/* set n layers */
- nlayers = ((SubdetectorIDDecoder)meta.getIDDecoder()).getSubdetector().getLayering().getLayerCount();
-
+ nlayers = ((SubdetectorIDDecoder)meta.getIDDecoder()).getSubdetector().getLayering().getLayerCount();
+
/* define plots for this coll */
- definePlots();
- }
+ this.definePlots();
+ }
/* plots for generic hits */
- private void definePlots()
+ public void definePlots()
{
- makeAidaDir("/" + collName);
- tree.cd("/" + collName);
+ super.definePlots();
- energy = aida.cloud1D(collName + "_hitEnergy");
- hitAvgEnergy = aida.cloud1D(collName + "_hitAvgEnergy");
- time = aida.cloud1D(collName + "_hitTime");
- thetaPhi = aida.cloud2D(collName + "_hitThetaPhi");
- xy = aida.cloud2D(collName + "_hitXY");
- rz = aida.cloud2D(collName + "_hitRZ");
- layer = aida.histogram1D(collName + "_hitLayer", nlayers, 0, nlayers);
- energyEvent = aida.cloud1D(collName + "_eventEnergy");
- hitCount = aida.cloud1D(collName + "_eventNumHits");
-
- tree.cd("..");
- }
+ energy = aida.cloud1D(getName() + "_hitEnergy");
+ hitAvgEnergy = aida.cloud1D(getName() + "_hitAvgEnergy");
+ time = aida.cloud1D(getName() + "_hitTime");
+ thetaPhi = aida.cloud2D(getName() + "_hitThetaPhi");
+ xy = aida.cloud2D(getName() + "_hitXY");
+ rz = aida.cloud2D(getName() + "_hitRZ");
+ layer = aida.histogram1D(getName() + "_hitLayer", nlayers, 0, nlayers);
+ energyEvent = aida.cloud1D(getName() + "_eventEnergy");
+ hitCount = aida.cloud1D(getName() + "_eventNumHits");
+ }
- public void fill(List<GenericHit> hits)
+ public void setGenericHitList(List<GenericHit> hits)
+ {
+ this.hits = hits;
+ }
+
+ public void fill()
+ {
+ super.fill();
+ if ( this.hits != null )
+ {
+ fill(this.hits);
+ }
+ }
+
+ private void fill(List<GenericHit> hits)
{
eventTotEnergy = 0;
int nhits = 0;
if ( hits.size() != 0 )
{
- tree.cd("/" + collName);
-
for ( GenericHit hit : hits )
{
double[] position = hit.getPosition();
@@ -102,7 +101,7 @@
/* hit layer */
layer.fill(hit.getLayer());
-
+
/* incr tot E */
eventTotEnergy += hit.getEnergy();
@@ -119,14 +118,6 @@
/* avg energy per hit */
double hitAvgE = eventTotEnergy / nhits;
hitAvgEnergy.fill(hitAvgE);
-
- tree.cd("..");
}
}
-
- /* return total energy from last event processed */
- public double getEventEnergy()
- {
- return eventTotEnergy;
- }
}
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.2 -r1.3
--- HitUtil.java 28 Jul 2005 19:20:14 -0000 1.2
+++ HitUtil.java 1 Aug 2005 06:33:51 -0000 1.3
@@ -17,7 +17,6 @@
*/
abstract public class HitUtil
{
-
public static double getSphericalRadius(double[] position)
{
return sqrt(position[0] * position[0] + position[1] * position[1] + position[2] * position[2]);
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.2 -r1.3
--- MCParticlePlots.java 29 Jul 2005 02:53:20 -0000 1.2
+++ MCParticlePlots.java 1 Aug 2005 06:33:51 -0000 1.3
@@ -23,10 +23,7 @@
* @author jeremym
*/
public class MCParticlePlots extends PlotsBase
-{
- AIDA aida = org.lcsim.util.aida.AIDA.defaultInstance();
- ITree tree = aida.tree();
-
+{
ParticlePropertyProvider mcpLkp = ParticlePropertyManager.getParticlePropertyProvider();
ICloud1D mcpCount;
@@ -37,27 +34,41 @@
int nmcp = 0;
double totE = 0;
- /** Creates a new instance of MCParticlePlots */
+ List<MCParticle> mcps;
+
public MCParticlePlots()
{
- definePlots();
+ super("MCParticles");
+ this.definePlots();
+ }
+
+ public void setMCParticleList(List<MCParticle> mcps)
+ {
+ this.mcps = mcps;
}
- private void definePlots()
+ public void definePlots()
{
- makeAidaDir("/MCParticles");
- tree.cd("/MCParticles");
+ super.definePlots();
mcpCount = aida.cloud1D("mcp_numPerEvent");
mcpTotalEnergyFinalState = aida.cloud1D("mcp_finalStateETotPerEvent");
tree.cd("..");
}
+ public void fill()
+ {
+ super.fill();
+ if ( mcps != null )
+ {
+ fill(mcps);
+ }
+ }
+
void fill(List<MCParticle> particles)
{
if ( particles.size() > 0 )
- {
+ {
particleCounts.clear();
- tree.cd("/MCParticles");
totE = 0;
for ( MCParticle particle : particles)
{
@@ -118,8 +129,6 @@
/* energy total per event */
mcpTotalEnergyFinalState.fill(totE);
-
- tree.cd("..");
}
}
}
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.2 -r1.3
--- Main.java 29 Jul 2005 03:25:42 -0000 1.2
+++ Main.java 1 Aug 2005 06:33:51 -0000 1.3
@@ -6,7 +6,11 @@
package org.lcsim.slic.diagnostics;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import org.lcsim.util.loop.LCIOEventSource;
@@ -15,68 +19,20 @@
/**
*
* @author jeremym
+ *
+ * Main takes a single argument, which should be a file containing
+ * a list of files to run on, one per line.
+ *
*/
public class Main
-{
+{
+ SlicDiagnosticsDriver slicDiag = new SlicDiagnosticsDriver();
+ List<String> fileNames = new ArrayList<String>();
+
public static void main(String[] args)
{
- new Main(args);
- }
-
- /**
- * Creates single output AIDA file from list of files on the local filesystem.
- * Output file is named after the first file in the list.
- */
- public Main(String[] args)
- {
- if (args.length == 0)
- {
- throw new IllegalArgumentException("Argument list is empty.");
- }
-
- try
- {
- List<File> files = new ArrayList<File>();
- for ( String arg : args )
- {
- File file = new File(arg);
- files.add(file);
- }
-
- LCIOEventSource src = new LCIOEventSource("SlicDiagnostics", files);
-
- SlicDiagnosticsDriver slicDiag = new SlicDiagnosticsDriver();
- slicDiag.setFileName(files.get(0).toString());
-
- /* Add all plot drivers. */
- GenericHitPlotsDriver genericPlots = new GenericHitPlotsDriver();
- MCParticlePlotsDriver mcpPlots = new MCParticlePlotsDriver();
- CalorimeterHitPlotsDriver calPlots = new CalorimeterHitPlotsDriver();
- EventSummaryPlotsDriver evtPlots = new EventSummaryPlotsDriver();
-
- slicDiag.add(evtPlots);
- slicDiag.add(genericPlots);
- slicDiag.add(mcpPlots);
- slicDiag.add(calPlots);
-
- LCSimLoop loop = new LCSimLoop();
- loop.setLCIORecordSource(src);
- loop.add(slicDiag);
-
- try {
- loop.loop(-1);
- }
- catch (Exception e)
- {
-// System.err.println(e.getMessage());
- System.out.println("DONE");
- }
-
- loop.dispose();
- }
- catch (Exception e)
- {
- throw new RuntimeException("Problem running SlicDiagnostics' Main.", e);
- }
- }
-}
+ Runner runner = new Runner();
+ runner.addFiles(args[0]);
+ runner.run();
+ }
+}
\ No newline at end of file
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.1 -r1.2
--- PlotsBase.java 29 Jul 2005 02:53:20 -0000 1.1
+++ PlotsBase.java 1 Aug 2005 06:33:51 -0000 1.2
@@ -13,20 +13,78 @@
*
* @author jeremym
*/
-abstract public class PlotsBase
+public class PlotsBase
{
- AIDA aida = org.lcsim.util.aida.AIDA.defaultInstance();
- ITree tree = aida.tree();
+ protected static AIDA aida = org.lcsim.util.aida.AIDA.defaultInstance();
+ protected static ITree tree = aida.tree();
- protected void makeAidaDir(String dir)
+ String name;
+ String dir;
+
+ public PlotsBase(String name)
+ {
+ this.name = name;
+ setupAidaDir();
+ }
+
+ public void fill()
+ {
+ this.cd();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getDir()
+ {
+ return dir;
+ }
+
+ public void cd()
+ {
+ tree.cd(this.getDir());
+ }
+
+ public void definePlots()
+ {
+ cd();
+ }
+
+ protected void setupAidaDir()
+ {
+ setupAidaDir(name);
+ }
+
+ /* Create new folder from root. */
+ private final void setupAidaDir(String dir)
{
+ tree.cd("/");
+
+ /* Create if not exists. */
+ try
+ {
+ tree.mkdirs(dir);
+ }
+ catch (Exception e)
+ {
+ System.err.println(e.getMessage());
+ }
+
+ /* Now it should exist... */
try
{
- tree.mkdir(dir);
+ tree.cd(dir);
}
+ /* Otherwise, something bad happened. */
catch (Exception e)
{
- /* probably it just already exists */
+ throw new RuntimeException("Could not setup AIDA dir: " + dir);
}
+
+ this.dir = "/" + dir;
+
+ tree.cd("/");
}
-}
+}
\ No newline at end of file
CVSspam 0.2.8