@@ -43,57 +43,49 @@ int DCSProcessor::process(const gsl::span<const DPCOM> dps)
4343 LOG (info) << " \n\n\n Processing new TF\n -----------------" ;
4444 }
4545
46- if (mVerbosity > 1 ) {
47- std::unordered_map<DPID , DPVAL > mapin;
48- for (auto & it : dps) {
49- mapin[it.id ] = it.data ;
50- }
46+ // LB: setup counters for ChamberStatus/CFGtag logic
47+ int ChamberStatusDPsCounter = 0 ;
48+ int CFGtagDPsCounter = 0 ;
5149
52- for (auto & it : mPids ) {
53- const auto & el = mapin.find (it.first );
54- if (el == mapin.end ()) {
55- LOG (info) << " DP " << it.first << " not found in map" ;
56- } else {
57- LOG (info) << " DP " << it.first << " found in map" ;
58- }
59- }
60- }
50+ std::unordered_map<DPID , DPVAL > mapin;
51+ for (auto & it : dps) {
52+ mapin[it.id ] = it.data ;
6153
62- // LB: check if all ChamberStatus/CFGtag DPs were sent by using a vector and then
63- // checking for duplicates, if new size is equal to 540 => all DPs were sent
64- std::vector<DPID > allChamberStatusDPsid;
65- std::vector<DPID > allCFGtagDPsid;
66- for (const auto & it : dps) {
67- auto & itid = it.id ;
68- if (std::strstr (itid.get_alias (), " trd_fedChamberStatus" ) != nullptr ) {
69- allChamberStatusDPsid.push_back (it.id );
70- } else if (std::strstr (itid.get_alias (), " trd_fedCFGtag" ) != nullptr ) {
71- allCFGtagDPsid.push_back (it.id );
54+ // LB: check if all ChamberStatus/CFGtag DPs were sent in dps
55+ // if counter is equal to 540 => all DPs were sent
56+ if (std::strstr (it.id .get_alias (), " trd_fedChamberStatus" ) != nullptr ) {
57+ ChamberStatusDPsCounter++;
58+ } else if (std::strstr (it.id .get_alias (), " trd_fedCFGtag" ) != nullptr ) {
59+ CFGtagDPsCounter++;
7260 }
7361 }
7462
75- // LB: If at least minimum number of DPs are sent, set ChamberStatus/CFGtag update variables to true
76- auto ChamberStatusUniqueIterator = std::unique (allChamberStatusDPsid.begin (), allChamberStatusDPsid.end ());
77- auto CFGtagUniqueIterator = std::unique (allCFGtagDPsid.begin (), allCFGtagDPsid.end ());
78- int ChamberStatusUniqueDPsCounter = std::distance (allChamberStatusDPsid.begin (), ChamberStatusUniqueIterator);
79- int CFGtagUniqueDPsCounter = std::distance (allCFGtagDPsid.begin (), CFGtagUniqueIterator);
80- if (ChamberStatusUniqueDPsCounter >= mFedMinimunDPsForUpdate ) {
63+ if (ChamberStatusDPsCounter >= mFedMinimunDPsForUpdate ) {
8164 mFedChamberStatusCompleteDPs = true ;
8265 if (mVerbosity > 1 ) {
8366 LOG (info) << " Minimum number of required DPs (" << mFedMinimunDPsForUpdate << " ) for ChamberStatus update were found." ;
8467 }
8568 }
86-
87- if (CFGtagUniqueDPsCounter >= mFedMinimunDPsForUpdate ) {
69+ if (CFGtagDPsCounter >= mFedMinimunDPsForUpdate ) {
8870 mFedCFGtagCompleteDPs = true ;
8971 if (mVerbosity > 1 ) {
9072 LOG (info) << " Minimum number of required DPs (" << mFedMinimunDPsForUpdate << " ) for CFGtag update were found." ;
9173 }
9274 }
75+ if (mVerbosity > 1 ) {
76+ LOG (info) << " Number of ChamberStatus DPs = " << ChamberStatusDPsCounter;
77+ LOG (info) << " Number of CFGtag DPs = " << CFGtagDPsCounter;
78+ }
9379
9480 if (mVerbosity > 1 ) {
95- LOG (info) << " Number of ChamberStatus DPs = " << ChamberStatusUniqueDPsCounter;
96- LOG (info) << " Number of CFGtag DPs = " << CFGtagUniqueDPsCounter;
81+ for (auto & it : mPids ) {
82+ const auto & el = mapin.find (it.first );
83+ if (el == mapin.end ()) {
84+ LOG (info) << " DP " << it.first << " not found in map" ;
85+ } else {
86+ LOG (info) << " DP " << it.first << " found in map" ;
87+ }
88+ }
9789 }
9890
9991 // now we process all DPs, one by one
@@ -246,8 +238,8 @@ int DCSProcessor::processDP(const DPCOM& dpcom)
246238 LOG (info) << " New run number " << o2::dcs::getValue<int32_t >(dpcom) << " differs from the old one " << mCurrentRunNumber ;
247239 mShouldUpdateRun = true ;
248240 // LB: two different flags as they reset separately, after upload of CCDB, for each object
249- mNewRunForFedChamberStatusUpdate = true ;
250- mNewRunForFedCFGtagUpdate = true ;
241+ mFirstRunEntryForFedChamberStatusUpdate = true ;
242+ mFirstRunEntryForFedCFGtagUpdate = true ;
251243 mRunEndTS = mCurrentTS ;
252244 }
253245
@@ -271,7 +263,7 @@ int DCSProcessor::processDP(const DPCOM& dpcom)
271263 if (etime != mLastDPTimeStamps [dpid]) {
272264 if (dpInfoFedChamberStatus != o2::dcs::getValue<int >(dpcom)) {
273265 // If value changes after processing and DPs should not be updated, log change as warning (for now)
274- if (mPids [dpid] && !(mFedChamberStatusCompleteDPs && mNewRunForFedChamberStatusUpdate )) {
266+ if (mPids [dpid] && !(mFedChamberStatusCompleteDPs && mFirstRunEntryForFedChamberStatusUpdate )) {
275267 // Issue an alarm if counter is lower than maximum, warning otherwise
276268 if (mFedChamberStatusAlarmCounter < mFedAlarmCounterMax ) {
277269 LOG (alarm) << " ChamberStatus change " << dpid.get_alias () << " : " << dpInfoFedChamberStatus << " -> " << o2::dcs::getValue<int >(dpcom) << " , run = " << mCurrentRunNumber ;
@@ -299,7 +291,7 @@ int DCSProcessor::processDP(const DPCOM& dpcom)
299291 if (etime != mLastDPTimeStamps [dpid]) {
300292 if (dpInfoFedCFGtag != o2::dcs::getValue<string>(dpcom)) {
301293 // If value changes after processing and DPs should not be updated, log change as warning (for now)
302- if (mPids [dpid] && !(mFedCFGtagCompleteDPs && mNewRunForFedCFGtagUpdate )) {
294+ if (mPids [dpid] && !(mFedCFGtagCompleteDPs && mFirstRunEntryForFedCFGtagUpdate )) {
303295 // Issue an alarm if counter is lower than maximum, warning otherwise
304296 if (mFedCFGtagAlarmCounter < mFedAlarmCounterMax ) {
305297 LOG (alarm) << " CFGtag change " << dpid.get_alias () << " : " << dpInfoFedCFGtag << " -> " << o2::dcs::getValue<string>(dpcom) << " , run = " << mCurrentRunNumber ;
@@ -739,7 +731,7 @@ void DCSProcessor::clearFedChamberStatusDPsInfo()
739731 mTRDDCSFedChamberStatus .clear ();
740732 mFedChamberStatusStartTSSet = false ;
741733 mFedChamberStatusCompleteDPs = false ;
742- mNewRunForFedChamberStatusUpdate = false ;
734+ mFirstRunEntryForFedChamberStatusUpdate = false ;
743735 mFedChamberStatusAlarmCounter = 0 ;
744736 // reset the 'processed' flags for the fed DPs
745737 for (auto & it : mPids ) {
@@ -756,8 +748,8 @@ void DCSProcessor::clearFedCFGtagDPsInfo()
756748{
757749 mTRDDCSFedCFGtag .clear ();
758750 mFedCFGtagStartTSSet = false ;
759- mFedChamberStatusCompleteDPs = false ;
760- mNewRunForFedChamberStatusUpdate = false ;
751+ mFedCFGtagCompleteDPs = false ;
752+ mFirstRunEntryForFedCFGtagUpdate = false ;
761753 mFedCFGtagAlarmCounter = 0 ;
762754 // reset the 'processed' flags for the fed DPs
763755 for (auto & it : mPids ) {
0 commit comments