//-------------------------------------------------------------------------- // Description: // Class MyronModeFilterModule: module for analysing the data taken in // Myron mode // // Environment: CDF Run II // // Author List: P.Murat //------------------------------------------------------------------------ #include #include #include "TInterpreter.h" #include "AbsEnv/AbsEnv.hh" #include "Bbos/bank_interface.hh" #include "evt/Event.hh" #include "RootObjs/Event/TrybosBank.hh" #include "StorableBanks/TSID_StorableBank.hh" #include #include #include "Stntuple/mod/MyronModeFilterModule.hh" // ClassImp(MyronModeFilterModule) // initialize static class members //______________________________________________________________________________ MyronModeFilterModule::MyronModeFilterModule(const char* name, const char* desc): AppFilterModule(name,desc) { gMyronEventList = new TObjArray(); gMyronCachedEvent = 0; gMyronFilterPassed = 0; } //______________________________________________________________________________ MyronModeFilterModule::~MyronModeFilterModule() { gMyronEventList->Delete(); delete gMyronEventList; } //______________________________________________________________________________ AppResult MyronModeFilterModule::beginJob(AbsEvent* event) { return AppResult::OK; } //______________________________________________________________________________ AppResult MyronModeFilterModule::beginRun( AbsEvent* event ) { gMyronEventList->Delete(); return AppResult::OK; } //_____________________________________________________________________________ AppResult MyronModeFilterModule::event(AbsEvent* event) { TSID_StorableBank *tsid, *last_tsid; int bc, last_bc, last_event_id, event_id; AbsEvent* last; // assume that events are ordered (which is a good // assumption if we're using DHInputModule and // turn ContentCatalog flag ON) if (gMyronFilterPassed) { gMyronEventList->Delete(); gMyronEventList->Add(gMyronCachedEvent); gMyronFilterPassed = 0; } int nev = gMyronEventList->GetEntriesFast(); if (nev == 0) { // no events in the buffer last = new AbsEvent(*event); gMyronEventList->Add(last); } else { // buffer is not empty, see if this event // has the same bunch counter as the previous one // - this should do the job in most cases tsid = (TSID_StorableBank*) TRYBOS_BANK::Find(event,"TSID"); bc = tsid->turnCounter(); last = (AbsEvent*) gMyronEventList->At(nev-1); last_tsid = (TSID_StorableBank*) TRYBOS_BANK::Find(last,"TSID"); last_bc = last_tsid->turnCounter(); last_event_id = last_tsid->eventID(); if (bc != last_bc) { // definitely not what we are looking for - // delete all the previously stored events and // put the last to the first place gMyronFilterPassed = 1; gMyronCachedEvent = new AbsEvent(*event); } else { // bunch counter is the same, make sure that this // is really THE NEXT event event_id = tsid->eventID(); if (event_id == last_event_id+1) { // the next event in series of 4 last = new AbsEvent(*event); gMyronEventList->Add(last); nev++; } } } this->setPassed(gMyronFilterPassed); return AppResult::OK; } //______________________________________________________________________________ AppResult MyronModeFilterModule::other(AbsEvent* aNode) { return AppResult::OK; } //______________________________________________________________________________ AppResult MyronModeFilterModule::endRun(AbsEvent* anEvent) { return AppResult::OK; } //______________________________________________________________________________ AppResult MyronModeFilterModule::endJob( AbsEvent* anEvent ) { return AppResult::OK; } //______________________________________________________________________________ AppResult MyronModeFilterModule::abortJob(AbsEvent* anEvent) { return AppResult::OK; }