#include "Stntuple/obj/TSvxDataBlock.hh" #include #include #include "TClass.h" ClassImp(TSvxDataBlock) // Do NOT use the default streamer for now. // But we still need to puff up the hash table for hits on a given digicode. // Do it explicitly with InitEvent() //______________________________________________________________________________ void TSvxDataBlock::Streamer(TBuffer &R__b) { if (R__b.IsReading()) { Version_t R__v = R__b.ReadVersion(); if (R__v<2) { TSvxDataBlock::Class()->ReadBuffer(R__b, this); } else { R__b >> fNSiHits; if (fNSiHits>0) { fSiHitList->Streamer(R__b); fDigiCodes.Streamer(R__b); fDigiCodeFirstHit.Streamer(R__b); fDigiCodeLastHit.Streamer(R__b); if (R__v>3) fSiStripLinkHit.Streamer(R__b); } } } else { R__b.WriteVersion(TSvxDataBlock::IsA()); R__b << fNSiHits; if (fNSiHits>0) { fSiHitList->Streamer(R__b); fDigiCodes.Streamer(R__b); fDigiCodeFirstHit.Streamer(R__b); fDigiCodeLastHit.Streamer(R__b); fSiStripLinkHit.Streamer(R__b); } } } //_____________________________________________________________________________ TSvxDataBlock::TSvxDataBlock() : fId(NULL),fSiStripLinkHit() { fNSiHits = 0; fSiHitList = new TClonesArray("TStnSiHit",1000); fSiHitList->BypassStreamer(kFALSE); fCollName = ""; TStnSiDigiCode digi(3,2,35,7,1); // 9125 fMaxDigiCode = digi.fDigiCode; fIndexFirstHit = new int[fMaxDigiCode+1]; fIndexLastHit = new int[fMaxDigiCode+1]; } //_____________________________________________________________________________ TSvxDataBlock::~TSvxDataBlock() { fSiHitList->Delete(); delete fSiHitList; delete []fIndexFirstHit; delete []fIndexLastHit; delete fId; } //_____________________________________________________________________________ Int_t TSvxDataBlock::InitEvent(Int_t flag) { // Puff up the lookup table for hits in a given detector element // from the array fDigiCodes and its kin. // You must call this after you've read the block for the event. if (fDigiCodes.GetSize()<=0) return -1; for (int i=0; iClear(opt); // fId.clear(); // User must clear this himself! fDigiCodes.Set(0); fDigiCodeFirstHit.Set(0); fDigiCodeLastHit.Set(0); std::memset(fIndexFirstHit,-1,(fMaxDigiCode+1)*sizeof(Int_t)); std::memset(fIndexLastHit, -2,(fMaxDigiCode+1)*sizeof(Int_t)); fSiStripLinkHit.Clear(); } //------------------------------------------------------------------------------ void TSvxDataBlock::Print(Option_t* opt) const { for (int i=0; iPrint(opt); std::cout << std::endl; } std::cout << "\nLinks from DigiCodes to SiHits" << std::endl; for (int i=0; i