///////////////////////////////////////////////////////// /// $Id: ITriggerBank.cxx,v 1.7 2011/12/08 18:13:23 lindner Exp $ /// /// Implement the COMET::IMCMBank class... #include //#include #include "IMidasBankProxyRegistry.hxx" #include "ITriggerBank.hxx" // Register the bank MIDAS bank mask for the family of bank names that map to // this class REGISTER_MIDAS_BANK(ITriggerBank,OTRI;ITRI;FTRI;ETRI;STRI;PTRI;TTRI) // Typically the class constructors do nothing beyond passing their arguments // to the IMidasBank base class and the destructor does nothing. //_____________________________________________________________________________ COMET::ITriggerBank::ITriggerBank() : IMidasBank(0,TTRIGGER_BANK_TITLE) { // Default constructor COMETTrace("ITriggerBank: Default ctor at:" << (void*) this); } //_____________________________________________________________________________ COMET::ITriggerBank::ITriggerBank(const ULong64_t *bank, const char* title /* = TTRIGGER_BANK_TITLE */) : IMidasBank(bank,title) { // Normal constructor COMETTrace("COMET::ITriggerBank: Normal ctor at:" << (void*) this << "\n Name:'" << this->GetName() << "'; Title:" << title << "; Bank size:" << this->GetBankSize() << "; starts at:" << (void*) this->GetBank()); } //_____________________________________________________________________________ COMET::ITriggerBank::~ITriggerBank() { COMETTrace("COMET::ITriggerBank: dtor at:" << (void*) this); } void COMET::ITriggerBank::SetContext(COMET::IRawDataHeader& header) const { // Figure out which bank we have here; if the bank name is FTRI then fill the FGD-CTM // trigger pattern field in ICOMETEvent. // Otherwise, then fill the TFB-CTM trigger pattern field in ICOMETEvent. if(std::string(GetName()) == "FTRI"){ header.SetFGDCTMTriggerPattern(0,GetTriggerPatternLow()); header.SetFGDCTMTriggerPattern(1,GetTriggerPatternMid()); header.SetFGDCTMTriggerPattern(2,GetTriggerPatternHigh()); }else{ header.SetCTMTriggerPattern(0,GetTriggerPatternLow()); header.SetCTMTriggerPattern(1,GetTriggerPatternMid()); header.SetCTMTriggerPattern(2,GetTriggerPatternHigh()); } } //_____________________________________________________________________________ void COMET::ITriggerBank::Print(const Option_t* opt /* = "" */) const { this->COMET::IMidasBank::Print(""); TString option = opt; option.ToLower(); if ( option.Contains("i")) { Char_t buff[1000]; Int_t n=0; Int_t spill = (this->GetTriggerWord()>>32)&0xffff; n += sprintf(buff+n,"Trigger word %16.16llx spill decimal %d",this->GetTriggerWord(),spill); COMETLog(buff); n=0; ULong64_t twl = this->GetTriggerPatternLow(); ULong64_t twm = this->GetTriggerPatternMid(); ULong64_t twh = this->GetTriggerPatternHigh(); n += sprintf(buff+n,"Trigger pattern (128-191) %16.16llx (64-127) %16.16llx (0-63) %16.16llx" ,twh, twm, twl); Int_t count = 0; for (Int_t i=1; i; i=i<<1) { if (twh&i) count++; if (twm&i) count++; if (twl&i) count++; } n += sprintf(buff+n," (#bits on %d)",count); COMETLog(buff); } }