2 added + 7 modified, total 9 files
SlicDiagnostics/src/org/lcsim/slic/diagnostics
diff -u -r1.29 -r1.30
--- SlicDiagnosticsDriver.java 7 Mar 2008 01:59:14 -0000 1.29
+++ SlicDiagnosticsDriver.java 3 Apr 2008 00:05:43 -0000 1.30
@@ -14,6 +14,8 @@
import org.lcsim.recon.cluster.cheat.CheatClusterDriver;
import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterDirectoryMaker;
import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterEventPlots;
+import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterPlotsNoDetector;
+import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterPlotsNoDetectorDriver;
import org.lcsim.slic.diagnostics.calorimeterhit.CalorimeterHitPlotsDriver;
import org.lcsim.slic.diagnostics.cluster.ClusterDirectoryMaker;
import org.lcsim.slic.diagnostics.cluster.ClusterPlotsDriver;
@@ -192,7 +194,6 @@
}
// Always add the layer info driver.
- //add(new LayerInfoDriver());
add(new LayerStatisticsMaker());
// Add up-front the directory makers for types that have at least one plotting driver.
@@ -211,15 +212,13 @@
add(new ClusterDirectoryMaker());
}
- // Make generator FS collection.
- // Needs to be in front of MCParticleDirectoryMaker.
+ // Make generator FS collection. Needs to be in front of MCParticleDirectoryMaker.
if (_options.getBooleanOption("mcparticle.generator"))
{
add(new CreateFinalStateMCParticleList("Gen"));
}
- // Make simulator FS collection.
- // Needs to be in front of MCParticleDirectoryMaker.
+ // Make simulator FS collection. Needs to be in front of MCParticleDirectoryMaker.
if (_options.getBooleanOption("mcparticle.simulator"))
{
add(new CreateFinalStateMCParticleList("Sim"));
@@ -244,22 +243,15 @@
{
add(new Cloud2HistogramConverter());
}
-
- // Print list of registered drivers.
- //if (_verbosity > 0)
- //{
- // for (Driver driver : this.drivers())
- // {
- // message("subdriver <" + driver.getClass().getCanonicalName()+">");
- // }
- //}
+
+ add(new CalorimeterPlotsNoDetectorDriver(this));
}
public void add(Driver subdriver)
{
super.add(subdriver);
if (_verbosity > 0)
- message("added " + subdriver.getName());
+ message("added driver " + subdriver.getName());
}
protected void process(EventHeader event)
@@ -270,7 +262,7 @@
if (_verbosity > 1 && (_evtCnt % _eventNoticeInterval == 0))
{
- message("Processed events <" + _evtCnt + ">");
+ message("Processed " + _evtCnt + " events");
}
}
@@ -305,15 +297,7 @@
/** Set the filename to argument basename, adding .aida extension if necessary. */
public void setAidaFileName(String path)
{
- //_fileName = (new File(path)).getRelativePath();
_fileName = path;
- //int pos = path.lastIndexOf(".aida");
- //System.out.println("pos="+pos);
- //if (pos == -1 || (pos != path.length() - 5))
- //{
- // _fileName += ".aida";
- //}
- //System.out.println("file: " + _fileName);
}
private void setFilename()
@@ -355,8 +339,6 @@
{
try
{
- //System.out.println("dirName="+dirName);
- //System.out.println("fileName="+_fileName);
savePlots(dirName + File.separator + _fileName);
}
catch (Exception e)
@@ -368,12 +350,11 @@
private void savePlots(String filename) throws IOException
{
- message("Saving AIDA tree to <" + filename + ">.");
+ message("Saving AIDA tree to " + filename + " ...");
if (_options.getBooleanOption("config.saveAsZip"))
_aida.saveAsZip(filename);
else
_aida.saveAs(filename);
- //if (!(new File(filename)).exists()) System.out.println(filename + " << does not exist!!!");
}
static public final void message(String m)
SlicDiagnostics/src/org/lcsim/slic/diagnostics/calorimeterhit
diff -N CalorimeterPlotsNoDetector.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CalorimeterPlotsNoDetector.java 3 Apr 2008 00:05:43 -0000 1.1
@@ -0,0 +1,192 @@
+package org.lcsim.slic.diagnostics.calorimeterhit;
+
+import static org.lcsim.slic.diagnostics.SlicDiagnosticsDirectories.SimCalorimeterHitDir;
+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;
+
+/**
+ *
+ * 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(SimCalorimeterHitDir, meta);
+ definePlots();
+ }
+
+ public void definePlots()
+ {
+ super.definePlots();
+
+ 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("X 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)
+ minsr = 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/calorimeterhit
diff -N CalorimeterPlotsNoDetectorDriver.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CalorimeterPlotsNoDetectorDriver.java 3 Apr 2008 00:05:43 -0000 1.1
@@ -0,0 +1,45 @@
+package org.lcsim.slic.diagnostics.calorimeterhit;
+
+import java.util.List;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.EventHeader.LCMetaData;
+import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.slic.diagnostics.SlicDiagnosticsDriver;
+import org.lcsim.slic.diagnostics.util.PlotsDriver;
+
+/**
+ * Driver for a set of CalorimeterHitPlots.
+ *
+ * @author jeremym
+ * @version $Id: CalorimeterPlotsNoDetectorDriver.java,v 1.1 2008/04/03 00:05:43 jeremy Exp $
+ */
+public class CalorimeterPlotsNoDetectorDriver extends PlotsDriver
+{
+ public CalorimeterPlotsNoDetectorDriver(SlicDiagnosticsDriver mom)
+ {
+ super(mom);
+ }
+
+ protected void process(EventHeader event)
+ {
+ super.process(event);
+
+ List<List<SimCalorimeterHit>> collections = event.get(SimCalorimeterHit.class);
+ for ( List<SimCalorimeterHit> collection : collections)
+ {
+ LCMetaData meta = event.getMetaData(collection);
+ CalorimeterPlotsNoDetector calPlots = getCalorimeterHitPlots(meta);
+ calPlots.fill(event, collection);
+ }
+ }
+
+ private CalorimeterPlotsNoDetector getCalorimeterHitPlots(LCMetaData meta)
+ {
+ String name = meta.getName();
+ if ( _plots.get(name) == null )
+ {
+ _plots.put(name, new CalorimeterPlotsNoDetector(meta) );
+ }
+ return (CalorimeterPlotsNoDetector)_plots.get(name);
+ }
+}
\ No newline at end of file
SlicDiagnostics/src/org/lcsim/slic/diagnostics/calorimeterhit
diff -u -r1.2 -r1.3
--- CalorimeterHitPlotsDriver.java 23 Jan 2007 23:27:58 -0000 1.2
+++ CalorimeterHitPlotsDriver.java 3 Apr 2008 00:05:43 -0000 1.3
@@ -11,7 +11,7 @@
* Driver for a set of CalorimeterHitPlots.
*
* @author jeremym
- * @version $Id: CalorimeterHitPlotsDriver.java,v 1.2 2007/01/23 23:27:58 jeremy Exp $
+ * @version $Id: CalorimeterHitPlotsDriver.java,v 1.3 2008/04/03 00:05:43 jeremy Exp $
*/
public class CalorimeterHitPlotsDriver extends PlotsDriver
{
@@ -28,9 +28,7 @@
for ( List<SimCalorimeterHit> collection : collections)
{
LCMetaData meta = event.getMetaData(collection);
- //System.out.println("CalorimeterHitPlotsDriver.process - " + meta.getName() + " " + meta.getType());
CalorimeterHitPlots calPlots = getCalorimeterHitPlots(meta);
- //calPlots.fill(event);
calPlots.fill(event, collection);
}
}
SlicDiagnostics/src/org/lcsim/slic/diagnostics/event
diff -u -r1.1 -r1.2
--- EventSummaryPlots.java 13 Jan 2007 00:18:21 -0000 1.1
+++ EventSummaryPlots.java 3 Apr 2008 00:05:43 -0000 1.2
@@ -2,6 +2,7 @@
import static org.lcsim.slic.diagnostics.util.AidaHelper.aida;
import hep.aida.ICloud1D;
+import hep.aida.IHistogram1D;
import java.util.List;
@@ -14,7 +15,7 @@
* Plots of combined event statistics.
*
* @author jeremym
- * @version $Id: EventSummaryPlots.java,v 1.1 2007/01/13 00:18:21 jeremy Exp $
+ * @version $Id: EventSummaryPlots.java,v 1.2 2008/04/03 00:05:43 jeremy Exp $
*/
class EventSummaryPlots extends AbstractPlots
{
@@ -25,10 +26,14 @@
ICloud1D _eventTrackerEnergy;
ICloud1D _eventCalorimeterEnergy;
+ IHistogram1D _eventCount;
+
protected void definePlots()
{
super.definePlots();
+ _eventCount = aida().histogram1D("Event Count", 3, -1, 1);
+
_eventTotalEnergy = aida().cloud1D("Energy");
_eventTotalEnergy.annotation().addItem("xAxisLabel","Event Energy (GeV)");
_eventTotalEnergy.annotation().addItem("yAxisLabel","Number of Events");
@@ -78,10 +83,11 @@
{
super.fill(event);
+ _eventCount.fill(0);
+
_trackerTotalEnergy = _calorimeterTotalEnergy = 0;
- _trackerHitCount = _calorimeterHitCount = 0;
+ _trackerHitCount = _calorimeterHitCount = 0;
- // CalorimeterHits
List<List<SimCalorimeterHit>> cals = event.get(SimCalorimeterHit.class);
for ( List<SimCalorimeterHit> simCalHits : cals )
{
@@ -92,7 +98,9 @@
}
}
- // TrackerHits
+ _eventCalorimeterEnergy.fill(_calorimeterTotalEnergy);
+ _eventCalorimeterHits.fill(_calorimeterHitCount);
+
List<List<SimTrackerHit>> trks = event.get(SimTrackerHit.class);
for ( List<SimTrackerHit> simTrkHits : trks )
{
@@ -103,14 +111,10 @@
}
}
- // Event Energy
- _eventTotalEnergy.fill(_trackerTotalEnergy + _calorimeterTotalEnergy);
- _eventCalorimeterEnergy.fill(_calorimeterTotalEnergy);
_eventTrackerEnergy.fill(_trackerTotalEnergy);
+ _eventTrackerHits.fill(_trackerHitCount);
- // Event Hit Counts
- _eventHits.fill(_trackerHitCount + _calorimeterHitCount);
- _eventTrackerHits.fill(_trackerHitCount);
- _eventCalorimeterHits.fill(_calorimeterHitCount);
+ _eventTotalEnergy.fill(_trackerTotalEnergy + _calorimeterTotalEnergy);
+ _eventHits.fill(_trackerHitCount + _calorimeterHitCount);
}
}
\ No newline at end of file
SlicDiagnostics/src/org/lcsim/slic/diagnostics/layer
diff -u -r1.1 -r1.2
--- LayerStatisticsMaker.java 5 Mar 2008 10:28:50 -0000 1.1
+++ LayerStatisticsMaker.java 3 Apr 2008 00:05:43 -0000 1.2
@@ -31,7 +31,7 @@
else if (firstHit instanceof GenericSimTrackerHit)
stats = new SimTrackerHitLayerStatistics(meta);
else
- throw new RuntimeException("Unrecognized GenericHit subtype: " + stats.getClass().getCanonicalName());
+ throw new RuntimeException("Unrecognized GenericHit subtype " + stats.getClass().getCanonicalName());
statsMap.put(meta.getName(), stats);
for (GenericHit hit : collection)
SlicDiagnostics/src/org/lcsim/slic/diagnostics/util
diff -u -r1.4 -r1.5
--- CommandLineProcessor.java 7 Mar 2008 01:59:14 -0000 1.4
+++ CommandLineProcessor.java 3 Apr 2008 00:05:43 -0000 1.5
@@ -28,7 +28,7 @@
* Main.
*
* @author Jeremy McCormick
- * @version $Id: CommandLineProcessor.java,v 1.4 2008/03/07 01:59:14 jeremy Exp $
+ * @version $Id: CommandLineProcessor.java,v 1.5 2008/04/03 00:05:43 jeremy Exp $
*/
public class CommandLineProcessor
{
@@ -111,6 +111,10 @@
opt = new Option("P", false, "write out properties file of this job");
opt.setArgs(1);
_options.addOption(opt);
+
+ opt = new Option("u", false, "use dummy detector");
+ opt.setArgs(1);
+ _options.addOption(opt);
}
/** Parse the command-line options. */
@@ -153,6 +157,12 @@
_userOptions.setIntegerOption("config.maxEvents",Integer.parseInt(cl.getOptionValue("n")));
}
+ // dummy detector
+ if (cl.hasOption("u"))
+ {
+ _userOptions.setStringOption("config.dummyDetector", cl.getOptionValue("u"));
+ }
+
// Process lists of files
String infileList[] = null;
if (cl.hasOption("f") || args.length == 1)
SlicDiagnostics/src/org/lcsim/slic/diagnostics/util
diff -u -r1.4 -r1.5
--- Runner.java 7 Mar 2008 01:59:14 -0000 1.4
+++ Runner.java 3 Apr 2008 00:05:43 -0000 1.5
@@ -12,7 +12,7 @@
* by using LCIOEventSource and LCSimLoop.
*
* @author jeremym
- * @version $Id: Runner.java,v 1.4 2008/03/07 01:59:14 jeremy Exp $
+ * @version $Id: Runner.java,v 1.5 2008/04/03 00:05:43 jeremy Exp $
*/
public class Runner
{
@@ -53,21 +53,24 @@
{
SlicDiagnosticsDriver.message("Maximum Events <" + maxevents + ">");
}
-
+
+ String dummyDetector = options.getStringOption("config.dummyDetector");
+ if ( dummyDetector != null)
+ {
+ loop.setDummyDetector(options.getStringOption("config.dummyDetector"));
+ }
+
try
{
- // Set the max number of events in the event loop.
loop.loop(maxevents);
}
catch (org.freehep.record.loop.NoLoopRecordException nlre)
- {
- // Ignore this exception.
- }
+ {}
catch (Exception e)
{
- System.out.println(e.getMessage());
+ throw new RuntimeException(e);
}
loop.dispose();
}
-}
+}
\ No newline at end of file
SlicDiagnostics/src/org/lcsim/slic/diagnostics/util
diff -u -r1.8 -r1.9
--- UserOptions.java 7 Mar 2008 02:02:31 -0000 1.8
+++ UserOptions.java 3 Apr 2008 00:05:43 -0000 1.9
@@ -13,7 +13,7 @@
* Represents simple options set from properties file or command-line.
*
* @author Jeremy McCormick
- * @version $Id: UserOptions.java,v 1.8 2008/03/07 02:02:31 jeremy Exp $
+ * @version $Id: UserOptions.java,v 1.9 2008/04/03 00:05:43 jeremy Exp $
*/
public final class UserOptions
{
@@ -110,8 +110,6 @@
parseIntegerOption("config.verbosity",4);
parseIntegerOption("config.maxEvents",-1);
parseStringOption("config.outputFile","SlicDiagnosticsPlots.aida");
- //String outDir = (new File(".")).getAbsolutePath();
- //outDir = outDir.substring(0,outDir.length()-2);
parseStringOption("config.outputDir",(new File(".")).getAbsolutePath());
parseBooleanOption("config.convertClouds",false);
CVSspam 0.2.8