55 #include "TLorentzVector.h" 57 #include <unordered_map> 65 using std::unordered_map;
76 int pathIndexOR = -99;
99 double get_wall_time(
void);
108 unordered_map<hltPlot*, edm::ParameterSet*>
plotMap;
224 topDirectoryName =
"HLT/ObjectMonitor";
225 mainShifterFolder = topDirectoryName +
"/MainShifter";
226 backupFolder = topDirectoryName +
"/Backup";
229 processName_ = iConfig.
getParameter<
string>(
"processName");
232 plotMap[&rsq_] = &rsq_pset;
234 plotMap[&mr_] = &mr_pset;
236 plotMap[&alphaT_] = &alphaT_pset;
238 plotMap[&photonPt_] = &photonPt_pset;
240 plotMap[&photonEta_] = &photonEta_pset;
242 plotMap[&photonPhi_] = &photonPhi_pset;
244 plotMap[&muonPt_] = &muonPt_pset;
246 plotMap[&muonEta_] = &muonEta_pset;
248 plotMap[&muonPhi_] = &muonPhi_pset;
250 plotMap[&l2muonPt_] = &l2muonPt_pset;
252 plotMap[&l2muonEta_] = &l2muonEta_pset;
254 plotMap[&l2muonPhi_] = &l2muonPhi_pset;
256 plotMap[&l2NoBPTXmuonPt_] = &l2NoBPTXmuonPt_pset;
258 plotMap[&l2NoBPTXmuonEta_] = &l2NoBPTXmuonEta_pset;
260 plotMap[&l2NoBPTXmuonPhi_] = &l2NoBPTXmuonPhi_pset;
262 plotMap[&electronPt_] = &electronPt_pset;
264 plotMap[&electronEta_] = &electronEta_pset;
266 plotMap[&electronPhi_] = &electronPhi_pset;
268 plotMap[&jetPt_] = &jetPt_pset;
270 plotMap[&jetAK8Mass_] = &jetAK8Mass_pset;
272 plotMap[&diMuonLowMass_] = &diMuonLowMass_pset;
274 plotMap[&caloMetPt_] = &caloMetPt_pset;
276 plotMap[&caloMetPhi_] = &caloMetPhi_pset;
278 plotMap[&pfMetPt_] = &pfMetPt_pset;
280 plotMap[&pfMetPhi_] = &pfMetPhi_pset;
282 plotMap[&caloHtPt_] = &caloHtPt_pset;
284 plotMap[&pfHtPt_] = &pfHtPt_pset;
286 plotMap[&bJetPhi_] = &bJetPhi_pset;
288 plotMap[&bJetEta_] = &bJetEta_pset;
290 plotMap[&bJetCSVCalo_] = &bJetCSVCalo_pset;
292 plotMap[&bJetCSVPF_] = &bJetCSVPF_pset;
294 plotMap[&diMuonMass_] = &diMuonMass_pset;
296 plotMap[&pAL1DoubleMuZMass_] = &pAL1DoubleMuZMass_pset;
298 plotMap[&pAL2DoubleMuZMass_] = &pAL2DoubleMuZMass_pset;
300 plotMap[&pAL3DoubleMuZMass_] = &pAL3DoubleMuZMass_pset;
302 plotMap[&diElecMass_] = &diElecMass_pset;
304 plotMap[&muonDxy_] = &muonDxy_pset;
306 plotMap[&jetAK8Pt_] = &jetAK8Pt_pset;
308 plotMap[&tauPt_] = &tauPt_pset;
310 plotMap[&wallTime_] = &wallTime_pset;
312 for (
auto item = plotMap.begin();
item != plotMap.end();
item++) {
315 (*
item->first).
nBins = (*
item->second).getParameter<
int>(
"NbinsX");
316 (*
item->first).
xMin = (*
item->second).getParameter<
double>(
"Xmin");
317 (*
item->first).
xMax = (*
item->second).getParameter<
double>(
"Xmax");
318 (*
item->first).xAxisLabel = (*
item->second).getParameter<
string>(
"axisLabel");
320 (*
item->first).displayInPrimary = (*
item->second).getParameter<
bool>(
"mainWorkspace");
322 if ((*
item->second).exists(
"pathName_OR")) {
323 (*
item->first).pathNameOR = (*
item->second).getParameter<
string>(
"pathName_OR");
325 if ((*
item->second).exists(
"moduleName_OR")) {
326 (*
item->first).moduleNameOR = (*
item->second).getParameter<
string>(
"moduleName_OR");
329 plotList.push_back(
item->first);
334 triggerResultsToken_ = consumes<edm::TriggerResults>(
edm::InputTag(
"TriggerResults",
"", processName_));
335 aodTriggerToken_ = consumes<trigger::TriggerEvent>(
edm::InputTag(
"hltTriggerSummaryAOD",
"", processName_));
336 lumiScalersToken_ = consumes<LumiScalersCollection>(
edm::InputTag(
"hltScalersRawToDigi",
"",
""));
337 beamSpotToken_ = consumes<reco::BeamSpot>(
edm::InputTag(
"hltOnlineBeamSpot",
"", processName_));
338 chargedCandToken_ = consumes<vector<reco::RecoChargedCandidate>>(
339 edm::InputTag(
"hltL3NoFiltersNoVtxMuonCandidates",
"", processName_));
341 consumes<reco::JetTagCollection>(
edm::InputTag(
"hltCombinedSecondaryVertexBJetTagsCalo",
"", processName_));
343 consumes<reco::JetTagCollection>(
edm::InputTag(
"hltCombinedSecondaryVertexBJetTagsPF",
"", processName_));
345 consumes<vector<reco::CaloJet>>(
edm::InputTag(
"hltSelector8CentralJetsL1FastJet",
"", processName_));
346 csvPfJetsToken_ = consumes<vector<reco::PFJet>>(
edm::InputTag(
"hltPFJetForBtag",
"", processName_));
360 double start = get_wall_time();
365 std::cout <<
"Inside analyze(). " << std::endl;
374 iEvent.getByToken(aodTriggerToken_, aodTriggerEvent);
375 if (!aodTriggerEvent.
isValid())
379 unordered_map<string, bool> firedMap = acceptMap;
380 for (
auto plot : plotList)
382 if (firedMap[
plot->pathName])
393 hltConfig_.saveTags(
plot->moduleNameOR)) {
394 if (firedMap[
plot->pathNameOR])
402 unsigned int moduleFilterIndex = aodTriggerEvent->
filterIndex(moduleFilter);
404 if (moduleFilterIndex + 1 > aodTriggerEvent->
sizeFilters())
421 else if (
pathName == jetPt_.pathName) {
427 else if (
pathName == photonPt_.pathName) {
436 else if (
pathName == electronPt_.pathName) {
445 else if (
pathName == muonPt_.pathName) {
454 else if (
pathName == l2muonPt_.pathName) {
463 else if (
pathName == l2NoBPTXmuonPt_.pathName) {
467 l2NoBPTXmuonPhi_.ME->Fill(
objects[
key].phi());
472 else if (
pathName == mr_.pathName) {
473 double onlineMR = 0, onlineRsq = 0;
479 mr_.ME->Fill(onlineMR);
480 rsq_.ME->Fill(onlineRsq);
485 else if (
pathName == alphaT_.pathName) {
486 std::vector<ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>>> alphaT_jets;
488 ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> JetLVec(
490 alphaT_jets.push_back(JetLVec);
493 float alphaT = AlphaT(alphaT_jets,
false).value();
498 else if (
pathName == tauPt_.pathName) {
504 else if (
pathName == caloMetPt_.pathName) {
512 else if (
pathName == caloHtPt_.pathName) {
520 else if (
pathName == jetAK8Pt_.pathName) {
528 else if (
pathName == pfMetPt_.pathName) {
536 else if (
pathName == bJetEta_.pathName ||
pathName == bJetEta_.pathNameOR) {
544 if (
pathName == bJetCSVPF_.pathName) {
546 iEvent.getByToken(csvPfTagsToken_, csvPfTags);
548 iEvent.getByToken(csvPfJetsToken_, csvPfJets);
551 for (
auto iter = csvPfTags->
begin(); iter != csvPfTags->
end(); iter++)
552 bJetCSVPF_.ME->Fill(iter->second);
555 if (
pathName == bJetCSVCalo_.pathName) {
557 iEvent.getByToken(csvCaloTagsToken_, csvCaloTags);
559 iEvent.getByToken(csvCaloJetsToken_, csvCaloJets);
562 for (
auto iter = csvCaloTags->
begin(); iter != csvCaloTags->
end(); iter++)
563 bJetCSVCalo_.ME->Fill(iter->second);
568 else if (
pathName == muonDxy_.pathName) {
570 iEvent.getByToken(chargedCandToken_, recoChargedCands);
572 iEvent.getByToken(beamSpotToken_, recoBeamSpot);
578 if (muon_dxy != -99.)
579 muonDxy_.ME->Fill(muon_dxy);
591 else if (
pathName == diMuonLowMass_.pathName) {
593 unsigned int kCnt0 = 0;
594 for (
const auto& key0 :
keys) {
595 unsigned int kCnt1 = 0;
596 for (
const auto& key1 :
keys) {
603 TLorentzVector mu1, mu2, dimu;
607 diMuonLowMass_.ME->Fill(dimu.M());
616 else if (
pathName == diMuonMass_.pathName ||
pathName == diMuonMass_.pathNameOR) {
618 unsigned int kCnt0 = 0;
619 for (
const auto& key0 :
keys) {
620 unsigned int kCnt1 = 0;
621 for (
const auto& key1 :
keys) {
628 TLorentzVector mu1, mu2, dimu;
632 diMuonMass_.ME->Fill(dimu.M());
641 else if (
pathName == pAL1DoubleMuZMass_.pathName) {
643 unsigned int kCnt0 = 0;
644 for (
const auto& key0 :
keys) {
645 unsigned int kCnt1 = 0;
646 for (
const auto& key1 :
keys) {
652 TLorentzVector mu1, mu2, dimu;
656 if (dimu.M() > pAL1DoubleMuZMass_.xMin && dimu.M() < pAL1DoubleMuZMass_.xMax)
657 pAL1DoubleMuZMass_.ME->Fill(dimu.M());
666 else if (
pathName == pAL2DoubleMuZMass_.pathName) {
668 unsigned int kCnt0 = 0;
669 for (
const auto& key0 :
keys) {
670 unsigned int kCnt1 = 0;
671 for (
const auto& key1 :
keys) {
678 TLorentzVector mu1, mu2, dimu;
682 if (dimu.M() > pAL2DoubleMuZMass_.xMin && dimu.M() < pAL2DoubleMuZMass_.xMax)
683 pAL2DoubleMuZMass_.ME->Fill(dimu.M());
692 else if (
pathName == pAL3DoubleMuZMass_.pathName) {
694 unsigned int kCnt0 = 0;
695 for (
const auto& key0 :
keys) {
696 unsigned int kCnt1 = 0;
697 for (
const auto& key1 :
keys) {
704 TLorentzVector mu1, mu2, dimu;
708 if (dimu.M() > pAL3DoubleMuZMass_.xMin && dimu.M() < pAL3DoubleMuZMass_.xMax)
709 pAL3DoubleMuZMass_.ME->Fill(dimu.M());
718 else if (
pathName == diElecMass_.pathName) {
719 unsigned int kCnt0 = 0;
720 for (
const auto& key0 :
keys) {
721 unsigned int kCnt1 = 0;
722 for (
const auto& key1 :
keys) {
728 TLorentzVector el1, el2, diEl;
732 diElecMass_.ME->Fill(diEl.M());
746 double end = get_wall_time();
754 std::cout <<
"Calling beginRun. " << std::endl;
756 if (hltConfig_.init(iRun, iSetup, processName_, changed)) {
758 std::cout <<
"Extracting HLTconfig. " << std::endl;
762 string pathName_noVersion;
763 vector<string>
triggerPaths = hltConfig_.triggerNames();
766 pathName_noVersion = hltConfig_.removeVersion(
pathName);
767 for (
auto plot : plotList) {
768 if (
plot->pathName == pathName_noVersion) {
769 (*plot).pathIndex = hltConfig_.triggerIndex(
pathName);
770 }
else if (
plot->pathNameOR == pathName_noVersion) {
771 (*plot).pathIndexOR = hltConfig_.triggerIndex(
pathName);
775 vector<hltPlot*> plotList_temp;
776 for (
auto plot : plotList) {
777 if (
plot->pathIndex > 0 ||
plot->pathIndexOR > 0) {
778 plotList_temp.push_back(
plot);
779 acceptMap[
plot->pathName] =
false;
780 if (
plot->pathIndexOR > 0)
781 acceptMap[
plot->pathNameOR] =
false;
785 plotList = plotList_temp;
786 plotList_temp.clear();
801 ibooker.
book1D(wallTime_.plotLabel, wallTime_.pathName, wallTime_.nBins, wallTime_.xMin, wallTime_.xMax);
804 for (
auto plot : plotList) {
806 if (!
plot->pathNameOR.empty())
807 display_pathNames =
plot->pathName +
" OR " +
plot->pathNameOR;
809 if (
plot->displayInPrimary) {
811 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
816 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
827 for (reco::RecoChargedCandidateCollection::const_iterator l3Muon = recoChargedCands->begin();
828 l3Muon != recoChargedCands->end();
830 if (
deltaR(
eta, phi, l3Muon->eta(), l3Muon->phi()) < 0.1) {
831 dxy = (-(l3Muon->vx() - recoBeamSpot->
x0()) * l3Muon->py() + (l3Muon->vy() - recoBeamSpot->
y0()) * l3Muon->px()) /
841 if (gettimeofday(&
time,
nullptr))
843 return (
double)
time.tv_sec + (double)
time.tv_usec * .000001;
edm::ParameterSet caloMetPt_pset
edm::ParameterSet bJetPhi_pset
const Keys & filterKeys(trigger::size_type index) const
T getParameter(std::string const &) const
edm::ParameterSet bJetCSVCalo_pset
edm::ParameterSet caloHtPt_pset
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
edm::ParameterSet jetAK8Mass_pset
edm::ParameterSet pfMetPhi_pset
edm::ParameterSet muonPhi_pset
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ParameterSet l2muonEta_pset
virtual void setCurrentFolder(std::string const &fullpath)
edm::ParameterSet photonPhi_pset
edm::ParameterSet electronPt_pset
#define DEFINE_FWK_MODULE(type)
trigger::size_type sizeFilters() const
edm::ParameterSet pAL2DoubleMuZMass_pset
edm::ParameterSet bJetCSVPF_pset
edm::ParameterSet muonEta_pset
edm::ParameterSet diMuonMass_pset
edm::ParameterSet muonDxy_pset
edm::EDGetTokenT< LumiScalersCollection > lumiScalersToken_
const_iterator begin() const
~HLTObjectMonitor() override
edm::ParameterSet l2NoBPTXmuonEta_pset
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ParameterSet pAL1DoubleMuZMass_pset
edm::ParameterSet l2muonPt_pset
edm::EDGetTokenT< vector< reco::PFJet > > csvPfJetsToken_
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
HLTObjectMonitor(const edm::ParameterSet &)
hltPlot pAL2DoubleMuZMass_
double x0() const
x coordinate
edm::ParameterSet wallTime_pset
edm::ParameterSet diElecMass_pset
edm::ParameterSet photonPt_pset
edm::EDGetTokenT< trigger::TriggerEvent > aodTriggerToken_
edm::ParameterSet electronEta_pset
edm::ParameterSet bJetEta_pset
edm::ParameterSet alphaT_pset
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > chargedCandToken_
edm::ParameterSet tauPt_pset
Abs< T >::type abs(const T &t)
const TriggerObjectCollection & getObjects() const
unordered_map< hltPlot *, edm::ParameterSet * > plotMap
edm::ParameterSet rsq_pset
double y0() const
y coordinate
edm::ParameterSet mr_pset
static std::string const triggerResults
hltPlot pAL1DoubleMuZMass_
edm::ParameterSet pfHtPt_pset
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
const_iterator end() const
hltPlot pAL3DoubleMuZMass_
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
edm::ParameterSet jetPt_pset
HLTConfigProvider hltConfig_
edm::ParameterSet diMuonLowMass_pset
edm::ParameterSet jetAK8Pt_pset
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
edm::ParameterSet l2muonPhi_pset
edm::ParameterSet muonPt_pset
double dxyFinder(double, double, edm::Handle< reco::RecoChargedCandidateCollection >, edm::Handle< reco::BeamSpot >)
edm::ParameterSet pfMetPt_pset
static constexpr float mu_mass
edm::ParameterSet electronPhi_pset
std::vector< size_type > Keys
edm::EDGetTokenT< reco::JetTagCollection > csvCaloTagsToken_
edm::EDGetTokenT< reco::JetTagCollection > csvPfTagsToken_
edm::ParameterSet photonEta_pset
edm::ParameterSet pAL3DoubleMuZMass_pset
edm::ParameterSet l2NoBPTXmuonPhi_pset
double get_wall_time(void)
edm::EDGetTokenT< vector< reco::CaloJet > > csvCaloJetsToken_
edm::ParameterSet caloMetPhi_pset
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
vector< hltPlot * > plotList
static std::string const triggerPaths
edm::ParameterSet l2NoBPTXmuonPt_pset
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
unordered_map< string, bool > acceptMap
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)