#include #include #include #include #include #include #include "CalorObjects/CC2Q_Storable.hh" #include #include //_____________________________________________________________________________ Int_t StntupleInitCcrDataBlock(TStnDataBlock* block, AbsEvent* event, int mode) { // initialize CCR data block with the `event' data // return -1, if bank doesn't exist, 0, if everything is OK TCcrDataBlock* data = (TCcrDataBlock*) block; data->Clear(); EventRecord::ConstIterator qiter(event, "CC2Q_Storable"); EventRecord::ConstIterator diter(event, "CCRD_StorableBank"); if (qiter.is_valid()) { ConstHandle chCc2q(qiter); int wedge, side, pad_num; const CC2Q_Storable::cc2qVector& vecCc2q = chCc2q->contents(); CC2Q_Storable::const_iterator cc2q; for (cc2q = vecCc2q.begin(); cc2q != vecCc2q.end(); ++cc2q) { wedge = cc2q->module(); side = cc2q->we(); pad_num = cc2q->padNo(); if ( (wedge < 0) || (wedge > 23) || (side < 0) || (side > 1) || (pad_num < 0) || (pad_num > 9)) { printf(" *** corrupted CCR data: side, wedge, pad_num ="); printf(" %i %i %i\n",side, wedge, pad_num); return -2; } data->fNHitPads[side][wedge]++; data->fPadData[side][wedge][pad_num] = cc2q->energy(); } } else if (diter.is_valid()) { ConstHandle ccrd(diter); int wedge, side, pad_num; for (CCRD_StorableBank::ConstBankIter blk(ccrd); blk.is_valid(); ++blk) { for (CCRD_StorableBank::ConstBlockIter ch(blk); ch.is_valid(); ++ch) { wedge = ccrd->get_module (ch); side = ccrd->get_we (ch); pad_num = ccrd->get_pad_number(ch); if ( (wedge < 0) || (wedge > 23) || (side < 0) || (side > 1) || (pad_num < 0) || (pad_num > 9)) { printf(" *** corrupted CCR data: side, wedge, pad_num ="); printf(" %i %i %i\n",side, wedge, pad_num); return -2; } data->fNHitPads[side][wedge]++; data->fPadData[side][wedge][pad_num] = ccrd->get_data(ch); } } } else { return -1; } return 0; }