20 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] Parameters initialization";
27 theMuonCollectionLabel_ = consumes<edm::View<reco::Muon> >(
parameters.getParameter<
edm::InputTag>(
"MuonCollection"));
62 theFolder =
parameters.getParameter<
string>(
"folder");
73 for (
unsigned int iEtaRegion = 0; iEtaRegion < 4; iEtaRegion++) {
87 etaTightTrack.push_back(
89 etaLooseTrack.push_back(
91 etaMediumTrack.push_back(
94 etaHighPtTrack.push_back(
98 phiGlbTrack.push_back(
102 phiStaTrack.push_back(
104 phiTightTrack.push_back(
106 phiLooseTrack.push_back(
108 phiMediumTrack.push_back(
110 phiSoftTrack.push_back(ibooker.
book1D(
"SoftMuon_phi_" + EtaName,
"#phi_{Soft}_" + EtaName,
phiBin,
phiMin,
phiMax));
111 phiHighPtTrack.push_back(
115 pGlbTrack.push_back(ibooker.
book1D(
"GlbMuon_p_" + EtaName,
"p_{GLB} " + EtaName,
pBin,
pMin,
pMax));
116 pTrack.push_back(ibooker.
book1D(
"TkMuon_p" + EtaName,
"p_{TK} " + EtaName,
pBin,
pMin,
pMax));
117 pStaTrack.push_back(ibooker.
book1D(
"StaMuon_p" + EtaName,
"p_{STA} " + EtaName,
pBin,
pMin,
pMax));
118 pTightTrack.push_back(ibooker.
book1D(
"TightMuon_p_" + EtaName,
"p_{Tight} " + EtaName,
pBin,
pMin,
pMax));
119 pLooseTrack.push_back(ibooker.
book1D(
"LooseMuon_p_" + EtaName,
"p_{Loose} " + EtaName,
pBin,
pMin,
pMax));
120 pMediumTrack.push_back(ibooker.
book1D(
"MediumMuon_p_" + EtaName,
"p_{Medium} " + EtaName,
pBin,
pMin,
pMax));
121 pSoftTrack.push_back(ibooker.
book1D(
"SoftMuon_p_" + EtaName,
"p_{Soft} " + EtaName,
pBin,
pMin,
pMax));
122 pHighPtTrack.push_back(ibooker.
book1D(
"HighPtMuon_p_" + EtaName,
"p_{HighPt} " + EtaName,
pBin,
pMin,
pMax));
125 ptGlbTrack.push_back(ibooker.
book1D(
"GlbMuon_pt_" + EtaName,
"pt_{GLB} " + EtaName,
ptBin,
ptMin,
ptMax));
126 ptTrack.push_back(ibooker.
book1D(
"TkMuon_pt_" + EtaName,
"pt_{TK} " + EtaName,
ptBin,
ptMin,
ptMax));
127 ptStaTrack.push_back(ibooker.
book1D(
"StaMuon_pt_" + EtaName,
"pt_{STA} " + EtaName,
ptBin,
ptMin,
pMax));
128 ptTightTrack.push_back(ibooker.
book1D(
"TightMuon_pt_" + EtaName,
"pt_{Tight} " + EtaName,
ptBin,
ptMin,
ptMax));
129 ptLooseTrack.push_back(ibooker.
book1D(
"LooseMuon_pt_" + EtaName,
"pt_{Loose} " + EtaName,
ptBin,
ptMin,
ptMax));
130 ptMediumTrack.push_back(ibooker.
book1D(
"MediumMuon_pt_" + EtaName,
"pt_{Medium} " + EtaName,
ptBin,
ptMin,
ptMax));
131 ptSoftTrack.push_back(ibooker.
book1D(
"SoftMuon_pt_" + EtaName,
"pt_{Soft} " + EtaName,
ptBin,
ptMin,
ptMax));
132 ptHighPtTrack.push_back(ibooker.
book1D(
"HighPtMuon_pt_" + EtaName,
"pt_{HighPt} " + EtaName,
ptBin,
ptMin,
ptMax));
135 chi2GlbTrack.push_back(
137 chi2probGlbTrack.push_back(ibooker.
book1D(
140 chi2probTrack.push_back(
142 chi2StaTrack.push_back(
144 chi2probStaTrack.push_back(ibooker.
book1D(
146 chi2TightTrack.push_back(
148 chi2probTightTrack.push_back(ibooker.
book1D(
150 chi2LooseTrack.push_back(
152 chi2MediumTrack.push_back(
154 chi2probLooseTrack.push_back(ibooker.
book1D(
156 chi2probMediumTrack.push_back(ibooker.
book1D(
158 chi2SoftTrack.push_back(
160 chi2probSoftTrack.push_back(ibooker.
book1D(
162 chi2HighPtTrack.push_back(
164 chi2probHighPtTrack.push_back(ibooker.
book1D(
169 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] Analyze the mu in different eta regions";
170 theService->update(iSetup);
173 iEvent.
getByToken(theMuonCollectionLabel_, muons);
179 unsigned int theIndexOfThePrimaryVertex = 999.;
184 for (
unsigned int ind = 0; ind < vertex->size(); ++ind) {
185 if ((*vertex)[ind].isValid() && !((*vertex)[ind].isFake())) {
186 theIndexOfThePrimaryVertex = ind;
192 if (theIndexOfThePrimaryVertex < 100) {
193 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
194 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
196 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
199 iEvent.
getByToken(theBeamSpotLabel_, recoBeamSpotHandle);
205 errVtx(2, 2) = bs.
sigmaZ();
212 cout <<
"[MuonKinVsEtaAnalyzer]: Analyze the mu in different eta regions" << endl;
218 for (
unsigned int iEtaRegion = 0; iEtaRegion < 4; iEtaRegion++) {
219 if (iEtaRegion == 0) {
223 if (iEtaRegion == 1) {
227 if (iEtaRegion == 2) {
231 if (iEtaRegion == 3) {
236 if (
muon->isGlobalMuon()) {
238 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is global... Filling the histos" << endl;
240 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] The mu is global - filling the histos";
243 if (fabs(recoCombinedGlbTrack->eta()) > EtaCutMin && fabs(recoCombinedGlbTrack->eta()) < EtaCutMax) {
244 etaGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->eta());
245 phiGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->phi());
246 pGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->p());
247 ptGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->pt());
248 chi2GlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->normalizedChi2());
249 chi2probGlbTrack[iEtaRegion]->Fill(TMath::Prob(recoCombinedGlbTrack->chi2(), recoCombinedGlbTrack->ndof()));
253 if (
muon->isTrackerMuon()) {
255 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is tracker... Filling the histos" << endl;
257 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] The mu is tracker - filling the histos";
260 if (fabs(recoTrack->eta()) > EtaCutMin && fabs(recoTrack->eta()) < EtaCutMax) {
261 etaTrack[iEtaRegion]->Fill(recoTrack->eta());
262 phiTrack[iEtaRegion]->Fill(recoTrack->phi());
263 pTrack[iEtaRegion]->Fill(recoTrack->p());
264 ptTrack[iEtaRegion]->Fill(recoTrack->pt());
265 chi2Track[iEtaRegion]->Fill(recoTrack->normalizedChi2());
266 chi2probTrack[iEtaRegion]->Fill(TMath::Prob(recoTrack->chi2(), recoTrack->ndof()));
270 if (
muon->isStandAloneMuon()) {
272 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is standlone... Filling the histos" << endl;
274 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] The mu is standalone - filling the histos";
277 if (fabs(recoStaTrack->eta()) > EtaCutMin && fabs(recoStaTrack->eta()) < EtaCutMax) {
278 etaStaTrack[iEtaRegion]->Fill(recoStaTrack->eta());
279 phiStaTrack[iEtaRegion]->Fill(recoStaTrack->phi());
280 pStaTrack[iEtaRegion]->Fill(recoStaTrack->p());
281 ptStaTrack[iEtaRegion]->Fill(recoStaTrack->pt());
282 chi2StaTrack[iEtaRegion]->Fill(recoStaTrack->normalizedChi2());
283 chi2probStaTrack[iEtaRegion]->Fill(TMath::Prob(recoStaTrack->chi2(), recoStaTrack->ndof()));
289 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is tight... Filling the histos" << endl;
291 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] The mu is Tight - filling the histos";
293 if (fabs(recoTightTrack->eta()) > EtaCutMin && fabs(recoTightTrack->eta()) < EtaCutMax) {
294 etaTightTrack[iEtaRegion]->Fill(recoTightTrack->eta());
295 phiTightTrack[iEtaRegion]->Fill(recoTightTrack->phi());
296 pTightTrack[iEtaRegion]->Fill(recoTightTrack->p());
297 ptTightTrack[iEtaRegion]->Fill(recoTightTrack->pt());
298 chi2TightTrack[iEtaRegion]->Fill(recoTightTrack->normalizedChi2());
299 chi2probTightTrack[iEtaRegion]->Fill(TMath::Prob(recoTightTrack->chi2(), recoTightTrack->ndof()));
305 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is Loose... Filling the histos" << endl;
307 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] The mu is Loose - filling the histos";
310 if (
muon->isGlobalMuon())
311 recoLooseTrack =
muon->combinedMuon();
313 recoLooseTrack =
muon->track();
315 if (fabs(recoLooseTrack->eta()) > EtaCutMin && fabs(recoLooseTrack->eta()) < EtaCutMax) {
316 etaLooseTrack[iEtaRegion]->Fill(recoLooseTrack->eta());
317 phiLooseTrack[iEtaRegion]->Fill(recoLooseTrack->phi());
318 pLooseTrack[iEtaRegion]->Fill(recoLooseTrack->p());
319 ptLooseTrack[iEtaRegion]->Fill(recoLooseTrack->pt());
320 chi2LooseTrack[iEtaRegion]->Fill(recoLooseTrack->normalizedChi2());
321 chi2probLooseTrack[iEtaRegion]->Fill(TMath::Prob(recoLooseTrack->chi2(), recoLooseTrack->ndof()));
327 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is Medium... Filling the histos" << endl;
329 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] The mu is Medium - filling the histos";
332 if (
muon->isGlobalMuon())
333 recoMediumTrack =
muon->combinedMuon();
335 recoMediumTrack =
muon->track();
337 if (fabs(recoMediumTrack->eta()) > EtaCutMin && fabs(recoMediumTrack->eta()) < EtaCutMax) {
338 etaMediumTrack[iEtaRegion]->Fill(recoMediumTrack->eta());
339 phiMediumTrack[iEtaRegion]->Fill(recoMediumTrack->phi());
340 pMediumTrack[iEtaRegion]->Fill(recoMediumTrack->p());
341 ptMediumTrack[iEtaRegion]->Fill(recoMediumTrack->pt());
342 chi2MediumTrack[iEtaRegion]->Fill(recoMediumTrack->normalizedChi2());
343 chi2probMediumTrack[iEtaRegion]->Fill(TMath::Prob(recoMediumTrack->chi2(), recoMediumTrack->ndof()));
349 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is Soft... Filling the histos" << endl;
351 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] The mu is Soft - filling the histos";
353 if (fabs(recoSoftTrack->eta()) > EtaCutMin && fabs(recoSoftTrack->eta()) < EtaCutMax) {
354 etaSoftTrack[iEtaRegion]->Fill(recoSoftTrack->eta());
355 phiSoftTrack[iEtaRegion]->Fill(recoSoftTrack->phi());
356 pSoftTrack[iEtaRegion]->Fill(recoSoftTrack->p());
357 ptSoftTrack[iEtaRegion]->Fill(recoSoftTrack->pt());
358 chi2SoftTrack[iEtaRegion]->Fill(recoSoftTrack->normalizedChi2());
359 chi2probSoftTrack[iEtaRegion]->Fill(TMath::Prob(recoSoftTrack->chi2(), recoSoftTrack->ndof()));
365 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is HighPt... Filling the histos" << endl;
367 LogTrace(
metname) <<
"[MuonKinVsEtaAnalyzer] The mu is HightPt - filling the histos";
369 if (fabs(recoHighPtTrack->eta()) > EtaCutMin && fabs(recoHighPtTrack->eta()) < EtaCutMax) {
370 etaHighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->eta());
371 phiHighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->phi());
372 pHighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->p());
373 ptHighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->pt());
374 chi2HighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->normalizedChi2());
375 chi2probHighPtTrack[iEtaRegion]->Fill(TMath::Prob(recoHighPtTrack->chi2(), recoHighPtTrack->ndof()));
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
void setCurrentFolder(std::string const &fullpath)
math::Error< dimension >::type Error
covariance error matrix (3x3)
bool isLooseMuon(const reco::Muon &)
void analyze(const edm::Event &, const edm::EventSetup &) override
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
bool isHighPtMuon(const reco::Muon &, const reco::Vertex &)
double sigmaZ() const
sigma z
double BeamWidthY() const
beam width Y
~MuonKinVsEtaAnalyzer() override
Destructor.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
static int position[264][3]
const Point & position() const
position
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
MuonKinVsEtaAnalyzer(const edm::ParameterSet &pSet)
Constructor.