54 #include "TLorentzVector.h" 56 #include <unordered_map> 64 using std::unordered_map;
75 int pathIndexOR = -99;
94 double get_wall_time(
void);
103 unordered_map<hltPlot*, edm::ParameterSet*>
plotMap;
213 topDirectoryName =
"HLT/ObjectMonitor";
214 mainShifterFolder = topDirectoryName +
"/MainShifter";
215 backupFolder = topDirectoryName +
"/Backup";
218 processName_ = iConfig.
getParameter<
string>(
"processName");
221 plotMap[&caloAK4JetPt_] = &caloAK4JetPt_pset;
223 plotMap[&caloAK4JetEta_] = &caloAK4JetEta_pset;
225 plotMap[&caloAK4JetPhi_] = &caloAK4JetPhi_pset;
227 plotMap[&pfAK4JetPt_] = &pfAK4JetPt_pset;
229 plotMap[&pfAK4JetEta_] = &pfAK4JetEta_pset;
231 plotMap[&pfAK4JetPhi_] = &pfAK4JetPhi_pset;
233 plotMap[&caloDiAK4JetPt_] = &caloDiAK4JetPt_pset;
235 plotMap[&caloDiAK4JetEta_] = &caloDiAK4JetEta_pset;
237 plotMap[&caloDiAK4JetPhi_] = &caloDiAK4JetPhi_pset;
239 plotMap[&pfDiAK4JetPt_] = &pfDiAK4JetPt_pset;
241 plotMap[&pfDiAK4JetEta_] = &pfDiAK4JetEta_pset;
243 plotMap[&pfDiAK4JetPhi_] = &pfDiAK4JetPhi_pset;
245 plotMap[&photonPt_] = &photonPt_pset;
247 plotMap[&photonEta_] = &photonEta_pset;
249 plotMap[&photonPhi_] = &photonPhi_pset;
251 plotMap[&photonPPPt_] = &photonPPPt_pset;
253 plotMap[&photonPPEta_] = &photonPPEta_pset;
255 plotMap[&photonPPPhi_] = &photonPPPhi_pset;
257 plotMap[&caloBJetPt_] = &caloBJetPt_pset;
259 plotMap[&caloBJetEta_] = &caloBJetEta_pset;
261 plotMap[&caloBJetPhi_] = &caloBJetPhi_pset;
263 plotMap[&pfBJetPt_] = &pfBJetPt_pset;
265 plotMap[&pfBJetEta_] = &pfBJetEta_pset;
267 plotMap[&pfBJetPhi_] = &pfBJetPhi_pset;
269 plotMap[&electronPt_] = &electronPt_pset;
271 plotMap[&electronEta_] = &electronEta_pset;
273 plotMap[&electronPhi_] = &electronPhi_pset;
275 plotMap[&l3muon3Pt_] = &l3muon3Pt_pset;
277 plotMap[&l3muon3Eta_] = &l3muon3Eta_pset;
279 plotMap[&l3muon3Phi_] = &l3muon3Phi_pset;
281 plotMap[&l2muon12Pt_] = &l2muon12Pt_pset;
283 plotMap[&l2muon12Eta_] = &l2muon12Eta_pset;
285 plotMap[&l2muon12Phi_] = &l2muon12Phi_pset;
287 plotMap[&l3muon12Pt_] = &l3muon12Pt_pset;
289 plotMap[&l3muon12Eta_] = &l3muon12Eta_pset;
291 plotMap[&l3muon12Phi_] = &l3muon12Phi_pset;
293 plotMap[&pAL1DoubleMuZMass_] = &pAL1DoubleMuZMass_pset;
295 plotMap[&pAL2DoubleMuZMass_] = &pAL2DoubleMuZMass_pset;
297 plotMap[&pAL3DoubleMuZMass_] = &pAL3DoubleMuZMass_pset;
299 plotMap[&wallTime_] = &wallTime_pset;
301 for (
auto item = plotMap.begin();
item != plotMap.end();
item++) {
304 (*
item->first).
nBins = (*
item->second).getParameter<
int>(
"NbinsX");
305 (*
item->first).
xMin = (*
item->second).getParameter<
double>(
"Xmin");
306 (*
item->first).
xMax = (*
item->second).getParameter<
double>(
"Xmax");
307 (*
item->first).xAxisLabel = (*
item->second).getParameter<
string>(
"axisLabel");
309 (*
item->first).displayInPrimary = (*
item->second).getParameter<
bool>(
"mainWorkspace");
311 if ((*
item->second).exists(
"pathName_OR")) {
312 (*
item->first).pathNameOR = (*
item->second).getParameter<
string>(
"pathName_OR");
314 if ((*
item->second).exists(
"moduleName_OR")) {
315 (*
item->first).moduleNameOR = (*
item->second).getParameter<
string>(
"moduleName_OR");
318 plotList.push_back(
item->first);
333 double start = get_wall_time();
338 std::cout <<
"Inside analyze(). " << std::endl;
347 iEvent.getByToken(aodTriggerToken_, aodTriggerEvent);
348 if (!aodTriggerEvent.
isValid())
352 unordered_map<string, bool> firedMap = acceptMap;
353 for (
auto plot : plotList)
355 if (firedMap[
plot->pathName])
366 hltConfig_.saveTags(
plot->moduleNameOR)) {
367 if (firedMap[
plot->pathNameOR])
375 unsigned int moduleFilterIndex = aodTriggerEvent->
filterIndex(moduleFilter);
377 if (moduleFilterIndex + 1 > aodTriggerEvent->
sizeFilters())
388 if (
pathName == caloAK4JetPt_.pathName) {
396 else if (
pathName == pfAK4JetPt_.pathName) {
404 else if (
pathName == caloDiAK4JetPt_.pathName) {
408 caloDiAK4JetPhi_.ME->Fill(
objects[
key].phi());
412 else if (
pathName == pfDiAK4JetPt_.pathName) {
420 else if (
pathName == photonPt_.pathName) {
428 else if (
pathName == photonPPPt_.pathName) {
436 else if (
pathName == caloBJetPt_.pathName) {
444 else if (
pathName == pfBJetPt_.pathName) {
452 else if (
pathName == electronPt_.pathName) {
458 }
else if (
pathName == l3muon3Pt_.pathName) {
464 }
else if (
pathName == l2muon12Pt_.pathName) {
470 }
else if (
pathName == l3muon12Pt_.pathName) {
484 else if (
pathName == pAL1DoubleMuZMass_.pathName) {
485 const double mu_mass(.105658);
486 unsigned int kCnt0 = 0;
487 for (
const auto& key0 :
keys) {
488 unsigned int kCnt1 = 0;
489 for (
const auto& key1 :
keys) {
493 TLorentzVector mu1, mu2, dimu;
497 if (dimu.M() > pAL1DoubleMuZMass_.xMin && dimu.M() < pAL1DoubleMuZMass_.xMax)
498 pAL1DoubleMuZMass_.ME->Fill(dimu.M());
504 }
else if (
pathName == pAL2DoubleMuZMass_.pathName) {
505 const double mu_mass(.105658);
506 unsigned int kCnt0 = 0;
507 for (
const auto& key0 :
keys) {
508 unsigned int kCnt1 = 0;
509 for (
const auto& key1 :
keys) {
514 TLorentzVector mu1, mu2, dimu;
518 if (dimu.M() > pAL2DoubleMuZMass_.xMin && dimu.M() < pAL2DoubleMuZMass_.xMax)
519 pAL2DoubleMuZMass_.ME->Fill(dimu.M());
526 }
else if (
pathName == pAL3DoubleMuZMass_.pathName) {
527 const double mu_mass(.105658);
528 unsigned int kCnt0 = 0;
529 for (
const auto& key0 :
keys) {
530 unsigned int kCnt1 = 0;
531 for (
const auto& key1 :
keys) {
536 TLorentzVector mu1, mu2, dimu;
540 if (dimu.M() > pAL3DoubleMuZMass_.xMin && dimu.M() < pAL3DoubleMuZMass_.xMax)
541 pAL3DoubleMuZMass_.ME->Fill(dimu.M());
555 double end = get_wall_time();
563 std::cout <<
"Calling beginRun. " << std::endl;
565 if (hltConfig_.init(iRun, iSetup, processName_, changed)) {
567 std::cout <<
"Extracting HLTconfig. " << std::endl;
571 string pathName_noVersion;
572 vector<string>
triggerPaths = hltConfig_.triggerNames();
575 pathName_noVersion = hltConfig_.removeVersion(
pathName);
576 for (
auto plot : plotList) {
577 if (
plot->pathName == pathName_noVersion) {
578 (*plot).pathIndex = hltConfig_.triggerIndex(
pathName);
579 }
else if (
plot->pathNameOR == pathName_noVersion) {
580 (*plot).pathIndexOR = hltConfig_.triggerIndex(
pathName);
584 vector<hltPlot*> plotList_temp;
585 for (
auto plot : plotList) {
586 if (
plot->pathIndex > 0 ||
plot->pathIndexOR > 0) {
587 plotList_temp.push_back(
plot);
588 acceptMap[
plot->pathName] =
false;
589 if (
plot->pathIndexOR > 0)
590 acceptMap[
plot->pathNameOR] =
false;
594 plotList = plotList_temp;
595 plotList_temp.clear();
612 ibooker.
book1D(wallTime_.plotLabel, wallTime_.pathName, wallTime_.nBins, wallTime_.xMin, wallTime_.xMax);
615 for (
auto plot : plotList) {
617 if (!
plot->pathNameOR.empty())
618 display_pathNames =
plot->pathName +
" OR " +
plot->pathNameOR;
620 if (
plot->displayInPrimary) {
622 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
627 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
635 if (gettimeofday(&
time,
nullptr))
637 return (
double)
time.tv_sec + (double)
time.tv_usec * .000001;
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
key
prepare the HTCondor submission files and eventually submit them
#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
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
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