29 theMuonCollectionLabel_ = consumes<reco::MuonCollection>(
parameters.getParameter<
InputTag>(
"MuonCollection"));
34 etaBin =
parameters.getParameter<
int>(
"etaBin");
35 etaMin =
parameters.getParameter<
double>(
"etaMin");
36 etaMax =
parameters.getParameter<
double>(
"etaMax");
38 phiBin =
parameters.getParameter<
int>(
"phiBin");
39 phiMin =
parameters.getParameter<
double>(
"phiMin");
40 phiMax =
parameters.getParameter<
double>(
"phiMax");
43 pMin =
parameters.getParameter<
double>(
"pMin");
44 pMax =
parameters.getParameter<
double>(
"pMax");
48 ptMax =
parameters.getParameter<
double>(
"ptMax");
50 chiBin =
parameters.getParameter<
int>(
"chiBin");
51 chiMin =
parameters.getParameter<
double>(
"chiMin");
52 chiMax =
parameters.getParameter<
double>(
"chiMax");
53 chiprobMin =
parameters.getParameter<
double>(
"chiprobMin");
54 chiprobMax =
parameters.getParameter<
double>(
"chiprobMax");
56 etaBMin =
parameters.getParameter<
double>(
"etaBMin");
57 etaBMax =
parameters.getParameter<
double>(
"etaBMax");
58 etaECMin =
parameters.getParameter<
double>(
"etaECMin");
59 etaECMax =
parameters.getParameter<
double>(
"etaECMax");
60 etaOvlpMin =
parameters.getParameter<
double>(
"etaOvlpMin");
61 etaOvlpMax =
parameters.getParameter<
double>(
"etaOvlpMax");
76 for(
unsigned int iEtaRegion=0;iEtaRegion<4;iEtaRegion++){
77 if (iEtaRegion==0) EtaName =
"Barrel";
78 if (iEtaRegion==1) EtaName =
"EndCap";
79 if (iEtaRegion==2) EtaName =
"Overlap";
80 if (iEtaRegion==3) EtaName =
"";
83 etaGlbTrack.push_back(ibooker.
book1D(
"GlbMuon_eta_"+EtaName,
"#eta_{GLB} "+EtaName, etaBin, etaMin, etaMax));
84 etaTrack.push_back(ibooker.
book1D(
"TkMuon_eta_"+EtaName,
"#eta_{TK} "+EtaName, etaBin, etaMin, etaMax));
85 etaStaTrack.push_back(ibooker.
book1D(
"StaMuon_eta_"+EtaName,
"#eta_{STA} "+EtaName, etaBin, etaMin, etaMax));
86 etaTightTrack.push_back(ibooker.
book1D(
"TightMuon_eta_"+EtaName,
"#eta_{Tight} "+EtaName, etaBin, etaMin, etaMax));
87 etaLooseTrack.push_back(ibooker.
book1D(
"LooseMuon_eta_"+EtaName,
"#eta_{Loose} "+EtaName, etaBin, etaMin, etaMax));
88 etaSoftTrack.push_back(ibooker.
book1D(
"SoftMuon_eta_"+EtaName,
"#eta_{Soft} "+EtaName, etaBin, etaMin, etaMax));
89 etaHighPtTrack.push_back(ibooker.
book1D(
"HighPtMuon_eta_"+EtaName,
"#eta_{HighPt} "+EtaName, etaBin, etaMin, etaMax));
92 phiGlbTrack.push_back(ibooker.
book1D(
"GlbMuon_phi_"+EtaName,
"#phi_{GLB} "+EtaName+
"(rad)", phiBin, phiMin, phiMax));
93 phiTrack.push_back(ibooker.
book1D(
"TkMuon_phi_"+EtaName,
"#phi_{TK}" +EtaName +
"(rad)", phiBin, phiMin, phiMax));
94 phiStaTrack.push_back(ibooker.
book1D(
"StaMuon_phi_"+EtaName,
"#phi_{STA}"+EtaName+
" (rad)", phiBin, phiMin, phiMax));
95 phiTightTrack.push_back(ibooker.
book1D(
"TightMuon_phi_"+EtaName,
"#phi_{Tight}_"+EtaName, phiBin, phiMin, phiMax));
96 phiLooseTrack.push_back(ibooker.
book1D(
"LooseMuon_phi_"+EtaName,
"#phi_{Loose}_"+EtaName, phiBin, phiMin, phiMax));
97 phiSoftTrack.push_back(ibooker.
book1D(
"SoftMuon_phi_"+EtaName,
"#phi_{Soft}_"+EtaName, phiBin, phiMin, phiMax));
98 phiHighPtTrack.push_back(ibooker.
book1D(
"HighPtMuon_phi_"+EtaName,
"#phi_{HighPt}_"+EtaName, phiBin, phiMin, phiMax));
101 pGlbTrack.push_back(ibooker.
book1D(
"GlbMuon_p_"+EtaName,
"p_{GLB} "+EtaName, pBin, pMin, pMax));
102 pTrack.push_back(ibooker.
book1D(
"TkMuon_p"+EtaName,
"p_{TK} "+EtaName, pBin, pMin, pMax));
103 pStaTrack.push_back(ibooker.
book1D(
"StaMuon_p"+EtaName,
"p_{STA} "+EtaName, pBin, pMin, pMax));
104 pTightTrack.push_back(ibooker.
book1D(
"TightMuon_p_"+EtaName,
"p_{Tight} "+EtaName, pBin, pMin, pMax));
105 pLooseTrack.push_back(ibooker.
book1D(
"LooseMuon_p_"+EtaName,
"p_{Loose} "+EtaName, pBin, pMin, pMax));
106 pSoftTrack.push_back(ibooker.
book1D(
"SoftMuon_p_"+EtaName,
"p_{Soft} "+EtaName, pBin, pMin, pMax));
107 pHighPtTrack.push_back(ibooker.
book1D(
"HighPtMuon_p_"+EtaName,
"p_{HighPt} "+EtaName, pBin, pMin, pMax));
110 ptGlbTrack.push_back(ibooker.
book1D(
"GlbMuon_pt_" +EtaName,
"pt_{GLB} "+EtaName, ptBin,
ptMin, ptMax));
111 ptTrack.push_back(ibooker.
book1D(
"TkMuon_pt_"+EtaName,
"pt_{TK} "+EtaName, ptBin,
ptMin, ptMax));
112 ptStaTrack.push_back(ibooker.
book1D(
"StaMuon_pt_"+EtaName,
"pt_{STA} "+EtaName, ptBin,
ptMin, pMax));
113 ptTightTrack.push_back(ibooker.
book1D(
"TightMuon_pt_"+EtaName,
"pt_{Tight} "+EtaName, ptBin,
ptMin, ptMax));
114 ptLooseTrack.push_back(ibooker.
book1D(
"LooseMuon_pt_"+EtaName,
"pt_{Loose} "+EtaName, ptBin,
ptMin, ptMax));
115 ptSoftTrack.push_back(ibooker.
book1D(
"SoftMuon_pt_"+EtaName,
"pt_{Soft} "+EtaName, ptBin,
ptMin, ptMax));
116 ptHighPtTrack.push_back(ibooker.
book1D(
"HighPtMuon_pt_"+EtaName,
"pt_{HighPt} "+EtaName, ptBin,
ptMin, ptMax));
119 chi2GlbTrack.push_back(ibooker.
book1D(
"GlbMuon_chi2_"+EtaName,
"#chi^{2}_{GLB} " + EtaName, chiBin, chiMin, chiMax));
120 chi2probGlbTrack.push_back(ibooker.
book1D(
"GlbMuon_chi2prob_"+EtaName,
"#chi^{2}_{GLB} prob." + EtaName, chiBin, chiprobMin, chiprobMax));
121 chi2Track.push_back(ibooker.
book1D(
"TkMuon_chi2_"+EtaName,
"#chi^{2}_{TK} " + EtaName, chiBin, chiMin, chiMax));
122 chi2probTrack.push_back(ibooker.
book1D(
"TkMuon_chi2prob_"+EtaName,
"#chi^{2}_{TK} prob." + EtaName, chiBin, chiprobMin, chiprobMax));
123 chi2StaTrack.push_back(ibooker.
book1D(
"StaMuon_chi2_"+EtaName,
"#chi^{2}_{STA} " + EtaName, chiBin, chiMin, chiMax));
124 chi2probStaTrack.push_back(ibooker.
book1D(
"StaMuon_chi2prob_"+EtaName,
"#chi^{2}_{STA} prob." + EtaName, chiBin, chiprobMin, chiprobMax));
125 chi2TightTrack.push_back(ibooker.
book1D(
"TightMuon_chi2_"+EtaName,
"#chi^{2}_{Tight} " + EtaName, chiBin, chiMin, chiMax));
126 chi2probTightTrack.push_back(ibooker.
book1D(
"TightMuon_chi2prob_"+EtaName,
"#chi^{2}_{Tight} prob." + EtaName, chiBin, chiprobMin, chiprobMax));
127 chi2LooseTrack.push_back(ibooker.
book1D(
"LooseMuon_chi2_"+EtaName,
"#chi^{2}_{Loose} " + EtaName, chiBin, chiMin, chiMax));
128 chi2probLooseTrack.push_back(ibooker.
book1D(
"LooseMuon_chi2prob_"+EtaName,
"#chi^{2}_{Loose} prob." + EtaName, chiBin, chiprobMin, chiprobMax));
129 chi2SoftTrack.push_back(ibooker.
book1D(
"SoftMuon_chi2_"+EtaName,
"#chi^{2}_{Soft} " + EtaName, chiBin, chiMin, chiMax));
130 chi2probSoftTrack.push_back(ibooker.
book1D(
"SoftMuon_chi2prob_"+EtaName,
"#chi^{2}_{Soft} prob." + EtaName, chiBin, chiprobMin, chiprobMax));
131 chi2HighPtTrack.push_back(ibooker.
book1D(
"HighPtMuon_chi2_"+EtaName,
"#chi^{2}_{HighPt} " + EtaName, chiBin, chiMin, chiMax));
132 chi2probHighPtTrack.push_back(ibooker.
book1D(
"HighPtMuon_chi2prob_"+EtaName,
"#chi^{2}_{HighPt} prob." + EtaName, chiBin, chiprobMin, chiprobMax));
137 LogTrace(
metname)<<
"[MuonKinVsEtaAnalyzer] Analyze the mu in different eta regions";
138 theService->update(iSetup);
141 iEvent.
getByToken(theMuonCollectionLabel_,muons);
147 unsigned int theIndexOfThePrimaryVertex = 999.;
152 for (
unsigned int ind=0; ind<vertex->size(); ++ind) {
153 if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
154 theIndexOfThePrimaryVertex = ind;
160 if (theIndexOfThePrimaryVertex<100) {
161 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
162 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
165 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
168 iEvent.
getByToken(theBeamSpotLabel_,recoBeamSpotHandle);
174 errVtx(2,2) = bs.
sigmaZ();
181 cout <<
"[MuonKinVsEtaAnalyzer]: Analyze the mu in different eta regions" << endl;
185 for (reco::MuonCollection::const_iterator muonIt = muons->begin(); muonIt!=muons->end(); ++muonIt){
188 for(
unsigned int iEtaRegion=0;iEtaRegion<4;iEtaRegion++){
189 if (iEtaRegion==0) {EtaCutMin= etaBMin; EtaCutMax=etaBMax;}
190 if (iEtaRegion==1) {EtaCutMin= etaECMin; EtaCutMax=etaECMax;}
191 if (iEtaRegion==2) {EtaCutMin= etaOvlpMin; EtaCutMax=etaOvlpMax;}
192 if (iEtaRegion==3) {EtaCutMin= etaBMin; EtaCutMax=etaECMax;}
196 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is global... Filling the histos" << endl;
198 LogTrace(
metname)<<
"[MuonKinVsEtaAnalyzer] The mu is global - filling the histos";
201 if(fabs(recoCombinedGlbTrack->eta())>EtaCutMin && fabs(recoCombinedGlbTrack->eta())<EtaCutMax){
202 etaGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->eta());
203 phiGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->phi());
204 pGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->p());
205 ptGlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->pt());
206 chi2GlbTrack[iEtaRegion]->Fill(recoCombinedGlbTrack->normalizedChi2());
207 chi2probGlbTrack[iEtaRegion]->Fill(TMath::Prob(recoCombinedGlbTrack->normalizedChi2(),recoCombinedGlbTrack->ndof()));
213 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is tracker... Filling the histos" << endl;
215 LogTrace(
metname)<<
"[MuonKinVsEtaAnalyzer] The mu is tracker - filling the histos";
218 if(fabs(recoTrack->eta())>EtaCutMin && fabs(recoTrack->eta())<EtaCutMax){
219 etaTrack[iEtaRegion]->Fill(recoTrack->eta());
220 phiTrack[iEtaRegion]->Fill(recoTrack->phi());
221 pTrack[iEtaRegion]->Fill(recoTrack->p());
222 ptTrack[iEtaRegion]->Fill(recoTrack->pt());
223 chi2Track[iEtaRegion]->Fill(recoTrack->normalizedChi2());
224 chi2probTrack[iEtaRegion]->Fill(TMath::Prob(recoTrack->normalizedChi2(),recoTrack->ndof()));
230 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is standlone... Filling the histos" << endl;
232 LogTrace(
metname)<<
"[MuonKinVsEtaAnalyzer] The mu is standalone - filling the histos";
235 if(fabs(recoStaTrack->eta())>EtaCutMin && fabs(recoStaTrack->eta())<EtaCutMax){
236 etaStaTrack[iEtaRegion]->Fill(recoStaTrack->eta());
237 phiStaTrack[iEtaRegion]->Fill(recoStaTrack->phi());
238 pStaTrack[iEtaRegion]->Fill(recoStaTrack->p());
239 ptStaTrack[iEtaRegion]->Fill(recoStaTrack->pt());
240 chi2StaTrack[iEtaRegion]->Fill(recoStaTrack->normalizedChi2());
241 chi2probStaTrack[iEtaRegion]->Fill(TMath::Prob(recoStaTrack->normalizedChi2(),recoStaTrack->ndof()));
247 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is tight... Filling the histos" << endl;
249 LogTrace(
metname)<<
"[MuonKinVsEtaAnalyzer] The mu is Tight - filling the histos";
251 if(fabs(recoTightTrack->eta())>EtaCutMin && fabs(recoTightTrack->eta())<EtaCutMax){
252 etaTightTrack[iEtaRegion]->Fill(recoTightTrack->eta());
253 phiTightTrack[iEtaRegion]->Fill(recoTightTrack->phi());
254 pTightTrack[iEtaRegion]->Fill(recoTightTrack->p());
255 ptTightTrack[iEtaRegion]->Fill(recoTightTrack->pt());
256 chi2TightTrack[iEtaRegion]->Fill(recoTightTrack->normalizedChi2());
257 chi2probTightTrack[iEtaRegion]->Fill(TMath::Prob(recoTightTrack->normalizedChi2(),recoTightTrack->ndof()));
264 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is Loose... Filling the histos" << endl;
266 LogTrace(
metname)<<
"[MuonKinVsEtaAnalyzer] The mu is Loose - filling the histos";
270 else recoLooseTrack = recoMu.
track();
272 if(fabs(recoLooseTrack->eta())>EtaCutMin && fabs(recoLooseTrack->eta())<EtaCutMax){
273 etaLooseTrack[iEtaRegion]->Fill(recoLooseTrack->eta());
274 phiLooseTrack[iEtaRegion]->Fill(recoLooseTrack->phi());
275 pLooseTrack[iEtaRegion]->Fill(recoLooseTrack->p());
276 ptLooseTrack[iEtaRegion]->Fill(recoLooseTrack->pt());
277 chi2LooseTrack[iEtaRegion]->Fill(recoLooseTrack->normalizedChi2());
278 chi2probLooseTrack[iEtaRegion]->Fill(TMath::Prob(recoLooseTrack->normalizedChi2(),recoLooseTrack->ndof()));
284 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is Soft... Filling the histos" << endl;
286 LogTrace(
metname)<<
"[MuonKinVsEtaAnalyzer] The mu is Soft - filling the histos";
288 if(fabs(recoSoftTrack->eta())>EtaCutMin && fabs(recoSoftTrack->eta())<EtaCutMax){
289 etaSoftTrack[iEtaRegion]->Fill(recoSoftTrack->eta());
290 phiSoftTrack[iEtaRegion]->Fill(recoSoftTrack->phi());
291 pSoftTrack[iEtaRegion]->Fill(recoSoftTrack->p());
292 ptSoftTrack[iEtaRegion]->Fill(recoSoftTrack->pt());
293 chi2SoftTrack[iEtaRegion]->Fill(recoSoftTrack->normalizedChi2());
294 chi2probSoftTrack[iEtaRegion]->Fill(TMath::Prob(recoSoftTrack->normalizedChi2(),recoSoftTrack->ndof()));
300 cout <<
"[MuonKinVsEtaAnalyzer]: The mu is HighPt... Filling the histos" << endl;
302 LogTrace(
metname)<<
"[MuonKinVsEtaAnalyzer] The mu is HightPt - filling the histos";
304 if(fabs(recoHighPtTrack->eta())>EtaCutMin && fabs(recoHighPtTrack->eta())<EtaCutMax){
305 etaHighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->eta());
306 phiHighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->phi());
307 pHighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->p());
308 ptHighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->pt());
309 chi2HighPtTrack[iEtaRegion]->Fill(recoHighPtTrack->normalizedChi2());
310 chi2probHighPtTrack[iEtaRegion]->Fill(TMath::Prob(recoHighPtTrack->normalizedChi2(),recoHighPtTrack->ndof()));
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
void analyze(const edm::Event &, const edm::EventSetup &)
bool isTrackerMuon() const
virtual TrackRef track() const
reference to a Track
bool isGlobalMuon() const
math::Error< dimension >::type Error
covariance error matrix (3x3)
bool isStandAloneMuon() const
bool isLooseMuon(const reco::Muon &)
bool isSoftMuon(const reco::Muon &, const reco::Vertex &)
MonitorElement * book1D(Args &&...args)
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 isHighPtMuon(const reco::Muon &, const reco::Vertex &)
virtual TrackRef combinedMuon() const
reference to a stand-alone muon Track
void setCurrentFolder(const std::string &fullpath)
double sigmaZ() const
sigma z
double BeamWidthY() const
beam width Y
static int position[264][3]
const Point & position() const
position
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
MuonKinVsEtaAnalyzer(const edm::ParameterSet &pSet)
Constructor.
~MuonKinVsEtaAnalyzer()
Destructor.
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track