CMS 3D CMS Logo

CosmicMuonRecoAnalyzer.cc
Go to the documentation of this file.
2 
7 
13 
17 
19 
20 using namespace std;
21 using namespace edm;
22 
24 public:
27 
29  ~CosmicMuonRecoAnalyzer() override;
30 
32  void analyze(const edm::Event&, const edm::EventSetup&) override;
33  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
34 
35 private:
36  // ----------member data ---------------------------
38 
40 
41  //histo binning parameters
42 
43  int hitsBin;
44  int hitsMin;
45  int hitsMax;
46 
47  int nTrkBin;
48  int nTrkMax;
49  int nTrkMin;
50 
51  int etaBin;
52  double etaMin;
53  double etaMax;
54 
55  int thetaBin;
56  double thetaMin;
57  double thetaMax;
58 
59  int phiBin;
60  double phiMin;
61  double phiMax;
62 
63  int chi2Bin;
64  double chi2Min;
65  double chi2Max;
66 
67  int pBin;
68  double pMin;
69  double pMax;
70 
71  int ptBin;
72  double ptMin;
73  double ptMax;
74 
75  int pResBin;
76  double pResMin;
77  double pResMax;
78 
79  // sta muon
81 
92 
97 
99 };
100 
102  parameters = pSet;
103 
104  // the services:
105  theMuonCollectionLabel_ = consumes<edm::View<reco::Track> >(parameters.getParameter<edm::InputTag>("MuonCollection"));
106 
107  nTrkBin = parameters.getParameter<int>("nTrkBin");
108  nTrkMax = parameters.getParameter<int>("nTrkMax");
109  nTrkMin = parameters.getParameter<int>("nTrkMin");
110  ptBin = parameters.getParameter<int>("ptBin");
111  ptMin = parameters.getParameter<double>("ptMin");
112  ptMax = parameters.getParameter<double>("ptMax");
113  pBin = parameters.getParameter<int>("pBin");
114  pMin = parameters.getParameter<double>("pMin");
115  pMax = parameters.getParameter<double>("pMax");
116  chi2Bin = parameters.getParameter<int>("chi2Bin");
117  chi2Min = parameters.getParameter<double>("chi2Min");
118  chi2Max = parameters.getParameter<double>("chi2Max");
119  phiBin = parameters.getParameter<int>("phiBin");
120  phiMin = parameters.getParameter<double>("phiMin");
121  phiMax = parameters.getParameter<double>("phiMax");
122  thetaBin = parameters.getParameter<int>("thetaBin");
123  thetaMin = parameters.getParameter<double>("thetaMin");
124  thetaMax = parameters.getParameter<double>("thetaMax");
125  etaBin = parameters.getParameter<int>("etaBin");
126  etaMin = parameters.getParameter<double>("etaMin");
127  etaMax = parameters.getParameter<double>("etaMax");
128  pResBin = parameters.getParameter<int>("pResBin");
129  pResMin = parameters.getParameter<double>("pResMin");
130  pResMax = parameters.getParameter<double>("pResMax");
131 
132  hitsBin = parameters.getParameter<int>("hitsBin");
133  hitsMin = parameters.getParameter<int>("hitsMin");
134  hitsMax = parameters.getParameter<int>("hitsMax");
135 
136  theFolder = parameters.getParameter<string>("folder");
137 }
138 
140 
142  edm::Run const& /*iRun*/,
143  edm::EventSetup const& /* iSetup */) {
144  ibooker.cd();
145  ibooker.setCurrentFolder(theFolder);
146 
148  // monitoring of eta parameter
150  std::string histname = "cosmicMuon";
151 
152  nTracksSta = ibooker.book1D(histname + "_traks", "#tracks", nTrkBin, nTrkMin, nTrkMax);
153 
154  etaStaTrack = ibooker.book1D(histname + "_eta", "#eta_{STA}", etaBin, etaMin, etaMax);
155 
157  // monitoring of theta parameter
159 
160  thetaStaTrack = ibooker.book1D(histname + "_theta", "#theta_{STA}", thetaBin, thetaMin, thetaMax);
161  thetaStaTrack->setAxisTitle("rad");
162 
163  // monitoring of phi paramater
164 
165  phiStaTrack = ibooker.book1D(histname + "_phi", "#phi_{STA}", phiBin, phiMin, phiMax);
166  phiStaTrack->setAxisTitle("rad");
167 
168  // monitoring of the chi2 parameter
169 
170  chi2OvDFStaTrack = ibooker.book1D(histname + "_chi2OverDf", "#chi_{2}OverDF_{STA}", chi2Bin, chi2Min, chi2Max);
171 
172  //--------------------------
173 
174  probchi2StaTrack = ibooker.book1D(histname + "_probchi", "Prob #chi_{STA}", 120, chi2Min, 1.20);
175 
176  // monitoring of the momentum
177 
178  pStaTrack = ibooker.book1D(histname + "_p", "p_{STA}", pBin, pMin, pMax);
179  pStaTrack->setAxisTitle("GeV");
180 
181  qOverPStaTrack = ibooker.book1D(histname + "_qoverp", "qoverp_{STA}", pResBin, pResMin, pResMax);
182  qOverPStaTrack->setAxisTitle("1/GeV");
183 
184  qOverPStaTrack_p =
185  ibooker.book2D(histname + "_qoverp_p", "qoverp_p_{STA}", pBin, pMin, pMax, pResBin, pResMin, pResMax);
186 
187  // monitoring of the transverse momentum
188 
189  ptStaTrack = ibooker.book1D(histname + "_pt", "pt_{STA}", ptBin, ptMin, pMax);
190  ptStaTrack->setAxisTitle("GeV");
191 
192  // monitoring of the muon charge
193 
194  qStaTrack = ibooker.book1D(histname + "_q", "q_{STA}", 5, -2.5, 2.5);
195 
197  // monitoring of the phi-eta
198 
199  phiVsetaStaTrack = ibooker.book2D(
200  histname + "_phiVseta", "#phi vs #eta (STA)", etaBin / 2, etaMin, etaMax, phiBin / 2, phiMin, phiMax);
201  phiVsetaStaTrack->setAxisTitle("eta", 1);
202  phiVsetaStaTrack->setAxisTitle("phi", 2);
203 
204  // monitoring the hits
205  nValidHitsStaTrack = ibooker.book1D(histname + "_nValidHits", "#valid hits (STA)", hitsBin, hitsMin, hitsMax);
206 
207  nValidHitsStaTrack_eta = ibooker.book2D(
208  histname + "_nValidHits_eta", "#valid hits vs eta (STA)", etaBin, etaMin, etaMax, hitsBin, hitsMin, hitsMax);
209 
210  nValidHitsStaTrack_phi = ibooker.book2D(
211  histname + "_nValidHits_phi", "#valid hits vs phi (STA)", phiBin, phiMin, phiMax, hitsBin, hitsMin, hitsMax);
212 }
213 
215  LogTrace("CosmicMuon") << "[MuonRecoAnalyzer] Analyze the mu";
216 
217  // Take the muon container
219  iEvent.getByToken(theMuonCollectionLabel_, muons);
220 
221  int nTracks_ = 0;
222 
223  if (!muons.isValid())
224  return;
225 
226  for (edm::View<reco::Track>::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
227  nTracks_++;
228 
229  // get the track using only the mu spectrometer data
230 
231  etaStaTrack->Fill(muon->eta());
232  thetaStaTrack->Fill(muon->theta());
233  phiStaTrack->Fill(muon->phi());
234  chi2OvDFStaTrack->Fill(muon->normalizedChi2());
235  probchi2StaTrack->Fill(TMath::Prob(muon->chi2(), muon->ndof()));
236  pStaTrack->Fill(muon->p());
237  ptStaTrack->Fill(muon->pt());
238  qStaTrack->Fill(muon->charge());
239  qOverPStaTrack->Fill(muon->qoverp());
240  qOverPStaTrack_p->Fill(muon->p(), muon->qoverp());
241  phiVsetaStaTrack->Fill(muon->eta(), muon->phi());
242 
243  nValidHitsStaTrack->Fill(muon->numberOfValidHits());
244  nValidHitsStaTrack_eta->Fill(muon->eta(), muon->numberOfValidHits());
245  nValidHitsStaTrack_phi->Fill(muon->phi(), muon->numberOfValidHits());
246  }
247 
248  nTracksSta->Fill(nTracks_);
249 }
250 
muonRecoAnalyzer_cfi.nTrkBin
nTrkBin
Definition: muonRecoAnalyzer_cfi.py:17
muonRecoAnalyzer_cfi.thetaBin
thetaBin
Definition: muonRecoAnalyzer_cfi.py:21
CosmicMuonRecoAnalyzer::pResMax
double pResMax
Definition: CosmicMuonRecoAnalyzer.cc:77
PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
Handle.h
CosmicMuonRecoAnalyzer::pResMin
double pResMin
Definition: CosmicMuonRecoAnalyzer.cc:76
CosmicMuonRecoAnalyzer::theFolder
std::string theFolder
Definition: CosmicMuonRecoAnalyzer.cc:98
ALCARECOTkAlBeamHalo_cff.etaMin
etaMin
GeV.
Definition: ALCARECOTkAlBeamHalo_cff.py:32
CosmicMuonRecoAnalyzer::nTrkMin
int nTrkMin
Definition: CosmicMuonRecoAnalyzer.cc:49
Muon.h
MessageLogger.h
CosmicMuonRecoAnalyzer::nTracksSta
MonitorElement * nTracksSta
Definition: CosmicMuonRecoAnalyzer.cc:80
bookHistograms
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
CosmicMuonRecoAnalyzer::hitsMax
int hitsMax
Definition: CosmicMuonRecoAnalyzer.cc:45
etaBin
int etaBin(const l1t::HGCalMulticluster *cl)
Definition: L1EGammaEEProducer.cc:19
muon
Definition: MuonCocktails.h:17
CosmicMuonRecoAnalyzer::pMin
double pMin
Definition: CosmicMuonRecoAnalyzer.cc:68
edm::Run
Definition: Run.h:45
BeamMonitor_cff.phiBin
phiBin
Definition: BeamMonitor_cff.py:77
CosmicMuonRecoAnalyzer::ptStaTrack
MonitorElement * ptStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:89
edm::EDGetTokenT
Definition: EDGetToken.h:33
CosmicMuonRecoAnalyzer::nTrkBin
int nTrkBin
Definition: CosmicMuonRecoAnalyzer.cc:47
edm
HLT enums.
Definition: AlignableModifier.h:19
CosmicMuonRecoAnalyzer::etaMin
double etaMin
Definition: CosmicMuonRecoAnalyzer.cc:52
muonRecoAnalyzer_cfi.chi2Min
chi2Min
Definition: muonRecoAnalyzer_cfi.py:34
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
CosmicMuonRecoAnalyzer::thetaStaTrack
MonitorElement * thetaStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:83
CosmicMuonRecoAnalyzer::nTrkMax
int nTrkMax
Definition: CosmicMuonRecoAnalyzer.cc:48
CosmicMuonRecoAnalyzer::theMuonCollectionLabel_
edm::EDGetTokenT< edm::View< reco::Track > > theMuonCollectionLabel_
Definition: CosmicMuonRecoAnalyzer.cc:39
CosmicMuonRecoAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Inizialize parameters for histo binning.
Definition: CosmicMuonRecoAnalyzer.cc:214
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
muonRecoAnalyzer_cfi.nTrkMin
nTrkMin
Definition: muonRecoAnalyzer_cfi.py:18
CosmicMuonRecoAnalyzer::ptBin
int ptBin
Definition: CosmicMuonRecoAnalyzer.cc:71
CosmicMuonRecoAnalyzer::pBin
int pBin
Definition: CosmicMuonRecoAnalyzer.cc:67
CosmicMuonRecoAnalyzer::nValidHitsStaTrack_phi
MonitorElement * nValidHitsStaTrack_phi
Definition: CosmicMuonRecoAnalyzer.cc:96
CosmicMuonRecoAnalyzer::phiBin
int phiBin
Definition: CosmicMuonRecoAnalyzer.cc:59
edm::Handle
Definition: AssociativeIterator.h:50
CosmicMuonRecoAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: CosmicMuonRecoAnalyzer.cc:141
muonRecoAnalyzer_cfi.ptBin
ptBin
Definition: muonRecoAnalyzer_cfi.py:45
CosmicMuonRecoAnalyzer::pResBin
int pResBin
Definition: CosmicMuonRecoAnalyzer.cc:75
CosmicMuonRecoAnalyzer::etaBin
int etaBin
Definition: CosmicMuonRecoAnalyzer.cc:51
CosmicMuonRecoAnalyzer::chi2Bin
int chi2Bin
Definition: CosmicMuonRecoAnalyzer.cc:63
CosmicMuonRecoAnalyzer::chi2OvDFStaTrack
MonitorElement * chi2OvDFStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:85
MakerMacros.h
Track.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
AlignmentTrackSelector_cfi.ptMax
ptMax
Definition: AlignmentTrackSelector_cfi.py:12
CosmicMuonRecoAnalyzer::ptMin
double ptMin
Definition: CosmicMuonRecoAnalyzer.cc:72
CosmicMuonRecoAnalyzer::chi2Max
double chi2Max
Definition: CosmicMuonRecoAnalyzer.cc:65
AlignmentTrackSelector_cfi.pMax
pMax
Definition: AlignmentTrackSelector_cfi.py:14
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11725
Service.h
MuonFwd.h
CosmicMuonRecoAnalyzer::nValidHitsStaTrack
MonitorElement * nValidHitsStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:91
CosmicMuonRecoAnalyzer::parameters
edm::ParameterSet parameters
Definition: CosmicMuonRecoAnalyzer.cc:37
AlignmentTrackSelector_cfi.phiMin
phiMin
Definition: AlignmentTrackSelector_cfi.py:18
CosmicMuonRecoAnalyzer::qOverPStaTrack
MonitorElement * qOverPStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:88
CosmicMuonRecoAnalyzer::pStaTrack
MonitorElement * pStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:87
AlignmentTrackSelector_cfi.phiMax
phiMax
Definition: AlignmentTrackSelector_cfi.py:17
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
CosmicMuonRecoAnalyzer::thetaMin
double thetaMin
Definition: CosmicMuonRecoAnalyzer.cc:56
CosmicMuonRecoAnalyzer::~CosmicMuonRecoAnalyzer
~CosmicMuonRecoAnalyzer() override
Destructor.
Definition: CosmicMuonRecoAnalyzer.cc:139
DQMEDAnalyzer.h
muonRecoAnalyzer_cfi.pBin
pBin
Definition: muonRecoAnalyzer_cfi.py:37
CosmicMuonRecoAnalyzer::etaStaTrack
MonitorElement * etaStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:82
muonRecoAnalyzer_cfi.thetaMin
thetaMin
Definition: muonRecoAnalyzer_cfi.py:22
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
MonitorElement.h
CosmicMuonRecoAnalyzer::hitsBin
int hitsBin
Definition: CosmicMuonRecoAnalyzer.cc:43
muonRecoAnalyzer_cfi.pResMax
pResMax
Definition: muonRecoAnalyzer_cfi.py:27
edm::ParameterSet
Definition: ParameterSet.h:47
CosmicMuonRecoAnalyzer::qStaTrack
MonitorElement * qStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:90
Event.h
ALCARECOTkAlMinBias_cff.pMin
pMin
GeV.
Definition: ALCARECOTkAlMinBias_cff.py:35
muonRecoAnalyzer_cfi.pResBin
pResBin
Definition: muonRecoAnalyzer_cfi.py:25
CosmicMuonRecoAnalyzer::nValidHitsStaTrack_eta
MonitorElement * nValidHitsStaTrack_eta
Definition: CosmicMuonRecoAnalyzer.cc:95
ModuleDef.h
iEvent
int iEvent
Definition: GenABIO.cc:224
muonRecoAnalyzer_cfi.nTrkMax
nTrkMax
Definition: muonRecoAnalyzer_cfi.py:19
muonRecoAnalyzer_cfi.chi2Max
chi2Max
Definition: muonRecoAnalyzer_cfi.py:35
CosmicMuonRecoAnalyzer::phiStaTrack
MonitorElement * phiStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:84
muonRecoAnalyzer_cfi.pResMin
pResMin
Definition: muonRecoAnalyzer_cfi.py:26
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition: EventSetup.h:58
CosmicMuonRecoAnalyzer::phiMin
double phiMin
Definition: CosmicMuonRecoAnalyzer.cc:60
CosmicMuonRecoAnalyzer::qOverPStaTrack_p
MonitorElement * qOverPStaTrack_p
Definition: CosmicMuonRecoAnalyzer.cc:93
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InputTag.h
muonRecoAnalyzer_cfi.hitsMin
hitsMin
Definition: muonRecoAnalyzer_cfi.py:14
muonRecoAnalyzer_cfi.hitsBin
hitsBin
Definition: muonRecoAnalyzer_cfi.py:13
std
Definition: JetResolutionObject.h:76
CosmicMuonRecoAnalyzer::probchi2StaTrack
MonitorElement * probchi2StaTrack
Definition: CosmicMuonRecoAnalyzer.cc:86
muonRecoAnalyzer_cfi.thetaMax
thetaMax
Definition: muonRecoAnalyzer_cfi.py:23
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
muonRecoAnalyzer_cfi.hitsMax
hitsMax
Definition: muonRecoAnalyzer_cfi.py:15
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
dqm::implementation::IBooker
Definition: DQMStore.h:43
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
CosmicMuonRecoAnalyzer::CosmicMuonRecoAnalyzer
CosmicMuonRecoAnalyzer(const edm::ParameterSet &)
Constructor.
Definition: CosmicMuonRecoAnalyzer.cc:101
CosmicMuonRecoAnalyzer::thetaMax
double thetaMax
Definition: CosmicMuonRecoAnalyzer.cc:57
CosmicMuonRecoAnalyzer::hitsMin
int hitsMin
Definition: CosmicMuonRecoAnalyzer.cc:44
CosmicMuonRecoAnalyzer::phiMax
double phiMax
Definition: CosmicMuonRecoAnalyzer.cc:61
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
ParameterSet.h
CosmicMuonRecoAnalyzer::thetaBin
int thetaBin
Definition: CosmicMuonRecoAnalyzer.cc:55
edm::Event
Definition: Event.h:73
CosmicMuonRecoAnalyzer::chi2Min
double chi2Min
Definition: CosmicMuonRecoAnalyzer.cc:64
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:791
edm::InputTag
Definition: InputTag.h:15
CosmicMuonRecoAnalyzer::etaMax
double etaMax
Definition: CosmicMuonRecoAnalyzer.cc:53
muonRecoAnalyzer_cfi.chi2Bin
chi2Bin
Definition: muonRecoAnalyzer_cfi.py:33
CosmicMuonRecoAnalyzer::pMax
double pMax
Definition: CosmicMuonRecoAnalyzer.cc:69
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
CosmicMuonRecoAnalyzer
Definition: CosmicMuonRecoAnalyzer.cc:23
CosmicMuonRecoAnalyzer::phiVsetaStaTrack
MonitorElement * phiVsetaStaTrack
Definition: CosmicMuonRecoAnalyzer.cc:94
CosmicMuonRecoAnalyzer::ptMax
double ptMax
Definition: CosmicMuonRecoAnalyzer.cc:73