5 #include <unordered_map> 39 #include "TLorentzVector.h" 44 std::pair<MonitorElement*, bool>
nME;
45 std::pair<MonitorElement*, bool>
etaME;
46 std::pair<MonitorElement*, bool>
phiME;
47 std::pair<MonitorElement*, bool>
ptME;
48 std::pair<MonitorElement*, bool>
massME;
50 std::pair<MonitorElement*, bool>
csvME;
54 std::pair<MonitorElement*, bool>
mrME;
55 std::pair<MonitorElement*, bool>
rsqME;
56 std::pair<MonitorElement*, bool>
dxyME;
57 std::pair<MonitorElement*, bool>
dzME;
59 std::pair<MonitorElement*, bool>
dRME;
61 std::pair<MonitorElement*, bool>
q1q2ME;
95 using std::unordered_map;
192 return hltPlot{std::make_pair<MonitorElement*, bool>(
nullptr,
false),
193 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_eta")),
194 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_phi")),
195 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_pt")),
196 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_mass")),
197 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_energy")),
198 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_csv")),
199 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_etaVSphi")),
200 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_pt_HEP17")),
201 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_pt_HEM17")),
202 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_MR")),
203 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_RSQ")),
204 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_dxy")),
205 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_dz")),
206 std::make_pair<MonitorElement*, bool>(
nullptr,
pset.getParameter<
bool>(
"displayInPrimary_dimass")),
207 std::make_pair<MonitorElement*, bool>(
nullptr,
false),
208 std::make_pair<MonitorElement*, bool>(
nullptr,
false),
209 std::make_pair<MonitorElement*, bool>(
nullptr,
false),
215 pset.getParameter<std::vector<double>>(
"etaBINNING"),
216 pset.getParameter<std::vector<double>>(
"ptBINNING"),
217 pset.getParameter<std::vector<double>>(
"phiBINNING"),
218 pset.getParameter<std::vector<double>>(
"massBINNING"),
219 pset.getParameter<std::vector<double>>(
"dxyBINNING"),
220 pset.getParameter<std::vector<double>>(
"dzBINNING"),
221 pset.getParameter<std::vector<double>>(
"dimassBINNING"),
222 pset.getUntrackedParameter<
bool>(
"doPlot2D",
false),
223 pset.getUntrackedParameter<
bool>(
"doPlotETA",
true),
224 pset.getUntrackedParameter<
bool>(
"doPlotMASS",
false),
225 pset.getUntrackedParameter<
bool>(
"doPlotENERGY",
false),
226 pset.getUntrackedParameter<
bool>(
"doPlotHEP17",
true),
227 pset.getUntrackedParameter<
bool>(
"doPlotCSV",
false),
228 pset.getUntrackedParameter<
bool>(
"doCALO",
false),
229 pset.getUntrackedParameter<
bool>(
"doPF",
false),
230 pset.getUntrackedParameter<
bool>(
"doPlotRazor",
false),
231 pset.getUntrackedParameter<
bool>(
"doPlotDXY",
false),
232 pset.getUntrackedParameter<
bool>(
"doPlotDZ",
false),
233 pset.getUntrackedParameter<
bool>(
"doPlotDiMass",
false)};
257 : TopFolder_(iConfig.getParameter<
std::
string>(
"TopFolder")),
258 label_(iConfig.getParameter<
std::
string>(
"label")),
259 processName_(iConfig.getParameter<
std::
string>(
"processName")),
261 debug_(iConfig.getUntrackedParameter<
bool>(
"debug",
false)),
264 beamSpot_(iConfig.getParameter<
edm::
InputTag>(
"beamspot")),
268 muCandidates_(iConfig.getParameter<
edm::
InputTag>(
"muCandidates")),
269 muCandidatesToken_(consumes<
std::
vector<
reco::RecoChargedCandidate>>(muCandidates_)),
270 eleCandidates_(iConfig.getParameter<
edm::
InputTag>(
"eleCandidates")),
271 eleCandidatesToken_(consumes<
std::
vector<
reco::RecoChargedCandidate>>(eleCandidates_)) {
325 if (
plot.pathIDX <= 0)
331 if (not plottedPathIndices[
index]) {
332 plottedPathIndices[
index] =
true;
334 std::cout <<
plot.pathNAME <<
" --> bin: " << ibin << std::endl;
342 bool moduleFOUND =
false;
344 for (
const auto&
module : moduleNames) {
349 std::cout <<
plot.moduleNAME << (moduleFOUND ?
"" :
"NOT") <<
" found in the list of modules" << std::endl;
352 for (
const auto&
module : moduleNames) {
355 if (idx < triggerEvent->sizeFilters())
364 std::cout <<
"moduleNAME: " <<
plot.moduleNAME <<
" --> " << moduleIDX << std::endl;
368 <<
plot.pathNAME <<
" " <<
plot.moduleNAME
369 <<
" is not available ! please, fix update DQM/HLTEvF/python/HLTObjectsMonitor_cfi.py";
389 std::cout <<
"object ID " <<
id <<
" mass: " <<
mass << std::endl;
392 plot.ptME.first->Fill(
pt);
397 if (
plot.doPlotCSV) {
400 plot.csvME.first->Fill(-10.);
405 std::cout <<
"[HLTObjectsMonitor::analyze] deltaR: " <<
dR <<
" matched ? " 406 << (
dR <= 0.4 ?
"YEAP" :
"NOPE") << std::endl;
407 plot.csvME.first->Fill(it->second);
411 }
else if (
plot.doPF) {
413 plot.csvME.first->Fill(-10.);
418 std::cout <<
"[HLTObjectsMonitor::analyze] deltaR: " <<
dR <<
" matched ? " 419 << (
dR <= 0.4 ?
"YEAP" :
"NOPE") << std::endl;
420 plot.csvME.first->Fill(it->second);
427 if (
plot.doPlotENERGY)
431 if (
plot.doPlotHEP17) {
433 plot.ptMEhep17.first->Fill(
pt);
435 plot.ptMEhem17.first->Fill(
pt);
443 if (
plot.doPlotDXY) {
452 if (
plot.doPlotRazor) {
453 plot.mrME.first->Fill(MR);
454 plot.rsqME.first->Fill(RSQ);
457 if (
keys.size() < 2) {
458 if (
plot.doPlotDiMass ||
plot.doPlotDZ)
459 LogDebug(
"HLTObjectsMonitor") <<
plot.pathNAME <<
" " <<
plot.moduleNAME <<
" # objects is (" <<
keys.size()
460 <<
") less than 2 ! you probably want to either change the moduleNAME or " 461 "switch off di-object system plots (doPlotDZ: " 462 <<
plot.doPlotDZ <<
" doPlotDiMass: " <<
plot.doPlotDiMass
463 <<
") in DQM/HLTEvF/python/HLTObjectsMonitor_cfi.py)";
471 unsigned int kCnt0 = 0;
479 unsigned int kCnt1 = 0;
480 for (
const auto& key1 :
keys) {
486 double phi2 =
objects[key1].phi();
490 plot.dRME.first->Fill(
dR);
493 int q1 = (
id == 0 ? 0 :
id /
abs(
id));
496 plot.q1q2ME.first->Fill(q1q2);
498 if ((
id +
id2) == 0) {
504 v2.SetPtEtaPhiM(
pt2,
eta2, phi2, 0);
506 if (
plot.doPlotDiMass) {
507 TLorentzVector
v = v1 + v2;
508 plot.dimassME.first->Fill(
v.M());
517 plot.dzME.first->Fill(
dz);
536 std::cout <<
"[HLTObjectsMonitor::dqmBeginRun] extracting HLTconfig" << std::endl;
553 if (
plot.pathNAME == pathName_noVersion) {
564 std::cout <<
"plot: " <<
plot.pathNAME <<
" --> pathIDX: " <<
plot.pathIDX << std::endl;
565 std::cout <<
"[HLTObjectsMonitor::dqmBeginRun] DONE" << std::endl;
573 std::cout <<
"[HLTObjectsMonitor::bookHistograms]" << std::endl;
582 std::unordered_map<std::string, int> uniqueNames;
597 std::cout <<
p.pathNAME <<
" --> bin: " <<
i << std::endl;
604 std::cout <<
"booking plots for " <<
plot.label << std::endl;
606 if (
plot.pathIDX <= 0) {
608 <<
" is not available in the HLT menu ! no plots are going to be booked for it " 609 "(update DQM/HLTEvF/python/HLTObjectsMonitor_cfi.py)";
613 std::cout <<
"booking histograms for " <<
plot.pathNAME << std::endl;
624 plot.nME.first->setAxisTitle(
plot.xTITLE +
" # objects");
627 if (
plot.ptME.second)
635 std::vector<float> fbinning((
plot.ptBINNING).begin(), (
plot.ptBINNING).
end());
636 float* arr = &fbinning[0];
638 plot.ptME.first->setAxisTitle(
plot.xTITLE +
" p_{T} [GeV]");
641 if (
plot.phiME.second)
649 std::vector<float> fbinning((
plot.phiBINNING).begin(), (
plot.phiBINNING).
end());
650 float* arr = &fbinning[0];
652 plot.phiME.first->setAxisTitle(
plot.xTITLE +
" #phi [rad]");
655 if (
plot.doPlotETA) {
656 if (
plot.etaME.second)
664 std::vector<float> fbinning((
plot.etaBINNING).begin(), (
plot.etaBINNING).
end());
665 float* arr = &fbinning[0];
668 plot.etaME.first->setAxisTitle(
plot.xTITLE +
" #eta");
671 if (
plot.doPlotMASS) {
672 if (
plot.massME.second)
680 std::vector<float> fbinning((
plot.massBINNING).begin(), (
plot.massBINNING).
end());
681 float* arr = &fbinning[0];
684 plot.massME.first->setAxisTitle(
plot.xTITLE +
" mass [GeV]");
687 if (
plot.doPlotENERGY) {
688 if (
plot.energyME.second)
696 std::vector<float> fbinning((
plot.ptBINNING).begin(), (
plot.ptBINNING).
end());
697 float* arr = &fbinning[0];
700 plot.energyME.first->setAxisTitle(
plot.xTITLE +
" energy [GeV]");
703 if (
plot.doPlotCSV) {
704 if (
plot.csvME.second)
713 plot.csvME.first->setAxisTitle(
plot.xTITLE +
" CSV discriminator");
717 if (
plot.etaVSphiME.second)
725 std::vector<float> fbinningX((
plot.etaBINNING).begin(), (
plot.etaBINNING).
end());
726 float* arrX = &fbinningX[0];
729 std::vector<float> fbinningY((
plot.phiBINNING).begin(), (
plot.phiBINNING).
end());
730 float* arrY = &fbinningY[0];
732 plot.etaVSphiME.first->setAxisTitle(
plot.xTITLE +
" #eta", 1);
733 plot.etaVSphiME.first->setAxisTitle(
plot.xTITLE +
" #phi", 2);
736 if (
plot.doPlotHEP17) {
737 if (
plot.ptMEhep17.second)
743 std::vector<float> fbinning((
plot.ptBINNING).begin(), (
plot.ptBINNING).
end());
744 float* arr = &fbinning[0];
749 plot.ptMEhep17.first->setAxisTitle(
plot.xTITLE +
" p_{T} [GeV]", 1);
751 if (
plot.ptMEhem17.second)
759 plot.ptMEhem17.first->setAxisTitle(
plot.xTITLE +
" p_{T} [GeV]", 1);
762 if (
plot.doPlotRazor) {
763 if (
plot.mrME.second)
771 plot.mrME.first->setAxisTitle(
plot.xTITLE +
" M_{R} [GeV]", 1);
773 if (
plot.rsqME.second)
781 plot.rsqME.first->setAxisTitle(
plot.xTITLE +
" RSQ [GeV]", 1);
784 if (
plot.doPlotDXY) {
785 if (
plot.dxyME.second)
793 std::vector<float> fbinning((
plot.dxyBINNING).begin(), (
plot.dxyBINNING).
end());
794 float* arr = &fbinning[0];
796 plot.dxyME.first->setAxisTitle(
plot.xTITLE +
" d_{xy} [cm]");
800 if (
plot.dzME.second)
808 std::vector<float> fbinning((
plot.dzBINNING).begin(), (
plot.dzBINNING).
end());
809 float* arr = &fbinning[0];
811 plot.dzME.first->setAxisTitle(
plot.xTITLE +
" d_{z} [cm]");
814 if (
plot.dRME.second)
822 plot.dRME.first->setAxisTitle(
plot.xTITLE +
" dR_{obj,obj}");
824 if (
plot.dRetaVSphiME.second)
830 title =
plot.pathNAME +
" di-object dR in the #eta-#phi plane (of 1st obj)";
832 plot.dRetaVSphiME.first->setAxisTitle(
plot.xTITLE +
" #eta", 1);
833 plot.dRetaVSphiME.first->setAxisTitle(
plot.xTITLE +
" #phi", 2);
834 plot.dRetaVSphiME.first->setAxisTitle(
plot.xTITLE +
" dR_{obj,obj}", 3);
836 if (
plot.q1q2ME.second)
842 title =
plot.pathNAME +
" di-object q1xq2";
844 plot.q1q2ME.first->setAxisTitle(
plot.xTITLE +
" q_{obj1} x q_{obj2}");
846 if (
plot.doPlotDiMass) {
847 if (
plot.dimassME.second)
853 title =
plot.pathNAME +
" di-object mass";
855 std::vector<float> fbinning((
plot.dimassBINNING).begin(), (
plot.dimassBINNING).
end());
856 float* arr = &fbinning[0];
858 plot.dimassME.first->setAxisTitle(
plot.xTITLE +
" m_{obj,obj} [GeV]");
863 std::cout <<
"[HLTObjectsMonitor::bookHistograms] DONE" << std::endl;
870 double dRcut = 0.1) {
874 <<
" is not valid ! please, update DQM/HLTEvF/python/HLTObjectsMonitor_cfi.py" 875 <<
" by switching OFF doPlotDXY or updating the InputTag collection";
880 <<
" is not valid ! please, update DQM/HLTEvF/python/HLTObjectsMonitor_cfi.py" 881 <<
" by switching OFF doPlotDXY or updating the InputTag collection";
886 for (reco::RecoChargedCandidateCollection::const_iterator candidate =
candidates->begin();
889 if (
deltaR(
eta,
phi, candidate->eta(), candidate->phi()) < dRcut) {
891 dxy = (-(candidate->vx() -
beamspot->x0()) * candidate->py() +
892 (candidate->vy() -
beamspot->y0()) * candidate->px()) /
898 edm::LogWarning(
"HLTObjectsMonitor") <<
"trigger object does not match ( dR > " << dRcut
899 <<
") to any of the candidates in either " <<
muCandidates_ <<
" or " 910 double dRcut = 0.1) {
914 <<
" is not valid ! please, update DQM/HLTEvF/python/HLTObjectsMonitor_cfi.py" 915 <<
" by switching OFF doPlotDZ or updating the InputTag collection";
921 bool matched1 =
false;
922 bool matched2 =
false;
923 for (reco::RecoChargedCandidateCollection::const_iterator candidate =
candidates->begin();
926 if (
deltaR(
eta1, phi1, candidate->eta(), candidate->phi()) < dRcut) {
930 std::cout <<
"cand1: " << cand1->
pt() <<
" " << cand1->
eta() <<
" " << cand1->
phi() << std::endl;
935 LogDebug(
"HLTObjectsMonitor") <<
"trigger object1 does not match ( dR > " << dRcut
936 <<
") to any of the candidates in either " <<
muCandidates_ <<
" or " 941 for (reco::RecoChargedCandidateCollection::const_iterator candidate =
candidates->begin();
945 std::cout <<
"candidate: " << candidate->pt() <<
" cand1: " << cand1->
pt() << std::endl;
946 std::cout <<
"candidate: " << candidate->eta() <<
" cand1: " << cand1->
eta() << std::endl;
947 std::cout <<
"candidate: " << candidate->phi() <<
" cand1: " << cand1->
phi() << std::endl;
949 if (&*candidate == cand1)
952 if (
deltaR(
eta2, phi2, candidate->eta(), candidate->phi()) < dRcut) {
956 std::cout <<
"cand2: " << cand2->
pt() <<
" " << cand2->
eta() <<
" " << cand2->
phi() << std::endl;
961 LogDebug(
"HLTObjectsMonitor") <<
"trigger object2 does not match ( dR > " << dRcut
962 <<
") to any of the candidates in either " <<
muCandidates_ <<
" or " 967 dz = cand1->
vz() - cand2->
vz();
edm::EDGetTokenT< reco::JetTagCollection > pfJetBTagsToken_
std::vector< double > phiBINNING
std::vector< hltPlot > hltPlots_
std::string backupFolder_
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
std::pair< MonitorElement *, bool > energyME
double pt() const final
transverse momentum
std::unordered_map< std::string, int > plotNamesToBins_
const MEbinning csv_binning_
double vz() const override
z coordinate of vertex position
edm::InputTag muCandidates_
virtual void setCurrentFolder(std::string const &fullpath)
edm::EDGetTokenT< reco::JetTagCollection > caloJetBTagsToken_
std::vector< double > etaBINNING
std::vector< double > dimassBINNING
static hltPlot getPlotPSet(edm::ParameterSet pset)
#define DEFINE_FWK_MODULE(type)
std::pair< MonitorElement *, bool > csvME
std::pair< MonitorElement *, bool > ptME
const MEbinning phi_binning_hep17_
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
std::pair< MonitorElement *, bool > etaVSphiME
std::pair< MonitorElement *, bool > ptMEhem17
std::pair< MonitorElement *, bool > q1q2ME
std::pair< MonitorElement *, bool > phiME
JetFloatAssociation::Container JetTagCollection
dqm::reco::MonitorElement MonitorElement
const MEbinning eta_binning_hep17_
static const std::string removeVersion(const std::string &trigger)
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< std::vector< reco::RecoChargedCandidate > > eleCandidatesToken_
bool isHEP17(double eta, double phi)
bool saveTags(const std::string &module) const
Is module an L3 filter (ie, tracked saveTags=true)
const MEbinning phi_binning_
HLTObjectsMonitor(const edm::ParameterSet &)
edm::InputTag eleCandidates_
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
double dxyFinder(double, double, edm::Handle< reco::RecoChargedCandidateCollection >, edm::Handle< reco::BeamSpot >, double)
std::pair< MonitorElement *, bool > etaME
Abs< T >::type abs(const T &t)
~HLTObjectsMonitor() override=default
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
static std::string const triggerResults
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::vector< double > massBINNING
std::pair< MonitorElement *, bool > rsqME
std::vector< double > dzBINNING
std::pair< MonitorElement *, bool > mrME
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
std::pair< MonitorElement *, bool > ptMEhep17
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
HLTConfigProvider hltConfig_
const MEbinning eta_binning_hem17_
edm::EDGetTokenT< std::vector< reco::RecoChargedCandidate > > muCandidatesToken_
std::pair< MonitorElement *, bool > dzME
bool isHEM17(double eta, double phi)
const std::vector< std::string > & triggerNames() const
names of trigger paths
std::pair< MonitorElement *, bool > dimassME
std::pair< MonitorElement *, bool > dxyME
std::pair< MonitorElement *, bool > nME
std::vector< double > phi_variable_binning_
MonitorElement * eventsPlot_
std::pair< MonitorElement *, bool > dRetaVSphiME
std::vector< edm::ParameterSet > plotPSETS_
void analyze(const edm::Event &, const edm::EventSetup &) override
double dzFinder(double, double, double, double, edm::Handle< reco::RecoChargedCandidateCollection >, double)
std::pair< MonitorElement *, bool > dRME
std::pair< MonitorElement *, bool > massME
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
double phi() const final
momentum azimuthal angle
static std::string const triggerPaths
std::vector< double > dxyBINNING
edm::EDGetTokenT< trigger::TriggerEvent > triggerEventToken_
std::vector< double > ptBINNING
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
double eta() const final
momentum pseudorapidity