#include "ITpcTriggerDecoder.hxx" bool ITpcTriggerDecoder::Decode(const UInt_t *buffPtr,int buffSize){ //bool ITpcTriggerDecoder::Decode(const ULong64_t* buffPtr,int buffSize){ UInt_t *tr32 = (UInt_t*) buffPtr; //if(buffSize!=2) // std::cout << " _________________" << std::endl; //std::cout << " BuffSize " << buffSize << std::endl; trigevt = *(tr32++); trigH = *(tr32++); trigL = *(tr32++); // if( buffSize == 24 ) { // if( buffSize > 3 ) { latency = *(tr32++); size = *(tr32++); #if __DEBUG__ std::cout << " _________________" << std::endl; //} std::cout << trigevt << " " << std::endl; std::cout << " Trigger Mask 0x" << std::hex << (trigH>>16&0xFFFF) << std::endl; std::cout << " 0x" << std::hex << trigH << " " << std::endl; std::cout << " 0x" << trigL << std::dec << " " << std::endl; std::cout << " Latency =" << (latency) << " " << std::endl; std::cout << " Size =" << (size) << " " << std::endl; #endif return true; } bool ITpcTriggerDecoder::Process(COMET::ICOMETEvent& event){ if( (int) event.GetHeader().GetTriggerBits() == 0x0 ) return false; // Get the raw event COMET::IHandle rawEvent = COMET::IEventFolder::GetCurrentEvent()->GetRaw(); if (!rawEvent) return false; latencyOld = 0; latencyMax = 0; sizeMax = 0; // Loop over all TPC DCC banks in this raw event for( int i = 0; i < NDCC ; i++ ) { char name[64]; sprintf(name,"TT%2.2d",i); COMET::IHandle midasBank(rawEvent->GetMidasBank(name)); #if __DEBUG__ printf(" Bank %s \n",name); std::cout << " Event trigger 0x" << std::hex << event.GetHeader().GetTriggerBits() << std::dec << std::endl; #endif if( midasBank ) { Decode(midasBank->GetData32(), midasBank->GetSize32()); // Decode(midasBank->GetData(), midasBank->GetSize()); } if(latency > latencyOld) { latencyMax = latency; sizeMax = size; } latencyOld = latency; } return true; }