New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
organize HLT trigger rate plots in directories #17519
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#include "DQM/HLTEvF/plugins/TriggerRatesMonitorClient.h" | ||
|
||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
|
||
// | ||
// -------------------------------------- Constructor -------------------------------------------- | ||
// | ||
TriggerRatesMonitorClient::TriggerRatesMonitorClient(const edm::ParameterSet& iConfig) | ||
: m_dqm_path( iConfig.getUntrackedParameter<std::string>("dqmPath") ) | ||
{ | ||
edm::LogInfo("TriggerRatesMonitorClient") << "Constructor TriggerRatesMonitorClient::TriggerRatesMonitorClient " << std::endl; | ||
|
||
} | ||
|
||
// | ||
// -------------------------------------- beginJob -------------------------------------------- | ||
// | ||
void TriggerRatesMonitorClient::beginJob() | ||
{ | ||
edm::LogInfo("TriggerRatesMonitorClient") << "TriggerRatesMonitorClient::beginJob " << std::endl; | ||
} | ||
|
||
// | ||
// -------------------------------------- get and book in the endJob -------------------------------------------- | ||
// | ||
void TriggerRatesMonitorClient::dqmEndJob(DQMStore::IBooker& ibooker_, DQMStore::IGetter& igetter_) | ||
{ | ||
// create and cd into new folder | ||
ibooker_.setCurrentFolder(m_dqm_path); | ||
|
||
//get available histograms | ||
std::vector<std::string> directories = igetter_.getSubdirs(); | ||
m_hltXpd_counts.resize( directories.size() ); | ||
|
||
int i = 0; | ||
for ( auto const & dir : directories) { | ||
// std::cout << "dir: " << dir << std::endl; | ||
ibooker_.setCurrentFolder(m_dqm_path + "/" + dir); | ||
|
||
std::vector<std::string> const & all_mes = igetter_.getMEs(); | ||
std::vector<std::string> mes; | ||
for ( auto const & me : all_mes ) | ||
if ( me.find("accept") != std::string::npos ) mes.push_back(me); | ||
|
||
int nbinsY = mes.size(); | ||
double xminY = 0.; | ||
double xmaxY = xminY + 1.*nbinsY; | ||
int nbinsX = 0; | ||
int ibinY = 1; | ||
for ( auto const & me : mes ) { | ||
// std::cout << "me: " << me << std::endl; | ||
ibooker_.setCurrentFolder(m_dqm_path + "/" + dir); | ||
TH1F* histo = igetter_.get( me )->getTH1F(); | ||
|
||
if (m_hltXpd_counts[i] == nullptr ) { | ||
// get range and binning for new MEs | ||
nbinsX = histo->GetNbinsX(); | ||
double xminX = histo->GetXaxis()->GetXmin(); | ||
double xmaxX = histo->GetXaxis()->GetXmax(); | ||
|
||
//book new histogram | ||
std::string hname = dir + "_summary"; | ||
ibooker_.setCurrentFolder(m_dqm_path); | ||
m_hltXpd_counts[i] = ibooker_.book2D(hname,hname,nbinsX,xminX,xmaxX,nbinsY,xminY,xmaxY)->getTH2F(); | ||
} else { | ||
m_hltXpd_counts[i]->GetYaxis()->SetBinLabel(ibinY,me.c_str()); | ||
} | ||
|
||
// handle mes | ||
for ( int ibinX=1; ibinX <= nbinsX; ++ibinX ) { | ||
float rate = histo->GetBinContent(ibinX); | ||
m_hltXpd_counts[i]->SetBinContent(ibinX,ibinY,rate); | ||
} | ||
ibinY++; | ||
} | ||
|
||
i++; | ||
} | ||
|
||
} | ||
|
||
// | ||
// -------------------------------------- get in the endLumi if needed -------------------------------------------- | ||
// | ||
void TriggerRatesMonitorClient::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker_, DQMStore::IGetter & igetter_, edm::LuminosityBlock const & iLumi, edm::EventSetup const& iSetup) | ||
{ | ||
edm::LogInfo("TriggerRatesMonitorClient") << "TriggerRatesMonitorClient::endLumi " << std::endl; | ||
} | ||
|
||
void TriggerRatesMonitorClient::fillDescriptions(edm::ConfigurationDescriptions & descriptions) | ||
{ | ||
|
||
edm::ParameterSetDescription desc; | ||
desc.addUntracked<std::string>("dqmPath","HLT/Datasets"); | ||
descriptions.add("dqmCorrelationClient", desc); | ||
|
||
} | ||
|
||
// Define this as a plug-in | ||
#include "FWCore/Framework/interface/MakerMacros.h" | ||
DEFINE_FWK_MODULE(TriggerRatesMonitorClient); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef TRIGGERRATESMONITORCLIENT_H | ||
#define TRIGGERRATESMONITORCLIENT_H | ||
|
||
//Framework | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
|
||
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" | ||
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" | ||
#include "FWCore/ParameterSet/interface/Registry.h" | ||
|
||
//DQM | ||
#include "DQMServices/Core/interface/DQMEDHarvester.h" | ||
#include "DQMServices/Core/interface/DQMStore.h" | ||
#include "DQMServices/Core/interface/MonitorElement.h" | ||
|
||
class TriggerRatesMonitorClient: public DQMEDHarvester{ | ||
|
||
public: | ||
|
||
TriggerRatesMonitorClient(const edm::ParameterSet& ps); | ||
virtual ~TriggerRatesMonitorClient() = default; | ||
static void fillDescriptions(edm::ConfigurationDescriptions & descriptions); | ||
|
||
protected: | ||
|
||
void beginJob() override; | ||
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const&) override; //performed in the endLumi | ||
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override; //performed in the endJob | ||
|
||
private: | ||
|
||
//private variables | ||
std::string m_dqm_path; | ||
|
||
// Histograms | ||
std::vector<TH2F *> m_hltXpd_counts; | ||
|
||
}; | ||
|
||
|
||
#endif // TRIGGERRATESMONITORCLIENT_H |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks like a bug - i is used in two loops at once. Is it really correct?
@mtosi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apparently the comment I wrote 10 days ago was not committed .. it seemed to me so, but it was not !
the comment was
loop opened in line 361 gets closed in 366,
not that the for instance does not have the
for (unsigned int i: m_datasets[d])
in addition, the compiler does not complain, above all in this case where the variable
i
gets different typesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah - ok, I missed the lack of a {} for the loop starting on line 361 (the } on line 366 closes the if statement started on 362)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right
is it ok ?
thanks