diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigCorMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigCorMoni.cxx index c3e8edd9b7c4278644da8c4bf8015d0ffabab710..e16ae118aa668d76284f156c028344b025a2025d 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigCorMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigCorMoni.cxx @@ -154,9 +154,9 @@ StatusCode TrigCorMoni::bookHists() // //default binning - char ctpid[11]; + char ctpid[20]; for (int ibin=1;ibin<=m_rejectL1->GetXaxis()->GetNbins(); ibin++) { - sprintf(ctpid,"CTPID-%d",ibin); + snprintf(ctpid,sizeof(ctpid),"CTPID-%d",ibin); m_rejectL1->GetXaxis()->SetBinLabel(ibin, ctpid); m_streamL1->GetXaxis()->SetBinLabel(ibin, ctpid); m_acceptL1->GetXaxis()->SetBinLabel(ibin, ctpid); diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx index 2b8e4e35855dc8fc514598b3fb13ec50ab96e224..783b82b9df3a9d62e4abee1f2c5f14bd967ea1ac 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigSignatureMoni.cxx @@ -192,7 +192,8 @@ TrigSignatureMoni::~TrigSignatureMoni() BinBlock::PrepareToBook(); } -void findChainsInStreams(std::map<std::string, TH1I*>& histograms, const std::vector<const HLT::SteeringChain*>& config, const std::string& level) +void findChainsInStreams(std::map<std::string, TH1I*>& histograms, + const std::vector<const HLT::SteeringChain*>& config, const std::string& level) { std::map<std::string, std::vector<std::string> > stream_to_chains; @@ -201,12 +202,12 @@ void findChainsInStreams(std::map<std::string, TH1I*>& histograms, const std::ve stream_to_chains[stream.getStream()].push_back(chain->getChainName()); } } - std::map<std::string, std::vector<std::string> >::const_iterator p; - for ( p = stream_to_chains.begin(); p != stream_to_chains.end(); ++p ) { + for ( auto& p : stream_to_chains ) { - TH1I* h = histograms[p->first] = new TH1I(("ChainsInStream_"+p->first).c_str(), ("Chains in " +level + "stream "+p->first).c_str(), p->second.size(), 0, p->second.size()); + TH1I* h = histograms[p.first] = new TH1I(("ChainsInStream_"+p.first).c_str(), ("Chains in " +level + "stream "+p.first).c_str(), p.second.size(), 0, p.second.size()); int bin = 1; - for ( const std::string& label : p->second) { + std::sort(p.second.begin(), p.second.end()); // sort alphabetically + for ( const std::string& label : p.second) { h->GetXaxis()->SetBinLabel(bin, label.c_str()); ++bin; } @@ -403,7 +404,6 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /* findChainsInStreams(m_chainsInStream, configuredChains, m_trigLvl); for ( const auto& s : m_chainsInStream ) { // (string,TH1I*) - s.second->GetXaxis()->LabelsOption("a"); if ( expertHistograms.regHist(s.second).isFailure()) { ATH_MSG_WARNING("Failed to book stream histogram"); }