111 : m_propagatorSetup(ps.getParameter<
edm::
ParameterSet>(
"muProp"), consumesCollector()),
113 m_resTypes({kResPt, kResQOverPt, kResPhi, kResEta}),
114 m_etaRegions({kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf}),
115 m_qualLevelsRes({kQualAll}),
116 m_effStrings({{kEffPt,
"pt"}, {kEffPhi,
"phi"}, {kEffEta,
"eta"}, {kEffVtx,
"vtx"}}),
117 m_effLabelStrings({{kEffPt,
"p_{T} (GeV)"}, {kEffPhi,
"#phi"}, {kEffEta,
"#eta"}, {kEffVtx,
"# vertices"}}),
118 m_resStrings({{kResPt,
"pt"},
119 {kRes1OverPt,
"1overpt"},
120 {kResQOverPt,
"qoverpt"},
123 {kResCh,
"charge"}}),
124 m_resLabelStrings({{kResPt,
"(p_{T}^{L1} - p_{T}^{reco})/p_{T}^{reco}"},
125 {kRes1OverPt,
"(p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"},
126 {kResQOverPt,
"(q^{L1}*q^{reco}*p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"},
127 {kResPhi,
"#phi_{L1} - #phi_{reco}"},
128 {kResEta,
"#eta_{L1} - #eta_{reco}"},
129 {kResCh,
"charge^{L1} - charge^{reco}"}}),
130 m_etaStrings({{kEtaRegionAll,
"etaMin0_etaMax2p4"},
131 {kEtaRegionBmtf,
"etaMin0_etaMax0p83"},
132 {kEtaRegionOmtf,
"etaMin0p83_etaMax1p24"},
133 {kEtaRegionEmtf,
"etaMin1p24_etaMax2p4"}}),
135 {{kQualAll,
"qualAll"}, {kQualOpen,
"qualOpen"}, {kQualDouble,
"qualDouble"}, {kQualSingle,
"qualSingle"}}),
136 m_verbose(ps.getUntrackedParameter<
bool>(
"verbose")),
137 m_HistFolder(ps.getUntrackedParameter<
string>(
"histFolder")),
138 m_TagPtCut(ps.getUntrackedParameter<
double>(
"tagPtCut")),
139 m_recoToL1PtCutFactor(ps.getUntrackedParameter<
double>(
"recoToL1PtCutFactor")),
140 m_cutsVPSet(ps.getUntrackedParameter<std::vector<edm::ParameterSet>>(
"cuts")),
141 m_MuonInputTag(consumes<reco::MuonCollection>(ps.getUntrackedParameter<
InputTag>(
"muonInputTag"))),
142 m_GmtInputTag(consumes<l1t::MuonBxCollection>(ps.getUntrackedParameter<
InputTag>(
"gmtInputTag"))),
143 m_VtxInputTag(consumes<VertexCollection>(ps.getUntrackedParameter<
InputTag>(
"vtxInputTag"))),
144 m_BsInputTag(consumes<BeamSpot>(ps.getUntrackedParameter<
InputTag>(
"bsInputTag"))),
145 m_trigInputTag(consumes<trigger::TriggerEvent>(ps.getUntrackedParameter<
InputTag>(
"trigInputTag"))),
146 m_trigProcess(ps.getUntrackedParameter<
string>(
"trigProcess")),
147 m_trigProcess_token(consumes<edm::TriggerResults>(ps.getUntrackedParameter<
InputTag>(
"trigProcess_token"))),
148 m_trigNames(ps.getUntrackedParameter<vector<string>>(
"triggerNames")),
149 m_effVsPtBins(ps.getUntrackedParameter<std::vector<double>>(
"efficiencyVsPtBins")),
150 m_effVsPhiBins(ps.getUntrackedParameter<std::vector<double>>(
"efficiencyVsPhiBins")),
151 m_effVsEtaBins(ps.getUntrackedParameter<std::vector<double>>(
"efficiencyVsEtaBins")),
152 m_effVsVtxBins(ps.getUntrackedParameter<std::vector<double>>(
"efficiencyVsVtxBins")),
153 m_useAtVtxCoord(ps.getUntrackedParameter<
bool>(
"useL1AtVtxCoord")),
155 m_minTagProbeDR(0.5),
156 m_maxHltMuonDR(0.1) {
158 cout <<
"[L1TMuonDQMOffline:] ____________ Storage initialization ____________ " << endl;
160 for (
const auto& cutsPSet : m_cutsVPSet) {
161 const auto qCut = cutsPSet.getUntrackedParameter<
int>(
"qualCut");
162 QualLevel qLevel = kQualAll;
164 qLevel = kQualSingle;
165 }
else if (qCut > 7) {
166 qLevel = kQualDouble;
167 }
else if (qCut > 3) {
170 m_cuts.emplace_back(std::make_pair(cutsPSet.getUntrackedParameter<
int>(
"ptCut"), qLevel));
179 cout <<
"[L1TMuonDQMOffline:] Called beginRun." << endl;
191 vector<string>::const_iterator trigNamesIt =
m_trigNames.begin();
192 vector<string>::const_iterator trigNamesEnd =
m_trigNames.end();
194 for (; trigNamesIt != trigNamesEnd; ++trigNamesIt) {
195 TString tNameTmp = TString(*trigNamesIt);
196 TRegexp tNamePattern = TRegexp(tNameTmp,
true);
201 if (tmpName.Contains(tNamePattern)) {
207 cout <<
"[L1TMuonDQMOffline:] Warning: Could not find trigger " << (*trigNamesIt) << endl;
237 cout <<
"[L1TMuonDQMOffline:] Computing efficiencies" << endl;
239 vector<MuonGmtPair>::const_iterator muonGmtPairsIt =
m_MuonGmtPairs.begin();
240 vector<MuonGmtPair>::const_iterator muonGmtPairsEnd =
m_MuonGmtPairs.end();
246 for (; muonGmtPairsIt != muonGmtPairsEnd; ++muonGmtPairsIt) {
248 if ((muonGmtPairsIt->etaRegion() !=
kEtaRegionOut) && (muonGmtPairsIt->gmtPt() > 0)) {
249 regsToFill[1] = muonGmtPairsIt->etaRegion();
252 const auto varToFill = muonGmtPairsIt->getDeltaVar(
var);
253 std::get<0>(histoKeyRes) =
var;
255 for (
const auto regToFill : regsToFill) {
256 std::get<1>(histoKeyRes) = regToFill;
261 if (muonGmtPairsIt->gmtQual() >=
qualCut) {
262 std::get<2>(histoKeyRes) = qualLevel;
272 unsigned int cutsCounter = 0;
274 const auto gmtPtCut =
cut.first;
275 const auto qualLevel =
cut.second;
276 const bool gmtAboveCut = (muonGmtPairsIt->gmtPt() > gmtPtCut);
282 regsToFill[1] = muonGmtPairsIt->etaRegion();
290 varToFill =
static_cast<double>(
nVtx);
292 varToFill = muonGmtPairsIt->getVar(
var);
298 std::get<0>(histoKeyEffDenVar) =
var;
300 for (
const auto regToFill : regsToFill) {
302 if (cutsCounter == 0) {
306 std::get<2>(histoKeyEffDenVar) = regToFill;
312 std::get<0>(histoKeyEffNumVar) =
var;
314 if (gmtAboveCut && muonGmtPairsIt->gmtQual() >= qualLevel * 4) {
319 std::get<3>(histoKeyEffNumVar) = qualLevel;
321 for (
const auto regToFill : regsToFill) {
322 std::get<2>(histoKeyEffNumVar) = regToFill;
334 cout <<
"[L1TMuonDQMOffline:] Computation finished" << endl;
340 cout <<
"[L1TMuonDQMOffline:] Booking Control Plot Histos" << endl;
346 ibooker.
book2D(
"NTightVsAll",
"NTightVsAll; # muons; # tight muons", 20, -0.5, 19.5, 16, -0.5, 15.5);
348 ibooker.
book2D(
"NProbesVsTight",
"NProbesVsTight; # tight muons; # probe muons", 8, -0.5, 7.5, 8, -0.5, 7.5);
359 ibooker.
book1D(
"TagMuonProbeMuonDeltaR",
"TagMuonProbeMuonDeltaR; #DeltaR", 50, 0., 5.0);
372 const auto gmtPtCut =
cut.first;
373 const auto qualLevel =
cut.second;
391 const int gmtPtCut =
cut.first;
400 const auto gmtPtCut =
cut.first;
401 const auto qualLevel =
cut.second;
415 cout <<
"[L1TMuonOffline:] Booking Resolution Plot Histos" << endl;
435 unsigned int nVtx = 0;
438 for (
const auto& vertexIt : *
vertex) {
439 if (vertexIt.isValid() && !vertexIt.isFake()) {
452 bool hasPrimaryVertex =
false;
455 vector<Vertex>::const_iterator vertexIt =
vertex->begin();
456 vector<Vertex>::const_iterator vertexEnd =
vertex->end();
458 for (; vertexIt != vertexEnd; ++vertexIt) {
459 if (vertexIt->isValid() && !vertexIt->isFake()) {
460 posVtx = vertexIt->position();
461 errVtx = vertexIt->error();
462 hasPrimaryVertex =
true;
468 if (!hasPrimaryVertex) {
470 errVtx(0, 0) =
beamSpot->BeamWidthX();
471 errVtx(1, 1) =
beamSpot->BeamWidthY();
481 cout <<
"[L1TMuonDQMOffline:] Getting tight muons" << endl;
483 MuonCollection::const_iterator muonIt =
muons->begin();
484 MuonCollection::const_iterator muonEnd =
muons->end();
486 for (; muonIt != muonEnd; ++muonIt) {
498 cout <<
"[L1TMuonDQMOffline:] getting probe muons" << endl;
500 std::vector<const reco::Muon*> tagMuonsInHist;
502 tagMuonsInHist.clear();
504 vector<const reco::Muon*>::const_iterator probeCandIt =
m_TightMuons.begin();
505 vector<const reco::Muon*>::const_iterator tightMuonsEnd =
m_TightMuons.end();
507 for (; probeCandIt != tightMuonsEnd; ++probeCandIt) {
508 bool isProbe =
false;
509 vector<const reco::Muon*>::const_iterator tagCandIt =
m_TightMuons.begin();
512 for (; tagCandIt != tightMuonsEnd; ++tagCandIt) {
513 bool tagMuonAlreadyInHist =
false;
514 bool tagHasTrig =
false;
515 float eta = (*tagCandIt)->eta();
516 float phi = (*tagCandIt)->phi();
517 float pt = (*tagCandIt)->pt();
518 float dEta =
eta - (*probeCandIt)->eta();
519 float dPhi =
phi - (*probeCandIt)->phi();
525 tagHasTrig = (matchHltDeltaR < m_maxHltMuonDR) && (pt >
m_TagPtCut);
526 isProbe |= tagHasTrig;
529 for (vector<const reco::Muon*>::const_iterator tagMuonsInHistIt = tagMuonsInHist.begin();
530 tagMuonsInHistIt != tagMuonsInHist.end();
531 ++tagMuonsInHistIt) {
532 if ((*tagCandIt) == (*tagMuonsInHistIt)) {
533 tagMuonAlreadyInHist =
true;
537 if (tagMuonAlreadyInHist ==
false)
538 tagMuonsInHist.push_back((*tagCandIt));
540 if (tagMuonAlreadyInHist ==
false) {
560 cout <<
"[L1TMuonDQMOffline:] Getting muon GMT pairs" << endl;
562 vector<const reco::Muon*>::const_iterator probeMuIt =
m_ProbeMuons.begin();
563 vector<const reco::Muon*>::const_iterator probeMuEnd =
m_ProbeMuons.end();
568 for (; probeMuIt != probeMuEnd; ++probeMuIt) {
576 gmtIt = gmtCands->
begin(0);
578 for (; gmtIt != gmtEnd; ++gmtIt) {
582 pairBestCand = pairTmpCand;
592 double matchDeltaR = 9999;
596 vector<int>::const_iterator trigIndexIt =
m_trigIndices.begin();
597 vector<int>::const_iterator trigIndexEnd =
m_trigIndices.end();
599 for (; trigIndexIt != trigIndexEnd; ++trigIndexIt) {
604 if (hltFilterIndex < triggerEvent->sizeFilters()) {
607 const unsigned nTriggers = triggerVids.size();
608 for (
size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
610 double dRtmp =
deltaR((*
mu), trigObject);
611 if (dRtmp < matchDeltaR)
641 return {50, -2., 2.};
643 return {50, -2., 2.};
645 return {50, -2., 2.};
647 return {96, -0.2, 0.2};
649 return {100, -0.1, 0.1};
std::map< EffType, std::string > m_effStrings
constexpr double deltaPhi(double phi1, double phi2)
const std::string & triggerName(unsigned int triggerIndex) const
double m_recoToL1PtCutFactor
edm::EDGetTokenT< reco::BeamSpot > m_BsInputTag
edm::EDGetTokenT< reco::MuonCollection > m_MuonInputTag
std::vector< double > m_effVsVtxBins
std::map< ResType, std::string > m_resLabelStrings
virtual void setCurrentFolder(std::string const &fullpath)
std::map< EtaRegion, std::string > m_etaStrings
edm::EDGetTokenT< edm::TriggerResults > m_trigProcess_token
void analyze(const edm::Event &e, const edm::EventSetup &c) override
std::map< std::tuple< ResType, EtaRegion, QualLevel >, MonitorElement * > m_ResolutionHistos
#define DEFINE_FWK_MODULE(type)
Geom::Phi< T > phi() const
const std::vector< EtaRegion > m_etaRegions
std::vector< double > m_effVsPhiBins
math::Error< dimension >::type Error
covariance error matrix (3x3)
std::string to_string(const V &value)
std::map< EtaRegion, MonitorElement * > m_EfficiencyDenPtHistos
std::tuple< EffType, int, EtaRegion, QualLevel > m_histoKeyEffNumVarType
double getDeltaVar(const L1TMuonDQMOffline::ResType) const
std::pair< int, QualLevel > m_histoKeyEffNumEtaType
std::tuple< ResType, EtaRegion, QualLevel > m_histoKeyResType
std::vector< const reco::Muon * > m_ProbeMuons
std::vector< float > getHistBinsEff(EffType eff)
void getProbeMuons(edm::Handle< edm::TriggerResults > &trigResults, edm::Handle< trigger::TriggerEvent > &trigEvent)
const unsigned int getNVertices(edm::Handle< reco::VertexCollection > &vertex)
~L1TMuonDQMOffline() override
std::vector< std::string > m_trigNames
const_iterator begin(int bx) const
virtual void bookControlHistos(DQMStore::IBooker &)
std::map< QualLevel, std::string > m_qualStrings
double matchHlt(edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
std::string m_trigProcess
std::vector< T >::const_iterator const_iterator
const l1t::Muon * m_regMu
Propagate an object (usually a track) to the second (default) or first muon station.
std::map< EffType, std::string > m_effLabelStrings
GlobalPoint globalPosition() const
std::tuple< int, double, double > getHistBinsRes(ResType res)
unsigned int size() const
number of trigger paths in trigger table
edm::EDGetTokenT< l1t::MuonBxCollection > m_GmtInputTag
std::vector< double > m_effVsPtBins
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
std::tuple< EffType, int, EtaRegion > m_histoKeyEffDenVarType
std::map< std::pair< int, QualLevel >, MonitorElement * > m_EfficiencyNumEtaHistos
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
L1TMuonDQMOffline::EtaRegion etaRegion() const
const reco::Muon * m_muon
PropagateToMuonSetup const m_propagatorSetup
Abs< T >::type abs(const T &t)
std::map< int, MonitorElement * > m_EfficiencyDenEtaHistos
std::vector< std::pair< int, QualLevel > > m_cuts
math::XYZPoint Point
point in the space
const std::vector< EffType > m_effTypes
const std::vector< QualLevel > m_qualLevelsRes
std::vector< MuonGmtPair > m_MuonGmtPairs
std::map< std::tuple< EffType, int, EtaRegion >, MonitorElement * > m_EfficiencyDenVarHistos
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
L1TMuonDQMOffline(const edm::ParameterSet &ps)
std::map< ResType, std::string > m_resStrings
std::vector< size_type > Keys
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
double getVar(const L1TMuonDQMOffline::EffType) const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
virtual void bookResolutionHistos(DQMStore::IBooker &ibooker)
HLTConfigProvider m_hltConfig
const reco::Vertex getPrimaryVertex(edm::Handle< reco::VertexCollection > &vertex, edm::Handle< reco::BeamSpot > &beamSpot)
std::vector< double > m_effVsEtaBins
std::vector< const reco::Muon * > m_TightMuons
const_iterator end(int bx) const
const std::vector< ResType > m_resTypes
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< reco::VertexCollection > m_VtxInputTag
edm::EDGetTokenT< trigger::TriggerEvent > m_trigInputTag
std::map< std::tuple< EffType, int, EtaRegion, QualLevel >, MonitorElement * > m_EfficiencyNumVarHistos
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
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
primaryVertex
hltOfflineBeamSpot for HLTMON
MuonGmtPair(const reco::Muon *muon, const l1t::Muon *regMu, const PropagateToMuon &propagator, bool useAtVtxCoord)
std::map< Control, MonitorElement * > m_ControlHistos
void getMuonGmtPairs(edm::Handle< l1t::MuonBxCollection > &gmtCands, PropagateToMuon const &propagator)
std::vector< int > m_trigIndices
virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker)
void getTightMuons(edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)
double eta() const final
momentum pseudorapidity