CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
L1TPhase2MuonOffline Class Reference

#include <L1TPhase2MuonOffline.h>

Inheritance diagram for L1TPhase2MuonOffline:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Types

enum  EffType { kEffPt, kEffPhi, kEffEta, kEffTypes }
 
enum  EtaRegion {
  kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf,
  kNEtaRegions
}
 
enum  MuType { kSAMuon, kTkMuon, kNMuTypes }
 
enum  QualLevel { kQualOpen, kQualDouble, kQualSingle, kNQualLevels }
 
enum  ResType {
  kResPt, kRes1OverPt, kResQOverPt, kResPhi,
  kResEta, kResCh, kNResTypes
}
 
enum  VarType {
  kPt, kEta, kPhi, kIso,
  kQual, kZ0, kD0, kNVarTypes
}
 
- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

 L1TPhase2MuonOffline (const edm::ParameterSet &ps)
 
 ~L1TPhase2MuonOffline () override=default
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void bookControlHistos (DQMStore::IBooker &, MuType type)
 
void bookEfficiencyHistos (DQMStore::IBooker &ibooker, MuType type)
 
void bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
 
void bookResolutionHistos (DQMStore::IBooker &ibooker, MuType type)
 
void dqmBeginRun (const edm::Run &run, const edm::EventSetup &iSetup) override
 
void fillControlHistos ()
 
void fillEfficiencyHistos ()
 
void fillResolutionHistos ()
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Member Functions

std::vector< float > getHistBinsEff (EffType eff)
 
std::tuple< int, double, double > getHistBinsRes (ResType res)
 
void getMuonGmtPairs (edm::Handle< l1t::MuonBxCollection > &gmtCands)
 
void matchMuonsToGen (std::vector< const reco::GenParticle *> genmus)
 

Private Attributes

MonitorElementcontrolHistos_ [kNMuTypes][kNVarTypes]
 
std::vector< std::pair< int, QualLevel > > cuts_
 
const std::vector< edm::ParameterSetcutsVPSet_
 
