Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit b2eda57b authored by dino's avatar dino
Browse files

EventBuilder used as Merger accepts a left margin on the coincidence window

git-svn-id: svn://gal-serv.lnl.infn.it/agata/trunk/narval_emulator@1130 170316e4-aea8-4b27-aad4-0380ec0519c9
parent eb12a621
......@@ -46,14 +46,11 @@ ${ACTORS}/filters/PostPSA
${ACTORS}/filters/Global
${ACTORS}/filters/Tracking ${ACTORS}/filters/Tracking/includeOFT ${ACTORS}/filters/Tracking/includeMGT
${ACTORS}/builders
${ADFDIR} ${ADFDIR}/standalone
${AGADIR}/include
${PRISMA}/include
${Boost_INCLUDE_DIR}
/usr/include/skstream-0.3 /usr/lib/skstream-0.3/include
${ROOT_INCLUDE_DIR}
${ACTORS}/producers/Basic
${ACTORS}/consumers/Basic
/usr/include/skstream-0.3 /usr/lib/skstream-0.3/include
)
SET(actors_SRCS
......@@ -99,8 +96,10 @@ IF(NOT WIN32)
ENDIF()
SET(adf_SRCS
${ADFDIR}/ADFCentralLog.cpp
${ADFDIR}/ADFConfig.cpp
${ADFDIR}/ADFObjects.cpp
${ADFDIR}/ADFLogCollector.cpp
${ADFDIR}/ADFLogMessage.cpp
${ADFDIR}/AgataConfigurationFrame.cpp
${ADFDIR}/AgataFrameFactory.cpp
${ADFDIR}/AgataKeyFactory.cpp
......@@ -113,6 +112,7 @@ ${ADFDIR}/ConfigurationFrame.cpp
${ADFDIR}/Counter.cpp
${ADFDIR}/CrystalFrame.cpp
${ADFDIR}/DataHandling.cpp
${ADFDIR}/DefaultFrameFactory.cpp
${ADFDIR}/DefaultKeyFactory.cpp
${ADFDIR}/DFAgent.cpp
${ADFDIR}/DotConf.cpp
......@@ -121,7 +121,6 @@ ${ADFDIR}/Frame.cpp
${ADFDIR}/FrameBlock.cpp
${ADFDIR}/FrameFactory.cpp
${ADFDIR}/FrameIO.cpp
${ADFDIR}/GenericFrame.cpp
${ADFDIR}/GObject.cpp
${ADFDIR}/Hits.cpp
${ADFDIR}/Key.cpp
......@@ -130,15 +129,10 @@ ${ADFDIR}/MetaFrame.cpp
${ADFDIR}/NarvalInterface.cpp
${ADFDIR}/RunAgent.cpp
${ADFDIR}/Signals.cpp
${ADFDIR}/TrackedFrame.cpp
${ADFDIR}/Trigger.cpp
${ADFDIR}/Version.cpp
${ADFDIR}/standalone/CentralLog.cpp
${ADFDIR}/standalone/LogCollector.cpp
${ADFDIR}/standalone/LogMessage.cpp
${ADFDIR}/BasicAFC.cpp
${ADFDIR}/BasicAFP.cpp
${ADFDIR}/DefaultFrameFactory.cpp
)
SET(PRISMA_SRCS
......
......@@ -462,6 +462,27 @@ bool topologyRead(string topo)
vector<string> loopValues;
vector<string> loopActors;
//LOOP CRY 1R 1G 1B 2R 2G 2B 3R 3G 3B 4R 4G 4B
// Chain 3 CRY
// Producer BasicAFP 1000000
// Filter PostPSAFilter
// Dispatcher EventBuilder
//ENDLOOP
//
//Chain 3 Ancillary
//Producer AncillaryProducerTCP 5000000
//Filter AncillaryFilterVME
//Dispatcher EventMerger
//
//Chain 2 Global/
//Builder EventBuilder 10000000
//Dispatcher EventMerger
//
//Chain 3 Global/
//Builder EventMerger 5000000
//Filter TrackingFilterOFT
//Consumer BasicAFC
string line, keyw, data;
while(true) {
// read new line or get it from stored loop statements
......
......@@ -21,8 +21,9 @@ EventBuilder::EventBuilder(std::string name, unsigned int nch) :
fOdirPrefix.clear();
useEventNumber = false;
timeout = 100*tst1second;
tsumbus = 100;
minFold = 1;
sumbusL = 0;
sumbusR = 100;
minFold = 1;
verbose = false;
details = 0;
......@@ -35,7 +36,7 @@ EventBuilder::EventBuilder(std::string name, unsigned int nch) :
#endif //EVB_MULTIHIST
minTstamp = 0;
numKeys = 0;
numKeys = 0;
Reset(nch);
......@@ -58,7 +59,7 @@ EventBuilder::~EventBuilder() {
//PrintStat();
}
bool EventBuilder::Reset(int nch, int wminfold, int wsumbus)
bool EventBuilder::Reset(int nch, int wminfold, int wsumbus, int zsumbus)
{
if(nchains > 0) {
if(evq) { delete [] evq; evq = NULL; }
......@@ -98,10 +99,21 @@ bool EventBuilder::Reset(int nch, int wminfold, int wsumbus)
statKeys = new UInt_t[nchains+1]; memset(statKeys, 0, sizeof(UInt_t)*(nchains+1));
iqueSize = new UInt_t[nchains ]; memset(iqueSize, 0, sizeof(UInt_t)*nchains);
isGood = new Bool_t[nchains ]; memset(isGood, false, sizeof(Bool_t)*nchains);
//isGood = new Bool_t[nchains ]; memset(isGood, false, sizeof(Bool_t)*nchains);
isGood = new Int_t [nchains ]; memset(isGood, 0, sizeof(Int_t)*nchains);
timeout = 100*tst1second;
tsumbus = wsumbus;
minFold = wminfold;
// checks to ensure consistency (0 <=z <=w)
int tR = abs(wsumbus);
int tL = abs(zsumbus);
if(tR >= tL) {
sumbusL = tL;
sumbusR = tR;
}
else {
sumbusL = tR;
sumbusR = tL;
}
minFold = max(1, wminfold);
errState = 0;
noBuild1 = 0;
noBuild2 = 0;
......@@ -225,14 +237,14 @@ void EventBuilder::Process(void *obuffer, unsigned int osize, unsigned int *used
continue;
UInt_t i4fs = 0;
if(numKeys < minFold) {
if(numKeys<minFold || isGood[nn]<0) {
// remove it from input queue
i4fs = evq[nn].moveOut(NULL);
}
else {
#ifdef EVB_MULTIHIST
// before moving it out, increment the tstamp-diff spectrum
if(EvbSpecTdiff && nn != minChain) {
if(EvbSpecTdiff/* && nn != minChain*/) {
int tdiff = int(evq[nn].getTstamp() - minTstamp);
EvbSpecTdiff->Incr(0, tdiff);
}
......@@ -407,7 +419,8 @@ void EventBuilder::CheckEvent_Evnum()
// check how many are equal to minEvnum
for(UInt_t nn = 0; nn < nchains; nn++) {
isGood[nn] = false; // preset to no action
//isGood[nn] = false; // preset to no action
isGood[nn] = 0; // preset to no action
if(evq[nn].isEmpty())
continue; // empty
if(evq[nn].evnFirst != minEvnum)
......@@ -419,7 +432,8 @@ void EventBuilder::CheckEvent_Evnum()
minChain = nn;
}
evq[nn].totCount++;
isGood[nn] = true;
//isGood[nn] = true;
isGood[nn] = 1;
numKeys++;
}
minTstamp = minTstamp;
......@@ -449,20 +463,41 @@ void EventBuilder::CheckEvent_Tstamp()
sTstamps->add(UInt_t((minTstamp>>32)&0xFFFFFFFF));
}
// check how many are closer than tsumbus to minTstamp
ULong64_t maxTstamp = minTstamp + tsumbus; // upper margin of time window
// check how many are inside the timestamp window
ULong64_t tstampR = minTstamp + sumbusR; // upper margin of time window
for(UInt_t nn = 0; nn < nchains; nn++) {
isGood[nn] = false; // preset to no action
isGood[nn] = 0; // preset to no action
if(evq[nn].isEmpty())
continue; // empty
if(evq[nn].tstFirst > maxTstamp)
if(evq[nn].tstFirst > tstampR)
continue; // out of time window
// ok, preset to move this frame to the output buffer
minEvnum = min(minEvnum, evq[nn].evnFirst);
evq[nn].totCount++;
isGood[nn] = true;
isGood[nn] = 1;
numKeys++;
}
// this is for "merger" behaviour: pass over what has tStamp >= left AND the queue with the lowest Tstamp (minChain)
// It works for only because in AGATA the ancillaries arrive always (?) ~ 100 samples before the Ge detectors
// To do this properly in all situation one has to write a real EventMerger which knows the purpose of the input queues
if(sumbusL>0) {
ULong64_t tstampL = minTstamp + sumbusL;
for(UInt_t nn = 0; nn < nchains; nn++) {
if(!isGood[nn] || nn==minChain) // to save the reference
continue;
// chains that satisfy the upper margin but are before the lower margin
if(evq[nn].tstFirst < tstampL) {
isGood[nn] = -1;
numKeys--;
}
}
if(numKeys==0) // 0 is used for inconsistent events
numKeys = -1;
else
numKeys = numKeys;
}
}
// gActualClass used to identify the setup file of the specific builder
......@@ -529,12 +564,12 @@ bool EventBuilder::InitBuilder()
if(!InitKeys(nchains))
return false;
Reset(nchains, minFold, (int)tsumbus);
Reset(nchains, minFold, (int)sumbusR, (int)sumbusL);
if(useEventNumber)
cout << "\n ==> " << gActualClass << " uses EventNumber" << endl;
else
cout << "\n ==> " << gActualClass << " uses TimeStamp : time interval is " << tsumbus << " samples" << endl;
cout << "\n ==> " << gActualClass << " uses TimeStamp : time interval is " << sumbusR << " samples" << endl;
cout << " ==> Minimum fold is " << minFold << endl;
......@@ -621,14 +656,17 @@ void EventBuilder::GetParameters(UInt_t *error_code)
forceTailSlash(fOdirPrefix);
KEND;
KPAR("BuilderType", "%s", "builder type (TimeStamp | EventNumber)");
KPAR("BuilderType", "%s [%s]", "builder type(TimeStamp | EventNumber) window [lower]");
stringSplit(data, keyw, value);
if( stringEq(keyw, "TimeStamp") ) {
useEventNumber = false;
if(value.size() > 0) {
int nn = atoi(value.c_str());
int v1, v2;
int nn = sscanf(value.c_str(), "%d %d", &v1, &v2);
if(nn > 0)
tsumbus = nn;
sumbusR = v1;
if(nn > 1)
sumbusL = v2;
}
ok = true;
}
......
......@@ -54,10 +54,11 @@ public:
Bool_t useEventNumber;
ULong64_t timeout;
ULong64_t tsumbus;
UInt_t minFold;
Bool_t verbose;
ULong64_t sumbusL; // lower value of the time window ( see comments in CheckEvent_Tstamp() )
ULong64_t sumbusR; // upper value of the time window
Int_t minFold;
Int_t details;
Bool_t verbose;
std::vector<std::string> sKeyIn;
std::vector<unsigned int> uKeyIn;
......@@ -74,7 +75,8 @@ public:
EventQueue *evq;
UInt_t *statKeys;
UInt_t *iqueSize;
Bool_t *isGood;
//Bool_t *isGood;
Int_t *isGood;
ChainLocker **inqLocker;
Bool_t *inqLocked;
......@@ -86,7 +88,8 @@ public:
UInt_t errState;
UInt_t noBuild1;
UInt_t noBuild2;
UInt_t numKeys;
//UInt_t numKeys;
Int_t numKeys;
bool fUseMultiHist;
#ifdef EVB_MULTIHIST
......@@ -106,7 +109,7 @@ public:
virtual ~EventBuilder();
bool Reset( int nch , int wminfold = 1, int wsumbus = 300);
bool Reset( int nch , int wminfold = 1, int wsumbus = 100, int zsumbus = 0);
bool setChain(int ichain, ChainLocker * pLock) {
inqLocker[ichain] = pLock;
......
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