55 #include "TLorentzVector.h" 57 #include <unordered_map> 65 using std::unordered_map;
76 int pathIndexOR = -99;
94 double get_wall_time(
void);
103 unordered_map<hltPlot*, edm::ParameterSet*>
plotMap;
219 topDirectoryName =
"HLT/ObjectMonitor";
220 mainShifterFolder = topDirectoryName +
"/MainShifter";
221 backupFolder = topDirectoryName +
"/Backup";
224 processName_ = iConfig.
getParameter<
string>(
"processName");
227 plotMap[&rsq_] = &rsq_pset;
229 plotMap[&mr_] = &mr_pset;
231 plotMap[&alphaT_] = &alphaT_pset;
233 plotMap[&photonPt_] = &photonPt_pset;
235 plotMap[&photonEta_] = &photonEta_pset;
237 plotMap[&photonPhi_] = &photonPhi_pset;
239 plotMap[&muonPt_] = &muonPt_pset;
241 plotMap[&muonEta_] = &muonEta_pset;
243 plotMap[&muonPhi_] = &muonPhi_pset;
245 plotMap[&l2muonPt_] = &l2muonPt_pset;
247 plotMap[&l2muonEta_] = &l2muonEta_pset;
249 plotMap[&l2muonPhi_] = &l2muonPhi_pset;
251 plotMap[&l2NoBPTXmuonPt_] = &l2NoBPTXmuonPt_pset;
253 plotMap[&l2NoBPTXmuonEta_] = &l2NoBPTXmuonEta_pset;
255 plotMap[&l2NoBPTXmuonPhi_] = &l2NoBPTXmuonPhi_pset;
257 plotMap[&electronPt_] = &electronPt_pset;
259 plotMap[&electronEta_] = &electronEta_pset;
261 plotMap[&electronPhi_] = &electronPhi_pset;
263 plotMap[&jetPt_] = &jetPt_pset;
265 plotMap[&jetAK8Mass_] = &jetAK8Mass_pset;
267 plotMap[&diMuonLowMass_] = &diMuonLowMass_pset;
269 plotMap[&caloMetPt_] = &caloMetPt_pset;
271 plotMap[&caloMetPhi_] = &caloMetPhi_pset;
273 plotMap[&pfMetPt_] = &pfMetPt_pset;
275 plotMap[&pfMetPhi_] = &pfMetPhi_pset;
277 plotMap[&caloHtPt_] = &caloHtPt_pset;
279 plotMap[&pfHtPt_] = &pfHtPt_pset;
281 plotMap[&bJetPhi_] = &bJetPhi_pset;
283 plotMap[&bJetEta_] = &bJetEta_pset;
285 plotMap[&bJetCSVCalo_] = &bJetCSVCalo_pset;
287 plotMap[&bJetCSVPF_] = &bJetCSVPF_pset;
289 plotMap[&diMuonMass_] = &diMuonMass_pset;
291 plotMap[&pAL1DoubleMuZMass_] = &pAL1DoubleMuZMass_pset;
293 plotMap[&pAL2DoubleMuZMass_] = &pAL2DoubleMuZMass_pset;
295 plotMap[&pAL3DoubleMuZMass_] = &pAL3DoubleMuZMass_pset;
297 plotMap[&diElecMass_] = &diElecMass_pset;
299 plotMap[&muonDxy_] = &muonDxy_pset;
301 plotMap[&jetAK8Pt_] = &jetAK8Pt_pset;
303 plotMap[&tauPt_] = &tauPt_pset;
305 plotMap[&wallTime_] = &wallTime_pset;
307 for (
auto item = plotMap.begin();
item != plotMap.end();
item++) {
310 (*
item->first).
nBins = (*
item->second).getParameter<
int>(
"NbinsX");
311 (*
item->first).
xMin = (*
item->second).getParameter<
double>(
"Xmin");
312 (*
item->first).
xMax = (*
item->second).getParameter<
double>(
"Xmax");
313 (*
item->first).xAxisLabel = (*
item->second).getParameter<
string>(
"axisLabel");
315 (*
item->first).displayInPrimary = (*
item->second).getParameter<
bool>(
"mainWorkspace");
317 if ((*
item->second).exists(
"pathName_OR")) {
318 (*
item->first).pathNameOR = (*
item->second).getParameter<
string>(
"pathName_OR");
320 if ((*
item->second).exists(
"moduleName_OR")) {
321 (*
item->first).moduleNameOR = (*
item->second).getParameter<
string>(
"moduleName_OR");
324 plotList.push_back(
item->first);
329 triggerResultsToken_ = consumes<edm::TriggerResults>(
edm::InputTag(
"TriggerResults",
"", processName_));
330 aodTriggerToken_ = consumes<trigger::TriggerEvent>(
edm::InputTag(
"hltTriggerSummaryAOD",
"", processName_));
331 lumiScalersToken_ = consumes<LumiScalersCollection>(
edm::InputTag(
"hltScalersRawToDigi",
"",
""));
332 beamSpotToken_ = consumes<reco::BeamSpot>(
edm::InputTag(
"hltOnlineBeamSpot",
"", processName_));
333 chargedCandToken_ = consumes<vector<reco::RecoChargedCandidate>>(
334 edm::InputTag(
"hltL3NoFiltersNoVtxMuonCandidates",
"", processName_));
336 consumes<reco::JetTagCollection>(
edm::InputTag(
"hltCombinedSecondaryVertexBJetTagsCalo",
"", processName_));
338 consumes<reco::JetTagCollection>(
edm::InputTag(
"hltCombinedSecondaryVertexBJetTagsPF",
"", processName_));
340 consumes<vector<reco::CaloJet>>(
edm::InputTag(
"hltSelector8CentralJetsL1FastJet",
"", processName_));
341 csvPfJetsToken_ = consumes<vector<reco::PFJet>>(
edm::InputTag(
"hltPFJetForBtag",
"", processName_));
350 double start = get_wall_time();
355 std::cout <<
"Inside analyze(). " << std::endl;
364 iEvent.getByToken(aodTriggerToken_, aodTriggerEvent);
365 if (!aodTriggerEvent.
isValid())
369 unordered_map<string, bool> firedMap = acceptMap;
370 for (
auto plot : plotList)
372 if (firedMap[
plot->pathName])
383 hltConfig_.saveTags(
plot->moduleNameOR)) {
384 if (firedMap[
plot->pathNameOR])
392 unsigned int moduleFilterIndex = aodTriggerEvent->
filterIndex(moduleFilter);
394 if (moduleFilterIndex + 1 > aodTriggerEvent->
sizeFilters())
411 else if (
pathName == jetPt_.pathName) {
417 else if (
pathName == photonPt_.pathName) {
426 else if (
pathName == electronPt_.pathName) {
435 else if (
pathName == muonPt_.pathName) {
444 else if (
pathName == l2muonPt_.pathName) {
453 else if (
pathName == l2NoBPTXmuonPt_.pathName) {
457 l2NoBPTXmuonPhi_.ME->Fill(
objects[
key].phi());
462 else if (
pathName == mr_.pathName) {
463 double onlineMR = 0, onlineRsq = 0;
469 mr_.ME->Fill(onlineMR);
470 rsq_.ME->Fill(onlineRsq);
475 else if (
pathName == alphaT_.pathName) {
476 std::vector<ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>>> alphaT_jets;
478 ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double>> JetLVec(
480 alphaT_jets.push_back(JetLVec);
483 float alphaT = AlphaT(alphaT_jets,
false).value();
488 else if (
pathName == tauPt_.pathName) {
494 else if (
pathName == caloMetPt_.pathName) {
502 else if (
pathName == caloHtPt_.pathName) {
510 else if (
pathName == jetAK8Pt_.pathName) {
518 else if (
pathName == pfMetPt_.pathName) {
526 else if (
pathName == bJetEta_.pathName ||
pathName == bJetEta_.pathNameOR) {
534 if (
pathName == bJetCSVPF_.pathName) {
536 iEvent.getByToken(csvPfTagsToken_, csvPfTags);
538 iEvent.getByToken(csvPfJetsToken_, csvPfJets);
541 for (
auto iter = csvPfTags->
begin(); iter != csvPfTags->
end(); iter++)
542 bJetCSVPF_.ME->Fill(iter->second);
545 if (
pathName == bJetCSVCalo_.pathName) {
547 iEvent.getByToken(csvCaloTagsToken_, csvCaloTags);
549 iEvent.getByToken(csvCaloJetsToken_, csvCaloJets);
552 for (
auto iter = csvCaloTags->
begin(); iter != csvCaloTags->
end(); iter++)
553 bJetCSVCalo_.ME->Fill(iter->second);
558 else if (
pathName == muonDxy_.pathName) {
560 iEvent.getByToken(chargedCandToken_, recoChargedCands);
562 iEvent.getByToken(beamSpotToken_, recoBeamSpot);
568 if (muon_dxy != -99.)
569 muonDxy_.ME->Fill(muon_dxy);
581 else if (
pathName == diMuonLowMass_.pathName) {
582 const double mu_mass(.105658);
583 unsigned int kCnt0 = 0;
584 for (
const auto& key0 :
keys) {
585 unsigned int kCnt1 = 0;
586 for (
const auto& key1 :
keys) {
593 TLorentzVector mu1, mu2, dimu;
597 diMuonLowMass_.ME->Fill(dimu.M());
606 else if (
pathName == diMuonMass_.pathName ||
pathName == diMuonMass_.pathNameOR) {
607 const double mu_mass(.105658);
608 unsigned int kCnt0 = 0;
609 for (
const auto& key0 :
keys) {
610 unsigned int kCnt1 = 0;
611 for (
const auto& key1 :
keys) {
618 TLorentzVector mu1, mu2, dimu;
622 diMuonMass_.ME->Fill(dimu.M());
631 else if (
pathName == pAL1DoubleMuZMass_.pathName) {
632 const double mu_mass(.105658);
633 unsigned int kCnt0 = 0;
634 for (
const auto& key0 :
keys) {
635 unsigned int kCnt1 = 0;
636 for (
const auto& key1 :
keys) {
642 TLorentzVector mu1, mu2, dimu;
646 if (dimu.M() > pAL1DoubleMuZMass_.xMin && dimu.M() < pAL1DoubleMuZMass_.xMax)
647 pAL1DoubleMuZMass_.ME->Fill(dimu.M());
656 else if (
pathName == pAL2DoubleMuZMass_.pathName) {
657 const double mu_mass(.105658);
658 unsigned int kCnt0 = 0;
659 for (
const auto& key0 :
keys) {
660 unsigned int kCnt1 = 0;
661 for (
const auto& key1 :
keys) {
668 TLorentzVector mu1, mu2, dimu;
672 if (dimu.M() > pAL2DoubleMuZMass_.xMin && dimu.M() < pAL2DoubleMuZMass_.xMax)
673 pAL2DoubleMuZMass_.ME->Fill(dimu.M());
682 else if (
pathName == pAL3DoubleMuZMass_.pathName) {
683 const double mu_mass(.105658);
684 unsigned int kCnt0 = 0;
685 for (
const auto& key0 :
keys) {
686 unsigned int kCnt1 = 0;
687 for (
const auto& key1 :
keys) {
694 TLorentzVector mu1, mu2, dimu;
698 if (dimu.M() > pAL3DoubleMuZMass_.xMin && dimu.M() < pAL3DoubleMuZMass_.xMax)
699 pAL3DoubleMuZMass_.ME->Fill(dimu.M());
708 else if (
pathName == diElecMass_.pathName) {
709 unsigned int kCnt0 = 0;
710 for (
const auto& key0 :
keys) {
711 unsigned int kCnt1 = 0;
712 for (
const auto& key1 :
keys) {
718 TLorentzVector el1, el2, diEl;
722 diElecMass_.ME->Fill(diEl.M());
736 double end = get_wall_time();
744 std::cout <<
"Calling beginRun. " << std::endl;
746 if (hltConfig_.init(iRun, iSetup, processName_, changed)) {
748 std::cout <<
"Extracting HLTconfig. " << std::endl;
752 string pathName_noVersion;
753 vector<string>
triggerPaths = hltConfig_.triggerNames();
756 pathName_noVersion = hltConfig_.removeVersion(
pathName);
757 for (
auto plot : plotList) {
758 if (
plot->pathName == pathName_noVersion) {
759 (*plot).pathIndex = hltConfig_.triggerIndex(
pathName);
760 }
else if (
plot->pathNameOR == pathName_noVersion) {
761 (*plot).pathIndexOR = hltConfig_.triggerIndex(
pathName);
765 vector<hltPlot*> plotList_temp;
766 for (
auto plot : plotList) {
767 if (
plot->pathIndex > 0 ||
plot->pathIndexOR > 0) {
768 plotList_temp.push_back(
plot);
769 acceptMap[
plot->pathName] =
false;
770 if (
plot->pathIndexOR > 0)
771 acceptMap[
plot->pathNameOR] =
false;
775 plotList = plotList_temp;
776 plotList_temp.clear();
791 ibooker.
book1D(wallTime_.plotLabel, wallTime_.pathName, wallTime_.nBins, wallTime_.xMin, wallTime_.xMax);
794 for (
auto plot : plotList) {
796 if (!
plot->pathNameOR.empty())
797 display_pathNames =
plot->pathName +
" OR " +
plot->pathNameOR;
799 if (
plot->displayInPrimary) {
801 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
806 (*plot).ME = ibooker.
book1D(
plot->plotLabel, display_pathNames.c_str(),
plot->nBins,
plot->xMin,
plot->xMax);
817 for (reco::RecoChargedCandidateCollection::const_iterator l3Muon = recoChargedCands->begin();
818 l3Muon != recoChargedCands->end();
820 if (
deltaR(
eta, phi, l3Muon->eta(), l3Muon->phi()) < 0.1) {
821 dxy = (-(l3Muon->vx() - recoBeamSpot->
x0()) * l3Muon->py() + (l3Muon->vy() - recoBeamSpot->
y0()) * l3Muon->px()) /
831 if (gettimeofday(&
time,
nullptr))
833 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
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
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
key
prepare the HTCondor submission files and eventually submit them
#define DEFINE_FWK_MODULE(type)
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
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
if(threadIdxLocalY==0 &&threadIdxLocalX==0)
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)