@@ -57,7 +57,7 @@ int CTPActiveRun::send2BK(std::unique_ptr<BkpClient>& BKClient, size_t ts, bool
5757 std::string clsname = cfg.getClassNameFromHWIndex (cls.first );
5858 // clsname = std::to_string(runOri) + "_" + clsname;
5959 try {
60- BKClient->triggerCounters ()->createOrUpdateForRun (runNumber, clsname, ts, cntsbk[0 ], cntsbk[1 ], cntsbk[2 ], cntsbk[3 ], cntsbk[4 ], cntsbk[5 ]);
60+ BKClient->ctpTriggerCounters ()->createOrUpdateForRun (runNumber, clsname, ts, cntsbk[0 ], cntsbk[1 ], cntsbk[2 ], cntsbk[3 ], cntsbk[4 ], cntsbk[5 ]);
6161 } catch (std::runtime_error& error) {
6262 std::cerr << " An error occurred: " << error.what () << std::endl;
6363 return 1 ;
@@ -124,8 +124,19 @@ int CTPRunManager::loadRun(const std::string& cfg)
124124
125125 return 0 ;
126126}
127- int CTPRunManager::startRun ( const std::string& cfg)
127+ int CTPRunManager::setRunConfigBK ( uint32_t runNumber, const std::string& cfg)
128128{
129+ std::cout << " Printing cfg:" << cfg << std::endl;
130+ if (mBKClient ) {
131+ try {
132+ uint32_t runNumber = 1 ;
133+ mBKClient ->run ()->setRawCtpTriggerConfiguration (runNumber, cfg);
134+ } catch (std::runtime_error& error) {
135+ std::cerr << " An error occurred: " << error.what () << std::endl;
136+ return 1 ;
137+ }
138+ LOG (info) << " Run BK:" << runNumber << " CFG:" << cfg;
139+ }
129140 return 0 ;
130141}
131142int CTPRunManager::stopRun (uint32_t irun, long timeStamp)
@@ -221,6 +232,13 @@ int CTPRunManager::processMessage(std::string& topic, const std::string& message
221232 loadRun (message);
222233 return 0 ;
223234 }
235+ if (topic.find (" soxorbit" ) != std::string::npos) {
236+ return 0 ;
237+ }
238+ if (topic.find (" orbitreset" ) != std::string::npos) {
239+ return 0 ;
240+ }
241+ static int nerror = 0 ;
224242 if (topic.find (" sox" ) != std::string::npos) {
225243 // get config
226244 size_t irun = message.find (" run" );
@@ -230,17 +248,15 @@ int CTPRunManager::processMessage(std::string& topic, const std::string& message
230248 }
231249 LOG (info) << " SOX received, Run keyword position:" << irun;
232250 std::string cfg = message.substr (irun, message.size () - irun);
233- startRun (cfg);
234251 firstcounters = message.substr (0 , irun);
235- }
236- if (topic.find (" eox" ) != std::string::npos) {
252+ } else if (topic.find (" eox" ) != std::string::npos) {
237253 LOG (info) << " EOX received" ;
238254 mEOX = 1 ;
239- }
240- static int nerror = 0 ;
241- if (topic == " rocnts " ) {
242- if (nerror < 1 ) {
243- LOG (warning) << " Skipping topic rocnts " ;
255+ } else if (topic. find ( " cnts " ) != std::string::npos) {
256+ // just continue
257+ } else {
258+ if (nerror < 10 ) {
259+ LOG (warning) << " Skipping topic: " << topic ;
244260 nerror++;
245261 }
246262 return 0 ;
@@ -293,6 +309,7 @@ int CTPRunManager::processMessage(std::string& topic, const std::string& message
293309 mActiveRunNumbers [i] = mCounters [i];
294310 mActiveRuns [i] = run->second ;
295311 mRunsLoaded .erase (run);
312+ setRunConfigBK (mActiveRuns [i]->cfg .getRunNumber (), mActiveRuns [i]->cfg .getConfigString ());
296313 addScalers (i, tt, 1 );
297314 saveRunScalersToQCDB (mActiveRuns [i]->scalers , tt * 1000 , tt * 1000 );
298315 } else {
0 commit comments