Commit 4bc48ae7 authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

Apply clang-format

parent c3bd3f89
Pipeline #8968 passed with stages
in 37 minutes and 22 seconds
...@@ -5,18 +5,15 @@ ...@@ -5,18 +5,15 @@
* GNU Lesser General Public Licence (LGPL) version 3, * * GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" * * copied verbatim in the file "LICENSE" *
********************************************************************************/ ********************************************************************************/
#include <mutex>
#include "CbmMqHistoServer.h" #include "CbmMqHistoServer.h"
#include "CbmFlesCanvasTools.h" #include "CbmFlesCanvasTools.h"
#include "BoostSerializer.h"
#include "FairLogger.h" #include "FairLogger.h"
#include "FairMQProgOptions.h" // device->fConfig #include "FairMQProgOptions.h" // device->fConfig
#include "RootSerializer.h"
#include "TCanvas.h" #include "TCanvas.h"
#include "TEnv.h"
#include "TFile.h" #include "TFile.h"
#include "TH1.h" #include "TH1.h"
#include "TH2.h" #include "TH2.h"
...@@ -26,10 +23,14 @@ ...@@ -26,10 +23,14 @@
#include "TProfile.h" #include "TProfile.h"
#include "TRootSniffer.h" #include "TRootSniffer.h"
#include "TSystem.h" #include "TSystem.h"
#include "TEnv.h"
#include "BoostSerializer.h"
#include <boost/serialization/utility.hpp> #include <boost/serialization/utility.hpp>
#include <mutex>
#include "RootSerializer.h"
std::mutex mtx; std::mutex mtx;
/* /*
Bool_t bMqHistoServerResetHistos = kFALSE; Bool_t bMqHistoServerResetHistos = kFALSE;
...@@ -70,9 +71,8 @@ void CbmMqHistoServer::InitTask() { ...@@ -70,9 +71,8 @@ void CbmMqHistoServer::InitTask() {
fServer = new THttpServer(Form("http:%u", fuHttpServerPort)); fServer = new THttpServer(Form("http:%u", fuHttpServerPort));
/// To avoid the server sucking all Histos from gROOT when no output file is used /// To avoid the server sucking all Histos from gROOT when no output file is used
fServer->GetSniffer()->SetScanGlobalDir(kFALSE); fServer->GetSniffer()->SetScanGlobalDir(kFALSE);
const char *jsrootsys = gSystem->Getenv("JSROOTSYS"); const char* jsrootsys = gSystem->Getenv("JSROOTSYS");
if (!jsrootsys) if (!jsrootsys) jsrootsys = gEnv->GetValue("HttpServ.JSRootPath", jsrootsys);
jsrootsys = gEnv->GetValue("HttpServ.JSRootPath", jsrootsys);
LOG(info) << "JSROOT location: " << jsrootsys; LOG(info) << "JSROOT location: " << jsrootsys;
......
...@@ -76,7 +76,7 @@ void CbmDeviceMonitorT0::InitTask() try { ...@@ -76,7 +76,7 @@ void CbmDeviceMonitorT0::InitTask() try {
fuMaxTotPulser = fConfig->GetValue<uint32_t>("PulsTotMax"); fuMaxTotPulser = fConfig->GetValue<uint32_t>("PulsTotMax");
fuOffSpillCountLimit = fConfig->GetValue<uint32_t>("SpillThr"); fuOffSpillCountLimit = fConfig->GetValue<uint32_t>("SpillThr");
fuOffSpillCountLimitNonPulser = fConfig->GetValue<uint32_t>("SpillThrNonPuls"); fuOffSpillCountLimitNonPulser = fConfig->GetValue<uint32_t>("SpillThrNonPuls");
fdSpillCheckInterval = fConfig->GetValue<double>("SpillCheckInt"); fdSpillCheckInterval = fConfig->GetValue<double>("SpillCheckInt");
std::string sChanMap = fConfig->GetValue<std::string>("ChanMap"); std::string sChanMap = fConfig->GetValue<std::string>("ChanMap");
fuPublishFreqTs = fConfig->GetValue<uint32_t>("PubFreqTs"); fuPublishFreqTs = fConfig->GetValue<uint32_t>("PubFreqTs");
fdMinPublishTime = fConfig->GetValue<double_t>("PubTimeMin"); fdMinPublishTime = fConfig->GetValue<double_t>("PubTimeMin");
......
...@@ -51,7 +51,7 @@ private: ...@@ -51,7 +51,7 @@ private:
uint32_t fuMaxTotPulser; uint32_t fuMaxTotPulser;
uint32_t fuOffSpillCountLimit; uint32_t fuOffSpillCountLimit;
uint32_t fuOffSpillCountLimitNonPulser; uint32_t fuOffSpillCountLimitNonPulser;
double fdSpillCheckInterval; double fdSpillCheckInterval;
std::vector<uint32_t> fvuChanMap; std::vector<uint32_t> fvuChanMap;
uint32_t fuPublishFreqTs; uint32_t fuPublishFreqTs;
double_t fdMinPublishTime; double_t fdMinPublishTime;
......
...@@ -20,14 +20,10 @@ void addCustomOptions(bpo::options_description& options) { ...@@ -20,14 +20,10 @@ void addCustomOptions(bpo::options_description& options) {
options.add_options()("PulsTotMax", options.add_options()("PulsTotMax",
bpo::value<uint32_t>()->default_value(195), bpo::value<uint32_t>()->default_value(195),
"Maximal TOT for pulser cut"); "Maximal TOT for pulser cut");
options.add_options()("SpillThr", options.add_options()("SpillThr", bpo::value<uint32_t>()->default_value(25), "Hits Nb Thr for spill detection");
bpo::value<uint32_t>()->default_value(25), options.add_options()("SpillThrNonPuls", bpo::value<uint32_t>()->default_value(10),
"Hits Nb Thr for spill detection");
options.add_options()("SpillThrNonPuls",
bpo::value<uint32_t>()->default_value(10),
"Non pulser Hits Nb Thr for spill detection"); "Non pulser Hits Nb Thr for spill detection");
options.add_options()("SpillCheckInt", options.add_options()("SpillCheckInt", bpo::value<double>()->default_value(0.128),
bpo::value<double>()->default_value(0.128),
"Interval in seconds between count checks for spill detection"); "Interval in seconds between count checks for spill detection");
options.add_options()("ChanMap", bpo::value<std::string>()->default_value("0,1,2,3,4,5,6,7"), options.add_options()("ChanMap", bpo::value<std::string>()->default_value("0,1,2,3,4,5,6,7"),
"Set T0 channel map e.g. 0,1,2,3,4,5,6,7"); "Set T0 channel map e.g. 0,1,2,3,4,5,6,7");
......
...@@ -11,27 +11,28 @@ ...@@ -11,27 +11,28 @@
#include "CbmFlesCanvasTools.h" #include "CbmFlesCanvasTools.h"
#include "CbmFormatDecHexPrintout.h" #include "CbmFormatDecHexPrintout.h"
#include "FairMQLogger.h"
#include "FairMQProgOptions.h" // device->fConfig
#include "BoostSerializer.h"
#include "RootSerializer.h"
#include "TimesliceInputArchive.hpp" #include "TimesliceInputArchive.hpp"
#include "TimesliceMultiInputArchive.hpp" #include "TimesliceMultiInputArchive.hpp"
#include "TimesliceMultiSubscriber.hpp" #include "TimesliceMultiSubscriber.hpp"
#include "TimesliceSubscriber.hpp" #include "TimesliceSubscriber.hpp"
#include "FairMQLogger.h"
#include "FairMQProgOptions.h" // device->fConfig
#include <TCanvas.h> #include <TCanvas.h>
#include <TH1F.h> #include <TH1F.h>
#include <TH1I.h> #include <TH1I.h>
#include <TProfile.h> #include <TProfile.h>
#include "BoostSerializer.h"
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_oarchive.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/regex.hpp> #include <boost/regex.hpp>
#include <boost/serialization/utility.hpp> #include <boost/serialization/utility.hpp>
#include "RootSerializer.h"
namespace filesys = boost::filesystem; namespace filesys = boost::filesystem;
#include <algorithm> #include <algorithm>
...@@ -66,7 +67,8 @@ CbmMQTsaMultiSampler::CbmMQTsaMultiSampler() ...@@ -66,7 +67,8 @@ CbmMQTsaMultiSampler::CbmMQTsaMultiSampler()
, fSource(nullptr) , fSource(nullptr)
, fTime() , fTime()
, fLastPublishTime {std::chrono::system_clock::now()} , fLastPublishTime {std::chrono::system_clock::now()}
{} {
}
void CbmMQTsaMultiSampler::InitTask() try { void CbmMQTsaMultiSampler::InitTask() try {
// Get the values from the command line options (via fConfig) // Get the values from the command line options (via fConfig)
...@@ -81,12 +83,12 @@ void CbmMQTsaMultiSampler::InitTask() try { ...@@ -81,12 +83,12 @@ void CbmMQTsaMultiSampler::InitTask() try {
fbSendTsPerChannel = fConfig->GetValue<bool>("send-ts-per-channel"); fbSendTsPerChannel = fConfig->GetValue<bool>("send-ts-per-channel");
fsChannelNameMissedTs = fConfig->GetValue<std::string>("ChNameMissTs"); fsChannelNameMissedTs = fConfig->GetValue<std::string>("ChNameMissTs");
fsChannelNameCommands = fConfig->GetValue<std::string>("ChNameCmds"); fsChannelNameCommands = fConfig->GetValue<std::string>("ChNameCmds");
fuPublishFreqTs = fConfig->GetValue< uint32_t >( "PubFreqTs" ); fuPublishFreqTs = fConfig->GetValue<uint32_t>("PubFreqTs");
fdMinPublishTime = fConfig->GetValue< double_t >( "PubTimeMin" ); fdMinPublishTime = fConfig->GetValue<double_t>("PubTimeMin");
fdMaxPublishTime = fConfig->GetValue< double_t >( "PubTimeMax" ); fdMaxPublishTime = fConfig->GetValue<double_t>("PubTimeMax");
fsChannelNameHistosInput = fConfig->GetValue< std::string >( "ChNameIn" ); fsChannelNameHistosInput = fConfig->GetValue<std::string>("ChNameIn");
fsChannelNameHistosConfig = fConfig->GetValue< std::string >( "ChNameHistCfg" ); fsChannelNameHistosConfig = fConfig->GetValue<std::string>("ChNameHistCfg");
fsChannelNameCanvasConfig = fConfig->GetValue< std::string >( "ChNameCanvCfg" ); fsChannelNameCanvasConfig = fConfig->GetValue<std::string>("ChNameCanvCfg");
if (fbNoSplitTs) { if (fbNoSplitTs) {
if (fbSendTsPerSysId) { if (fbSendTsPerSysId) {
...@@ -207,8 +209,9 @@ void CbmMQTsaMultiSampler::InitTask() try { ...@@ -207,8 +209,9 @@ void CbmMQTsaMultiSampler::InitTask() try {
/// Catches and ignores the channels for missing TS indices and commands /// Catches and ignores the channels for missing TS indices and commands
/// Same for the histogram channels /// Same for the histogram channels
if (entry.first == fsChannelNameMissedTs || entry.first == fsChannelNameCommands if (entry.first == fsChannelNameMissedTs || entry.first == fsChannelNameCommands
|| ( 0 < fuPublishFreqTs && ( entry.first == fsChannelNameHistosInput || || (0 < fuPublishFreqTs
entry.first == fsChannelNameHistosConfig || entry.first == fsChannelNameCanvasConfig ) ) ) { && (entry.first == fsChannelNameHistosInput || entry.first == fsChannelNameHistosConfig
|| entry.first == fsChannelNameCanvasConfig))) {
continue; continue;
} // if( entry.first == fsChannelNameMissedTs || entry.first == fsChannelNameCommands || histo channels name) } // if( entry.first == fsChannelNameMissedTs || entry.first == fsChannelNameCommands || histo channels name)
...@@ -262,36 +265,36 @@ void CbmMQTsaMultiSampler::InitTask() try { ...@@ -262,36 +265,36 @@ void CbmMQTsaMultiSampler::InitTask() try {
LOG(info) << "Sending components in separate TS per channel"; LOG(info) << "Sending components in separate TS per channel";
} // else if( fbSendTsPerSysId && fbSendTsPerSysId ) of if( fbNoSplitTs ) } // else if( fbSendTsPerSysId && fbSendTsPerSysId ) of if( fbNoSplitTs )
if( 0 < fuPublishFreqTs ) { if (0 < fuPublishFreqTs) {
LOG(info) << "Histograms publication frequency in TS: " << fuPublishFreqTs; LOG(info) << "Histograms publication frequency in TS: " << fuPublishFreqTs;
LOG(info) << "Histograms publication min. interval in s: " << fdMinPublishTime; LOG(info) << "Histograms publication min. interval in s: " << fdMinPublishTime;
LOG(info) << "Histograms publication max. interval in s: " << fdMaxPublishTime; LOG(info) << "Histograms publication max. interval in s: " << fdMaxPublishTime;
/// Vector of pointers on each histo (+ optionally desired folder) /// Vector of pointers on each histo (+ optionally desired folder)
std::vector< std::pair< TNamed *, std::string > > vHistos = {}; std::vector<std::pair<TNamed*, std::string>> vHistos = {};
/// Vector of pointers on each canvas (+ optionally desired folder) /// Vector of pointers on each canvas (+ optionally desired folder)
std::vector< std::pair< TCanvas *, std::string > > vCanvases = {}; std::vector<std::pair<TCanvas*, std::string>> vCanvases = {};
/// Histos creation and obtain pointer on them /// Histos creation and obtain pointer on them
fhTsRate = new TH1I("TsRate", "TS rate; t [s]", 1800, 0., 1800.); fhTsRate = new TH1I("TsRate", "TS rate; t [s]", 1800, 0., 1800.);
fhTsSize = new TH1I("TsSize", "Size of TS; Size [MB]", 15000, 0., 15000.); fhTsSize = new TH1I("TsSize", "Size of TS; Size [MB]", 15000, 0., 15000.);
fhTsSizeEvo = new TProfile( "TsSizeEvo", "Evolution of the TS Size; t [s]; Mean size [MB]", 1800, 0., 1800.); fhTsSizeEvo = new TProfile("TsSizeEvo", "Evolution of the TS Size; t [s]; Mean size [MB]", 1800, 0., 1800.);
fhTsMaxSizeEvo = new TH1F("TsMaxSizeEvo", "Evolution of maximal TS Size; t [s]; Max size [MB]", 1800, 0., 1800.); fhTsMaxSizeEvo = new TH1F("TsMaxSizeEvo", "Evolution of maximal TS Size; t [s]; Max size [MB]", 1800, 0., 1800.);
fhMissedTS = new TH1I("Missed_TS", "Missed TS", 2, 0., 2.); fhMissedTS = new TH1I("Missed_TS", "Missed TS", 2, 0., 2.);
fhMissedTSEvo = new TProfile( "Missed_TS_Evo", "Missed TS evolution; t [s]", 1800, 0., 1800.); fhMissedTSEvo = new TProfile("Missed_TS_Evo", "Missed TS evolution; t [s]", 1800, 0., 1800.);
/// Add histo pointers to the histo vector /// Add histo pointers to the histo vector
vHistos.push_back( std::pair< TNamed *, std::string >( fhTsRate, "Sampler" ) ); vHistos.push_back(std::pair<TNamed*, std::string>(fhTsRate, "Sampler"));
vHistos.push_back( std::pair< TNamed *, std::string >( fhTsSize, "Sampler" ) ); vHistos.push_back(std::pair<TNamed*, std::string>(fhTsSize, "Sampler"));
vHistos.push_back( std::pair< TNamed *, std::string >( fhTsSizeEvo, "Sampler" ) ); vHistos.push_back(std::pair<TNamed*, std::string>(fhTsSizeEvo, "Sampler"));
vHistos.push_back( std::pair< TNamed *, std::string >( fhTsMaxSizeEvo, "Sampler" ) ); vHistos.push_back(std::pair<TNamed*, std::string>(fhTsMaxSizeEvo, "Sampler"));
vHistos.push_back( std::pair< TNamed *, std::string >( fhMissedTS, "Sampler" ) ); vHistos.push_back(std::pair<TNamed*, std::string>(fhMissedTS, "Sampler"));
vHistos.push_back( std::pair< TNamed *, std::string >( fhMissedTSEvo, "Sampler" ) ); vHistos.push_back(std::pair<TNamed*, std::string>(fhMissedTSEvo, "Sampler"));
/// Canvases creation /// Canvases creation
Double_t w = 10; Double_t w = 10;
Double_t h = 10; Double_t h = 10;
fcSummary = new TCanvas( "cSampSummary", "Sampler monitoring plots", w, h); fcSummary = new TCanvas("cSampSummary", "Sampler monitoring plots", w, h);
fcSummary->Divide(2, 3); fcSummary->Divide(2, 3);
fcSummary->cd(1); fcSummary->cd(1);
...@@ -327,17 +330,16 @@ void CbmMQTsaMultiSampler::InitTask() try { ...@@ -327,17 +330,16 @@ void CbmMQTsaMultiSampler::InitTask() try {
fhMissedTSEvo->Draw("el"); fhMissedTSEvo->Draw("el");
/// Add canvas pointers to the canvas vector /// Add canvas pointers to the canvas vector
vCanvases.push_back( std::pair< TCanvas *, std::string >( fcSummary, "canvases") ); vCanvases.push_back(std::pair<TCanvas*, std::string>(fcSummary, "canvases"));
/// Add pointers to each histo in the histo array /// Add pointers to each histo in the histo array
/// Create histo config vector /// Create histo config vector
/// ===> Use an std::vector< std::pair< std::string, std::string > > with < Histo name, Folder > /// ===> Use an std::vector< std::pair< std::string, std::string > > with < Histo name, Folder >
/// and send it through a separate channel using the BoostSerializer /// and send it through a separate channel using the BoostSerializer
for( UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto ) for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) {
{ // LOG(info) << "Registering " << vHistos[ uHisto ].first->GetName()
// LOG(info) << "Registering " << vHistos[ uHisto ].first->GetName() // << " in " << vHistos[ uHisto ].second.data()
// << " in " << vHistos[ uHisto ].second.data() // ;
// ;
fArrayHisto.Add( vHistos[ uHisto ].first ); fArrayHisto.Add( vHistos[ uHisto ].first );
std::pair< std::string, std::string > psHistoConfig( vHistos[ uHisto ].first->GetName(), std::pair< std::string, std::string > psHistoConfig( vHistos[ uHisto ].first->GetName(),
vHistos[ uHisto ].second ); vHistos[ uHisto ].second );
...@@ -350,20 +352,19 @@ void CbmMQTsaMultiSampler::InitTask() try { ...@@ -350,20 +352,19 @@ void CbmMQTsaMultiSampler::InitTask() try {
/// Send message to the common histogram config messages queue /// Send message to the common histogram config messages queue
if( Send( messageHist, fsChannelNameHistosConfig ) < 0 ) if( Send( messageHist, fsChannelNameHistosConfig ) < 0 )
{ {
LOG(fatal) << "Problem sending histo config"; LOG(fatal) << "Problem sending histo config";
} // if( Send( messageHist, fsChannelNameHistosConfig ) < 0 ) } // if( Send( messageHist, fsChannelNameHistosConfig ) < 0 )
LOG(info) << "Config of hist " << psHistoConfig.first.data() LOG(info) << "Config of hist " << psHistoConfig.first.data()
<< " in folder " << psHistoConfig.second.data() ; << " in folder " << psHistoConfig.second.data() ;
} // for( UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto ) } // for( UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto )
/// Create canvas config vector /// Create canvas config vector
/// ===> Use an std::vector< std::pair< std::string, std::string > > with < Canvas name, config > /// ===> Use an std::vector< std::pair< std::string, std::string > > with < Canvas name, config >
/// and send it through a separate channel using the BoostSerializer /// and send it through a separate channel using the BoostSerializer
for( UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv ) for (UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv) {
{ // LOG(info) << "Registering " << vCanvases[ uCanv ].first->GetName()
// LOG(info) << "Registering " << vCanvases[ uCanv ].first->GetName() // << " in " << vCanvases[ uCanv ].second.data();
// << " in " << vCanvases[ uCanv ].second.data();
std::string sCanvName = (vCanvases[ uCanv ].first)->GetName(); std::string sCanvName = (vCanvases[ uCanv ].first)->GetName();
std::string sCanvConf = GenerateCanvasConfigString( vCanvases[ uCanv ].first ); std::string sCanvConf = GenerateCanvasConfigString( vCanvases[ uCanv ].first );
...@@ -378,13 +379,13 @@ void CbmMQTsaMultiSampler::InitTask() try { ...@@ -378,13 +379,13 @@ void CbmMQTsaMultiSampler::InitTask() try {
/// Send message to the common canvas config messages queue /// Send message to the common canvas config messages queue
if( Send( messageCan, fsChannelNameCanvasConfig ) < 0 ) if( Send( messageCan, fsChannelNameCanvasConfig ) < 0 )
{ {
LOG(fatal) << "Problem sending canvas config"; LOG(fatal) << "Problem sending canvas config";
} // if( Send( messageCan, fsChannelNameCanvasConfig ) < 0 ) } // if( Send( messageCan, fsChannelNameCanvasConfig ) < 0 )
LOG(info) << "Config string of Canvas " << psCanvConfig.first.data() LOG(info) << "Config string of Canvas " << psCanvConfig.first.data()
<< " is " << psCanvConfig.second.data() ; << " is " << psCanvConfig.second.data() ;
} // for( UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv ) } // for( UInt_t uCanv = 0; uCanv < vCanvases.size(); ++uCanv )
} // if( 0 < fuPublishFreqTs ) } // if( 0 < fuPublishFreqTs )
fTime = std::chrono::steady_clock::now(); fTime = std::chrono::steady_clock::now();
} catch (InitTaskError& e) { } catch (InitTaskError& e) {
...@@ -445,37 +446,35 @@ bool CbmMQTsaMultiSampler::ConditionalRun() { ...@@ -445,37 +446,35 @@ bool CbmMQTsaMultiSampler::ConditionalRun() {
const fles::Timeslice& ts = *timeslice; const fles::Timeslice& ts = *timeslice;
uint64_t uTsIndex = ts.index(); uint64_t uTsIndex = ts.index();
if( 0 < fuPublishFreqTs ) { if (0 < fuPublishFreqTs) {
uint64_t uTsTime = ts.descriptor(0, 0).idx; uint64_t uTsTime = ts.descriptor(0, 0).idx;
if( 0 == fuStartTime ) { if (0 == fuStartTime) { fuStartTime = uTsTime; } // if( 0 == fuStartTime )
fuStartTime = uTsTime; fdTimeToStart = static_cast<double_t>(uTsTime - fuStartTime) / 1e9;
} // if( 0 == fuStartTime )
fdTimeToStart = static_cast< double_t >(uTsTime - fuStartTime)/1e9;
uint64_t uSizeMb = 0; uint64_t uSizeMb = 0;
for( uint64_t uComp = 0; uComp < ts.num_components(); ++uComp ) { for (uint64_t uComp = 0; uComp < ts.num_components(); ++uComp) {
uSizeMb += ts.size_component( uComp ) / (1024 * 1024); uSizeMb += ts.size_component(uComp) / (1024 * 1024);
} // for( uint_t uComp = 0; uComp < ts.num_components(); ++uComp ) } // for( uint_t uComp = 0; uComp < ts.num_components(); ++uComp )
fhTsRate->Fill( fdTimeToStart ); fhTsRate->Fill(fdTimeToStart);
fhTsSize->Fill( uSizeMb ); fhTsSize->Fill(uSizeMb);
fhTsSizeEvo->Fill( fdTimeToStart, uSizeMb ); fhTsSizeEvo->Fill(fdTimeToStart, uSizeMb);
/// Fill max size per s (assumes the histo binning is 1 second!) /// Fill max size per s (assumes the histo binning is 1 second!)
if( 0. == fdLastMaxTime ) { if (0. == fdLastMaxTime) {
fdLastMaxTime = fdTimeToStart; fdLastMaxTime = fdTimeToStart;
fdTsMaxSize = uSizeMb; fdTsMaxSize = uSizeMb;
} // if( 0. == fdLastMaxTime ) } // if( 0. == fdLastMaxTime )
else if( 1. <= fdTimeToStart - fdLastMaxTime ) { else if (1. <= fdTimeToStart - fdLastMaxTime) {
fhTsMaxSizeEvo->Fill( fdLastMaxTime, fdTsMaxSize ); fhTsMaxSizeEvo->Fill(fdLastMaxTime, fdTsMaxSize);
fdLastMaxTime = fdTimeToStart; fdLastMaxTime = fdTimeToStart;
fdTsMaxSize = uSizeMb;
} // else if if( 1 <= fdTimeToStart - fdLastMaxTime )
else if (fdTsMaxSize < uSizeMb) {
fdTsMaxSize = uSizeMb; fdTsMaxSize = uSizeMb;
} // else if if( 1 <= fdTimeToStart - fdLastMaxTime ) } // else if( fdTsMaxSize < uSizeMb )
else if( fdTsMaxSize < uSizeMb ) { } // if( 0 < fuPublishFreqTs )
fdTsMaxSize = uSizeMb;
} // else if( fdTsMaxSize < uSizeMb )
} // if( 0 < fuPublishFreqTs )
/// Missed TS detection (only if output channel name defined by user) /// Missed TS detection (only if output channel name defined by user)
if ((uTsIndex != (fuPrevTsIndex + 1)) if ((uTsIndex != (fuPrevTsIndex + 1))
...@@ -499,16 +498,16 @@ bool CbmMQTsaMultiSampler::ConditionalRun() { ...@@ -499,16 +498,16 @@ bool CbmMQTsaMultiSampler::ConditionalRun() {
return false; return false;
} // if( !SendMissedTsIdx( vulMissedIndices ) ) } // if( !SendMissedTsIdx( vulMissedIndices ) )
if( 0 < fuPublishFreqTs ) { if (0 < fuPublishFreqTs) {
fhMissedTS->Fill(1, uTsIndex - fuPrevTsIndex); fhMissedTS->Fill(1, uTsIndex - fuPrevTsIndex);
fhMissedTSEvo->Fill(fdTimeToStart, 1, uTsIndex - fuPrevTsIndex); fhMissedTSEvo->Fill(fdTimeToStart, 1, uTsIndex - fuPrevTsIndex);
} // if( 0 < fuPublishFreqTs ) } // if( 0 < fuPublishFreqTs )
} // if( ( uTsIndex != ( fuPrevTsIndex + 1 ) ) && ( 0 != fuPrevTsIndex && 0 != uTsIndex ) && "" != fsChannelNameMissedTs ) } // if( ( uTsIndex != ( fuPrevTsIndex + 1 ) ) && ( 0 != fuPrevTsIndex && 0 != uTsIndex ) && "" != fsChannelNameMissedTs )
else if( 0 < fuPublishFreqTs ) { else if (0 < fuPublishFreqTs) {
fhMissedTS->Fill(0); fhMissedTS->Fill(0);
fhMissedTSEvo->Fill(fdTimeToStart, 0, 1); fhMissedTSEvo->Fill(fdTimeToStart, 0, 1);
} // else if( 0 < fuPublishFreqTs ) } // else if( 0 < fuPublishFreqTs )
fuPrevTsIndex = uTsIndex; fuPrevTsIndex = uTsIndex;
...@@ -579,21 +578,21 @@ bool CbmMQTsaMultiSampler::ConditionalRun() { ...@@ -579,21 +578,21 @@ bool CbmMQTsaMultiSampler::ConditionalRun() {
} // for (unsigned int nrComp = 0; nrComp < ts.num_components(); ++nrComp) } // for (unsigned int nrComp = 0; nrComp < ts.num_components(); ++nrComp)
} // else of if( fbSendTsPerSysId ) } // else of if( fbSendTsPerSysId )
if( 0 < fuPublishFreqTs ) { if (0 < fuPublishFreqTs) {
/// Send histograms periodically. /// Send histograms periodically.
/// Use also runtime checker to trigger sending after M s if /// Use also runtime checker to trigger sending after M s if
/// processing too slow or delay sending if processing too fast /// processing too slow or delay sending if processing too fast
std::chrono::system_clock::time_point currentTime = std::chrono::system_clock::now(); std::chrono::system_clock::time_point currentTime = std::chrono::system_clock::now();
std::chrono::duration<double_t> elapsedSeconds = currentTime - fLastPublishTime; std::chrono::duration<double_t> elapsedSeconds = currentTime - fLastPublishTime;
if ((fdMaxPublishTime < elapsedSeconds.count()) || if ((fdMaxPublishTime < elapsedSeconds.count())
(0 == fTSCounter % fuPublishFreqTs && fdMinPublishTime < elapsedSeconds.count())) { || (0 == fTSCounter % fuPublishFreqTs && fdMinPublishTime < elapsedSeconds.count())) {
SendHistograms(); SendHistograms();
fLastPublishTime = std::chrono::system_clock::now(); fLastPublishTime = std::chrono::system_clock::now();
} // if( ( fdMaxPublishTime < elapsedSeconds.count() ) || ( 0 == fTSCounter % fuPublishFreqTs && fdMinPublishTime < elapsedSeconds.count() ) ) } // if( ( fdMaxPublishTime < elapsedSeconds.count() ) || ( 0 == fTSCounter % fuPublishFreqTs && fdMinPublishTime < elapsedSeconds.count() ) )
} // if( 0 < fuPublishFreqTs ) } // if( 0 < fuPublishFreqTs )
return true; return true;
} // if (fTSCounter < fMaxTimeslices) } // if (fTSCounter < fMaxTimeslices)
else { else {
CalcRuntime(); CalcRuntime();
...@@ -609,8 +608,8 @@ bool CbmMQTsaMultiSampler::ConditionalRun() { ...@@ -609,8 +608,8 @@ bool CbmMQTsaMultiSampler::ConditionalRun() {
} // if( "" != fsChannelNameCommands ) } // if( "" != fsChannelNameCommands )
return false; return false;
} // else of if (fTSCounter < fMaxTimeslices) } // else of if (fTSCounter < fMaxTimeslices)
} // if (timeslice) } // if (timeslice)
else { else {
CalcRuntime(); CalcRuntime();
...@@ -626,7 +625,7 @@ bool CbmMQTsaMultiSampler::ConditionalRun() { ...@@ -626,7 +625,7 @@ bool CbmMQTsaMultiSampler::ConditionalRun() {
} // if( "" != fsChannelNameCommands ) } // if( "" != fsChannelNameCommands )
return false; return false;
} // else of if (timeslice) } // else of if (timeslice)
} }
bool CbmMQTsaMultiSampler::CreateAndSendComponent(const fles::Timeslice& ts, bool CbmMQTsaMultiSampler::CreateAndSendComponent(const fles::Timeslice& ts,
...@@ -1003,15 +1002,14 @@ bool CbmMQTsaMultiSampler::SendCommand(std::string sCommand) { ...@@ -1003,15 +1002,14 @@ bool CbmMQTsaMultiSampler::SendCommand(std::string sCommand) {
bool CbmMQTsaMultiSampler::SendHistograms() bool CbmMQTsaMultiSampler::SendHistograms()
{ {
/// Serialize the array of histos into a single MQ message /// Serialize the array of histos into a single MQ message
FairMQMessagePtr message( NewMessage() ); FairMQMessagePtr message(NewMessage());
Serialize<RootSerializer>( *message, &fArrayHisto ); Serialize<RootSerializer>(*message, &fArrayHisto);
/// Send message to the common histogram messages queue /// Send message to the common histogram messages queue
if( Send( message, fsChannelNameHistosInput ) < 0 ) if (Send(message, fsChannelNameHistosInput) < 0) {
{
LOG(error) << "Problem sending data"; LOG(error) << "Problem sending data";
return false; return false;
} // if( Send( message, fsChannelNameHistosInput ) < 0 ) } // if( Send( message, fsChannelNameHistosInput ) < 0 )
/// Reset the histograms after sending them (but do not reset the time) /// Reset the histograms after sending them (but do not reset the time)
ResetHistograms(); ResetHistograms();
......
...@@ -51,9 +51,9 @@ protected: ...@@ -51,9 +51,9 @@ protected:
std::string fsChannelNameHistosInput = "histogram-in"; std::string fsChannelNameHistosInput = "histogram-in";
std::string fsChannelNameHistosConfig = "histo-conf"; std::string fsChannelNameHistosConfig = "histo-conf";
std::string fsChannelNameCanvasConfig = "canvas-conf"; std::string fsChannelNameCanvasConfig = "canvas-conf";
uint32_t fuPublishFreqTs = 0; uint32_t fuPublishFreqTs = 0;
double_t fdMinPublishTime = 0.5; double_t fdMinPublishTime = 0.5;
double_t fdMaxPublishTime = 5; double_t fdMaxPublishTime = 5;
uint64_t fuPrevTsIndex