56 #include "TLorentzVector.h"
58 #include <unordered_map>
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])
376 hltConfig_.saveTags(
plot->moduleNameOR)) {
377 if (firedMap[
plot->pathNameOR])
385 unsigned int moduleFilterIndex = aodTriggerEvent->
filterIndex(moduleFilter);
387 if (moduleFilterIndex + 1 > aodTriggerEvent->
sizeFilters())
398 if (
pathName == caloAK4JetPt_.pathName) {
406 else if (
pathName == pfAK4JetPt_.pathName) {
414 else if (
pathName == caloDiAK4JetPt_.pathName) {
418 caloDiAK4JetPhi_.ME->Fill(
objects[
key].phi());
422 else if (
pathName == pfDiAK4JetPt_.pathName) {
430 else if (
pathName == photonPt_.pathName) {
438 else if (
pathName == photonPPPt_.pathName) {
446 else if (
pathName == caloBJetPt_.pathName) {
454 else if (
pathName == pfBJetPt_.pathName) {
462 else if (
pathName == electronPt_.pathName) {
468 }
else if (
pathName == l3muon3Pt_.pathName) {
474 }
else if (
pathName == l2muon12Pt_.pathName) {
480 }
else if (
pathName == l3muon12Pt_.pathName) {
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;
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) {
524 TLorentzVector mu1, mu2, dimu;
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) {
546 TLorentzVector mu1, mu2, dimu;
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();
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;