Commit 0e300999 authored by dino's avatar dino
Browse files

EventBuilder does not add the composite-frame key if keyOut given as None

Keyword TriggerMask in TrackingFilter.conf to selectively register any of the 6 programmed triggers (default is as before: 111100).

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1136 170316e4-aea8-4b27-aad4-0380ec0519c9
parent c145653d
......@@ -185,7 +185,7 @@ void EventBuilder::Process(void *obuffer, unsigned int osize, unsigned int *used
}
unsigned int *obuf = (unsigned int *)obuffer;
unsigned int opos = 5; // leave space for event key
unsigned int opos = uKeyOut ? 5 : 0; // space for key sourrounding the composite event (if requested)
unsigned int osiz = 0; // used length of output buffers
unsigned int osizMax = ((osize/4)*9)/10; // never fill more than 90%
obufFull = false;
......@@ -266,7 +266,7 @@ void EventBuilder::Process(void *obuffer, unsigned int osize, unsigned int *used
// check for inversions
if(useEventNumber) {
if( (evq[nn].evnFirst > evq[nn].evnLast) ||
(evq[nn].tstFirst > evq[nn].tstLast) ) {
(evq[nn].tstFirst > evq[nn].tstLast) ) {
evq[nn].Error(nn);
allPresent = false;
goAhead = false;
......@@ -274,9 +274,9 @@ void EventBuilder::Process(void *obuffer, unsigned int osize, unsigned int *used
}
else {
if( (evq[nn].tstFirst > evq[nn].tstLast) ) {
evq[nn].Error(nn);
allPresent = false;
goAhead = false;
evq[nn].Error(nn);
allPresent = false;
goAhead = false;
}
}
}
......@@ -292,12 +292,13 @@ void EventBuilder::Process(void *obuffer, unsigned int osize, unsigned int *used
// obuf[opos] = 0;
// opos++;
//}
obuf[0] = opos*4;
obuf[1] = uKeyOut;
obuf[2] = useEventNumber ? minEvnum : nevCount;
obuf[3] = (unsigned int)( minTstamp & 0xFFFFFFFF);
obuf[4] = (unsigned int)((minTstamp>>32) & 0xFFFFFFFF);
if(uKeyOut) { // this part only if surrounding frame was requested
obuf[0] = opos*4;
obuf[1] = uKeyOut;
obuf[2] = useEventNumber ? minEvnum : nevCount;
obuf[3] = (unsigned int)( minTstamp & 0xFFFFFFFF);
obuf[4] = (unsigned int)((minTstamp>>32) & 0xFFFFFFFF);
}
osiz += opos; // total size used so far
obuf += opos; // advance pointer to output buffer
......@@ -311,7 +312,7 @@ void EventBuilder::Process(void *obuffer, unsigned int osize, unsigned int *used
obufFull = true;
break;
}
opos = 5; // where to start writing next event, relative to obuf
opos = uKeyOut ? 5 : 0; // where to start writing next event, relative to obuf
}
*used_osize = osiz*4;
......@@ -829,11 +830,14 @@ bool EventBuilder::InitKeys(unsigned int nv)
}
uKeyIn.push_back(mess);
}
mess = 0;
ok = ADF::AgataKeyFactory::theFactory()->GetMessage(sKeyOut, mess);
if(!ok) {
cout << "EventBuilder::InitKeys could not map \"" << sKeyOut << "\" to a numeric value" << endl;
nerrors++;
if(!stringEq(sKeyOut, "None")) {
ok = ADF::AgataKeyFactory::theFactory()->GetMessage(sKeyOut, mess);
if(!ok) {
cout << "EventBuilder::InitKeys could not map \"" << sKeyOut << "\" to a numeric value" << endl;
nerrors++;
}
}
uKeyOut = mess;
......
......@@ -60,6 +60,8 @@ TrackingFilter::TrackingFilter() :
fWhichRotoTranslations = "CrystalPositionLookUpTable";
fTriggerMask = "111100"; // the first 4 are enabled by default (leftmost = b0)
fAncRawFrameNum = 1;
fAncRawFrameStr = "data:ranc1";
......@@ -498,6 +500,14 @@ void TrackingFilter::DefineTriggers(UInt_t *error_code)
fAncRawFrameStr = string(chtmp);
cout << endl;
UInt_t whichTriggers = 0;
for(size_t ll = 0; ll < fTriggerMask.size(); ll++) {
if(fTriggerMask[ll] != '0')
whichTriggers |= 1<<ll;
if(ll > 31)
break;
}
#if 1
// Trigger on event:data &event:data:psa |data:rancN inside (normal output of EventMerger, with or without ancillary)
rerr = 0;
......@@ -514,16 +524,18 @@ void TrackingFilter::DefineTriggers(UInt_t *error_code)
frame = fTriggerEventData_1X.SetOutputFrame("Agata", "data:tracked");
if(!frame)
rerr |= 4;
if( !fFrameIO.Register(&fTriggerEventData_1X) )
rerr |= 1;
if(whichTriggers & 3) {
if( !fFrameIO.Register(&fTriggerEventData_1X) )
rerr |= 1;
}
if(rerr) {
cout << errMsg + trigName + " --> " << rerr << endl;
*error_code = 100 + rerr;
return;
}
cout << "Trigger " << setw(2) << trigNums << " " << "event:data &event:data:psa &" << fAncRawFrameStr << endl;
cout << "Trigger " << setw(2) << trigNums << " [" << ((whichTriggers&3)?1:0) << "] event:data &event:data:psa &" << fAncRawFrameStr << endl;
nTriggerEventData_11 = trigNums++; // event:data:psa WITH data:rancN
cout << "Trigger " << setw(2) << trigNums << " " << "event:data &event:data:psa !" << fAncRawFrameStr << endl;
cout << "Trigger " << setw(2) << trigNums << " [" << ((whichTriggers&3)?1:0) << "] event:data &event:data:psa !" << fAncRawFrameStr << endl;
nTriggerEventData_10 = trigNums++; // event:data:psa WITHOUT data:rancN
#endif
......@@ -541,14 +553,16 @@ void TrackingFilter::DefineTriggers(UInt_t *error_code)
frame = fTriggerEventData_01.Add("Agata", fAncRawFrameStr.c_str(), 0, false); // keep input data
if(!frame)
rerr |= 32;
if( !fFrameIO.Register(&fTriggerEventData_01) )
rerr |= 1;
if(whichTriggers & 4) {
if( !fFrameIO.Register(&fTriggerEventData_01) )
rerr |= 1;
}
if(rerr) {
cout << errMsg + trigName + " --> " << rerr << endl;
*error_code = 100 + rerr;
return;
}
cout << "Trigger " << setw(2) << trigNums << " " << trigName << endl;
cout << "Trigger " << setw(2) << trigNums << " [" << ((whichTriggers&4)?1:0) << "] " << trigName << endl;
nTriggerEventData_01 = trigNums++;
#endif
......@@ -562,14 +576,16 @@ void TrackingFilter::DefineTriggers(UInt_t *error_code)
frame = fTriggerEventDataPSA.SetOutputFrame("Agata", "data:tracked");
if(!frame)
rerr |= 4;
if( !fFrameIO.Register(&fTriggerEventDataPSA) )
rerr |= 1;
if(whichTriggers & 8) {
if( !fFrameIO.Register(&fTriggerEventDataPSA) )
rerr |= 1;
}
if(rerr) {
cout << errMsg + trigName + " --> " << rerr << endl;
*error_code = 100 + rerr;
return;
}
cout << "Trigger " << setw(2) << trigNums << " " << trigName << endl;
cout << "Trigger " << setw(2) << trigNums << " [" << ((whichTriggers&8)?1:0) << "] " << trigName << endl;
nTriggerEventDataPSA = trigNums++;
#endif
......@@ -584,15 +600,16 @@ void TrackingFilter::DefineTriggers(UInt_t *error_code)
frame = fTriggerDataPSA.SetOutputFrame("Agata", "data:tracked");
if(!frame)
rerr |= 4;
// UNCOMMENT if you want/need to trigger on this data
//if( !fFrameIO.Register(&fTriggerDataPSA) )
// rerr |= 1;
if(whichTriggers & 16) {
if( !fFrameIO.Register(&fTriggerDataPSA) )
rerr |= 1;
}
if(rerr) {
cout << errMsg + trigName + " --> " << rerr << endl;
*error_code = 100 + rerr;
return;
}
cout << "Trigger " << setw(2) << trigNums << " " << trigName << endl;
cout << "Trigger " << setw(2) << trigNums << " [" << ((whichTriggers&16)?1:0) << "] " << trigName << endl;
nTriggerDataPSA = trigNums++;
#endif
......@@ -604,15 +621,16 @@ void TrackingFilter::DefineTriggers(UInt_t *error_code)
frame = fTriggerDataRawAnc.Add("Agata", fAncRawFrameStr.c_str(), 0, true); // discard input data
if(!frame)
rerr |= 8;
// UNCOMMENT if you want/need to trigger on this data
//if( !fFrameIO.Register(&fTriggerDataRawAnc) )
// rerr |= 1;
if(whichTriggers & 32) {
if( !fFrameIO.Register(&fTriggerDataRawAnc) )
rerr |= 1;
}
if(rerr) {
cout << errMsg + trigName + " --> " << rerr << endl;
*error_code = 100 + rerr;
return;
}
cout << "Trigger " << setw(2) << trigNums << " " << trigName << endl;
cout << "Trigger " << setw(2) << trigNums << " [" << ((whichTriggers&32)?1:0) << "] " << trigName << endl;
nTriggerDataRawAnc = trigNums++;
#endif
......@@ -1392,6 +1410,11 @@ void TrackingFilter::GetParameters(UInt_t *error_code)
ok = true;
KEND;
KPAR("TriggerMask", "%s", "string of 1/0 to selectively register the 6 triggers ["+fTriggerMask+"]");
fTriggerMask = data;
ok = true;
KEND;
KPAR("OutputModel", "%s", "kSafe | kStrict | kGrowing behaviour for ad");
if( stringEq(data, "kSafe") ) {
fWriteModel = ConfAgent::kSafe;
......@@ -2183,6 +2206,11 @@ bool TrackingFilter::AnalysisOfCrystals()
}
}
}
if(TrackSpec_EE) {
TrackSpec_EE->Incr(0, 8, int(fEnergyGain*esumCC));
if(number_of_crystals==1)
TrackSpec_EE->Incr(0, 9, int(fEnergyGain*esumCC));
}
if(TrackSpec_ES && number_of_crystals > 0 && number_of_crystals < fNumGeDets) {
TrackSpec_ES->Incr(0, 0, int(esumCC)); // total sum energy
TrackSpec_ES->Incr(0, number_of_crystals, int(esumCC)); // sum energy [fold]
......
......@@ -222,6 +222,8 @@ protected:
ADF::ConfAgent::EModel fWriteModel;
bool fSetWriteModel;
std::string fTriggerMask;
UShort_t crystal_id;
UShort_t crystal_status;
Float_t CoreE[2];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment