2 added + 1 removed + 1 modified, total 4 files
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.32 -r1.33
--- SlicDiagnosticsDriver.java 4 Jun 2009 18:16:41 -0000 1.32
+++ SlicDiagnosticsDriver.java 7 Oct 2009 03:17:27 -0000 1.33
@@ -15,7 +15,7 @@
import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterDirectoryMaker;
import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterEventPlots;
import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterHitPlotsDriver;
-import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterPlotsNoDetectorDriver;
+//import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterPlotsNoDetectorDriver;
import org.lcsim.slic.diagnostics.cluster.ClusterDirectoryMaker;
import org.lcsim.slic.diagnostics.cluster.ClusterPlotsDriver;
import org.lcsim.slic.diagnostics.generichit.CollectionStatisticsMaker;
@@ -244,10 +244,10 @@
add(new Cloud2HistogramConverter());
}
- if (_options.getBooleanOption("calorimeter.nodet"))
- {
- add(new CalorimeterPlotsNoDetectorDriver(this));
- }
+ //if (_options.getBooleanOption("calorimeter.nodet"))
+ //{
+ // add(new CalorimeterPlotsNoDetectorDriver(this));
+ //}
}
public void add(Driver subdriver)
SlicDiagnostics/src/org/lcsim/slic/diagnostics/calorimeterhit
diff -N SimCalHitNoDetectorPlots.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SimCalHitNoDetectorPlots.java 7 Oct 2009 03:17:27 -0000 1.1
@@ -0,0 +1,189 @@
+package org.lcsim.slic.diagnostics.calorimeterhit;
+
+import static org.lcsim.slic.diagnostics.util.AidaHelper.c1d;
+import static org.lcsim.slic.diagnostics.util.AidaHelper.c2d;
+import static org.lcsim.slic.diagnostics.util.VecUtil.getCylindricalRadius;
+import static org.lcsim.slic.diagnostics.util.VecUtil.getSphericalRadius;
+import hep.aida.ICloud1D;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.slic.diagnostics.util.AbstractCollectionPlots;
+import org.lcsim.slic.diagnostics.util.AidaHelper;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * Plot SimCalorimeterHit data without relying on a Detector being present.
+ *
+ * @author jeremym
+ */
+public class SimCalHitNoDetectorPlots extends AbstractCollectionPlots
+{
+ public void definePlots()
+ {
+ c1d("X Position", "X [mm]", "Number of Entries");
+ c1d("Y Position", "Y [mm]", "Number of Entries");
+ c1d("Z Position", "Z [mm]", "Number of Entries");
+ c2d("X vs Y", "X [mm]", "Y [mm]");
+ c2d("Z vs X", "Z [mm]", "X [mm]");
+ c2d("Z vs Y", "Z [mm]", "Y [mm]");
+ c1d("Spherical Radius", "R [mm]", "Number of Entries");
+ c1d("Cylindrical Radius", "R [mm]", "Number of Entries");
+ ICloud1D time = c1d("Time","Time [ns]","Number of Entries");
+ time.annotation().addItem("xAxisScale", "log");
+ ICloud1D avgTime = c1d("Average Hit Time by Event","Time [ns]","Number of Entries");
+ avgTime.annotation().addItem("xAxisScale", "log");
+ c1d("Raw Energy", "Energy [GeV]", "Number of Entries");
+ c1d("Cos Theta", "cos(theta)", "Number of Entries");
+ c1d("Phi", "phi [radians]", "Number of Entries");
+ c1d("Number of Hits by Event", "Hit Count", "Number of Entries");
+ c1d("Total Raw Energy by Event", "Energy [GeV]", "Number of Entries");
+ c1d("Average Hit Energy by Event", "Energy [GeV]", "Number of Entries");
+ c1d("Minimum Hit Raw Energy by Event", "Energy [GeV]", "Number of Entries");
+ c1d("Maximum Hit Raw Energy by Event", "Energy [GeV]", "Number of Entries");
+ c1d("Minimum Cylindrical Radius by Event", "Radius [mm]", "Number of Entries");
+ c1d("Maximum Cylindrical Radius by Event", "Radius [mm]", "Number of Entries");
+ c1d("Minimum Spherical Radius by Event", "Radius [mm]", "Number of Entries");
+ c1d("Maximum Spherical Radius by Event", "Radius [mm]", "Number of Entries");
+ c1d("Number of MC Contribs per Hit", "Count", "Number of Entries");
+ c1d("Averge Number of MC Contribs per Hit by Event", "Count", "Number of Entries");
+ c1d("Number of Unique MCP Contributions by Event", "Count", "Number of Entries");
+ }
+
+ public void plotCollection(EventHeader event, String collectionName)
+ {
+ List<SimCalorimeterHit> collection = event.get(getType(), collectionName);
+
+ if (collection.size() == 0)
+ return;
+
+ AidaHelper.cd(getDirectory(collectionName));
+
+ int hits = 0;
+ int contribs = 0;
+ double timeSum = 0.;
+ double esum = 0.;
+ double mine = Double.MAX_VALUE;
+ double maxe = 0.;
+ double minsr = Double.MAX_VALUE;
+ double maxsr = 0.;
+ double mincr = Double.MAX_VALUE;
+ double maxcr = 0.;
+ double mint = Double.MAX_VALUE;
+ double maxt = 0.;
+ Set<MCParticle> uniqMcps = new HashSet<MCParticle>();
+
+ for (SimCalorimeterHit hit : collection)
+ {
+ double[] position = hit.getPosition();
+ double e = hit.getRawEnergy();
+ Hep3Vector positionVector =
+ new BasicHep3Vector(position[0], position[1], position[2]);
+
+ c1d("X Position").fill(position[0]);
+ c1d("Y Position").fill(position[1]);
+ c1d("Z Position").fill(position[2]);
+
+ c2d("X vs Y").fill(position[0], position[1]);
+ c2d("Z vs X").fill(position[2], position[0]);
+ c2d("Z vs Y").fill(position[2], position[1]);
+
+ c1d("Raw Energy").fill(e);
+ if (e > maxe)
+ maxe = e;
+ if (e < mine)
+ mine = e;
+
+ double sr = getSphericalRadius(position);
+ c1d("Spherical Radius").fill(sr);
+ if (sr > maxsr)
+ maxsr = sr;
+ if (sr < minsr)
+ minsr = sr;
+
+ double cr = getCylindricalRadius(position);
+ c1d("Cylindrical Radius").fill(cr);
+ if (cr > maxcr)
+ maxcr = cr;
+ if (sr < mincr)
+ mincr = cr;
+
+ double t = hit.getTime();
+ c1d("Time").fill(t);
+ if (t > maxt)
+ maxt = t;
+ if (t < mint)
+ mint = t;
+
+ c1d("Cos Theta").fill(VecOp.cosTheta(positionVector));
+ c1d("Phi").fill(VecOp.phi(positionVector));
+
+ int mcpCount = hit.getMCParticleCount();
+ c1d("Number of MC Contribs per Hit").fill(mcpCount);
+
+ contribs += mcpCount;
+ esum += e;
+ ++hits;
+ timeSum += t;
+
+ for (int i = 0; i < hit.getMCParticleCount(); i++)
+ {
+ uniqMcps.add(hit.getMCParticle(i));
+ }
+ }
+
+ c1d("Average Hit Energy by Event").fill(esum / hits);
+ c1d("Number of Hits by Event").fill(hits);
+ c1d("Total Raw Energy by Event").fill(esum);
+ c1d("Averge Number of MC Contribs per Hit by Event").fill(contribs / hits);
+ c1d("Average Hit Time by Event","Time [ns]","Number of Entries").fill(timeSum / hits);
+ c1d("Number of Unique MCP Contributions by Event").fill(uniqMcps.size());
+
+ c1d("Maximum Hit Raw Energy by Event").fill(maxe);
+ c1d("Minimum Hit Raw Energy by Event").fill(mine);
+ c1d("Minimum Cylindrical Radius by Event").fill(mincr);
+ c1d("Maximum Cylindrical Radius by Event").fill(maxcr);
+ c1d("Minimum Spherical Radius by Event").fill(minsr);
+ c1d("Maximum Spherical Radius by Event").fill(maxsr);
+ }
+
+ public SimCalHitNoDetectorPlots()
+ {}
+
+ public Class getType()
+ {
+ return SimCalorimeterHit.class;
+ }
+
+ public void process(EventHeader event)
+ {
+ super.process(event);
+ }
+
+ public void startOfData()
+ {
+ super.startOfData();
+ }
+
+ public void endOfData()
+ {
+ try
+ {
+ AIDA.defaultInstance().saveAs("calHitPlots.aida");
+ }
+ catch (Exception x)
+ {
+ throw new RuntimeException(x);
+ }
+ }
+}
SlicDiagnostics/src/org/lcsim/slic/diagnostics/calorimeterhit
diff -N CalorimeterPlotsNoDetector.java
--- CalorimeterPlotsNoDetector.java 4 Jun 2009 18:16:41 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,193 +0,0 @@
-package org.lcsim.slic.diagnostics.calorimeterhit;
-
-import static org.lcsim.slic.diagnostics.util.AidaHelper.c1d;
-import static org.lcsim.slic.diagnostics.util.AidaHelper.c2d;
-import static org.lcsim.slic.diagnostics.util.VecUtil.getCylindricalRadius;
-import static org.lcsim.slic.diagnostics.util.VecUtil.getSphericalRadius;
-import hep.aida.ICloud1D;
-import hep.aida.ICloud2D;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.lcsim.event.EventHeader;
-import org.lcsim.event.MCParticle;
-import org.lcsim.event.SimCalorimeterHit;
-import org.lcsim.event.EventHeader.LCMetaData;
-import org.lcsim.slic.diagnostics.util.AbstractPlots;
-import org.lcsim.slic.diagnostics.util.AidaHelper;
-
-/**
- *
- * A set of calorimeter hit plots for LCIO files without a Detector.
- *
- * @author jeremym
- */
-public class CalorimeterPlotsNoDetector extends AbstractPlots
-{
- ICloud1D x;
- ICloud1D y;
- ICloud1D z;
- ICloud2D xy;
- ICloud2D zx;
- ICloud2D zy;
- ICloud1D sphr;
- ICloud1D cylr;
- ICloud1D time;
- ICloud1D rawE;
- ICloud1D phi;
- ICloud1D cosTheta;
- ICloud1D nhits;
- ICloud1D totRawE;
- ICloud1D avgHitE;
- ICloud1D maxRawE;
- ICloud1D minRawE;
- ICloud1D maxCylR;
- ICloud1D minCylR;
- ICloud1D maxSphR;
- ICloud1D minSphR;
- ICloud1D mcpContribs;
- ICloud1D avgMcpContribs;
- ICloud1D avgTime;
- ICloud1D uniqParticleContrib;
-
- public CalorimeterPlotsNoDetector(LCMetaData meta)
- {
- super(meta);
- definePlots();
- }
-
- public void definePlots()
- {
- super.definePlots();
- //System.out.println(getCollectionName() + " - baseDir = " + getBaseDir());
- AidaHelper.cd(getBaseDir());
- x = c1d("X Position", "X [mm]", "Number of Entries");
- y = c1d("Y Position", "Y [mm]", "Number of Entries");
- z = c1d("Z Position", "Z [mm]", "Number of Entries");
- xy = c2d("X vs Y", "X [mm]", "Y [mm]");
- zx = c2d("Z vs X", "Z [mm]", "X [mm]");
- zy = c2d("Z vs Y", "Z [mm]", "Y [mm]");
- sphr = c1d("Spherical Radius", "R [mm]", "Number of Entries");
- cylr = c1d("Cylindrical Radius", "R [mm]", "Number of Entries");
- time = c1d("Time","Time [ns]","Number of Entries");
- time.annotation().addItem("xAxisScale", "log");
- avgTime = c1d("Average Hit Time by Event","Time [ns]","Number of Entries");
- avgTime.annotation().addItem("xAxisScale", "log");
- rawE = c1d("Raw Energy", "Energy [GeV]", "Number of Entries");
- cosTheta = c1d("Cos Theta", "cos(theta)", "Number of Entries");
- phi = c1d("Phi", "phi [radians]", "Number of Entries");
- nhits = c1d("Number of Hits by Event", "Hit Count", "Number of Entries");
- totRawE = c1d("Total Raw Energy by Event", "Energy [GeV]", "Number of Entries");
- avgHitE = c1d("Average Hit Energy by Event", "Energy [GeV]", "Number of Entries");
- minRawE = c1d("Minimum Hit Raw Energy by Event", "Energy [GeV]", "Number of Entries");
- maxRawE = c1d("Maximum Hit Raw Energy by Event", "Energy [GeV]", "Number of Entries");
- minCylR = c1d("Minimum Cylindrical Radius by Event", "Radius [mm]", "Number of Entries");
- maxCylR = c1d("Maximum Cylindrical Radius by Event", "Radius [mm]", "Number of Entries");
- minSphR = c1d("Minimum Spherical Radius by Event", "Radius [mm]", "Number of Entries");
- maxSphR = c1d("Maximum Spherical Radius by Event", "Radius [mm]", "Number of Entries");
- mcpContribs = c1d("Number of MC Contribs per Hit", "Count", "Number of Entries");
- avgMcpContribs = c1d("Averge Number of MC Contribs per Hit by Event", "Count", "Number of Entries");
- uniqParticleContrib = c1d("Number of Unique MCP Contributions by Event", "Count", "Number of Entries");
- }
-
- public void fill(EventHeader event, List<SimCalorimeterHit> collection)
- {
- // Changes to correct directory.
- super.fill(event);
-
- if (collection.size() == 0)
- return;
-
- int hits = 0;
- int contribs = 0;
- double timeSum = 0.;
- double esum = 0.;
- double mine = Double.MAX_VALUE;
- double maxe = 0.;
- double minsr = Double.MAX_VALUE;
- double maxsr = 0.;
- double mincr = Double.MAX_VALUE;
- double maxcr = 0.;
- double mint = Double.MAX_VALUE;
- double maxt = 0.;
- Set<MCParticle> uniqMcps = new HashSet<MCParticle>();
-
- for (SimCalorimeterHit hit : collection)
- {
- double[] position = hit.getPosition();
- double e = hit.getRawEnergy();
- Hep3Vector positionVector =
- new BasicHep3Vector(position[0], position[1], position[2]);
-
- x.fill(position[0]);
- y.fill(position[1]);
- z.fill(position[2]);
-
- xy.fill(position[0], position[1]);
- zx.fill(position[2], position[0]);
- zy.fill(position[2], position[1]);
-
- rawE.fill(e);
- if (e > maxe)
- maxe = e;
- if (e < mine)
- mine = e;
-
- double sr = getSphericalRadius(position);
- sphr.fill(sr);
- if (sr > maxsr)
- maxsr = sr;
- if (sr < minsr)
- minsr = sr;
-
- double cr = getCylindricalRadius(position);
- cylr.fill(cr);
- if (cr > maxcr)
- maxcr = cr;
- if (sr < mincr)
- mincr = cr;
-
- double t = hit.getTime();
- time.fill(t);
- if (t > maxt)
- maxt = t;
- if (t < mint)
- mint = t;
-
- phi.fill(VecOp.cosTheta(positionVector));
- cosTheta.fill(VecOp.phi(positionVector));
-
- int mcpCount = hit.getMCParticleCount();
- mcpContribs.fill(mcpCount);
-
- contribs += mcpCount;
- esum += e;
- ++hits;
- timeSum += t;
-
- for (int i = 0; i < hit.getMCParticleCount(); i++)
- {
- uniqMcps.add(hit.getMCParticle(i));
- }
- }
-
- avgHitE.fill(esum / hits);
- nhits.fill(hits);
- totRawE.fill(esum);
- avgMcpContribs.fill(contribs / hits);
- avgTime.fill(timeSum / hits);
- uniqParticleContrib.fill(uniqMcps.size());
-
- maxRawE.fill(maxe);
- minRawE.fill(mine);
- minCylR.fill(mincr);
- maxCylR.fill(maxcr);
- minSphR.fill(minsr);
- maxSphR.fill(maxsr);
- }
-}
\ No newline at end of file
SlicDiagnostics/src/org/lcsim/slic/diagnostics/util
diff -N AbstractCollectionPlots.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ AbstractCollectionPlots.java 7 Oct 2009 03:17:27 -0000 1.1
@@ -0,0 +1,135 @@
+package org.lcsim.slic.diagnostics.util;
+
+import static org.lcsim.slic.diagnostics.util.AidaHelper.tree;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.util.Driver;
+
+/**
+ *
+ * @author jeremym
+ *
+ */
+public abstract class AbstractCollectionPlots extends Driver
+{
+ List<String> inputCollectionNames = new ArrayList<String>();
+ List<String> directories = new ArrayList<String>();
+ Map<String,String> nameToDir = new HashMap<String,String>();
+
+ public AbstractCollectionPlots()
+ {}
+
+ /**
+ *
+ * @return
+ */
+ public abstract Class getType();
+
+ /**
+ *
+ */
+ protected abstract void definePlots();
+
+ /**
+ *
+ */
+ public void defineAllPlots()
+ {
+ for (String inputCollection : inputCollectionNames)
+ {
+ AidaHelper.cd(getDirectory(inputCollection));
+ definePlots();
+ }
+ }
+
+ /**
+ *
+ * @param event
+ * @param collection
+ */
+ public abstract void plotCollection(EventHeader event, String collection);
+
+ /**
+ *
+ * @param collectionName
+ * @return
+ */
+ public final String getDirectory(String collectionName)
+ {
+ return nameToDir.get(collectionName);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public final List<String> getDirectories()
+ {
+ return directories;
+ }
+
+ /**
+ *
+ * @param inputCollectionName
+ */
+ public final void setInputCollectionName(String inputCollectionName)
+ {
+ inputCollectionNames.add(inputCollectionName);
+ }
+
+ /**
+ *
+ * @param inputCollectionNames
+ */
+ public final void setInputCollectionNames(String inputCollectionNames[])
+ {
+ this.inputCollectionNames.addAll(Arrays.asList(inputCollectionNames));
+ }
+
+ /**
+ *
+ */
+ public final void setup()
+ {
+ for (String collectionName : inputCollectionNames)
+ {
+ String dir = "/" + getType().getSimpleName() + "/" + collectionName;
+ try
+ {
+ tree().mkdirs(dir);
+ directories.add(dir);
+ nameToDir.put(collectionName, dir);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Problem creating AIDA directory " + dir + ".",e);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public void startOfData()
+ {
+ setup();
+ defineAllPlots();
+ }
+
+ /**
+ *
+ */
+ public void process(EventHeader event)
+ {
+ for (String collectionName : inputCollectionNames)
+ {
+ plotCollection(event, collectionName);
+ }
+ }
+}
\ No newline at end of file
CVSspam 0.2.8