//_____________________________________________________________________________ // initialize PES data block starting from PlugStripColl // 14 Feb 2002 Bruce Knuteson // modification of InitPesDataBlock.cc //_____________________________________________________________________________ #include #include #include #include #include #include #include #include "ShowerMax/PESQCodec.hh" #include "CalorObjects/PESQ_Coll.hh" #include #include #include using namespace std; //_____________________________________________________________________________ Int_t StntupleInitPesCorrectedDataBlock(TStnDataBlock* block, AbsEvent* event, int mode) { // initialize PES data block with the corrected `event' data // return -1, if bank doesn't exist, 0, if everything is OK Int_t rc = 0; TPesCorrectedDataBlock* data = (TPesCorrectedDataBlock*) block; data->Clear(); PlugStripColl_ch psch; // plug strip coll handle PlugStripColl::find(psch); if(psch==0) { // try looking for PESQ EventRecord::ConstIterator iPESQ(event,"PESQ_Coll"); if(!(iPESQ.is_valid())) { cout << "No PlugStripColl or PESQ found in this event!" << endl; return(-1); } ConstHandle aPESQ(iPESQ); PESQCodec decoder; psch = decoder.DecodePESQ(aPESQ); } int wedge, side, layer, strip; int nstrip = psch->contents().size(); if(nstrip<=0) psch->puffEvent(); for(int i=0; icontents().size(); i++) { wedge = psch->contents()[i].PesOctant(); side = psch->contents()[i].PesPlug(); layer = psch->contents()[i].PesLayer(); strip = psch->contents()[i].PesStrip(); if ( (wedge < 0) || (wedge > 7) || (side < 0) || (side > 1) || (layer < 0) || (layer > 1) || (strip < 0) || (strip > 199) ) { // corrupted data printf(" *** corrupted PES data: side, wedge, layer, strip ="); printf(" %i %i %i %i\n",side, wedge, layer, strip); rc = -2; return rc; } else { data->fEnergy[side][wedge][layer][strip] = psch->contents()[i].PesEnergy(); data->fNStrips[side][wedge][layer]++; } } return rc; }