float totXE = 0.;
TObjArray *xtalRecCol = calRec->getCalXtalRecCol();
TIter xtalIter(xtalRecCol);
CalXtalRecData *xtal = 0;
while (xtal = (CalXtalRecData*)xtalIter.Next()) {
Double_t xtalEnergy = xtal->getEnergy();
if (xtalEnergy > 2000) {
const CalXtalId id = xtal->getPackedId();
int lyr = id.getLayer();
int twr = id.getTower();
int col = id.getColumn();
CalRangeRecData* rData = xtal->getRangeRecData(0);
int range = rData->getRange(0);
double ph0 = xtal->getEnergySelectedRange(range,0);
continue;
}
totXE += xtalEnergy;
}
((TH1F*)GetObjectPtr("CALXTALTOTE"))->Fill(totXE);
|
Retrieve the full collection of CalXtalRecData
Create a ROOT TIter to iterate over the CalXtalRecData. The while loop uses this iterator and fills the xtal variable with the current CalXtalRecData pointer.
Retrieve the reconstructed energy associated with this crystal. If that energy is greater than 2000 MeV, retrieve the CalXtalId and use the CalXtalId member functions to find the layer, tower, and column.
Get the first CalRangeRecData which corresponds to "Best Range", retrieve the range and energy associated with that range.
Maintain running total of the energy.
Fill the CALXTALTOTE histogram. |