From: Jörn Adamczewski-Musch Date: Tue, 7 Jan 2014 10:21:41 +0000 (+0100) Subject: Eventbuilder: Added evaluation of trb3 trigger type from first data X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=327908df05f5cbd9c0ccdbca63dc3fdf78ed338e;p=daqdata.git Eventbuilder: Added evaluation of trb3 trigger type from first data stream as "eventID" for event header (new function SubEvt_trigType_trb3).This is read from bit 4..7 of decoding word of subevent header. If this trb3 trigger type is non zero, it will define eventID. If not, fallback to trb3 behaviour: eventID is evaluated from CTS data word 2 with shift/mask procedure of SubEvt_trigType() function. --- diff --git a/hadaq/evtbuild.c b/hadaq/evtbuild.c index bf14c1d..8bab340 100644 --- a/hadaq/evtbuild.c +++ b/hadaq/evtbuild.c @@ -64,6 +64,10 @@ static RFILE *fRemote = NULL; /*define this to get log output of first 10 triggernumbers*/ /*#define TRIGNO_DEBUG 1*/ +/* switch on output of trigger types by this:*/ +/*#define TRIGTYPE_DEBUG 1*/ + + #define NEVTIDS 64UL /* must be 2^n */ #define NEVTIDS_IN_FILE 0UL /* must be 2^n */ @@ -1281,8 +1285,24 @@ int main(int argc, char *argv[]) if (theArgs->evtId != 0) currId = theArgs->evtId; else if (theArgs->subsysId != 0) { - currId = SubEvt_trigType(subEvt, theArgs->wordNr, theArgs->bitMask, theArgs->bitShift); - } else + /* JAM first check of trb3 trigger type*/ + currId=SubEvt_trigType_trb3(subEvt); +#ifdef TRIGTYPE_DEBUG + sprintf(msglog," Subevent stream %d sees trb3 trigger type 0x%x", + i, currId); + storeLogInfo(theArgs, msglog); +#endif + if(currId==0) + { + /* no trb3 trigger type, use trb2 trigger type from cts data as before*/ + currId = SubEvt_trigType(subEvt, theArgs->wordNr, theArgs->bitMask, theArgs->bitShift); +#ifdef TRIGTYPE_DEBUG + sprintf(msglog," Subevent stream %d use trb2 trigger type 0x%x", + i, currId); + storeLogInfo(theArgs, msglog); +#endif + } + } else currId = SubEvt_pureId(subEvt); /* Insert DAQ version into event Id */ diff --git a/hadaq/subevt.h b/hadaq/subevt.h index 4988b4b..2272ad5 100644 --- a/hadaq/subevt.h +++ b/hadaq/subevt.h @@ -122,6 +122,13 @@ static void SubEvt_setTrigNr(void *my, uint32_t trigNr) SubEvt_setHdrValue(my, SubEvtIdx_trigNr, trigNr); } +static uint32_t SubEvt_trigType_trb3(const void *my) +{ +/* get trb3 trigger type info in bits 4...7*/ + return ((HadTu_decoding(my) & 0xF0) >> 4) ; +} + + static uint32_t SubEvt_decoding(const void *my) { /* JAM: mask out the trb3 trigger type info in bits 4...7*/