11 #include <initializer_list> 43 #include "TLorentzVector.h" 64 vector<LeafCandidate> &from,
65 vector<LeafCandidate> &
to,
66 double deltaRMatchingCut,
70 vector<double> &
xBins,
72 vector<double> &
yBins,
77 vector<double> &
xBins,
79 vector<double> &
yBins,
85 vector<double> &
xBins,
87 vector<double> &
yBins,
92 vector<double> &
xBins,
94 vector<double> &
yBins,
140 map<TString, MonitorElement *>
ME;
148 triggerProcessName(
pset.getUntrackedParameter<
string>(
"TriggerProcessName")),
149 triggerPathName(
pset.getUntrackedParameter<
string>(
"TriggerPathName")),
150 motherIDs(
pset.getUntrackedParameter<
vector<
int> >(
"MotherIDs")),
151 genGlobDeltaRMatchingCut(
pset.getUntrackedParameter<double>(
"GenGlobDeltaRMatchingCut")),
152 globL1DeltaRMatchingCut(
pset.getUntrackedParameter<double>(
"GlobL1DeltaRMatchingCut")),
153 globL2DeltaRMatchingCut(
pset.getUntrackedParameter<double>(
"GlobL2DeltaRMatchingCut")),
154 globL3DeltaRMatchingCut(
pset.getUntrackedParameter<double>(
"GlobL3DeltaRMatchingCut")),
155 deltaEtaBins(
pset.getUntrackedParameter<
vector<double> >(
"DeltaEtaBins")),
156 deltaPhiBins(
pset.getUntrackedParameter<
vector<double> >(
"DeltaPhiBins")),
157 muonPtBins(
pset.getUntrackedParameter<
vector<double> >(
"MuonPtBins")),
158 muonEtaBins(
pset.getUntrackedParameter<
vector<double> >(
"MuonEtaBins")),
159 muonPhiBins(
pset.getUntrackedParameter<
vector<double> >(
"MuonPhiBins")),
160 dimuonPtBins(
pset.getUntrackedParameter<
vector<double> >(
"DimuonPtBins")),
161 dimuonEtaBins(
pset.getUntrackedParameter<
vector<double> >(
"DimuonEtaBins")),
162 dimuonDRBins(
pset.getUntrackedParameter<
vector<double> >(
"DimuonDRBins")),
181 LogDebug(
"HLTriggerOfflineHeavyFlavor")
182 <<
"Successfully initialized HLTConfigProvider with process name: " <<
triggerProcessName << endl;
185 <<
"Could not initialize HLTConfigProvider with process name: " <<
triggerProcessName << endl;
253 "pathDimuon_recoRapPt",
261 "diPathDimuon_recoRapPt",
272 "pathDimuon_recoPtDR",
276 "#mu#mu #Delta R at IP",
279 "diPathDimuon_recoPtDR",
283 "#mu#mu #Delta R at IP",
289 "pathDimuon_recoPtDRpos",
293 "#mu#mu #Delta R in MS",
296 "diPathDimuon_recoPtDRpos",
300 "#mu#mu #Delta R in MS",
310 vector<double> sizeBins;
311 sizeBins.push_back(10);
312 sizeBins.push_back(0);
313 sizeBins.push_back(10);
314 myBook1D(ibooker,
"genMuon_size", sizeBins,
"container size");
315 myBook1D(ibooker,
"globMuon_size", sizeBins,
"container size");
329 if (
p->status() == 1 &&
std::abs(
p->pdgId()) == 13 &&
336 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Could not access GenParticleCollection" << endl;
340 LogDebug(
"HLTriggerOfflineHeavyFlavor")
343 vector<LeafCandidate> globMuons;
344 vector<LeafCandidate> globMuons_position;
347 if (recoMuonsHandle.
isValid()) {
348 for (MuonCollection::const_iterator
p = recoMuonsHandle->begin();
p != recoMuonsHandle->end(); ++
p) {
349 if (
p->isGlobalMuon()) {
350 globMuons.push_back(*
p);
353 p->outerTrack()->innerPosition().y(),
354 p->outerTrack()->innerPosition().z(),
359 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Could not access reco Muons" << endl;
361 ME[
"globMuon_size"]->Fill(globMuons.size());
362 LogDebug(
"HLTriggerOfflineHeavyFlavor")
363 <<
"Global Muons from " <<
recoMuonsTag <<
" has size: " << globMuons.size() << endl;
366 vector<vector<LeafCandidate> > muonsAtFilter;
367 vector<vector<LeafCandidate> > muonPositionsAtFilter;
369 muonsAtFilter.push_back(vector<LeafCandidate>());
370 muonPositionsAtFilter.push_back(vector<LeafCandidate>());
374 if (rawTriggerEvent.
isValid()) {
377 if (index < rawTriggerEvent->
size()) {
379 vector<L1MuonParticleRef> l1Cands;
381 for (
size_t j = 0;
j < l1Cands.size();
j++) {
382 muonsAtFilter[
i].push_back(*l1Cands[
j]);
385 vector<RecoChargedCandidateRef> hltCands;
387 for (
size_t j = 0;
j < hltCands.size();
j++) {
388 muonsAtFilter[
i].push_back(*hltCands[
j]);
390 muonPositionsAtFilter[
i].push_back(
393 hltCands[
j]->
track()->innerPosition().
y(),
394 hltCands[
j]->
track()->innerPosition().
z(),
401 LogDebug(
"HLTriggerOfflineHeavyFlavor")
402 <<
"Filter \"" <<
filterNamesLevels[
i].first <<
"\" has " << muonsAtFilter[
i].size() <<
" muons" << endl;
405 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Could not access RAWTriggerEvent" << endl;
409 vector<LeafCandidate> pathMuons;
412 if (aodTriggerEvent.
isValid()) {
417 for (
size_t j = 0;
j <
keys.size();
j++) {
419 allObjects[
keys[
j]].
id() > 0 ? 1 : -1,
425 ME[
"pathMuon_size"]->Fill(pathMuons.size());
426 LogDebug(
"HLTriggerOfflineHeavyFlavor")
427 <<
"Path \"" <<
triggerPathName <<
"\" has " << pathMuons.size() <<
" muons at last filter \"" 430 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Could not access AODTriggerEvent" << endl;
434 bool triggerFired =
false;
440 bool hlt_exists =
false;
457 vector<int> glob_gen(
genMuons.size(), -1);
459 vector<vector<int> > filt_glob;
460 vector<int> path_glob(globMuons.size(), -1);
474 if (glob_gen[
i] != -1) {
475 ME[
"resGlobGen_genEtaPt"]->Fill(
479 ME[
"globMuon_recoEtaPt"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
pt());
480 ME[
"globMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
phi());
481 if (path_glob[glob_gen[
i]] != -1) {
482 ME[
"resPathGlob_recoEtaPt"]->Fill(
483 globMuons[glob_gen[
i]].
eta(),
484 globMuons[glob_gen[
i]].
pt(),
485 (pathMuons[path_glob[glob_gen[
i]]].
pt() - globMuons[glob_gen[
i]].
pt()) / globMuons[glob_gen[
i]].
pt());
486 ME[
"pathMuon_recoEtaPt"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
pt());
487 ME[
"pathMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
phi());
493 ME[
"resultMuon_recoEtaPt"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
pt());
494 ME[
"resultMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
phi());
508 if (secondMuon > 0) {
512 double genDimuonRap = (
genMuons[0].p4() +
genMuons[secondMuon].p4()).Rapidity();
513 double genDimuonDR = deltaR<LeafCandidate, LeafCandidate>(
genMuons[0],
genMuons[secondMuon]);
515 ME[
"genDimuon_genEtaPt"]->Fill(genDimuonEta, genDimuonPt);
516 ME[
"genDimuon_genRapPt"]->Fill(genDimuonRap, genDimuonPt);
518 ME[
"genDimuon_genPtDR"]->Fill(genDimuonPt, genDimuonDR);
520 if (glob_gen[0] != -1 && glob_gen[secondMuon] != -1) {
521 ME[
"globDimuon_genEtaPt"]->Fill(genDimuonEta, genDimuonPt);
522 ME[
"globDimuon_genRapPt"]->Fill(genDimuonRap, genDimuonPt);
524 ME[
"globDimuon_genPtDR"]->Fill(genDimuonPt, genDimuonDR);
525 double globDimuonPt = (globMuons[glob_gen[0]].p4() + globMuons[glob_gen[secondMuon]].p4()).
pt();
526 double globDimuonEta = (globMuons[glob_gen[0]].p4() + globMuons[glob_gen[secondMuon]].p4()).
eta();
527 double globDimuonRap = (globMuons[glob_gen[0]].p4() + globMuons[glob_gen[secondMuon]].p4()).Rapidity();
528 double globDimuonDR =
529 deltaR<LeafCandidate, LeafCandidate>(globMuons[glob_gen[0]], globMuons[glob_gen[secondMuon]]);
530 double globDimuonDRpos = deltaR<LeafCandidate, LeafCandidate>(globMuons_position[glob_gen[0]],
531 globMuons_position[glob_gen[secondMuon]]);
532 ME[
"globDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
533 ME[
"globDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
535 ME[
"globDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
537 ME[
"globDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
538 if (path_glob[glob_gen[0]] != -1 && path_glob[glob_gen[secondMuon]] != -1) {
539 ME[
"diPathDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
540 ME[
"diPathDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
542 ME[
"diPathDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
544 ME[
"diPathDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
547 if (path_glob[glob_gen[0]] != -1 || path_glob[glob_gen[secondMuon]] != -1) {
548 ME[
"pathDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
549 ME[
"pathDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
551 ME[
"pathDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
553 ME[
"pathDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
557 ME[
"resultDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
558 ME[
"resultDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
560 ME[
"resultDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
562 ME[
"resultDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
571 if (mother->
pdgId() ==
p->pdgId()) {
574 return mother->
pdgId();
582 vector<LeafCandidate> &from,
583 vector<LeafCandidate> &
to,
584 double dRMatchingCut,
586 vector<double>
dR(from.size());
587 for (
size_t i = 0;
i < from.size();
i++) {
591 for (
size_t j = 0;
j <
to.size();
j++) {
592 double dRtmp = deltaR<double>(from[
i].eta(), from[
i].phi(),
to[
j].eta(),
to[
j].phi());
603 if (
dR[
i] > dRMatchingCut) {
608 for (
size_t k = 0;
k <
i;
k++) {
631 Double_t *
pt =
new Double_t[ptN];
632 for (
int i = 0;
i < ptN;
i++) {
636 Double_t *
eta =
new Double_t[etaN];
637 for (
int i = 0;
i < etaN;
i++) {
641 h->SetXTitle(ptLabel);
642 h->SetYTitle(etaLabel);
657 Double_t *
pt =
new Double_t[ptN];
658 for (
int i = 0;
i < ptN;
i++) {
662 Double_t *
eta =
new Double_t[etaN];
663 for (
int i = 0;
i < etaN;
i++) {
666 TProfile2D *
h =
new TProfile2D(
name,
name, ptN - 1,
pt, etaN - 1,
eta);
667 h->SetXTitle(ptLabel);
668 h->SetYTitle(etaLabel);
678 Double_t *myBins =
new Double_t[binsN];
679 for (
int i = 0;
i < binsN;
i++) {
682 TH1F *
h =
new TH1F(
name,
name, binsN - 1, myBins);
692 return s.find(sub) != std::string::npos;
696 const auto containsAny = [](
const std::string &
s,
const std::vector<std::string> &subs) ->
bool {
697 for (
const auto &sub : subs) {
698 if (
s.find(sub) != std::string::npos)
705 const auto isAnyOf = [](
const std::string &
s,
const std::vector<std::string> &ms) ->
bool {
706 for (
const auto &
m : ms) {
722 const std::string l2Filter =
"HLTMuonL2FromL1TPreFilter";
723 const std::vector<std::string> l3Filters = {
"HLTMuonDimuonL3Filter",
"HLTMuonL3PreFilter"};
724 const std::vector<std::string> l4Filters = {
725 "HLTDisplacedmumuFilter",
"HLTDiMuonGlbTrkFilter",
"HLTMuonTrackMassFilter"};
726 const std::vector<std::string> l5Filters = {
"HLTmumutkFilter",
"HLT2MuonMuonDZ",
"HLTDisplacedmumuFilter"};
739 if (containsAny(
moduleName, {
"DisplacedmumuFilter",
"DiMuon",
"MuonL3Filtered",
"TrackMassFiltered"}) &&
double globL1DeltaRMatchingCut
vector< double > dimuonPtBins
const Keys & filterKeys(trigger::size_type index) const
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())
bool contains(EventRange const &lh, EventID const &rh)
void myBook2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)
virtual void setCurrentFolder(std::string const &fullpath)
void analyze(const edm::Event &, const edm::EventSetup &) override
enum start value shifted to 81 so as to avoid clashes with PDG codes
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
vector< double > deltaPhiBins
trigger::size_type sizeFilters() const
double globL3DeltaRMatchingCut
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
string triggerProcessName
vector< double > dimuonEtaBins
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const edm::InputTag filterTag(trigger::size_type index) const
std::vector< TPRegexp > filters
int getFilterLevel(const std::string &moduleName, const HLTConfigProvider &hltConfig)
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
EDGetTokenT< TriggerEvent > triggerSummaryAODTag
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
U second(std::pair< T, U > const &p)
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void myBookProfile2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel, TString title)
vector< double > dimuonDRBins
int getMotherId(const Candidate *p)
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
void match(MonitorElement *me, vector< LeafCandidate > &from, vector< LeafCandidate > &to, double deltaRMatchingCut, vector< int > &map)
EDGetTokenT< TriggerEventWithRefs > triggerSummaryRAWTag
Abs< T >::type abs(const T &t)
const TriggerObjectCollection & getObjects() const
void myBook1D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString label, TString title)
#define DEFINE_FWK_MODULE(type)
static std::string const triggerResults
double genGlobDeltaRMatchingCut
vector< double > muonPtBins
HeavyFlavorValidation(const edm::ParameterSet &)
double globL2DeltaRMatchingCut
~HeavyFlavorValidation() override
virtual int pdgId() const =0
PDG identifier.
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
vector< double > deltaEtaBins
void myBook2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel)
EDGetTokenT< MuonCollection > recoMuonsToken
std::vector< size_type > Keys
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
vector< double > muonPhiBins
EDGetTokenT< GenParticleCollection > genParticlesToken
void myBookProfile2D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString xLabel, vector< double > &yBins, TString yLabel)
void myBook1D(DQMStore::IBooker &ibooker, TString name, vector< double > &xBins, TString label)
EDGetTokenT< TriggerResults > triggerResultsToken
Log< level::Warning, false > LogWarning
InputTag triggerResultsTag
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
map< TString, MonitorElement * > ME
vector< pair< string, int > > filterNamesLevels
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
vector< double > muonEtaBins
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type