Commit in lcsim/src/org/lcsim/rpc on MAIN | |||
PadDigiAnalysisDriver.java | +53 | -6 | 1.1 -> 1.2 |
add endcap histos
diff -u -r1.1 -r1.2 --- PadDigiAnalysisDriver.java 6 Feb 2013 01:43:09 -0000 1.1 +++ PadDigiAnalysisDriver.java 7 Feb 2013 21:54:47 -0000 1.2 @@ -21,8 +21,9 @@
/** * @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: PadDigiAnalysisDriver.java,v 1.1 2013/02/06 01:43:09 jeremy Exp $
+ * @version $Id: PadDigiAnalysisDriver.java,v 1.2 2013/02/07 21:54:47 jeremy Exp $
*/
+// TODO: Make common method to fill barrel and endcap histograms.
public class PadDigiAnalysisDriver extends Driver { // Collection names with defaults. These can all be overridden via set methods.
@@ -43,14 +44,24 @@
IHistogram1D barrelDigiHitsPerSimHit; IHistogram1D barrelInputDistanceToPadCenter;
+ IHistogram1D endcapOutputHitEnergy; + ICloud1D endcapOutputHitsPerEvent; + IHistogram1D endcapSimHitsPerDigiHit; + IHistogram1D endcapDigiHitsPerSimHit; + IHistogram1D endcapInputDistanceToPadCenter; +
public void startOfData() { barrelOutputHitEnergy = aida.histogram1D(barrelOutputCollection + ": Hit Energy", 1000, 0., 2.0); barrelOutputHitsPerEvent = aida.cloud1D(barrelOutputCollection + ": Hits Per Event");
- barrelSimHitsPerDigiHit = aida.histogram1D(barrelOutputCollection + ": Sim Hits Per Digi Hit", 5, 1., 6.); - - barrelInputDistanceToPadCenter = aida.histogram1D(barrelInputCollection + ": Contrib Distance to Cell Center", 200, 0., 10.); -
+ barrelSimHitsPerDigiHit = aida.histogram1D(barrelOutputCollection + ": Sim Hits Per Digi Hit", 5, 1., 6.); + barrelInputDistanceToPadCenter = aida.histogram1D(barrelInputCollection + ": Contrib Distance to Cell Center", 200, 0., 10.);
barrelDigiHitsPerSimHit = aida.histogram1D(barrelInputCollection + ": Digi Hits Per Sim Hit", 20, 1., 21.);
+ + endcapOutputHitEnergy = aida.histogram1D(endcapOutputCollection + ": Hit Energy", 1000, 0., 2.0); + endcapOutputHitsPerEvent = aida.cloud1D(endcapOutputCollection + ": Hits Per Event"); + endcapSimHitsPerDigiHit = aida.histogram1D(endcapOutputCollection + ": Sim Hits Per Digi Hit", 5, 1., 6.); + endcapInputDistanceToPadCenter = aida.histogram1D(endcapInputCollection + ": Contrib Distance to Cell Center", 200, 0., 10.); + endcapDigiHitsPerSimHit = aida.histogram1D(endcapInputCollection + ": Digi Hits Per Sim Hit", 20, 1., 21.);
} public void setBarrelInputCollection(String barrelInputCollection)
@@ -104,10 +115,20 @@
// Output relations connecting digi hits to sim hits. List<LCRelation> barrelRelations = event.get(LCRelation.class, barrelRelationCollection); List<LCRelation> endcapRelations = event.get(LCRelation.class, endcapRelationCollection);
-
+ + // Hit relations.
RelationalTable<CalorimeterHit, SimCalorimeterHit> barrelRelationalTable = createRelationalTable(barrelRelations); RelationalTable<CalorimeterHit, SimCalorimeterHit> endcapRelationalTable = createRelationalTable(endcapRelations);
+ // Fill barrel histograms. + fillBarrelHistograms(event, barrelInputHits, barrelOutputHits, barrelRelationalTable); + + // Fill endcap histograms. + fillEndcapHistograms(event, endcapInputHits, endcapOutputHits, endcapRelationalTable); + } + + private void fillBarrelHistograms(EventHeader event, List<SimCalorimeterHit> barrelInputHits, List<CalorimeterHit> barrelOutputHits, RelationalTable<CalorimeterHit, SimCalorimeterHit> barrelRelationalTable) + {
// Barrel digi hits. barrelOutputHitsPerEvent.fill(barrelOutputHits.size()); for (CalorimeterHit hit : barrelOutputHits) {
@@ -132,4 +153,30 @@
} }
+ private void fillEndcapHistograms(EventHeader event, List<SimCalorimeterHit> endcapInputHits, List<CalorimeterHit> endcapOutputHits, RelationalTable<CalorimeterHit, SimCalorimeterHit> endcapRelationalTable) + { + // Barrel digi hits. + endcapOutputHitsPerEvent.fill(endcapOutputHits.size()); + for (CalorimeterHit hit : endcapOutputHits) { + endcapOutputHitEnergy.fill(hit.getCorrectedEnergy()); + endcapSimHitsPerDigiHit.fill(endcapRelationalTable.allFrom(hit).size()); + } + + // Barrel sim hits. + IDDecoder decoder = event.getMetaData(endcapInputHits).getIDDecoder(); + for (SimCalorimeterHit hit : endcapInputHits) { + int ncontribs = hit.getMCParticleCount(); + decoder.setID(hit.getCellID()); + double[] cellPos = decoder.getPosition(); + Hep3Vector p1 = new BasicHep3Vector(cellPos[0], cellPos[1], cellPos[2]); + for (int i = 0; i < ncontribs; i++) { + float[] stepPos = hit.getStepPosition(i); + Hep3Vector p2 = new BasicHep3Vector(stepPos[0], stepPos[1], stepPos[2]); + double d = sqrt(pow((p1.x() - p2.x()), 2) + pow((p1.y() - p2.y()), 2) + pow((p1.z() - p2.z()), 2)); + endcapInputDistanceToPadCenter.fill(d); + } + endcapDigiHitsPerSimHit.fill(endcapRelationalTable.allTo(hit).size()); + } + } +
}
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1