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;
319 "pathDimuon_recoRapPt",
338 "diPathDimuon_recoRapPt",
360 "pathDimuon_recoPtDR",
364 "#mu#mu #Delta R at IP",
378 "diPathDimuon_recoPtDR",
382 "#mu#mu #Delta R at IP",
399 "pathDimuon_recoPtDRpos",
403 "#mu#mu #Delta R in MS",
417 "diPathDimuon_recoPtDRpos",
421 "#mu#mu #Delta R in MS",
442 vector<double> sizeBins;
443 sizeBins.push_back(10);
444 sizeBins.push_back(0);
445 sizeBins.push_back(10);
446 myBook1D(ibooker,
"genMuon_size", sizeBins,
"container size");
447 myBook1D(ibooker,
"globMuon_size", sizeBins,
"container size");
467 if (
p->status() == 1 &&
std::abs(
p->pdgId()) == 13 &&
474 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Could not access GenParticleCollection" << endl;
478 LogDebug(
"HLTriggerOfflineHeavyFlavor")
481 vector<LeafCandidate> globMuons;
482 vector<LeafCandidate> globMuons_position;
485 if (recoMuonsHandle.
isValid()) {
486 for (MuonCollection::const_iterator
p = recoMuonsHandle->begin();
p != recoMuonsHandle->end(); ++
p) {
487 if (
p->isGlobalMuon()) {
488 globMuons.push_back(*
p);
491 p->outerTrack()->innerPosition().y(),
492 p->outerTrack()->innerPosition().z(),
497 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Could not access reco Muons" << endl;
499 ME[
"globMuon_size"]->Fill(globMuons.size());
500 LogDebug(
"HLTriggerOfflineHeavyFlavor")
501 <<
"Global Muons from " <<
recoMuonsTag <<
" has size: " << globMuons.size() << endl;
504 vector<vector<LeafCandidate> > muonsAtFilter;
505 vector<vector<LeafCandidate> > muonPositionsAtFilter;
507 muonsAtFilter.push_back(vector<LeafCandidate>());
508 muonPositionsAtFilter.push_back(vector<LeafCandidate>());
512 if (rawTriggerEvent.
isValid()) {
515 if (index < rawTriggerEvent->
size()) {
517 vector<L1MuonParticleRef> l1Cands;
519 for (
size_t j = 0;
j < l1Cands.size();
j++) {
520 muonsAtFilter[
i].push_back(*l1Cands[
j]);
523 vector<RecoChargedCandidateRef> hltCands;
525 for (
size_t j = 0;
j < hltCands.size();
j++) {
526 muonsAtFilter[
i].push_back(*hltCands[
j]);
528 muonPositionsAtFilter[
i].push_back(
531 hltCands[
j]->
track()->innerPosition().
y(),
532 hltCands[
j]->
track()->innerPosition().
z(),
539 LogDebug(
"HLTriggerOfflineHeavyFlavor")
540 <<
"Filter \"" <<
filterNamesLevels[
i].first <<
"\" has " << muonsAtFilter[
i].size() <<
" muons" << endl;
543 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Could not access RAWTriggerEvent" << endl;
547 vector<LeafCandidate> pathMuons;
550 if (aodTriggerEvent.
isValid()) {
555 for (
size_t j = 0;
j <
keys.size();
j++) {
557 allObjects[
keys[
j]].
id() > 0 ? 1 : -1,
563 ME[
"pathMuon_size"]->Fill(pathMuons.size());
564 LogDebug(
"HLTriggerOfflineHeavyFlavor")
565 <<
"Path \"" <<
triggerPathName <<
"\" has " << pathMuons.size() <<
" muons at last filter \"" 568 LogDebug(
"HLTriggerOfflineHeavyFlavor") <<
"Could not access AODTriggerEvent" << endl;
572 bool triggerFired =
false;
578 bool hlt_exists =
false;
595 vector<int> glob_gen(
genMuons.size(), -1);
597 vector<vector<int> > filt_glob;
622 vector<int> path_glob(globMuons.size(), -1);
636 if (glob_gen[
i] != -1) {
637 ME[
"resGlobGen_genEtaPt"]->Fill(
641 ME[
"globMuon_recoEtaPt"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
pt());
642 ME[
"globMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
phi());
660 if (path_glob[glob_gen[
i]] != -1) {
661 ME[
"resPathGlob_recoEtaPt"]->Fill(
662 globMuons[glob_gen[
i]].
eta(),
663 globMuons[glob_gen[
i]].
pt(),
664 (pathMuons[path_glob[glob_gen[
i]]].
pt() - globMuons[glob_gen[
i]].
pt()) / globMuons[glob_gen[
i]].
pt());
665 ME[
"pathMuon_recoEtaPt"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
pt());
666 ME[
"pathMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
phi());
672 ME[
"resultMuon_recoEtaPt"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
pt());
673 ME[
"resultMuon_recoEtaPhi"]->Fill(globMuons[glob_gen[
i]].
eta(), globMuons[glob_gen[
i]].
phi());
687 if (secondMuon > 0) {
691 double genDimuonRap = (
genMuons[0].p4() +
genMuons[secondMuon].p4()).Rapidity();
692 double genDimuonDR = deltaR<LeafCandidate, LeafCandidate>(
genMuons[0],
genMuons[secondMuon]);
694 ME[
"genDimuon_genEtaPt"]->Fill(genDimuonEta, genDimuonPt);
695 ME[
"genDimuon_genRapPt"]->Fill(genDimuonRap, genDimuonPt);
697 ME[
"genDimuon_genPtDR"]->Fill(genDimuonPt, genDimuonDR);
699 if (glob_gen[0] != -1 && glob_gen[secondMuon] != -1) {
700 ME[
"globDimuon_genEtaPt"]->Fill(genDimuonEta, genDimuonPt);
701 ME[
"globDimuon_genRapPt"]->Fill(genDimuonRap, genDimuonPt);
703 ME[
"globDimuon_genPtDR"]->Fill(genDimuonPt, genDimuonDR);
704 double globDimuonPt = (globMuons[glob_gen[0]].p4() + globMuons[glob_gen[secondMuon]].p4()).
pt();
705 double globDimuonEta = (globMuons[glob_gen[0]].p4() + globMuons[glob_gen[secondMuon]].p4()).
eta();
706 double globDimuonRap = (globMuons[glob_gen[0]].p4() + globMuons[glob_gen[secondMuon]].p4()).Rapidity();
707 double globDimuonDR =
708 deltaR<LeafCandidate, LeafCandidate>(globMuons[glob_gen[0]], globMuons[glob_gen[secondMuon]]);
709 double globDimuonDRpos = deltaR<LeafCandidate, LeafCandidate>(globMuons_position[glob_gen[0]],
710 globMuons_position[glob_gen[secondMuon]]);
711 ME[
"globDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
712 ME[
"globDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
714 ME[
"globDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
716 ME[
"globDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
748 if (path_glob[glob_gen[0]] != -1 && path_glob[glob_gen[secondMuon]] != -1) {
749 ME[
"diPathDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
750 ME[
"diPathDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
752 ME[
"diPathDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
754 ME[
"diPathDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
757 if (path_glob[glob_gen[0]] != -1 || path_glob[glob_gen[secondMuon]] != -1) {
758 ME[
"pathDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
759 ME[
"pathDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
761 ME[
"pathDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
763 ME[
"pathDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
767 ME[
"resultDimuon_recoEtaPt"]->Fill(globDimuonEta, globDimuonPt);
768 ME[
"resultDimuon_recoRapPt"]->Fill(globDimuonRap, globDimuonPt);
770 ME[
"resultDimuon_recoPtDR"]->Fill(globDimuonPt, globDimuonDR);
772 ME[
"resultDimuon_recoPtDRpos"]->Fill(globDimuonPt, globDimuonDRpos);
781 if (mother->
pdgId() ==
p->pdgId()) {
784 return mother->
pdgId();
792 vector<LeafCandidate> &from,
793 vector<LeafCandidate> &
to,
794 double dRMatchingCut,
796 vector<double>
dR(from.size());
797 for (
size_t i = 0;
i < from.size();
i++) {
801 for (
size_t j = 0;
j <
to.size();
j++) {
802 double dRtmp = deltaR<double>(from[
i].eta(), from[
i].phi(),
to[
j].eta(),
to[
j].phi());
813 if (
dR[
i] > dRMatchingCut) {
818 for (
size_t k = 0;
k <
i;
k++) {
841 Double_t *
pt =
new Double_t[ptN];
842 for (
int i = 0;
i < ptN;
i++) {
846 Double_t *
eta =
new Double_t[etaN];
847 for (
int i = 0;
i < etaN;
i++) {
851 h->SetXTitle(ptLabel);
852 h->SetYTitle(etaLabel);
867 Double_t *
pt =
new Double_t[ptN];
868 for (
int i = 0;
i < ptN;
i++) {
872 Double_t *
eta =
new Double_t[etaN];
873 for (
int i = 0;
i < etaN;
i++) {
876 TProfile2D *
h =
new TProfile2D(
name,
name, ptN - 1,
pt, etaN - 1,
eta);
877 h->SetXTitle(ptLabel);
878 h->SetYTitle(etaLabel);
888 Double_t *myBins =
new Double_t[binsN];
889 for (
int i = 0;
i < binsN;
i++) {
892 TH1F *
h =
new TH1F(
name,
name, binsN - 1, myBins);
902 return s.find(sub) != std::string::npos;
906 const auto containsAny = [](
const std::string &
s,
const std::vector<std::string> &subs) ->
bool {
907 for (
const auto &sub : subs) {
908 if (
s.find(sub) != std::string::npos)
915 const auto isAnyOf = [](
const std::string &
s,
const std::vector<std::string> &ms) ->
bool {
916 for (
const auto &
m : ms) {
932 const std::string l2Filter =
"HLTMuonL2FromL1TPreFilter";
933 const std::vector<std::string> l3Filters = {
"HLTMuonDimuonL3Filter",
"HLTMuonL3PreFilter"};
934 const std::vector<std::string> l4Filters = {
935 "HLTDisplacedmumuFilter",
"HLTDiMuonGlbTrkFilter",
"HLTMuonTrackMassFilter"};
936 const std::vector<std::string> l5Filters = {
"HLTmumutkFilter",
"HLT2MuonMuonDZ",
"HLTDisplacedmumuFilter"};
949 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