Skip to content

Commit

Permalink
Merge pull request #138 from JeffersonLab/davidl_DEventTag
Browse files Browse the repository at this point in the history
Davidl DEventTag
  • Loading branch information
staylorjlab committed Dec 9, 2015
2 parents 623b2f2 + 192b145 commit 7bc50d4
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/libraries/DAQ/DAQ_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -59,6 +60,7 @@ jerror_t DAQ_init(JEventLoop *loop)
loop->AddFactory(new JFactory<DCODAEventInfo>());
loop->AddFactory(new JFactory<DCODAROCInfo>());
loop->AddFactory(new JFactory<DEPICSvalue>());
loop->AddFactory(new JFactory<DEventTag>());

return NOERROR;
}
39 changes: 39 additions & 0 deletions src/libraries/DAQ/DEventTag.h
Original file line number Diff line number Diff line change
@@ -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 <JANA/jerror.h>

#include <TRIGGER/DL3Trigger.h>

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<pair<string,string> > &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_

54 changes: 54 additions & 0 deletions src/libraries/DAQ/JEventSource_EVIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -2860,7 +2863,19 @@ void JEventSource_EVIO::ParseEVIOEvent(evioDOMTree *evt, list<ObjList*> &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<uint32_t> *vec = bankPtr->getVector<uint32_t>();
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 ){
Expand Down Expand Up @@ -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<ObjList*> &events)
{
if(!PARSE_EVENTTAG){ iptr = iend; return; }

if(VERBOSE>5) evioout << " Entering ParseEventTag() (events.size()="<<events.size()<<")" << endl;

// Make sure there is one event in the event container
// and get pointer to it.
if(events.empty()) events.push_back(new ObjList());
ObjList *objs = *(events.begin());


DEventTag *etag = new DEventTag;

// event_status
uint64_t lo = *iptr++;
uint64_t hi = *iptr++;
etag->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
//----------------
Expand Down
3 changes: 3 additions & 0 deletions src/libraries/DAQ/JEventSource_EVIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ typedef pair<int,int> tagNum;
#include "DCODAEventInfo.h"
#include "DCODAROCInfo.h"
#include "DEPICSvalue.h"
#include "DEventTag.h"

extern set<uint32_t> ROCIDS_TO_PARSE;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -364,6 +366,7 @@ class JEventSource_EVIO: public jana::JEventSource{
void ParseEPICSevent(evioDOMNodeP bankPtr, list<ObjList*> &events);
#endif // HAVE_EVIO
void ParseModuleConfiguration(int32_t rocid, const uint32_t* &iptr, const uint32_t *iend, list<ObjList*> &events);
void ParseEventTag(const uint32_t* &iptr, const uint32_t *iend, list<ObjList*> &events);
void ParseJLabModuleData(int32_t rocid, const uint32_t* &iptr, const uint32_t *iend, list<ObjList*> &events);
void Parsef250Bank(int32_t rocid, const uint32_t* &iptr, const uint32_t *iend, list<ObjList*> &events);
void Parsef125Bank(int32_t rocid, const uint32_t* &iptr, const uint32_t *iend, list<ObjList*> &events);
Expand Down
32 changes: 14 additions & 18 deletions src/programs/Analysis/hd_dump/MyProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;i<toprint.size();i++){
for(unsigned int i=0;i<toprint.size();i++){

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
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;
Expand All @@ -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;i<fac_info.size();i++){
try{
string name =fac_info[i].dataClassName;
string tag = fac_info[i].tag;
eventLoop->Print(name,tag.c_str());

if(LIST_ASSOCIATED_OBJECTS)PrintAssociatedObjects(eventLoop, &fac_info[i]);
}catch(...){
// exception thrown
Expand Down

0 comments on commit 7bc50d4

Please sign in to comment.