Commit in mcd-analysis/src/main/java/org/lcsim/mcd/analysis on MAIN | |||
TotalEnergyDriver.java | +43 | added 1.1 |
simple driver that loops over the calorimeter hits and sums up the total energy
diff -N TotalEnergyDriver.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ TotalEnergyDriver.java 18 Dec 2012 23:26:42 -0000 1.1 @@ -0,0 +1,43 @@
+package org.lcsim.mcd.analysis; +import hep.aida.ICloud1D; +import java.util.List; +import org.lcsim.event.EventHeader; +import org.lcsim.event.SimCalorimeterHit; +import org.lcsim.util.Driver; +import org.lcsim.util.aida.AIDA; + +/** + * + */ +public class TotalEnergyDriver extends Driver +{ + AIDA aida = AIDA.defaultInstance(); + ICloud1D totEnergyPlot; + public void startOfData() + { + totEnergyPlot = aida.cloud1D(" Total Energy"); + } + + + @Override + protected void process(EventHeader event) + { + double TotEnergy = 0.0; + // loop over all the collections in this event which contain SimCalorimeterHits + List<List<SimCalorimeterHit>> calHitLists = event.get(SimCalorimeterHit.class); + for (List<SimCalorimeterHit> calHitList : calHitLists) + { + for (SimCalorimeterHit h : calHitList) + { + long id = h.getCellID(); + TotEnergy = TotEnergy+h.getRawEnergy(); + } + } + totEnergyPlot.fill(TotEnergy); + } + @Override + protected void endOfData() + { + + } +}
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