diff --git a/src/libraries/DAQ/DAQ_init.cc b/src/libraries/DAQ/DAQ_init.cc index 561b624e7..0fad99e84 100644 --- a/src/libraries/DAQ/DAQ_init.cc +++ b/src/libraries/DAQ/DAQ_init.cc @@ -29,6 +29,7 @@ using namespace jana; #include "DCODAEventInfo.h" #include "DCODAROCInfo.h" #include "DEPICSvalue.h" +#include "DEventTag.h" jerror_t DAQ_init(JEventLoop *loop) { @@ -59,6 +60,7 @@ jerror_t DAQ_init(JEventLoop *loop) loop->AddFactory(new JFactory()); loop->AddFactory(new JFactory()); loop->AddFactory(new JFactory()); + loop->AddFactory(new JFactory()); return NOERROR; } diff --git a/src/libraries/DAQ/DEventTag.h b/src/libraries/DAQ/DEventTag.h new file mode 100644 index 000000000..b29db7c95 --- /dev/null +++ b/src/libraries/DAQ/DEventTag.h @@ -0,0 +1,39 @@ +// $Id$ +// +// File: DEventTag.h +// Created: Fri Dec 4 10:14:22 EST 2015 +// Creator: davidl (on Darwin harriet.jlab.org 13.4.0 i386) +// + +#ifndef _DEventTag_ +#define _DEventTag_ + +#include + +#include + +class DEventTag:public jana::JObject{ + public: + JOBJECT_PUBLIC(DEventTag); + + DEventTag(uint64_t es=0L, DL3Trigger::L3_decision_t d=DL3Trigger::kNO_DECISION, uint64_t l3s=0, uint32_t l3a=0) + :event_status(es),L3_decision(d),L3_status(l3s),L3_algorithm(l3a){} + + uint64_t event_status; ///< JANA event status word when event was written + DL3Trigger::L3_decision_t L3_decision; ///< L3 decision when event was written + uint64_t L3_status; ///< L3 status word when event was written + uint32_t L3_algorithm; ///< L3 algorithm identifier when event was written + + // This method is used primarily for pretty printing + // the second argument to AddString is printf style format + void toStrings(vector > &items)const{ + AddString(items, "event_status", "0x%x" , event_status); + AddString(items, "L3_decision" , "%d" , L3_decision); + AddString(items, "L3_status" , "0x%016x" , L3_status); + AddString(items, "L3_algorithm", "0x%08x" , L3_algorithm); + } + +}; + +#endif // _DEventTag_ + diff --git a/src/libraries/DAQ/JEventSource_EVIO.cc b/src/libraries/DAQ/JEventSource_EVIO.cc index 23f2bbfce..9a42c410b 100644 --- a/src/libraries/DAQ/JEventSource_EVIO.cc +++ b/src/libraries/DAQ/JEventSource_EVIO.cc @@ -116,6 +116,7 @@ JEventSource_EVIO::JEventSource_EVIO(const char* source_name):JEventSource(sourc PARSE_CAEN1290TDC = true; PARSE_CONFIG = true; PARSE_EPICS = true; + PARSE_EVENTTAG = true; PARSE_TRIGGER = true; BUFFER_SIZE = 20000000; // in bytes ET_STATION_NEVENTS = 10; @@ -193,6 +194,7 @@ JEventSource_EVIO::JEventSource_EVIO(const char* source_name):JEventSource(sourc gPARMS->SetDefaultParameter("EVIO:PARSE_CAEN1290TDC", PARSE_CAEN1290TDC, "Set this to 0 to disable parsing of data from CAEN 1290 TDC modules (for benchmarking/debugging)"); gPARMS->SetDefaultParameter("EVIO:PARSE_CONFIG", PARSE_CONFIG, "Set this to 0 to disable parsing of ROC configuration data in the data stream (for benchmarking/debugging)"); gPARMS->SetDefaultParameter("EVIO:PARSE_EPICS", PARSE_EPICS, "Set this to 0 to disable parsing of EPICS events from the data stream (for benchmarking/debugging)"); + gPARMS->SetDefaultParameter("EVIO:PARSE_EVENTTAG", PARSE_EVENTTAG, "Set this to 0 to disable parsing of event tag data in the data stream (for benchmarking/debugging)"); gPARMS->SetDefaultParameter("EVIO:PARSE_TRIGGER", PARSE_TRIGGER, "Set this to 0 to disable parsing of the built trigger bank from CODA (for benchmarking/debugging)"); gPARMS->SetDefaultParameter("EVIO:BUFFER_SIZE", BUFFER_SIZE, "Size in bytes to allocate for holding a single EVIO event."); @@ -349,6 +351,7 @@ JEventSource_EVIO::JEventSource_EVIO(const char* source_name):JEventSource(sourc event_source_data_types.insert("DCODAEventInfo"); event_source_data_types.insert("DCODAROCInfo"); event_source_data_types.insert("DEPICSvalue"); + event_source_data_types.insert("DEventTag"); // Read in optional module type translation map if it exists ReadOptionalModuleTypeTranslation(); @@ -2860,7 +2863,19 @@ void JEventSource_EVIO::ParseEVIOEvent(evioDOMTree *evt, list &full_ev ParseBuiltTriggerBank(bankPtr, tmp_events); if(VERBOSE>5) evioout << " Merging objects in ParseEVIOEvent" << endl; MergeObjLists(full_events, tmp_events); + + // Check if this is a DEventTag bank + }else if(bankPtr->tag == 0x0056){ + const vector *vec = bankPtr->getVector(); + if(vec){ + const uint32_t *iptr = &(*vec)[0]; + const uint32_t *iend = &(*vec)[vec->size()]; + ParseEventTag(iptr, iend, tmp_events); + if(VERBOSE>5) evioout << " Merging DEventTag objects in ParseEVIOEvent" << endl; + MergeObjLists(full_events, tmp_events); + } } + continue; // if this wasn't a trigger bank, then it has the wrong lineage to be a data bank } if( physics_event_bank->getParent() != NULL ){ @@ -3271,6 +3286,45 @@ void JEventSource_EVIO::ParseModuleConfiguration(int32_t rocid, const uint32_t* if(VERBOSE>5) evioout << " Leaving ParseModuleConfiguration()" << endl; } +//---------------- +// ParseEventTag +//---------------- +void JEventSource_EVIO::ParseEventTag(const uint32_t* &iptr, const uint32_t *iend, list &events) +{ + if(!PARSE_EVENTTAG){ iptr = iend; return; } + + if(VERBOSE>5) evioout << " Entering ParseEventTag() (events.size()="<event_status = (hi<<32) + lo; + + // L3_status + lo = *iptr++; + hi = *iptr++; + etag->L3_status = (hi<<32) + lo; + + // L3_decision + etag->L3_decision = (DL3Trigger::L3_decision_t)*iptr++; + + // L3_algorithm + etag->L3_algorithm = *iptr++; + + objs->misc_objs.push_back(etag); + + + if(VERBOSE>5) evioout << " Leaving ParseEventTag()" << endl; +} + //---------------- // ParseJLabModuleData //---------------- diff --git a/src/libraries/DAQ/JEventSource_EVIO.h b/src/libraries/DAQ/JEventSource_EVIO.h index a7265f3cd..97b3e2132 100644 --- a/src/libraries/DAQ/JEventSource_EVIO.h +++ b/src/libraries/DAQ/JEventSource_EVIO.h @@ -72,6 +72,7 @@ typedef pair tagNum; #include "DCODAEventInfo.h" #include "DCODAROCInfo.h" #include "DEPICSvalue.h" +#include "DEventTag.h" extern set ROCIDS_TO_PARSE; @@ -213,6 +214,7 @@ class JEventSource_EVIO: public jana::JEventSource{ bool PARSE_CAEN1290TDC; bool PARSE_CONFIG; bool PARSE_EPICS; + bool PARSE_EVENTTAG; bool PARSE_TRIGGER; bool MAKE_DOM_TREE; int ET_STATION_NEVENTS; @@ -364,6 +366,7 @@ class JEventSource_EVIO: public jana::JEventSource{ void ParseEPICSevent(evioDOMNodeP bankPtr, list &events); #endif // HAVE_EVIO void ParseModuleConfiguration(int32_t rocid, const uint32_t* &iptr, const uint32_t *iend, list &events); + void ParseEventTag(const uint32_t* &iptr, const uint32_t *iend, list &events); void ParseJLabModuleData(int32_t rocid, const uint32_t* &iptr, const uint32_t *iend, list &events); void Parsef250Bank(int32_t rocid, const uint32_t* &iptr, const uint32_t *iend, list &events); void Parsef125Bank(int32_t rocid, const uint32_t* &iptr, const uint32_t *iend, list &events); diff --git a/src/programs/Analysis/hd_dump/MyProcessor.cc b/src/programs/Analysis/hd_dump/MyProcessor.cc index fe9ede8a2..07e682f68 100644 --- a/src/programs/Analysis/hd_dump/MyProcessor.cc +++ b/src/programs/Analysis/hd_dump/MyProcessor.cc @@ -115,27 +115,22 @@ jerror_t MyProcessor::evnt(JEventLoop *eventLoop, uint64_t eventnumber) // "boring". int event_is_boring = 1; - if(SKIP_BORING_EVENTS){ - for(unsigned int i=0;iGetFactory(name,tag.c_str()); - if(!factory)factory = eventLoop->GetFactory("D" + name,tag.c_str()); - if(factory){ - try{ - if(factory->GetNrows()>0){ - event_is_boring=0; - if(PRINT_SUMMARY_HEADER)break; - } - }catch(...){ - // someone threw an exception + string name =fac_info[i].dataClassName; + string tag = fac_info[i].tag; + JFactory_base *factory = eventLoop->GetFactory(name,tag.c_str()); + if(!factory)factory = eventLoop->GetFactory("D" + name,tag.c_str()); + if(factory){ + try{ + if(factory->GetNrows()>0){ + event_is_boring=0; + if(PRINT_SUMMARY_HEADER)break; } + }catch(...){ + // someone threw an exception } } - if(event_is_boring)return NOERROR; - }else{ - event_is_boring = 0; } if(SKIP_BORING_EVENTS && event_is_boring)return NOERROR; @@ -161,13 +156,14 @@ jerror_t MyProcessor::evnt(JEventLoop *eventLoop, uint64_t eventnumber) if(PRINT_STATUS_BITS) cout << japp->StatusWordToString(eventLoop->GetJEvent().GetStatus()) << endl; if(PRINT_SUMMARY_HEADER) eventLoop->PrintFactories(SPARSIFY_SUMMARY ? 2:0); - + // Print data for all specified factories for(unsigned int i=0;iPrint(name,tag.c_str()); + if(LIST_ASSOCIATED_OBJECTS)PrintAssociatedObjects(eventLoop, &fac_info[i]); }catch(...){ // exception thrown