56 #include "TLorentzVector.h"
58 #include <unordered_map>
64 using namespace trigger;
66 using std::unordered_map;
77 int pathIndexOR = -99;
99 double get_wall_time(
void);
108 unordered_map<hltPlot*, edm::ParameterSet*>
plotMap;
218 topDirectoryName =
"HLT/ObjectMonitor";
219 mainShifterFolder = topDirectoryName +
"/MainShifter";
220 backupFolder = topDirectoryName +
"/Backup";
223 processName_ = iConfig.
getParameter<
string>(
"processName");
226 plotMap[&caloAK4JetPt_] = &caloAK4JetPt_pset;
228 plotMap[&caloAK4JetEta_] = &caloAK4JetEta_pset;
230 plotMap[&caloAK4JetPhi_] = &caloAK4JetPhi_pset;
232 plotMap[&pfAK4JetPt_] = &pfAK4JetPt_pset;
234 plotMap[&pfAK4JetEta_] = &pfAK4JetEta_pset;
236 plotMap[&pfAK4JetPhi_] = &pfAK4JetPhi_pset;
238 plotMap[&caloDiAK4JetPt_] = &caloDiAK4JetPt_pset;
240 plotMap[&caloDiAK4JetEta_] = &caloDiAK4JetEta_pset;
242 plotMap[&caloDiAK4JetPhi_] = &caloDiAK4JetPhi_pset;
244 plotMap[&pfDiAK4JetPt_] = &pfDiAK4JetPt_pset;
246 plotMap[&pfDiAK4JetEta_] = &pfDiAK4JetEta_pset;
248 plotMap[&pfDiAK4JetPhi_] = &pfDiAK4JetPhi_pset;
250 plotMap[&photonPt_] = &photonPt_pset;
252 plotMap[&photonEta_] = &photonEta_pset;
254 plotMap[&photonPhi_] = &photonPhi_pset;
256 plotMap[&photonPPPt_] = &photonPPPt_pset;
258 plotMap[&photonPPEta_] = &photonPPEta_pset;
260 plotMap[&photonPPPhi_] = &photonPPPhi_pset;
262 plotMap[&caloBJetPt_] = &caloBJetPt_pset;
264 plotMap[&caloBJetEta_] = &caloBJetEta_pset;
266 plotMap[&caloBJetPhi_] = &caloBJetPhi_pset;
268 plotMap[&pfBJetPt_] = &pfBJetPt_pset;
270 plotMap[&pfBJetEta_] = &pfBJetEta_pset;
272 plotMap[&pfBJetPhi_] = &pfBJetPhi_pset;
274 plotMap[&electronPt_] = &electronPt_pset;
276 plotMap[&electronEta_] = &electronEta_pset;
278 plotMap[&electronPhi_] = &electronPhi_pset;
280 plotMap[&l3muon3Pt_] = &l3muon3Pt_pset;
282 plotMap[&l3muon3Eta_] = &l3muon3Eta_pset;
284 plotMap[&l3muon3Phi_] = &l3muon3Phi_pset;
286 plotMap[&l2muon12Pt_] = &l2muon12Pt_pset;
288 plotMap[&l2muon12Eta_] = &l2muon12Eta_pset;
290 plotMap[&l2muon12Phi_] = &l2muon12Phi_pset;
292 plotMap[&l3muon12Pt_] = &l3muon12Pt_pset;
294 plotMap[&l3muon12Eta_] = &l3muon12Eta_pset;
296 plotMap[&l3muon12Phi_] = &l3muon12Phi_pset;
298 plotMap[&pAL1DoubleMuZMass_] = &pAL1DoubleMuZMass_pset;
300 plotMap[&pAL2DoubleMuZMass_] = &pAL2DoubleMuZMass_pset;
302 plotMap[&pAL3DoubleMuZMass_] = &pAL3DoubleMuZMass_pset;
304 plotMap[&wallTime_] = &wallTime_pset;
306 for (
auto item = plotMap.begin();
item != plotMap.end();
item++) {
309 (*
item->first).nBins = (*
item->second).getParameter<
int>(
"NbinsX");
310 (*
item->first).xMin = (*
item->second).getParameter<
double>(
"Xmin");
311 (*
item->first).xMax = (*
item->second).getParameter<
double>(
"Xmax");
312 (*
item->first).xAxisLabel = (*
item->second).getParameter<
string>(
"axisLabel");
314 (*
item->first).displayInPrimary = (*
item->second).getParameter<
bool>(
"mainWorkspace");
316 if ((*
item->second).exists(
"pathName_OR")) {
317 (*
item->first).pathNameOR = (*
item->second).getParameter<
string>(
"pathName_OR");
319 if ((*
item->second).exists(
"moduleName_OR")) {
320 (*
item->first).moduleNameOR = (*
item->second).getParameter<
string>(
"moduleName_OR");
323 plotList.push_back(
item->first);
343 double start = get_wall_time();
348 std::cout <<
"Inside analyze(). " << std::endl;
357 iEvent.
getByToken(aodTriggerToken_, aodTriggerEvent);
358 if (!aodTriggerEvent.isValid())
362 unordered_map<string, bool> firedMap = acceptMap;
363 for (
auto plot : plotList)
365 if (firedMap[
plot->pathName])
367 bool triggerAccept =
false;
373 pathName =
plot->pathName;
374 triggerAccept =
true;
376 hltConfig_.saveTags(
plot->moduleNameOR)) {
377 if (firedMap[
plot->pathNameOR])
380 pathName =
plot->pathNameOR;
381 triggerAccept =
true;
385 unsigned int moduleFilterIndex = aodTriggerEvent->filterIndex(moduleFilter);
387 if (moduleFilterIndex + 1 > aodTriggerEvent->sizeFilters())
389 const Keys&
keys = aodTriggerEvent->filterKeys(moduleFilterIndex);
398 if (pathName == caloAK4JetPt_.pathName) {
399 for (
const auto&
key : keys) {
400 caloAK4JetPt_.ME->Fill(objects[
key].
pt());
401 caloAK4JetEta_.ME->Fill(objects[
key].
eta());
402 caloAK4JetPhi_.ME->Fill(objects[
key].phi());
406 else if (pathName == pfAK4JetPt_.pathName) {
407 for (
const auto&
key : keys) {
408 pfAK4JetPt_.ME->Fill(objects[
key].
pt());
409 pfAK4JetEta_.ME->Fill(objects[
key].
eta());
410 pfAK4JetPhi_.ME->Fill(objects[
key].phi());
414 else if (pathName == caloDiAK4JetPt_.pathName) {
415 for (
const auto&
key : keys) {
416 caloDiAK4JetPt_.ME->Fill(objects[
key].
pt());
417 caloDiAK4JetEta_.ME->Fill(objects[
key].
eta());
418 caloDiAK4JetPhi_.ME->Fill(objects[
key].phi());
422 else if (pathName == pfDiAK4JetPt_.pathName) {
423 for (
const auto&
key : keys) {
424 pfDiAK4JetPt_.ME->Fill(objects[
key].
pt());
425 pfDiAK4JetEta_.ME->Fill(objects[
key].
eta());
426 pfDiAK4JetPhi_.ME->Fill(objects[
key].phi());
430 else if (pathName == photonPt_.pathName) {
431 for (
const auto&
key : keys) {
432 photonPt_.ME->Fill(objects[
key].
pt());
433 photonEta_.ME->Fill(objects[
key].
eta());
434 photonPhi_.ME->Fill(objects[
key].phi());
438 else if (pathName == photonPPPt_.pathName) {
439 for (
const auto&
key : keys) {
440 photonPPPt_.ME->Fill(objects[
key].
pt());
441 photonPPEta_.ME->Fill(objects[
key].
eta());
442 photonPPPhi_.ME->Fill(objects[
key].phi());
446 else if (pathName == caloBJetPt_.pathName) {
447 for (
const auto&
key : keys) {
448 caloBJetPt_.ME->Fill(objects[
key].
pt());
449 caloBJetEta_.ME->Fill(objects[
key].
eta());
450 caloBJetPhi_.ME->Fill(objects[
key].phi());
454 else if (pathName == pfBJetPt_.pathName) {
455 for (
const auto&
key : keys) {
456 pfBJetPt_.ME->Fill(objects[
key].
pt());
457 pfBJetEta_.ME->Fill(objects[
key].
eta());
458 pfBJetPhi_.ME->Fill(objects[
key].phi());
462 else if (pathName == electronPt_.pathName) {
463 for (
const auto&
key : keys) {
464 electronPt_.ME->Fill(objects[
key].
pt());
465 electronEta_.ME->Fill(objects[
key].
eta());
466 electronPhi_.ME->Fill(objects[
key].phi());
468 }
else if (pathName == l3muon3Pt_.pathName) {
469 for (
const auto&
key : keys) {
470 l3muon3Pt_.ME->Fill(objects[
key].
pt());
471 l3muon3Eta_.ME->Fill(objects[
key].
eta());
472 l3muon3Phi_.ME->Fill(objects[
key].phi());
474 }
else if (pathName == l2muon12Pt_.pathName) {
475 for (
const auto&
key : keys) {
476 l2muon12Pt_.ME->Fill(objects[
key].
pt());
477 l2muon12Eta_.ME->Fill(objects[
key].
eta());
478 l2muon12Phi_.ME->Fill(objects[
key].phi());
480 }
else if (pathName == l3muon12Pt_.pathName) {
481 for (
const auto&
key : keys) {
482 l3muon12Pt_.ME->Fill(objects[
key].
pt());
483 l3muon12Eta_.ME->Fill(objects[
key].
eta());
484 l3muon12Phi_.ME->Fill(objects[
key].phi());
494 else if (pathName == pAL1DoubleMuZMass_.pathName) {
496 unsigned int kCnt0 = 0;
497 for (
const auto& key0 : keys) {
498 unsigned int kCnt1 = 0;
499 for (
const auto& key1 : keys) {
503 TLorentzVector mu1, mu2, dimu;
504 mu1.SetPtEtaPhiM(objects[key0].
pt(), objects[key0].
eta(), objects[key0].phi(), mu_mass);
505 mu2.SetPtEtaPhiM(objects[key1].
pt(), objects[key1].
eta(), objects[key1].phi(), mu_mass);
507 if (dimu.M() > pAL1DoubleMuZMass_.xMin && dimu.M() < pAL1DoubleMuZMass_.xMax)
508 pAL1DoubleMuZMass_.ME->Fill(dimu.M());
514 }
else if (pathName == pAL2DoubleMuZMass_.pathName) {
516 unsigned int kCnt0 = 0;
517 for (
const auto& key0 : keys) {
518 unsigned int kCnt1 = 0;
519 for (
const auto& key1 : keys) {
522 if (
abs(objects[key0].
id()) == 13 &&
523 (objects[key0].
id() + objects[key1].
id() == 0)) {
524 TLorentzVector mu1, mu2, dimu;
525 mu1.SetPtEtaPhiM(objects[key0].
pt(), objects[key0].
eta(), objects[key0].phi(), mu_mass);
526 mu2.SetPtEtaPhiM(objects[key1].
pt(), objects[key1].
eta(), objects[key1].phi(), mu_mass);
528 if (dimu.M() > pAL2DoubleMuZMass_.xMin && dimu.M() < pAL2DoubleMuZMass_.xMax)
529 pAL2DoubleMuZMass_.ME->Fill(dimu.M());
536 }
else if (pathName == pAL3DoubleMuZMass_.pathName) {
538 unsigned int kCnt0 = 0;
539 for (
const auto& key0 : keys) {
540 unsigned int kCnt1 = 0;
541 for (
const auto& key1 : keys) {
544 if (
abs(objects[key0].
id()) == 13 &&
545 (objects[key0].
id() + objects[key1].
id() == 0)) {
546 TLorentzVector mu1, mu2, dimu;
547 mu1.SetPtEtaPhiM(objects[key0].
pt(), objects[key0].
eta(), objects[key0].phi(), mu_mass);
548 mu2.SetPtEtaPhiM(objects[key1].
pt(), objects[key1].
eta(), objects[key1].phi(), mu_mass);
550 if (dimu.M() > pAL3DoubleMuZMass_.xMin && dimu.M() < pAL3DoubleMuZMass_.xMax)
551 pAL3DoubleMuZMass_.ME->Fill(dimu.M());
565 double end = get_wall_time();
573 std::cout <<
"Calling beginRun. " << std::endl;
575 if (hltConfig_.init(iRun, iSetup, processName_, changed)) {
577 std::cout <<
"Extracting HLTconfig. " << std::endl;
581 string pathName_noVersion;
582 vector<string>
triggerPaths = hltConfig_.triggerNames();
584 for (
const auto&
pathName : triggerPaths) {
585 pathName_noVersion = hltConfig_.removeVersion(
pathName);
586 for (
auto plot : plotList) {
587 if (
plot->pathName == pathName_noVersion) {
588 (*plot).pathIndex = hltConfig_.triggerIndex(
pathName);
589 }
else if (
plot->pathNameOR == pathName_noVersion) {
590 (*plot).pathIndexOR = hltConfig_.triggerIndex(
pathName);
594 vector<hltPlot*> plotList_temp;
595 for (
auto plot : plotList) {
596 if (
plot->pathIndex > 0 ||
plot->pathIndexOR > 0) {
597 plotList_temp.push_back(
plot);
598 acceptMap[
plot->pathName] =
false;
599 if (
plot->pathIndexOR > 0)
600 acceptMap[
plot->pathNameOR] =
false;
604 plotList = plotList_temp;
605 plotList_temp.clear();
622 ibooker.
book1D(wallTime_.plotLabel, wallTime_.pathName, wallTime_.nBins, wallTime_.xMin, wallTime_.xMax);
625 for (
auto plot : plotList) {
627 if (!
plot->pathNameOR.empty())
628 display_pathNames =
plot->pathName +
" OR " +
plot->pathNameOR;
630 if (
plot->displayInPrimary) {
632 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
637 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
645 if (gettimeofday(&time,
nullptr))
647 return (
double)time.tv_sec + (double)time.tv_usec * .000001;
~HLTObjectMonitorProtonLead() override
edm::ParameterSet caloAK4JetEta_pset
edm::EDGetTokenT< trigger::TriggerEvent > aodTriggerToken_
edm::ParameterSet caloBJetEta_pset
edm::ParameterSet l3muon3Eta_pset
virtual void setCurrentFolder(std::string const &fullpath)
edm::ParameterSet pfAK4JetPhi_pset
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
hltPlot pAL1DoubleMuZMass_
edm::ParameterSet caloDiAK4JetPt_pset
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
if(conf_.getParameter< bool >("UseStripCablingDB"))
tuple key
prepare the HTCondor submission files and eventually submit them
Abs< T >::type abs(const T &t)
edm::ParameterSet pfBJetPhi_pset
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
HLTConfigProvider hltConfig_
edm::ParameterSet pAL2DoubleMuZMass_pset
edm::ParameterSet caloBJetPhi_pset
std::vector< size_type > Keys
T getParameter(std::string const &) const
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
static constexpr float mu_mass
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