54 #include "TLorentzVector.h" 56 #include <unordered_map> 64 using std::unordered_map;
75 int pathIndexOR = -99;
97 double get_wall_time(
void);
106 unordered_map<hltPlot*, edm::ParameterSet*>
plotMap;
216 topDirectoryName =
"HLT/ObjectMonitor";
217 mainShifterFolder = topDirectoryName +
"/MainShifter";
218 backupFolder = topDirectoryName +
"/Backup";
221 processName_ = iConfig.
getParameter<
string>(
"processName");
224 plotMap[&caloAK4JetPt_] = &caloAK4JetPt_pset;
226 plotMap[&caloAK4JetEta_] = &caloAK4JetEta_pset;
228 plotMap[&caloAK4JetPhi_] = &caloAK4JetPhi_pset;
230 plotMap[&pfAK4JetPt_] = &pfAK4JetPt_pset;
232 plotMap[&pfAK4JetEta_] = &pfAK4JetEta_pset;
234 plotMap[&pfAK4JetPhi_] = &pfAK4JetPhi_pset;
236 plotMap[&caloDiAK4JetPt_] = &caloDiAK4JetPt_pset;
238 plotMap[&caloDiAK4JetEta_] = &caloDiAK4JetEta_pset;
240 plotMap[&caloDiAK4JetPhi_] = &caloDiAK4JetPhi_pset;
242 plotMap[&pfDiAK4JetPt_] = &pfDiAK4JetPt_pset;
244 plotMap[&pfDiAK4JetEta_] = &pfDiAK4JetEta_pset;
246 plotMap[&pfDiAK4JetPhi_] = &pfDiAK4JetPhi_pset;
248 plotMap[&photonPt_] = &photonPt_pset;
250 plotMap[&photonEta_] = &photonEta_pset;
252 plotMap[&photonPhi_] = &photonPhi_pset;
254 plotMap[&photonPPPt_] = &photonPPPt_pset;
256 plotMap[&photonPPEta_] = &photonPPEta_pset;
258 plotMap[&photonPPPhi_] = &photonPPPhi_pset;
260 plotMap[&caloBJetPt_] = &caloBJetPt_pset;
262 plotMap[&caloBJetEta_] = &caloBJetEta_pset;
264 plotMap[&caloBJetPhi_] = &caloBJetPhi_pset;
266 plotMap[&pfBJetPt_] = &pfBJetPt_pset;
268 plotMap[&pfBJetEta_] = &pfBJetEta_pset;
270 plotMap[&pfBJetPhi_] = &pfBJetPhi_pset;
272 plotMap[&electronPt_] = &electronPt_pset;
274 plotMap[&electronEta_] = &electronEta_pset;
276 plotMap[&electronPhi_] = &electronPhi_pset;
278 plotMap[&l3muon3Pt_] = &l3muon3Pt_pset;
280 plotMap[&l3muon3Eta_] = &l3muon3Eta_pset;
282 plotMap[&l3muon3Phi_] = &l3muon3Phi_pset;
284 plotMap[&l2muon12Pt_] = &l2muon12Pt_pset;
286 plotMap[&l2muon12Eta_] = &l2muon12Eta_pset;
288 plotMap[&l2muon12Phi_] = &l2muon12Phi_pset;
290 plotMap[&l3muon12Pt_] = &l3muon12Pt_pset;
292 plotMap[&l3muon12Eta_] = &l3muon12Eta_pset;
294 plotMap[&l3muon12Phi_] = &l3muon12Phi_pset;
296 plotMap[&pAL1DoubleMuZMass_] = &pAL1DoubleMuZMass_pset;
298 plotMap[&pAL2DoubleMuZMass_] = &pAL2DoubleMuZMass_pset;
300 plotMap[&pAL3DoubleMuZMass_] = &pAL3DoubleMuZMass_pset;
302 plotMap[&wallTime_] = &wallTime_pset;
304 for (
auto item = plotMap.begin();
item != plotMap.end();
item++) {
307 (*
item->first).
nBins = (*
item->second).getParameter<
int>(
"NbinsX");
308 (*
item->first).
xMin = (*
item->second).getParameter<
double>(
"Xmin");
309 (*
item->first).
xMax = (*
item->second).getParameter<
double>(
"Xmax");
310 (*
item->first).xAxisLabel = (*
item->second).getParameter<
string>(
"axisLabel");
312 (*
item->first).displayInPrimary = (*
item->second).getParameter<
bool>(
"mainWorkspace");
314 if ((*
item->second).exists(
"pathName_OR")) {
315 (*
item->first).pathNameOR = (*
item->second).getParameter<
string>(
"pathName_OR");
317 if ((*
item->second).exists(
"moduleName_OR")) {
318 (*
item->first).moduleNameOR = (*
item->second).getParameter<
string>(
"moduleName_OR");
321 plotList.push_back(
item->first);
341 double start = get_wall_time();
346 std::cout <<
"Inside analyze(). " << std::endl;
355 iEvent.getByToken(aodTriggerToken_, aodTriggerEvent);
356 if (!aodTriggerEvent.
isValid())
360 unordered_map<string, bool> firedMap = acceptMap;
361 for (
auto plot : plotList)
363 if (firedMap[
plot->pathName])
374 hltConfig_.saveTags(
plot->moduleNameOR)) {
375 if (firedMap[
plot->pathNameOR])
383 unsigned int moduleFilterIndex = aodTriggerEvent->
filterIndex(moduleFilter);
385 if (moduleFilterIndex + 1 > aodTriggerEvent->
sizeFilters())
396 if (
pathName == caloAK4JetPt_.pathName) {
404 else if (
pathName == pfAK4JetPt_.pathName) {
412 else if (
pathName == caloDiAK4JetPt_.pathName) {
416 caloDiAK4JetPhi_.ME->Fill(
objects[
key].phi());
420 else if (
pathName == pfDiAK4JetPt_.pathName) {
428 else if (
pathName == photonPt_.pathName) {
436 else if (
pathName == photonPPPt_.pathName) {
444 else if (
pathName == caloBJetPt_.pathName) {
452 else if (
pathName == pfBJetPt_.pathName) {
460 else if (
pathName == electronPt_.pathName) {
466 }
else if (
pathName == l3muon3Pt_.pathName) {
472 }
else if (
pathName == l2muon12Pt_.pathName) {
478 }
else if (
pathName == l3muon12Pt_.pathName) {
492 else if (
pathName == pAL1DoubleMuZMass_.pathName) {
493 const double mu_mass(.105658);
494 unsigned int kCnt0 = 0;
495 for (
const auto& key0 :
keys) {
496 unsigned int kCnt1 = 0;
497 for (
const auto& key1 :
keys) {
501 TLorentzVector mu1, mu2, dimu;
505 if (dimu.M() > pAL1DoubleMuZMass_.xMin && dimu.M() < pAL1DoubleMuZMass_.xMax)
506 pAL1DoubleMuZMass_.ME->Fill(dimu.M());
512 }
else if (
pathName == pAL2DoubleMuZMass_.pathName) {
513 const double mu_mass(.105658);
514 unsigned int kCnt0 = 0;
515 for (
const auto& key0 :
keys) {
516 unsigned int kCnt1 = 0;
517 for (
const auto& key1 :
keys) {
522 TLorentzVector mu1, mu2, dimu;
526 if (dimu.M() > pAL2DoubleMuZMass_.xMin && dimu.M() < pAL2DoubleMuZMass_.xMax)
527 pAL2DoubleMuZMass_.ME->Fill(dimu.M());
534 }
else if (
pathName == pAL3DoubleMuZMass_.pathName) {
535 const double mu_mass(.105658);
536 unsigned int kCnt0 = 0;
537 for (
const auto& key0 :
keys) {
538 unsigned int kCnt1 = 0;
539 for (
const auto& key1 :
keys) {
544 TLorentzVector mu1, mu2, dimu;
548 if (dimu.M() > pAL3DoubleMuZMass_.xMin && dimu.M() < pAL3DoubleMuZMass_.xMax)
549 pAL3DoubleMuZMass_.ME->Fill(dimu.M());
563 double end = get_wall_time();
571 std::cout <<
"Calling beginRun. " << std::endl;
573 if (hltConfig_.init(iRun, iSetup, processName_, changed)) {
575 std::cout <<
"Extracting HLTconfig. " << std::endl;
579 string pathName_noVersion;
580 vector<string>
triggerPaths = hltConfig_.triggerNames();
583 pathName_noVersion = hltConfig_.removeVersion(
pathName);
584 for (
auto plot : plotList) {
585 if (
plot->pathName == pathName_noVersion) {
586 (*plot).pathIndex = hltConfig_.triggerIndex(
pathName);
587 }
else if (
plot->pathNameOR == pathName_noVersion) {
588 (*plot).pathIndexOR = hltConfig_.triggerIndex(
pathName);
592 vector<hltPlot*> plotList_temp;
593 for (
auto plot : plotList) {
594 if (
plot->pathIndex > 0 ||
plot->pathIndexOR > 0) {
595 plotList_temp.push_back(
plot);
596 acceptMap[
plot->pathName] =
false;
597 if (
plot->pathIndexOR > 0)
598 acceptMap[
plot->pathNameOR] =
false;
602 plotList = plotList_temp;
603 plotList_temp.clear();
620 ibooker.
book1D(wallTime_.plotLabel, wallTime_.pathName, wallTime_.nBins, wallTime_.xMin, wallTime_.xMax);
623 for (
auto plot : plotList) {
625 if (!
plot->pathNameOR.empty())
626 display_pathNames =
plot->pathName +
" OR " +
plot->pathNameOR;
628 if (
plot->displayInPrimary) {
630 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
635 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
643 if (gettimeofday(&
time,
nullptr))
645 return (
double)
time.tv_sec + (double)
time.tv_usec * .000001;
~HLTObjectMonitorProtonLead() override
edm::ParameterSet caloAK4JetEta_pset
edm::EDGetTokenT< trigger::TriggerEvent > aodTriggerToken_
const Keys & filterKeys(trigger::size_type index) const
T getParameter(std::string const &) const
edm::ParameterSet caloBJetEta_pset
edm::ParameterSet l3muon3Eta_pset
virtual void setCurrentFolder(std::string const &fullpath)
edm::ParameterSet pfAK4JetPhi_pset
hltPlot pAL1DoubleMuZMass_
edm::ParameterSet caloDiAK4JetPt_pset
trigger::size_type sizeFilters() const
edm::ParameterSet l3muon3Pt_pset
unordered_map< string, bool > acceptMap
edm::ParameterSet pfAK4JetPt_pset
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ParameterSet l2muon12Eta_pset
edm::ParameterSet electronEta_pset
edm::ParameterSet wallTime_pset
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::ParameterSet l3muon12Phi_pset
edm::ParameterSet photonPt_pset
edm::ParameterSet pfDiAK4JetPt_pset
edm::ParameterSet caloBJetPt_pset
hltPlot pAL2DoubleMuZMass_
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
edm::ParameterSet electronPhi_pset
edm::ParameterSet l3muon12Pt_pset
Abs< T >::type abs(const T &t)
edm::ParameterSet pfBJetPhi_pset
const TriggerObjectCollection & getObjects() const
#define DEFINE_FWK_MODULE(type)
static std::string const triggerResults
unordered_map< hltPlot *, edm::ParameterSet * > plotMap
edm::ParameterSet photonPhi_pset
edm::ParameterSet pfDiAK4JetPhi_pset
edm::ParameterSet pAL1DoubleMuZMass_pset
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
edm::ParameterSet photonPPEta_pset
edm::ParameterSet pfDiAK4JetEta_pset
edm::ParameterSet photonPPPhi_pset
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
HLTConfigProvider hltConfig_
edm::ParameterSet pAL2DoubleMuZMass_pset
edm::ParameterSet caloBJetPhi_pset
std::vector< size_type > Keys
HLTObjectMonitorProtonLead(const edm::ParameterSet &)
edm::ParameterSet pAL3DoubleMuZMass_pset
edm::ParameterSet l2muon12Phi_pset
edm::ParameterSet photonPPPt_pset
edm::ParameterSet electronPt_pset
hltPlot pAL3DoubleMuZMass_
edm::ParameterSet caloDiAK4JetPhi_pset
edm::ParameterSet pfAK4JetEta_pset
edm::ParameterSet pfBJetEta_pset
double get_wall_time(void)
vector< hltPlot * > plotList
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
edm::ParameterSet photonEta_pset
edm::ParameterSet caloAK4JetPt_pset
edm::ParameterSet l3muon3Phi_pset
static std::string const triggerPaths
edm::ParameterSet caloAK4JetPhi_pset
edm::ParameterSet caloDiAK4JetEta_pset
edm::ParameterSet pfBJetPt_pset
edm::ParameterSet l3muon12Eta_pset
edm::ParameterSet l2muon12Pt_pset
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void analyze(const edm::Event &, const edm::EventSetup &) override