#include #include #include #include "Trybos/TRY_Bank_Number.hh" #include #include #include #include //_____________________________________________________________________________ Int_t StntupleInitCesDataBlock(TStnDataBlock* block, AbsEvent* event, int mode) { // initialize PES data block with the `event' data // return -1, if bank doesn't exist, 0, if everything is OK TCesDataBlock* data = (TCesDataBlock*) block; data->Clear(); EventRecord::ConstIterator iter(event, "CESD_StorableBank"); if (! iter.is_valid()) return -1; ConstHandle cesd(iter); int wedge, side, strip, strip_num; for (CESD_StorableBank::ConstBankIter blk(cesd); blk.is_valid(); ++blk) { for (CESD_StorableBank::ConstBlockIter ch(blk); ch.is_valid(); ++ch) { wedge = cesd->get_module(ch); side = cesd->get_we (blk); strip = cesd->get_strip (ch); strip_num = cesd->get_stripNo(ch); if ( (wedge < 0) || (wedge > 24) || (side < 0) || (side > 1) || (strip < 0) || (strip > 1)) { // corrupted CES data printf(" *** corrupted CES data: side, wedge, strip, strip_num ="); printf(" %i %i %i %i\n",side, wedge, strip, strip_num); return -2; } if (strip == 0) { // this is a strip if ((strip_num < 0) || (strip_num > 127)) { printf(" *** corrupted CES strip data: side, wedge, strip, strip_num ="); printf(" %i %i %i %i\n",side, wedge, strip, strip_num); return -3; } if(cesd->get_data(ch)>=60) { data->fNHitStrips[side][wedge][0]++; data->fStripData[side][wedge][strip_num] = cesd->get_data(ch); } // end energy cut } else { if ((strip_num < 0) || (strip_num > 63)) { printf(" *** corrupted CES wire data: side, wedge, strip, strip_num ="); printf(" %i %i %i %i\n",side, wedge, strip, strip_num); return -4; } if(cesd->get_data(ch)>=55) { // this is a wire data->fNHitStrips[side][wedge][1]++; data->fWireData [side][wedge][strip_num] = cesd->get_data(ch); } // end energy cut } } } return 0; } //_____________________________________________________________________________ Int_t StntupleFillCesd(TCesDataBlock* Block, CESD_StorableBank*& Cesd) { int4 n_blk = CESD_StorableBank::get_n_blocks(); int4 ndat = n_blk+2; int4 block = 0; uint2 *buf = new uint2[CESD_StorableBank::get_max_size()]; // Total number of blocks buf[block++] = n_blk; for (int side=0; side < 2; side++) { for (int wedge=0; wedge < 24; wedge++) { if ((wedge%3) == 0) { buf[block++] = ndat; } for (int i=0; i<128; i++) { short adc = Block->GetStripData(side,wedge,i); if (adc > 0) { uint2 chid = CESD_StorableBank::make_chid(wedge,0,i); buf[ndat++] = chid; buf[ndat++] = adc; } } for (int i=0; i<64; i++) { short adc = Block->GetWireData(side,wedge,i); if (adc > 0) { uint2 chid = CESD_StorableBank::make_chid(wedge,1,i); buf[ndat++] = chid; buf[ndat++] = adc; } } } } // Pointer to end of data buf[block] = ndat; Cesd = new CESD_StorableBank( 0, ndat, buf ); delete [] buf; return 0; }