MonitorElementefficiencyDen_ [kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
 
MonitorElementefficiencyNum_ [kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
 
const std::vector< EffTypeeffTypes_
 
const std::vector< double > effVsEtaBins_
 
const std::vector< double > effVsPhiBins_
 
const std::vector< double > effVsPtBins_
 
std::map< EtaRegion, std::string > etaNames_
 
const std::vector< EtaRegionetaRegions_
 
edm::Handle< std::vector< reco::GenParticle > > genparticles_
 
edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticleToken_
 
edm::EDGetTokenT< l1t::SAMuonCollectiongmtMuonToken_
 
edm::Handle< l1t::SAMuonCollectiongmtSAMuon_
 
std::vector< GenMuonGMTPairgmtSAMuonPairs_
 
edm::Handle< l1t::TrackerMuonCollectiongmtTkMuon_
 
std::vector< GenMuonGMTPairgmtTkMuonPairs_
 
edm::EDGetTokenT< l1t::TrackerMuonCollectiongmtTkMuonToken_
 
const std::string histFolder_
 
const float lsb_d0 = Phase2L1GMT::LSBSAd0
 
const float lsb_eta = Phase2L1GMT::LSBeta
 
const float lsb_phi = Phase2L1GMT::LSBphi
 
const float lsb_pt = Phase2L1GMT::LSBpt
 
const float lsb_z0 = Phase2L1GMT::LSBSAz0
 
const double maxGmtMuonDR_
 
std::map< MuType, std::string > muonNames_
 
const std::vector< MuTypemuonTypes_
 
const std::vector< QualLevelqualLevels_
 
std::map< QualLevel, std::string > qualNames_
 
std::map< ResType, std::string > resLabels_
 
std::map< ResType, std::string > resNames_
 
MonitorElementresolutionHistos_ [kNMuTypes][kNEtaRegions][kNQualLevels][kNResTypes]
 
const std::vector< ResTyperesTypes_
 

Additional Inherited Members

- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 43 of file L1TPhase2MuonOffline.h.

Member Enumeration Documentation

◆ EffType

◆ EtaRegion

◆ MuType

◆ QualLevel

◆ ResType

◆ VarType

Constructor & Destructor Documentation

◆ L1TPhase2MuonOffline()

L1TPhase2MuonOffline::L1TPhase2MuonOffline ( const edm::ParameterSet ps)

Definition at line 94 of file L1TPhase2MuonOffline.cc.

References kSAMuon, and kTkMuon.

95  : gmtMuonToken_(consumes<l1t::SAMuonCollection>(ps.getParameter<edm::InputTag>("gmtMuonToken"))),
96  gmtTkMuonToken_(consumes<l1t::TrackerMuonCollection>(ps.getParameter<edm::InputTag>("gmtTkMuonToken"))),
98  consumes<std::vector<reco::GenParticle>>(ps.getUntrackedParameter<edm::InputTag>("genParticlesInputTag"))),
104  resNames_({{kResPt, "pt"},
105  {kRes1OverPt, "1overpt"},
106  {kResQOverPt, "qoverpt"},
107  {kResPhi, "phi"},
108  {kResEta, "eta"},
109  {kResCh, "charge"}}),
110  resLabels_({{kResPt, "(p_{T}^{L1} - p_{T}^{reco})/p_{T}^{reco}"},
111  {kRes1OverPt, "(p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"},
112  {kResQOverPt, "(q^{L1}*q^{reco}*p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"},
113  {kResPhi, "#phi_{L1} - #phi_{reco}"},
114  {kResEta, "#eta_{L1} - #eta_{reco}"},
115  {kResCh, "charge^{L1} - charge^{reco}"}}),
116  etaNames_({{kEtaRegionAll, "etaMin0_etaMax2p4"},
117  {kEtaRegionBmtf, "etaMin0_etaMax0p83"},
118  {kEtaRegionOmtf, "etaMin0p83_etaMax1p24"},
119  {kEtaRegionEmtf, "etaMin1p24_etaMax2p4"}}),
120  qualNames_({{kQualOpen, "qualOpen"}, {kQualDouble, "qualDouble"}, {kQualSingle, "qualSingle"}}),
121  muonNames_({{kSAMuon, "SAMuon"}, {kTkMuon, "TkMuon"}}),
122  histFolder_(ps.getUntrackedParameter<string>("histFolder")),
123  cutsVPSet_(ps.getUntrackedParameter<std::vector<edm::ParameterSet>>("cuts")),
124  effVsPtBins_(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsPtBins")),
125  effVsPhiBins_(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsPhiBins")),
126  effVsEtaBins_(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsEtaBins")),
127  maxGmtMuonDR_(ps.getUntrackedParameter<double>("maxDR")) {
128  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::L1TPhase2MuonOffline()" << endl;
129 
130  for (const auto& c : cutsVPSet_) {
131  const auto qCut = c.getUntrackedParameter<int>("qualCut");
132  QualLevel qLevel = kQualOpen;
133  if (qCut > 11) {
134  qLevel = kQualSingle;
135  } else if (qCut > 7) {
136  qLevel = kQualDouble;
137  } else if (qCut > 3) {
138  qLevel = kQualOpen;
139  }
140  cuts_.emplace_back(std::make_pair(c.getUntrackedParameter<int>("ptCut"), qLevel));
141  }
142 }
const std::vector< double > effVsPtBins_
edm::EDGetTokenT< l1t::SAMuonCollection > gmtMuonToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::map< MuType, std::string > muonNames_
const std::vector< EtaRegion > etaRegions_
const std::vector< MuType > muonTypes_
const std::vector< QualLevel > qualLevels_
std::map< ResType, std::string > resNames_
std::vector< std::pair< int, QualLevel > > cuts_
std::map< ResType, std::string > resLabels_
const std::vector< edm::ParameterSet > cutsVPSet_
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< double > effVsEtaBins_
std::map< EtaRegion, std::string > etaNames_
Log< level::Info, false > LogInfo
const std::vector< ResType > resTypes_
const std::string histFolder_
const std::vector< double > effVsPhiBins_
const std::vector< EffType > effTypes_
std::map< QualLevel, std::string > qualNames_
edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticleToken_
edm::EDGetTokenT< l1t::TrackerMuonCollection > gmtTkMuonToken_

◆ ~L1TPhase2MuonOffline()

L1TPhase2MuonOffline::~L1TPhase2MuonOffline ( )
overridedefault

Member Function Documentation

◆ analyze()

void L1TPhase2MuonOffline::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 164 of file L1TPhase2MuonOffline.cc.

References funct::abs(), fillControlHistos(), fillEfficiencyHistos(), fillResolutionHistos(), genparticles_, genParticleToken_, gmtMuonToken_, gmtSAMuon_, gmtTkMuon_, gmtTkMuonToken_, iEvent, and matchMuonsToGen().

164  {
165  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() " << endl;
166 
167  // COLLECT GEN MUONS
169 
170  std::vector<const reco::GenParticle*> genmus;
171  for (const reco::GenParticle& gen : *genparticles_) {
172  if (std::abs(gen.pdgId()) != 13)
173  continue;
174  genmus.push_back(&gen);
175  }
176  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() N of genmus: " << genmus.size() << endl;
177 
178  // Collect both muon collection:
179  iEvent.getByToken(gmtMuonToken_, gmtSAMuon_);
180  iEvent.getByToken(gmtTkMuonToken_, gmtTkMuon_);
181 
182  // Fill Control histograms
183  edm::LogInfo("L1TPhase2MuonOffline") << "Fill Control histograms for GMT Muons" << endl;
185 
186  // Match each muon to a gen muon, if possible.
187  if (genmus.empty())
188  return;
189  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() calling matchMuonsToGen() " << endl;
190  matchMuonsToGen(genmus);
191 
192  // Fill efficiency and resolution once, matching has been done...
195  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() Computation finished" << endl;
196 }
edm::EDGetTokenT< l1t::SAMuonCollection > gmtMuonToken_
edm::Handle< l1t::SAMuonCollection > gmtSAMuon_
void matchMuonsToGen(std::vector< const reco::GenParticle *> genmus)
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::Handle< std::vector< reco::GenParticle > > genparticles_
Log< level::Info, false > LogInfo
edm::Handle< l1t::TrackerMuonCollection > gmtTkMuon_
edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticleToken_
edm::EDGetTokenT< l1t::TrackerMuonCollection > gmtTkMuonToken_

◆ bookControlHistos()

void L1TPhase2MuonOffline::bookControlHistos ( DQMStore::IBooker ibooker,
MuType  type 
)
protected

Definition at line 199 of file L1TPhase2MuonOffline.cc.

References dqm::implementation::IBooker::book1D(), controlHistos_, histFolder_, kD0, kEta, kIso, kPhi, kPt, kQual, kZ0, muonNames_, and dqm::implementation::NavigatorBase::setCurrentFolder().

Referenced by bookHistograms().

199  {
200  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookControlHistos()" << endl;
201 
202  ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/control_variables");
203 
204  controlHistos_[mutype][kPt] = ibooker.book1D(muonNames_[mutype] + "Pt", "MuonPt; p_{T}", 50, 0., 100.);
205  controlHistos_[mutype][kPhi] = ibooker.book1D(muonNames_[mutype] + "Phi", "MuonPhi; #phi", 66, -3.3, 3.3);
206  controlHistos_[mutype][kEta] = ibooker.book1D(muonNames_[mutype] + "Eta", "MuonEta; #eta", 50, -2.5, 2.5);
207  controlHistos_[mutype][kIso] = ibooker.book1D(muonNames_[mutype] + "Iso", "MuonIso; RelIso", 50, 0, 1.0);
208  controlHistos_[mutype][kQual] = ibooker.book1D(muonNames_[mutype] + "Qual", "MuonQual; Quality", 15, 0.5, 15.5);
209  controlHistos_[mutype][kZ0] = ibooker.book1D(muonNames_[mutype] + "Z0", "MuonZ0; Z_{0}", 50, 0, 50.0);
210  controlHistos_[mutype][kD0] = ibooker.book1D(muonNames_[mutype] + "D0", "MuonD0; D_{0}", 50, 0, 200.);
211 }
std::map< MuType, std::string > muonNames_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * controlHistos_[kNMuTypes][kNVarTypes]
Log< level::Info, false > LogInfo
const std::string histFolder_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookEfficiencyHistos()

void L1TPhase2MuonOffline::bookEfficiencyHistos ( DQMStore::IBooker ibooker,
MuType  type 
)
protected

Definition at line 213 of file L1TPhase2MuonOffline.cc.

References dqm::implementation::IBooker::book1D(), efficiencyDen_, efficiencyNum_, PVValHelper::eta, etaNames_, etaRegions_, getHistBinsEff(), histFolder_, kEffEta, kEffPhi, kEffPt, muonNames_, submitPVResolutionJobs::q, qualLevels_, qualNames_, dqm::implementation::NavigatorBase::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by bookHistograms().

213  {
214  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookEfficiencyHistos()" << endl;
215 
216  ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/nums_and_dens");
217 
218  std::string histoname = "";
219  for (const auto eta : etaRegions_) {
220  for (const auto q : qualLevels_) {
221  histoname = "Eff_" + muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q];
222 
223  auto histBins = getHistBinsEff(kEffPt);
224  efficiencyNum_[mutype][eta][q][kEffPt] =
225  ibooker.book1D(histoname + "_Pt_Num", "MuonPt; p_{T} ;", histBins.size() - 1, &histBins[0]);
226  efficiencyDen_[mutype][eta][q][kEffPt] =
227  ibooker.book1D(histoname + "_Pt_Den", "MuonPt; p_{T} ;", histBins.size() - 1, &histBins[0]);
228 
229  histBins = getHistBinsEff(kEffEta);
230  efficiencyNum_[mutype][eta][q][kEffEta] =
231  ibooker.book1D(histoname + "_Eta_Num", "MuonEta; #eta ;", histBins.size() - 1, &histBins[0]);
232  efficiencyDen_[mutype][eta][q][kEffEta] =
233  ibooker.book1D(histoname + "_Eta_Den", "MuonEta; #eta ;", histBins.size() - 1, &histBins[0]);
234 
235  histBins = getHistBinsEff(kEffPhi);
236  efficiencyNum_[mutype][eta][q][kEffPhi] =
237  ibooker.book1D(histoname + "_Phi_Num", "MuonPhi; #phi ;", histBins.size() - 1, &histBins[0]);
238  efficiencyDen_[mutype][eta][q][kEffPhi] =
239  ibooker.book1D(histoname + "_Phi_Den", "MuonPhi; #phi ;", histBins.size() - 1, &histBins[0]);
240  }
241  }
242 }
std::map< MuType, std::string > muonNames_
const std::vector< EtaRegion > etaRegions_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
const std::vector< QualLevel > qualLevels_
std::map< EtaRegion, std::string > etaNames_
MonitorElement * efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
std::vector< float > getHistBinsEff(EffType eff)
Log< level::Info, false > LogInfo
const std::string histFolder_
std::map< QualLevel, std::string > qualNames_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookHistograms()

void L1TPhase2MuonOffline::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 150 of file L1TPhase2MuonOffline.cc.

References bookControlHistos(), bookEfficiencyHistos(), bookResolutionHistos(), and muonTypes_.

152  {
153  edm::LogInfo("L1TPhase2MuonOFfline") << "L1TPhase2MuonOffline::bookHistograms" << endl;
154 
155  //book histos
156  for (const auto mutype : muonTypes_) {
157  bookControlHistos(ibooker, mutype);
158  bookEfficiencyHistos(ibooker, mutype);
159  bookResolutionHistos(ibooker, mutype);
160  }
161 }
const std::vector< MuType > muonTypes_
void bookControlHistos(DQMStore::IBooker &, MuType type)
Log< level::Info, false > LogInfo
void bookResolutionHistos(DQMStore::IBooker &ibooker, MuType type)
void bookEfficiencyHistos(DQMStore::IBooker &ibooker, MuType type)

◆ bookResolutionHistos()

void L1TPhase2MuonOffline::bookResolutionHistos ( DQMStore::IBooker ibooker,
MuType  type 
)
protected

Definition at line 244 of file L1TPhase2MuonOffline.cc.

References dqm::implementation::IBooker::book1D(), PVValHelper::eta, etaNames_, etaRegions_, getHistBinsRes(), histFolder_, muonNames_, LaserClient_cfi::nbins, submitPVResolutionJobs::q, qualLevels_, qualNames_, resLabels_, resNames_, resolutionHistos_, resTypes_, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, ALCARECOEcalPhiSym_cff::var, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by bookHistograms().

244  {
245  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookResolutionHistos()" << endl;
246 
247  ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/resolution");
248  std::string histoname = "";
249  for (const auto eta : etaRegions_) {
250  for (const auto q : qualLevels_) {
251  for (const auto var : resTypes_) {
252  histoname = "Res_" + muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q] + "_" + resNames_[var];
253  auto nbins = std::get<0>(getHistBinsRes(var));
254  auto xmin = std::get<1>(getHistBinsRes(var));
255  auto xmax = std::get<2>(getHistBinsRes(var));
256  resolutionHistos_[mutype][eta][q][var] =
257  ibooker.book1D(histoname, resNames_[var] + ";" + resLabels_[var], nbins, xmin, xmax);
258  }
259  }
260  }
261 }
std::map< MuType, std::string > muonNames_
const std::vector< EtaRegion > etaRegions_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
const std::vector< QualLevel > qualLevels_
std::map< ResType, std::string > resNames_
std::tuple< int, double, double > getHistBinsRes(ResType res)
std::map< ResType, std::string > resLabels_
std::map< EtaRegion, std::string > etaNames_
Log< level::Info, false > LogInfo
const std::vector< ResType > resTypes_
const std::string histFolder_
MonitorElement * resolutionHistos_[kNMuTypes][kNEtaRegions][kNQualLevels][kNResTypes]
std::map< QualLevel, std::string > qualNames_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ dqmBeginRun()

void L1TPhase2MuonOffline::dqmBeginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 145 of file L1TPhase2MuonOffline.cc.

145  {
146  edm::LogInfo("L1TPhase2MuonOFfline") << "L1TPhase2MuonOffline::dqmBeginRun" << endl;
147 }
Log< level::Info, false > LogInfo

◆ fillControlHistos()

void L1TPhase2MuonOffline::fillControlHistos ( )
protected

Definition at line 264 of file L1TPhase2MuonOffline.cc.

References controlHistos_, dqm::impl::MonitorElement::Fill(), gmtSAMuon_, gmtTkMuon_, kD0, kEta, kIso, kPhi, kPt, kQual, kSAMuon, kTkMuon, kZ0, lsb_d0, lsb_eta, lsb_phi, lsb_pt, and lsb_z0.

Referenced by analyze().

264  {
265  for (auto& muIt : *gmtSAMuon_) {
266  controlHistos_[kSAMuon][kPt]->Fill(lsb_pt * muIt.hwPt());
267  controlHistos_[kSAMuon][kPhi]->Fill(lsb_phi * muIt.hwPhi());
268  controlHistos_[kSAMuon][kEta]->Fill(lsb_eta * muIt.hwEta());
269  controlHistos_[kSAMuon][kIso]->Fill(muIt.hwIso());
270  controlHistos_[kSAMuon][kQual]->Fill(muIt.hwQual());
271  controlHistos_[kSAMuon][kZ0]->Fill(lsb_z0 * muIt.hwZ0());
272  controlHistos_[kSAMuon][kD0]->Fill(lsb_d0 * muIt.hwD0());
273  }
274 
275  for (auto& muIt : *gmtTkMuon_) {
276  controlHistos_[kTkMuon][kPt]->Fill(lsb_pt * muIt.hwPt());
277  controlHistos_[kTkMuon][kPhi]->Fill(lsb_phi * muIt.hwPhi());
278  controlHistos_[kTkMuon][kEta]->Fill(lsb_eta * muIt.hwEta());
279  controlHistos_[kTkMuon][kIso]->Fill(muIt.hwIso());
280  controlHistos_[kTkMuon][kQual]->Fill(muIt.hwQual());
281  controlHistos_[kTkMuon][kZ0]->Fill(lsb_z0 * muIt.hwZ0());
282  controlHistos_[kTkMuon][kD0]->Fill(lsb_d0 * muIt.hwD0());
283  }
284 }
edm::Handle< l1t::SAMuonCollection > gmtSAMuon_
void Fill(long long x)
MonitorElement * controlHistos_[kNMuTypes][kNVarTypes]
edm::Handle< l1t::TrackerMuonCollection > gmtTkMuon_

◆ fillEfficiencyHistos()

void L1TPhase2MuonOffline::fillEfficiencyHistos ( )
protected

FOR TK MUONS

Definition at line 286 of file L1TPhase2MuonOffline.cc.

References DMR_cfg::cut, cuts_, efficiencyDen_, efficiencyNum_, effTypes_, PVValHelper::eta, dqm::impl::MonitorElement::Fill(), gmtSAMuonPairs_, gmtTkMuonPairs_, kEffPt, kSAMuon, kTkMuon, submitPVResolutionJobs::q, and ALCARECOEcalPhiSym_cff::var.

Referenced by analyze().

286  {
287  for (const auto& muIt : gmtSAMuonPairs_) {
288  auto eta = muIt.etaRegion();
289  for (const auto var : effTypes_) {
290  auto varToFill = muIt.getVar(var);
291  for (const auto& cut : cuts_) {
292  const auto q = cut.second;
293  efficiencyDen_[kSAMuon][eta][q][var]->Fill(varToFill);
294  if (muIt.gmtPt() < 0)
295  continue; // there is not an assciated gmt muon
296  if (muIt.gmtQual() < q * 4)
297  continue; //quality requirements
298  const auto gmtPtCut = cut.first;
299  if (var != kEffPt && muIt.gmtPt() < gmtPtCut)
300  continue; // pt requirement
301  efficiencyNum_[kSAMuon][eta][q][var]->Fill(varToFill);
302  }
303  }
304  }
305 
307  for (const auto& muIt : gmtTkMuonPairs_) {
308  auto eta = muIt.etaRegion();
309  for (const auto var : effTypes_) {
310  auto varToFill = muIt.getVar(var);
311  for (const auto& cut : cuts_) {
312  const auto q = cut.second;
313  efficiencyDen_[kTkMuon][eta][q][var]->Fill(varToFill);
314  if (muIt.gmtPt() < 0)
315  continue; // there is not an assciated gmt muon
316  if (muIt.gmtQual() < q * 4)
317  continue; //quality requirements
318  const auto gmtPtCut = cut.first;
319  if (var != kEffPt && muIt.gmtPt() < gmtPtCut)
320  continue; // pt requirement
321  efficiencyNum_[kTkMuon][eta][q][var]->Fill(varToFill);
322  }
323  }
324  }
325 }
std::vector< GenMuonGMTPair > gmtSAMuonPairs_
MonitorElement * efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
std::vector< std::pair< int, QualLevel > > cuts_
void Fill(long long x)
MonitorElement * efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
const std::vector< EffType > effTypes_
std::vector< GenMuonGMTPair > gmtTkMuonPairs_

◆ fillResolutionHistos()

void L1TPhase2MuonOffline::fillResolutionHistos ( )
protected

Definition at line 327 of file L1TPhase2MuonOffline.cc.

References PVValHelper::eta, dqm::impl::MonitorElement::Fill(), gmtSAMuonPairs_, gmtTkMuonPairs_, kSAMuon, kTkMuon, submitPVResolutionJobs::q, qualLevels_, resolutionHistos_, resTypes_, and ALCARECOEcalPhiSym_cff::var.

Referenced by analyze().

327  {
328  for (const auto& muIt : gmtSAMuonPairs_) {
329  if (muIt.gmtPt() < 0)
330  continue;
331 
332  auto eta = muIt.etaRegion();
333  for (const auto q : qualLevels_) {
334  if (muIt.gmtQual() < q * 4)
335  continue;
336  for (const auto var : resTypes_) {
337  auto varToFill = muIt.getDeltaVar(var);
338 
339  resolutionHistos_[kSAMuon][eta][q][var]->Fill(varToFill);
340  }
341  }
342  }
343 
344  for (const auto& muIt : gmtTkMuonPairs_) {
345  if (muIt.gmtPt() < 0)
346  continue;
347 
348  auto eta = muIt.etaRegion();
349  for (const auto q : qualLevels_) {
350  if (muIt.gmtQual() < q * 4)
351  continue;
352  for (const auto var : resTypes_) {
353  auto varToFill = muIt.getDeltaVar(var);
354 
355  resolutionHistos_[kTkMuon][eta][q][var]->Fill(varToFill);
356  }
357  }
358  }
359 }
std::vector< GenMuonGMTPair > gmtSAMuonPairs_
const std::vector< QualLevel > qualLevels_
void Fill(long long x)
const std::vector< ResType > resTypes_
MonitorElement * resolutionHistos_[kNMuTypes][kNEtaRegions][kNQualLevels][kNResTypes]
std::vector< GenMuonGMTPair > gmtTkMuonPairs_

◆ getHistBinsEff()

std::vector< float > L1TPhase2MuonOffline::getHistBinsEff ( EffType  eff)
private

Definition at line 401 of file L1TPhase2MuonOffline.cc.

References L1TMuonDQMOffline_cfi::effVsEtaBins, effVsEtaBins_, L1TMuonDQMOffline_cfi::effVsPhiBins, effVsPhiBins_, L1TMuonDQMOffline_cfi::effVsPtBins, effVsPtBins_, kEffEta, kEffPhi, and kEffPt.

Referenced by bookEfficiencyHistos().

401  {
402  if (eff == kEffPt) {
403  std::vector<float> effVsPtBins(effVsPtBins_.begin(), effVsPtBins_.end());
404  return effVsPtBins;
405  }
406  if (eff == kEffPhi) {
407  std::vector<float> effVsPhiBins(effVsPhiBins_.begin(), effVsPhiBins_.end());
408  return effVsPhiBins;
409  }
410  if (eff == kEffEta) {
411  std::vector<float> effVsEtaBins(effVsEtaBins_.begin(), effVsEtaBins_.end());
412  return effVsEtaBins;
413  }
414  return {0., 1.};
415 }
const std::vector< double > effVsPtBins_
const std::vector< double > effVsEtaBins_
const std::vector< double > effVsPhiBins_

◆ getHistBinsRes()

std::tuple< int, double, double > L1TPhase2MuonOffline::getHistBinsRes ( ResType  res)
private

Definition at line 417 of file L1TPhase2MuonOffline.cc.

References kRes1OverPt, kResCh, kResEta, kResPhi, kResPt, and kResQOverPt.

Referenced by bookResolutionHistos().

417  {
418  if (res == kResPt)
419  return {50, -2., 2.};
420  if (res == kRes1OverPt)
421  return {50, -2., 2.};
422  if (res == kResQOverPt)
423  return {50, -2., 2.};
424  if (res == kResPhi)
425  return {96, -0.2, 0.2};
426  if (res == kResEta)
427  return {100, -0.1, 0.1};
428  if (res == kResCh)
429  return {5, -2, 3};
430  return {1, 0, 1};
431 }
Definition: Electron.h:6

◆ getMuonGmtPairs()

void L1TPhase2MuonOffline::getMuonGmtPairs ( edm::Handle< l1t::MuonBxCollection > &  gmtCands)
private

◆ matchMuonsToGen()

void L1TPhase2MuonOffline::matchMuonsToGen ( std::vector< const reco::GenParticle *>  genmus)
private

Definition at line 362 of file L1TPhase2MuonOffline.cc.

References GenMuonGMTPair::dR2(), gmtSAMuon_, gmtSAMuonPairs_, gmtTkMuon_, gmtTkMuonPairs_, and maxGmtMuonDR_.

Referenced by analyze().

362  {
363  gmtSAMuonPairs_.clear();
364  gmtTkMuonPairs_.clear();
365 
366  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() " << endl;
367 
368  for (const reco::GenParticle* gen : genmus) {
369  edm::LogInfo("L1TPhase2MuonOffline") << "Looping on genmus: " << gen << endl;
370  GenMuonGMTPair pairBestCand(&(*gen), nullptr);
371  float dr2Best = maxGmtMuonDR_ * maxGmtMuonDR_;
372  for (auto& muIt : *gmtSAMuon_) {
373  GenMuonGMTPair pairTmpCand(&(*gen), &(muIt));
374  float dr2Tmp = pairTmpCand.dR2();
375  if (dr2Tmp < dr2Best) {
376  dr2Best = dr2Tmp;
377  pairBestCand = pairTmpCand;
378  }
379  }
380  gmtSAMuonPairs_.emplace_back(pairBestCand);
381 
382  GenMuonGMTPair pairBestCand2(&(*gen), nullptr);
383  dr2Best = maxGmtMuonDR_ * maxGmtMuonDR_;
384  for (auto& tkmuIt : *gmtTkMuon_) {
385  GenMuonGMTPair pairTmpCand(&(*gen), &(tkmuIt));
386  float dr2Tmp = pairTmpCand.dR2();
387  if (dr2Tmp < dr2Best) {
388  dr2Best = dr2Tmp;
389  pairBestCand2 = pairTmpCand;
390  }
391  }
392  gmtTkMuonPairs_.emplace_back(pairBestCand2);
393  }
394  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() gmtSAMuons: "
395  << gmtSAMuonPairs_.size() << endl;
396  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() gmtTkMuons: "
397  << gmtTkMuonPairs_.size() << endl;
398  edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() END " << endl;
399 }
std::vector< GenMuonGMTPair > gmtSAMuonPairs_
edm::Handle< l1t::SAMuonCollection > gmtSAMuon_
Log< level::Info, false > LogInfo
edm::Handle< l1t::TrackerMuonCollection > gmtTkMuon_
std::vector< GenMuonGMTPair > gmtTkMuonPairs_

Member Data Documentation

◆ controlHistos_

MonitorElement* L1TPhase2MuonOffline::controlHistos_[kNMuTypes][kNVarTypes]
private

Definition at line 119 of file L1TPhase2MuonOffline.h.

Referenced by bookControlHistos(), and fillControlHistos().

◆ cuts_

std::vector<std::pair<int, QualLevel> > L1TPhase2MuonOffline::cuts_
private

Definition at line 124 of file L1TPhase2MuonOffline.h.

Referenced by fillEfficiencyHistos().

◆ cutsVPSet_

const std::vector<edm::ParameterSet> L1TPhase2MuonOffline::cutsVPSet_
private

Definition at line 103 of file L1TPhase2MuonOffline.h.

◆ efficiencyDen_

MonitorElement* L1TPhase2MuonOffline::efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
private

Definition at line 117 of file L1TPhase2MuonOffline.h.

Referenced by bookEfficiencyHistos(), and fillEfficiencyHistos().

◆ efficiencyNum_

MonitorElement* L1TPhase2MuonOffline::efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
private

Definition at line 116 of file L1TPhase2MuonOffline.h.

Referenced by bookEfficiencyHistos(), and fillEfficiencyHistos().

◆ effTypes_

const std::vector<EffType> L1TPhase2MuonOffline::effTypes_
private

Definition at line 86 of file L1TPhase2MuonOffline.h.

Referenced by fillEfficiencyHistos().

◆ effVsEtaBins_

const std::vector<double> L1TPhase2MuonOffline::effVsEtaBins_
private

Definition at line 107 of file L1TPhase2MuonOffline.h.

Referenced by getHistBinsEff().

◆ effVsPhiBins_

const std::vector<double> L1TPhase2MuonOffline::effVsPhiBins_
private

Definition at line 106 of file L1TPhase2MuonOffline.h.

Referenced by getHistBinsEff().

◆ effVsPtBins_

const std::vector<double> L1TPhase2MuonOffline::effVsPtBins_
private

Definition at line 105 of file L1TPhase2MuonOffline.h.

Referenced by getHistBinsEff().

◆ etaNames_

std::map<EtaRegion, std::string> L1TPhase2MuonOffline::etaNames_
private

Definition at line 97 of file L1TPhase2MuonOffline.h.

Referenced by bookEfficiencyHistos(), and bookResolutionHistos().

◆ etaRegions_

const std::vector<EtaRegion> L1TPhase2MuonOffline::etaRegions_
private

Definition at line 89 of file L1TPhase2MuonOffline.h.

Referenced by bookEfficiencyHistos(), and bookResolutionHistos().

◆ genparticles_

edm::Handle<std::vector<reco::GenParticle> > L1TPhase2MuonOffline::genparticles_
private

Definition at line 80 of file L1TPhase2MuonOffline.h.

Referenced by analyze().

◆ genParticleToken_

edm::EDGetTokenT<std::vector<reco::GenParticle> > L1TPhase2MuonOffline::genParticleToken_
private

Definition at line 76 of file L1TPhase2MuonOffline.h.

Referenced by analyze().

◆ gmtMuonToken_

edm::EDGetTokenT<l1t::SAMuonCollection> L1TPhase2MuonOffline::gmtMuonToken_
private

Definition at line 74 of file L1TPhase2MuonOffline.h.

Referenced by analyze().

◆ gmtSAMuon_

edm::Handle<l1t::SAMuonCollection> L1TPhase2MuonOffline::gmtSAMuon_
private

Definition at line 78 of file L1TPhase2MuonOffline.h.

Referenced by analyze(), fillControlHistos(), and matchMuonsToGen().

◆ gmtSAMuonPairs_

std::vector<GenMuonGMTPair> L1TPhase2MuonOffline::gmtSAMuonPairs_
private

◆ gmtTkMuon_

edm::Handle<l1t::TrackerMuonCollection> L1TPhase2MuonOffline::gmtTkMuon_
private

Definition at line 79 of file L1TPhase2MuonOffline.h.

Referenced by analyze(), fillControlHistos(), and matchMuonsToGen().

◆ gmtTkMuonPairs_

std::vector<GenMuonGMTPair> L1TPhase2MuonOffline::gmtTkMuonPairs_
private

◆ gmtTkMuonToken_

edm::EDGetTokenT<l1t::TrackerMuonCollection> L1TPhase2MuonOffline::gmtTkMuonToken_
private

Definition at line 75 of file L1TPhase2MuonOffline.h.

Referenced by analyze().

◆ histFolder_

const std::string L1TPhase2MuonOffline::histFolder_
private

◆ lsb_d0

const float L1TPhase2MuonOffline::lsb_d0 = Phase2L1GMT::LSBSAd0
private

Definition at line 130 of file L1TPhase2MuonOffline.h.

Referenced by fillControlHistos().

◆ lsb_eta

const float L1TPhase2MuonOffline::lsb_eta = Phase2L1GMT::LSBeta
private

Definition at line 128 of file L1TPhase2MuonOffline.h.

Referenced by fillControlHistos().

◆ lsb_phi

const float L1TPhase2MuonOffline::lsb_phi = Phase2L1GMT::LSBphi
private

Definition at line 127 of file L1TPhase2MuonOffline.h.

Referenced by fillControlHistos().

◆ lsb_pt

const float L1TPhase2MuonOffline::lsb_pt = Phase2L1GMT::LSBpt
private

Definition at line 126 of file L1TPhase2MuonOffline.h.

Referenced by fillControlHistos().

◆ lsb_z0

const float L1TPhase2MuonOffline::lsb_z0 = Phase2L1GMT::LSBSAz0
private

Definition at line 129 of file L1TPhase2MuonOffline.h.

Referenced by fillControlHistos().

◆ maxGmtMuonDR_

const double L1TPhase2MuonOffline::maxGmtMuonDR_
private

Definition at line 109 of file L1TPhase2MuonOffline.h.

Referenced by matchMuonsToGen().

◆ muonNames_

std::map<MuType, std::string> L1TPhase2MuonOffline::muonNames_
private

◆ muonTypes_

const std::vector<MuType> L1TPhase2MuonOffline::muonTypes_
private

Definition at line 85 of file L1TPhase2MuonOffline.h.

Referenced by bookHistograms().

◆ qualLevels_

const std::vector<QualLevel> L1TPhase2MuonOffline::qualLevels_
private

◆ qualNames_

std::map<QualLevel, std::string> L1TPhase2MuonOffline::qualNames_
private

Definition at line 98 of file L1TPhase2MuonOffline.h.

Referenced by bookEfficiencyHistos(), and bookResolutionHistos().

◆ resLabels_

std::map<ResType, std::string> L1TPhase2MuonOffline::resLabels_
private

Definition at line 96 of file L1TPhase2MuonOffline.h.

Referenced by bookResolutionHistos().

◆ resNames_

std::map<ResType, std::string> L1TPhase2MuonOffline::resNames_
private

Definition at line 95 of file L1TPhase2MuonOffline.h.

Referenced by bookResolutionHistos().

◆ resolutionHistos_

MonitorElement* L1TPhase2MuonOffline::resolutionHistos_[kNMuTypes][kNEtaRegions][kNQualLevels][kNResTypes]
private

Definition at line 118 of file L1TPhase2MuonOffline.h.

Referenced by bookResolutionHistos(), and fillResolutionHistos().

◆ resTypes_

const std::vector<ResType> L1TPhase2MuonOffline::resTypes_
private

Definition at line 87 of file L1TPhase2MuonOffline.h.

Referenced by bookResolutionHistos(), and fillResolutionHistos().