@@ -74,26 +74,21 @@ void DQMHistAnalysisTOPModule::initialize()
7474 if (m_backgroundAlarmLevels.size () != 2 ) B2ERROR (" Parameter list 'backgroundAlarmLevels' must contain two numbers" );
7575 if (m_photonYieldsAlarmLevels.size () != 2 ) B2ERROR (" Parameter list 'photonYieldsAlarmLevels' must contain two numbers" );
7676
77- // parse excluded boardstacks
77+ // make a map of boardstack names to ID's
7878
79- m_includedBoardstacks.resize (64 , true );
80- if (not m_excludedBoardstacks.empty ()) {
81- std::map<std::string, int > bsmap;
82- int id = 1 ;
83- for (int slot = 1 ; slot <= 16 ; slot++) {
84- string slotstr = to_string (slot);
85- for (std::string bs : {" a" , " b" , " c" , " d" }) {
86- bsmap[slotstr + bs] = id;
87- id++;
88- }
89- }
90- for (const auto & bsname : m_excludedBoardstacks) {
91- id = bsmap[bsname];
92- if (id > 0 ) m_includedBoardstacks[id - 1 ] = false ;
93- else B2ERROR (" Invalid boardstack name: " << bsname);
79+ int id = 1 ;
80+ for (int slot = 1 ; slot <= 16 ; slot++) {
81+ string slotstr = to_string (slot);
82+ for (std::string bs : {" a" , " b" , " c" , " d" }) {
83+ m_bsmap[slotstr + bs] = id;
84+ id++;
9485 }
9586 }
9687
88+ // parse excluded boardstacks
89+
90+ setIncludedBoardstacks (m_excludedBoardstacks);
91+
9792 // MiraBelle monitoring
9893
9994 m_monObj = getMonitoringObject (" top" );
@@ -104,6 +99,7 @@ void DQMHistAnalysisTOPModule::initialize()
10499 registerEpicsPV (m_pvPrefix + " badCarriers" , " badCarriers" );
105100 registerEpicsPV (m_pvPrefix + " badAsics" , " badAsics" );
106101 registerEpicsPV (m_pvPrefix + " badPMTs" , " badPMTs" );
102+ registerEpicsPV (m_pvPrefix + " numExcludedBS" , " numExcludedBS" );
107103
108104 // Epics used to get limits from configuration file - override module parameters (input only)
109105
@@ -114,10 +110,7 @@ void DQMHistAnalysisTOPModule::initialize()
114110 registerEpicsPV (m_pvPrefix + " deadChannelsAlarmLevels" , " deadChannelsAlarmLevels" );
115111 registerEpicsPV (m_pvPrefix + " backgroundAlarmLevels" , " backgroundAlarmLevels" );
116112 registerEpicsPV (m_pvPrefix + " photonYieldsAlarmLevels" , " photonYieldsAlarmLevels" );
117- for (int slot = 1 ; slot <= 16 ; slot++) {
118- std::string varName = " slot" + to_string (slot);
119- registerEpicsPV (m_pvPrefix + varName, varName); // excludedBoardstacks (lolo = BS0, low = BS1, high = BS2, hihi = BS3)
120- }
113+ registerEpicsPV (m_pvPrefix + " excludedBoardstacks" , " excludedBoardstacks" );
121114
122115 updateEpicsPVs (5.0 );
123116
@@ -266,6 +259,7 @@ void DQMHistAnalysisTOPModule::updateWindowVsSlotCanvas()
266259 canvas->cd ();
267260 m_text1->Draw ();
268261 for (auto * line : m_asicWindowsBandLines) line->Draw ();
262+ canvas->Pad ()->SetFrameFillColor (10 );
269263 canvas->Pad ()->SetFillColor (getAlarmColor (alarmState));
270264 canvas->Modified ();
271265 }
@@ -292,6 +286,7 @@ void DQMHistAnalysisTOPModule::updateEventMonitorCanvas()
292286 if (canvas) {
293287 canvas->cd ();
294288 m_text2->Draw ();
289+ canvas->Pad ()->SetFrameFillColor (10 );
295290 canvas->Pad ()->SetFillColor (getAlarmColor (alarmState));
296291 canvas->Modified ();
297292 }
@@ -705,12 +700,16 @@ void DQMHistAnalysisTOPModule::setEpicsVariables()
705700 setEpicsPV (" badCarriers" , badCarriers);
706701 setEpicsPV (" badAsics" , badAsics);
707702 setEpicsPV (" badPMTs" , badPMTs);
703+ int numBS = 0 ;
704+ for (auto included : m_includedBoardstacks) if (not included) numBS++;
705+ setEpicsPV (" numExcludedBS" , numBS);
708706 updateEpicsPVs (5.0 );
709707
710708 B2DEBUG (20 , " badBoardstacks: " << badBoardstacks);
711709 B2DEBUG (20 , " badCarriers: " << badCarriers);
712710 B2DEBUG (20 , " badAsics: " << badAsics);
713711 B2DEBUG (20 , " badPMTs: " << badPMTs);
712+ B2DEBUG (20 , " excludedBS: " << numBS);
714713}
715714
716715void DQMHistAnalysisTOPModule::updateLimits ()
@@ -732,30 +731,49 @@ void DQMHistAnalysisTOPModule::updateLimits()
732731
733732 setAlarmLines ();
734733
735- m_excludedBoardstacks.clear ();
736- std::vector<std::string> bsLabels = {" a" , " b" , " c" , " d" };
737- for (int slot = 1 ; slot <= 16 ; slot++) {
738- std::vector<double > includedBS (4 );
739- for (int bs = 0 ; bs < 4 ; bs++) includedBS[bs] = m_includedBoardstacks[(slot - 1 ) * 4 + bs];
740- std::string varName = " slot" + to_string (slot);
741- requestLimitsFromEpicsPVs (varName, includedBS[0 ], includedBS[1 ], includedBS[2 ], includedBS[3 ]);
742- for (int bs = 0 ; bs < 4 ; bs++) {
743- int index = (slot - 1 ) * 4 + bs;
744- m_includedBoardstacks[index] = (includedBS[bs] != 0 );
745- if (not m_includedBoardstacks[index]) m_excludedBoardstacks.push_back (to_string (slot) + bsLabels[bs]);
734+ bool status = false ;
735+ std::string excludedBS = getEpicsStringPV (" excludedBoardstacks" , status);
736+
737+ if (status) {
738+ m_excludedBoardstacks.clear ();
739+ std::string name;
740+ for (auto c : excludedBS) {
741+ if (isspace (c)) continue ;
742+ else if (ispunct (c)) {
743+ if (not name.empty ()) {
744+ m_excludedBoardstacks.push_back (name);
745+ name.clear ();
746+ }
747+ } else name.push_back (c);
746748 }
749+ if (not name.empty ()) {
750+ m_excludedBoardstacks.push_back (name);
751+ }
752+ setIncludedBoardstacks (m_excludedBoardstacks);
747753 }
748754
749- B2DEBUG (20 , " asicWindowsBand: [" << m_asicWindowsBand[0 ] << " , " << m_asicWindowsBand[1 ] << " ]" );
750- B2DEBUG (20 , " asicWindowsAlarmLevels: [" << m_asicWindowsAlarmLevels[0 ] << " , " << m_asicWindowsAlarmLevels[1 ] << " ]" );
755+ B2DEBUG (20 , " asicWindowsBand: [" << m_asicWindowsBand[0 ] << " , " << m_asicWindowsBand[1 ] << " ]" );
756+ B2DEBUG (20 , " asicWindowsAlarmLevels: [" << m_asicWindowsAlarmLevels[0 ] << " , " << m_asicWindowsAlarmLevels[1 ] << " ]" );
751757 B2DEBUG (20 , " eventMonitorAlarmLevels: [" << m_eventMonitorAlarmLevels[0 ] << " , " << m_eventMonitorAlarmLevels[1 ] << " ]" );
752- B2DEBUG (20 , " junkHitsAlarmLevels: [" << m_junkHitsAlarmLevels[0 ] << " , " << m_junkHitsAlarmLevels[1 ] << " ]" );
758+ B2DEBUG (20 , " junkHitsAlarmLevels: [" << m_junkHitsAlarmLevels[0 ] << " , " << m_junkHitsAlarmLevels[1 ] << " ]" );
753759 B2DEBUG (20 , " deadChannelsAlarmLevels: [" << m_deadChannelsAlarmLevels[0 ] << " , " << m_deadChannelsAlarmLevels[1 ] << " ]" );
754760 B2DEBUG (20 , " backgroundAlarmLevels: [" << m_backgroundAlarmLevels[0 ] << " , " << m_backgroundAlarmLevels[1 ] << " ]" );
755761 B2DEBUG (20 , " photonYieldsAlarmLevels: [" << m_photonYieldsAlarmLevels[0 ] << " , " << m_photonYieldsAlarmLevels[1 ] << " ]" );
756762 std::string ss;
757763 for (const auto & s : m_excludedBoardstacks) ss += " '" + s + " ', " ;
758764 if (ss.size () > 2 ) {ss.pop_back (); ss.pop_back ();}
759765 B2DEBUG (20 , " excludedBoardstacks: [" << ss << " ]" );
766+
760767}
761768
769+ void DQMHistAnalysisTOPModule::setIncludedBoardstacks (const std::vector<std::string>& excludedBoardstacks)
770+ {
771+ m_includedBoardstacks.clear ();
772+ m_includedBoardstacks.resize (64 , true );
773+
774+ for (const auto & bsname : excludedBoardstacks) {
775+ int id = m_bsmap[bsname];
776+ if (id > 0 ) m_includedBoardstacks[id - 1 ] = false ;
777+ else B2ERROR (" Invalid boardstack name: " << bsname);
778+ }
779+ }
0 commit comments