///////////////////////////////////////////////////////// /// $Id: IMidasTripTOldHistoItr.cxx,v 1.2 2009/09/25 06:02:32 nickwest Exp $ /// /// Implement the COMET::IMidasTripTOldHistoItr class... #include "IMidasObj.hxx" #include "ICOMETLog.hxx" #include "IMidasItr.cxx" #include "IMidasTripTOldHistoItr.hxx" #include "ITripTOldHistoBank.hxx" // The ProHisto class is for the prototype histogram bank used in the first implementation // of the DPT. The ITripTHistoBank and IMidasTripTHisto banks are used for the new // version of the DPT (developed in July 2009, installed a month or two later). //_____________________________________________________________________________ COMET::IMidasTripTOldHistoItr::IMidasTripTOldHistoItr(const ITripTOldHistoBank* parent) : IMidasItr(parent->GetRawDataVer(),0,parent,parent->GetNumAllHisto()), fParent(parent), fPtrStart(parent->GetData16() + RAWDPT_HVS_OFFSET1), fDataStart(parent->GetHistoStart()), fDataEOD(fDataStart + parent->GetSize8()), fSlotStart(0), fSlotEOD(parent->GetNumAllHisto()) { // fPtrStart = parent->GetData16() + RAWDPT_HVS_OFFSET1; // fDataStart = parent->GetData8() + ((RAWDPT_HVS_OFFSET1 + parent->GetNumAllHisto()) << 1); // Inside () is a Short_t offset, fDataStart is UChar_t // fDataEOD = fDataStart + parent->GetSize8(); this->Rewind(); // Sets fSlotNext and fDataNext } //_____________________________________________________________________________ COMET::IMidasTripTOldHisto COMET::IMidasTripTOldHistoItr::GetImp() { if ( fSlotNext > fSlotEOD ) { COMETError("COMET::IMidasTripTOldHistoItr: Bank truncated!"); fSlotNext = fSlotEOD; } if ( this->EODImp() ) { COMETError("COMET::IMidasTripTOldHistoItr: Requesting object beyond end of set; returning one marked as invalid"); return IMidasTripTOldHisto(IMidasObj::IteratorOutOfRange); } // Split the fSlotNext into tfb,trip,chan UInt_t ch = 16 + fParent->GetNExtraChan(); UInt_t tt = fSlotNext/ch; // Integer divide UInt_t tfb = tt>>2; UInt_t trip = tt&0x3; UInt_t chan = fSlotNext % ch; // Integer remainder IMidasTripTOldHisto histo(fParent->GetEncoding(),fDataNext,fPtrStart[fSlotNext],tfb,trip,chan); fDataNext += fPtrStart[fSlotNext]; ++fSlotNext; while (!this->EODImp() && (fPtrStart[fSlotNext] == 0)) { // Skip directly over missing histograms ++fSlotNext; // fDataNext += fPtrStart[fSlotNext]; // Superfluous because we have just checked fPtrStart[fSlotNext] == 0; } return histo; }