Skip to content
Snippets Groups Projects
Commit c8fe5e1f authored by Frank Winklmeier's avatar Frank Winklmeier Committed by Graeme Stewart
Browse files

std::sort bin labels instead of using ROOT (ATR-15742) (TrigSteerMonitor-01-05-14)

	* src/TrigSignatureMoni.cxx: std::sort bin labels instead of using ROOT (ATR-15742)
	* TrigSteerMonitor-01-05-14

2017-01-28  scott snyder  <snyder@bnl.gov>

	* Tagging TrigSteerMonitor-01-05-13.
	* gcc7 warning: potential snprintf truncation.
parent 290f4bee
No related merge requests found
...@@ -154,9 +154,9 @@ StatusCode TrigCorMoni::bookHists() ...@@ -154,9 +154,9 @@ StatusCode TrigCorMoni::bookHists()
// //
//default binning //default binning
char ctpid[11]; char ctpid[20];
for (int ibin=1;ibin<=m_rejectL1->GetXaxis()->GetNbins(); ibin++) { 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_rejectL1->GetXaxis()->SetBinLabel(ibin, ctpid);
m_streamL1->GetXaxis()->SetBinLabel(ibin, ctpid); m_streamL1->GetXaxis()->SetBinLabel(ibin, ctpid);
m_acceptL1->GetXaxis()->SetBinLabel(ibin, ctpid); m_acceptL1->GetXaxis()->SetBinLabel(ibin, ctpid);
......
...@@ -192,7 +192,8 @@ TrigSignatureMoni::~TrigSignatureMoni() ...@@ -192,7 +192,8 @@ TrigSignatureMoni::~TrigSignatureMoni()
BinBlock::PrepareToBook(); 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; 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 ...@@ -201,12 +202,12 @@ void findChainsInStreams(std::map<std::string, TH1I*>& histograms, const std::ve
stream_to_chains[stream.getStream()].push_back(chain->getChainName()); stream_to_chains[stream.getStream()].push_back(chain->getChainName());
} }
} }
std::map<std::string, std::vector<std::string> >::const_iterator p; for ( auto& p : stream_to_chains ) {
for ( p = stream_to_chains.begin(); p != stream_to_chains.end(); ++p ) {
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; 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()); h->GetXaxis()->SetBinLabel(bin, label.c_str());
++bin; ++bin;
} }
...@@ -403,7 +404,6 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /* ...@@ -403,7 +404,6 @@ StatusCode TrigSignatureMoni::bookHistograms( bool/* isNewEventsBlock*/, bool /*
findChainsInStreams(m_chainsInStream, configuredChains, m_trigLvl); findChainsInStreams(m_chainsInStream, configuredChains, m_trigLvl);
for ( const auto& s : m_chainsInStream ) { // (string,TH1I*) for ( const auto& s : m_chainsInStream ) { // (string,TH1I*)
s.second->GetXaxis()->LabelsOption("a");
if ( expertHistograms.regHist(s.second).isFailure()) { if ( expertHistograms.regHist(s.second).isFailure()) {
ATH_MSG_WARNING("Failed to book stream histogram"); ATH_MSG_WARNING("Failed to book stream histogram");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment