///////////////////////////////////////////////////////// /// $Id: IMCMBank.cxx,v 1.7 2010/07/21 03:04:26 litchfld Exp $ /// /// Implement the COMET::IMCMBank class... /*** 64-bit trigger word definition 0-31 event number 32-47 Spill number Trigger 48 Beam spill 49 Pedestal/noise 50 TPC laser 51 POD LED 52 ECAL LED 53 FGD LED 54 FEE calibration 55 TRIP-t cosmic 56 Reserved for FGD cosmic 57 unused Instruction 58 Reserved for start-of-run 59 Reserved for end-of-run 60 1 PPS / counter reset 61 Go to spill mode 62 Go to cosmic mode 63 Decline CTM request/abort ***/ //#include "oaEvent_version.h" #include "IMidasBankProxyRegistry.hxx" #include "IMCMBank.hxx" #include "IRawDataHeader.hxx" // Register the bank MIDAS bank mask for the family of bank names that map to // this class REGISTER_MIDAS_BANK(IMCMBank,OMCM;PMCM;IMCM;EMCM;SMCM;TMCM;FMCM;PSCM;ESCM;SSCM;TSCM;FSCM) // Typically the class constructors do nothing beyond passing their arguments // to the IMidasBank base class and the destructor does nothing. //_____________________________________________________________________________ COMET::IMCMBank::IMCMBank() : IMidasBank(0,TMCM_BANK_TITLE) { // Default constructor COMETTrace("IMCMBank: Default ctor at:" << (void*) this); } //_____________________________________________________________________________ COMET::IMCMBank::IMCMBank(const ULong64_t *bank, const char* title /* = TMCM_BANK_TITLE */) : IMidasBank(bank,title) { // Normal constructor COMETTrace("COMET::IMCMBank: Normal ctor at:" << (void*) this << "\n Name:'" << this->GetName() << "'; Title:" << title << "; Bank size:" << this->GetBankSize() << "; starts at:" << (void*) this->GetBank()); } //_____________________________________________________________________________ COMET::IMCMBank::~IMCMBank() { COMETTrace("COMET::IMCMBank: dtor at:" << (void*) this); } //_____________________________________________________________________________ void COMET::IMCMBank::SetContext(COMET::IRawDataHeader& header) const { // Hold the 4 character bank name. This has been zero terminated when the // IMidasBank object was constructed. const char* bankName = GetName(); if (header.GetTriggerWord() == (unsigned) COMET::IRawDataHeader::Invalid) { header.SetTriggerWord(this->GetTriggerWord()); } if (header.GetTriggerWord() != this->GetTriggerWord()) { COMETError("Trigger word mismatch: " << this->GetName() << ", " << std::hex << header.GetTriggerWord() << " != " << std::hex << this->GetTriggerWord()); } switch (bankName[0]) { case 'O': header.SetTriggerWord(this->GetTriggerWord()); header.SetMCMSecond(this->GetUnixTimeTrig()); header.SetMCMSubSecond(this->GetUnixTimeSSecTrig()); header.SetMCMTimeSinceBusy(this->GetTimeSinceBusy()); break; case 'P': header.SetP0DSecond(this->GetUnixTimeTrig()); header.SetP0DSubSecond(this->GetUnixTimeSSecTrig()); header.SetP0DTimeSinceBusy(this->GetTimeSinceBusy()); break; case 'T': header.SetTPCSecond(this->GetUnixTimeTrig()); header.SetTPCSubSecond(this->GetUnixTimeSSecTrig()); header.SetTPCTimeSinceBusy(this->GetTimeSinceBusy()); break; case 'F': header.SetFGDSecond(this->GetUnixTimeTrig()); header.SetFGDSubSecond(this->GetUnixTimeSSecTrig()); header.SetFGDTimeSinceBusy(this->GetTimeSinceBusy()); break; case 'E': header.SetECalSecond(this->GetUnixTimeTrig()); header.SetECalSubSecond(this->GetUnixTimeSSecTrig()); header.SetECalTimeSinceBusy(this->GetTimeSinceBusy()); break; case 'S': header.SetSMRDSecond(this->GetUnixTimeTrig()); header.SetSMRDSubSecond(this->GetUnixTimeSSecTrig()); header.SetSMRDTimeSinceBusy(this->GetTimeSinceBusy()); break; case 'I': header.SetINGRIDSecond(this->GetUnixTimeTrig()); header.SetINGRIDSubSecond(this->GetUnixTimeSSecTrig()); header.SetINGRIDTimeSinceBusy(this->GetTimeSinceBusy()); break; default: COMETWarn("Unknown clock module"); break; } } //_____________________________________________________________________________ void COMET::IMCMBank::Print(const Option_t* opt /* = "" */) const { this->COMET::IMidasBank::Print(""); TString option = opt; option.ToLower(); if ( option.Contains("v")) { Char_t buff[1000]; Int_t n=0; n += sprintf(buff+n,"Trigger word %16.16llx",this->GetTriggerWord()); COMETLog(buff); #if 1 n=0; n += sprintf(buff+n,"UnixTimeTrig......$%8.8x ",this->GetUnixTimeTrig() ); n += sprintf(buff+n,"ssec..............$%8.8x",this->GetUnixTimeSSecTrig()); COMETLog(buff); n=0; n += sprintf(buff+n,"EventTime........%10d",this->GetEventTime()); COMETLog(buff); n=0; n += sprintf(buff+n,"TriggerSep.......%10d ",this->GetTriggerSep() ); n += sprintf(buff+n,"TimeBetwEvent....%10d",this->GetTimeBetwEvent()); COMETLog(buff); n=0; n += sprintf(buff+n,"AddrBIgnore.......$%8.8x ",this->GetAddrBIgnore()); n += sprintf(buff+n,"TriggerSelected..%10d",this->GetTriggerSelected()); COMETLog(buff); n=0; n += sprintf(buff+n,"SeqSwitchTimeSec..$%8.8x ",this->GetSeqSwitchTimeSec() ); n += sprintf(buff+n,"SeqSwitchTimeSSec.$%8.8x",this->GetSeqSwitchTimeSSec()); COMETLog(buff); n=0; n += sprintf(buff+n,"SeqLastEv........%10d ",this->GetSeqLastEv() ); n += sprintf(buff+n,"TimeSinceBusy....%10d",this->GetTimeSinceBusy()); COMETLog(buff); n=0; n += sprintf(buff+n,"TotalTimeLive....%10d ",this->GetTotalTimeLive() ); n += sprintf(buff+n,"TotalRunTime.....%10d",this->GetTotalRunTime()); COMETLog(buff); #endif n=0; n += sprintf(buff+n,"Spill Accepted %8x Live %8x Alloc %8x" ,this->GetSpillAccepted() ,this->GetSpillLive() ,this->GetSpillAlloc() ); COMETLog(buff); n=0; n += sprintf(buff+n,"Ped Accepted %8x Live %8x Alloc %8x" ,this->GetPedAccepted() ,this->GetPedLive() ,this->GetPedAlloc() ); COMETLog(buff); n=0; n += sprintf(buff+n,"TPCLaser Accepted %8x Live %8x Alloc %8x" ,this->GetTPCLaserAccepted() ,this->GetTPCLaserLive() ,this->GetTPCLaserAlloc() ); COMETLog(buff); n=0; n += sprintf(buff+n,"P0DLED Accepted %8x Live %8x Alloc %8x" ,this->GetP0DLEDAccepted() ,this->GetP0DLEDLive() ,this->GetP0DLEDAlloc() ); COMETLog(buff); n=0; n += sprintf(buff+n,"ECALLED Accepted %8x Live %8x Alloc %8x" ,this->GetECALLEDAccepted() ,this->GetECALLEDLive() ,this->GetECALLEDAlloc() ); COMETLog(buff); n=0; n += sprintf(buff+n,"FGDLED Accepted %8x Live %8x Alloc %8x" ,this->GetFGDLEDAccepted() ,this->GetFGDLEDLive() ,this->GetFGDLEDAlloc() ); COMETLog(buff); n=0; n += sprintf(buff+n,"FEECal Accepted %8x Live %8x Alloc %8x" ,this->GetFEECalAccepted() ,this->GetFEECalLive() ,this->GetFEECalAlloc() ); COMETLog(buff); n=0; n += sprintf(buff+n,"TripTCosmic Accepted %8x Live %8x Alloc %8x" ,this->GetTripTCosmicAccepted() ,this->GetTripTCosmicLive() ,this->GetTripTCosmicAlloc() ); COMETLog(buff); n=0; n += sprintf(buff+n,"FGDCosmic Accepted %8x Live %8x Alloc %8x" ,this->GetFGDCosmicAccepted() ,this->GetFGDCosmicLive() ,this->GetFGDCosmicAlloc() ); COMETLog(buff); for (unsigned int i=42; iGetSize32(); i+=4) { n=0; n += sprintf(buff+n," %3d of %3d:",i,this->GetSize32()); for (unsigned int j=i; jGetSize32()) break; n += sprintf(buff+n," %8x",*(this->GetData32() + j)); } COMETLog(buff); } } }