26 singlemuonExpr_ = muonparms.
getParameter<std::vector<std::string> >(
"hltPaths");
27 doublemuonExpr_ = dimuonparms.getParameter<std::vector<std::string> >(
"hltPaths");
29 theMuonCollectionLabel_ = consumes<reco::MuonCollection>(
parameters.getParameter<
edm::InputTag>(
"MuonCollection"));
32 theTriggerResultsLabel_ = consumes<TriggerResults>(
parameters.getParameter<
InputTag>(
"TriggerResultsLabel"));
50 delete _SingleMuonEventFlag;
51 delete _DoubleMuonEventFlag;
55 cout <<
"[MuonRecoOneHLT] beginRun " << endl;
56 cout <<
"[MuonRecoOneHLT] Is MuonEventFlag On? " << _SingleMuonEventFlag->on() << endl;
62 muReco = ibooker.
book1D(
"Muon_Reco",
"Muon Reconstructed Tracks", 6, 1, 7);
64 muReco->setBinLabel(2,
"glb+sta");
65 muReco->setBinLabel(3,
"tk+sta");
66 muReco->setBinLabel(4,
"tk");
67 muReco->setBinLabel(5,
"sta");
68 muReco->setBinLabel(6,
"calo");
83 phiGlbTrack[1]->setAxisTitle(
"rad");
85 phiGlbTrack[2]->setAxisTitle(
"rad");
93 chi2OvDFGlbTrack.push_back(
95 chi2OvDFGlbTrack.push_back(
97 chi2OvDFGlbTrack.push_back(
107 ptGlbTrack[1]->setAxisTitle(
"GeV");
109 ptGlbTrack[2]->setAxisTitle(
"GeV");
117 if (_SingleMuonEventFlag->on())
118 _SingleMuonEventFlag->initRun(iRun, iSetup);
119 if (_DoubleMuonEventFlag->on())
120 _DoubleMuonEventFlag->initRun(iRun, iSetup);
122 if (_SingleMuonEventFlag->on() &&
123 _SingleMuonEventFlag->expressionsFromDB(_SingleMuonEventFlag->hltDBKey(), iSetup)[0] !=
"CONFIG_ERROR")
124 singlemuonExpr_ = _SingleMuonEventFlag->expressionsFromDB(_SingleMuonEventFlag->hltDBKey(), iSetup);
125 if (_DoubleMuonEventFlag->on() &&
126 _DoubleMuonEventFlag->expressionsFromDB(_DoubleMuonEventFlag->hltDBKey(), iSetup)[0] !=
"CONFIG_ERROR")
127 singlemuonExpr_ = _DoubleMuonEventFlag->expressionsFromDB(_DoubleMuonEventFlag->hltDBKey(), iSetup);
130 theService->update(iSetup);
136 unsigned int theIndexOfThePrimaryVertex = 999.;
141 for (
unsigned int ind = 0; ind < vertex->size(); ++ind) {
142 if ((*vertex)[ind].isValid() && !((*vertex)[ind].isFake())) {
143 theIndexOfThePrimaryVertex = ind;
149 if (theIndexOfThePrimaryVertex < 100) {
150 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
151 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
153 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
156 iEvent.
getByToken(theBeamSpotLabel_, recoBeamSpotHandle);
162 errVtx(2, 2) = bs.
sigmaZ();
170 iEvent.
getByToken(theMuonCollectionLabel_, muons);
173 iEvent.
getByToken(theTriggerResultsLabel_, triggerResults);
180 std::map<float, const reco::Muon*> muonMap;
181 for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu != muons->end(); ++recoMu) {
182 muonMap[recoMu->pt()] = &*recoMu;
184 std::vector<const reco::Muon*> LeadingMuon;
185 for (std::map<float, const reco::Muon*>::reverse_iterator rit = muonMap.rbegin(); rit != muonMap.rend(); ++rit) {
186 LeadingMuon.push_back((*rit).second);
191 const unsigned int nTrig(triggerNames.
size());
192 bool _trig_SingleMu =
false;
193 bool _trig_DoubleMu =
false;
194 for (
unsigned int i = 0;
i < nTrig; ++
i) {
195 if (triggerNames.
triggerName(
i).find(singlemuonExpr_[0].substr(0, singlemuonExpr_[0].rfind(
"_v") + 2)) !=
198 _trig_SingleMu =
true;
199 if (triggerNames.
triggerName(
i).find(doublemuonExpr_[0].substr(0, doublemuonExpr_[0].rfind(
"_v") + 2)) !=
202 _trig_DoubleMu =
true;
205 cout <<
"[MuonRecoOneHLT] Trigger Fired ? " << (_trig_SingleMu || _trig_DoubleMu) << endl;
208 if (!_trig_SingleMu && !_trig_DoubleMu)
210 if (LeadingMuon.empty())
215 if ((*LeadingMuon[0]).isGlobalMuon()) {
216 LogTrace(
metname) <<
"[MuonRecoOneHLT] The mu is global - filling the histos";
217 if ((*LeadingMuon[0]).isTrackerMuon() && (*LeadingMuon[0]).isStandAloneMuon())
219 if (!((*LeadingMuon[0]).isTrackerMuon()) && (*LeadingMuon[0]).isStandAloneMuon())
221 if (!(*LeadingMuon[0]).isStandAloneMuon())
222 LogTrace(
metname) <<
"[MuonRecoOneHLT] ERROR: the mu is global but not standalone!";
225 reco::TrackRef recoCombinedGlbTrack = (*LeadingMuon[0]).combinedMuon();
231 etaGlbTrack[0]->Fill(recoCombinedGlbTrack->eta());
232 etaGlbTrack[1]->Fill(recoTkGlbTrack->eta());
233 etaGlbTrack[2]->Fill(recoStaGlbTrack->eta());
235 phiGlbTrack[0]->Fill(recoCombinedGlbTrack->phi());
236 phiGlbTrack[1]->Fill(recoTkGlbTrack->phi());
237 phiGlbTrack[2]->Fill(recoStaGlbTrack->phi());
239 chi2OvDFGlbTrack[0]->Fill(recoCombinedGlbTrack->normalizedChi2());
240 chi2OvDFGlbTrack[1]->Fill(recoTkGlbTrack->normalizedChi2());
241 chi2OvDFGlbTrack[2]->Fill(recoStaGlbTrack->normalizedChi2());
243 ptGlbTrack[0]->Fill(recoCombinedGlbTrack->pt());
244 ptGlbTrack[1]->Fill(recoTkGlbTrack->pt());
245 ptGlbTrack[2]->Fill(recoStaGlbTrack->pt());
249 LogTrace(
metname) <<
"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
251 reco::TrackRef recoCombinedGlbTrack = (*LeadingMuon[0]).combinedMuon();
253 etaTight->Fill(recoCombinedGlbTrack->eta());
254 phiTight->Fill(recoCombinedGlbTrack->phi());
255 chi2OvDFTight->Fill(recoCombinedGlbTrack->normalizedChi2());
256 ptTight->Fill(recoCombinedGlbTrack->pt());
260 if ((*LeadingMuon[0]).isTrackerMuon() && !((*LeadingMuon[0]).isGlobalMuon())) {
261 LogTrace(
metname) <<
"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
262 if ((*LeadingMuon[0]).isStandAloneMuon())
264 if (!((*LeadingMuon[0]).isStandAloneMuon()))
270 etaTrack->Fill(recoTrack->eta());
271 phiTrack->Fill(recoTrack->phi());
272 chi2OvDFTrack->Fill(recoTrack->normalizedChi2());
273 ptTrack->Fill(recoTrack->pt());
277 if ((*LeadingMuon[0]).isStandAloneMuon() && !((*LeadingMuon[0]).isGlobalMuon())) {
278 LogTrace(
metname) <<
"[MuonRecoOneHLT] The mu is STA only - filling the histos";
279 if (!((*LeadingMuon[0]).isTrackerMuon()))
285 etaStaTrack->Fill(recoStaTrack->eta());
286 phiStaTrack->Fill(recoStaTrack->phi());
287 chi2OvDFStaTrack->Fill(recoStaTrack->normalizedChi2());
288 ptStaTrack->Fill(recoStaTrack->pt());
291 if ((*LeadingMuon[0]).isCaloMuon() && !((*LeadingMuon[0]).isGlobalMuon()) && !((*LeadingMuon[0]).isTrackerMuon()) &&
292 !((*LeadingMuon[0]).isStandAloneMuon()))
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
void setCurrentFolder(std::string const &fullpath)
bool accept() const
Has at least one path accepted the event?
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void analyze(const edm::Event &, const edm::EventSetup &) override
math::Error< dimension >::type Error
covariance error matrix (3x3)
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
Strings::size_type size() const
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
static std::string const triggerResults
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MuonRecoOneHLT(const edm::ParameterSet &)
Constructor.
std::string const & triggerName(unsigned int index) const
double sigmaZ() const
sigma z
double BeamWidthY() const
beam width Y
~MuonRecoOneHLT() override
Destructor.
static int position[264][3]
const Point & position() const
position
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)