19 _DoubleMuonEventFlag =
23 singlemuonExpr_ = muonparms.
getParameter<std::vector<std::string> >(
"hltPaths");
24 doublemuonExpr_ = dimuonparms.getParameter<std::vector<std::string> >(
"hltPaths");
26 theMuonCollectionLabel_ = consumes<reco::MuonCollection>(
parameters.getParameter<
edm::InputTag>(
"MuonCollection"));
29 theTriggerResultsLabel_ = consumes<TriggerResults>(
parameters.getParameter<
InputTag>(
"TriggerResultsLabel"));
38 chi2Bin =
parameters.getParameter<
int>(
"chi2Bin");
39 chi2Min =
parameters.getParameter<
double>(
"chi2Min");
41 phiBin =
parameters.getParameter<
int>(
"phiBin");
46 delete _SingleMuonEventFlag;
47 delete _DoubleMuonEventFlag;
51 cout <<
"[MuonRecoOneHLT] beginRun " << endl;
52 cout <<
"[MuonRecoOneHLT] Is MuonEventFlag On? " << _SingleMuonEventFlag->on() << endl;
58 muReco = ibooker.
book1D(
"Muon_Reco",
"Muon Reconstructed Tracks", 6, 1, 7);
60 muReco->setBinLabel(2,
"glb+sta");
61 muReco->setBinLabel(3,
"tk+sta");
62 muReco->setBinLabel(4,
"tk");
63 muReco->setBinLabel(5,
"sta");
64 muReco->setBinLabel(6,
"calo");
76 phiGlbTrack.push_back(ibooker.
book1D(histname +
"Glb_phi",
"#phi_{GLB}", phiBin,
phiMin,
phiMax));
78 phiGlbTrack.push_back(ibooker.
book1D(histname +
"Tk_phi",
"#phi_{TKfromGLB}", phiBin,
phiMin,
phiMax));
79 phiGlbTrack[1]->setAxisTitle(
"rad");
80 phiGlbTrack.push_back(ibooker.
book1D(histname +
"Sta_phi",
"#phi_{STAfromGLB}", phiBin,
phiMin,
phiMax));
81 phiGlbTrack[2]->setAxisTitle(
"rad");
89 chi2OvDFGlbTrack.push_back(
90 ibooker.
book1D(histname +
"Glb_chi2OverDf",
"#chi_{2}OverDF_{GLB}", chi2Bin, chi2Min,
chi2Max));
91 chi2OvDFGlbTrack.push_back(
92 ibooker.
book1D(histname +
"Tk_chi2OverDf",
"#chi_{2}OverDF_{TKfromGLB}", phiBin, chi2Min,
chi2Max));
93 chi2OvDFGlbTrack.push_back(
94 ibooker.
book1D(histname +
"Sta_chi2OverDf",
"#chi_{2}OverDF_{STAfromGLB}", chi2Bin, chi2Min,
chi2Max));
95 chi2OvDFTight = ibooker.
book1D(
"TightMuon_chi2OverDf",
"#chi_{2}OverDF_{GLB}", chi2Bin, chi2Min,
chi2Max);
96 chi2OvDFTrack = ibooker.
book1D(
"TkMuon_chi2OverDf",
"#chi_{2}OverDF_{TK}", chi2Bin, chi2Min,
chi2Max);
97 chi2OvDFStaTrack = ibooker.
book1D(
"StaMuon_chi2OverDf",
"#chi_{2}OverDF_{STA}", chi2Bin, chi2Min,
chi2Max);
100 ptGlbTrack.push_back(ibooker.
book1D(histname +
"Glb_pt",
"pt_{GLB}", ptBin,
ptMin,
ptMax));
102 ptGlbTrack.push_back(ibooker.
book1D(histname +
"Tk_pt",
"pt_{TKfromGLB}", ptBin,
ptMin,
ptMax));
103 ptGlbTrack[1]->setAxisTitle(
"GeV");
104 ptGlbTrack.push_back(ibooker.
book1D(histname +
"Sta_pt",
"pt_{STAfromGLB}", ptBin,
ptMin,
ptMax));
105 ptGlbTrack[2]->setAxisTitle(
"GeV");
113 if (_SingleMuonEventFlag->on())
114 _SingleMuonEventFlag->initRun(iRun, iSetup);
115 if (_DoubleMuonEventFlag->on())
116 _DoubleMuonEventFlag->initRun(iRun, iSetup);
118 if (_SingleMuonEventFlag->on() &&
119 _SingleMuonEventFlag->expressionsFromDB(_SingleMuonEventFlag->hltDBKey(), iSetup)[0] !=
"CONFIG_ERROR")
120 singlemuonExpr_ = _SingleMuonEventFlag->expressionsFromDB(_SingleMuonEventFlag->hltDBKey(), iSetup);
121 if (_DoubleMuonEventFlag->on() &&
122 _DoubleMuonEventFlag->expressionsFromDB(_DoubleMuonEventFlag->hltDBKey(), iSetup)[0] !=
"CONFIG_ERROR")
123 singlemuonExpr_ = _DoubleMuonEventFlag->expressionsFromDB(_DoubleMuonEventFlag->hltDBKey(), iSetup);
130 unsigned int theIndexOfThePrimaryVertex = 999.;
135 for (
unsigned int ind = 0; ind < vertex->size(); ++ind) {
136 if ((*vertex)[ind].isValid() && !((*vertex)[ind].isFake())) {
137 theIndexOfThePrimaryVertex = ind;
143 if (theIndexOfThePrimaryVertex < 100) {
144 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
145 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
147 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
150 iEvent.
getByToken(theBeamSpotLabel_, recoBeamSpotHandle);
156 errVtx(2, 2) = bs.
sigmaZ();
164 iEvent.
getByToken(theMuonCollectionLabel_, muons);
167 iEvent.
getByToken(theTriggerResultsLabel_, triggerResults);
174 std::map<float, const reco::Muon*> muonMap;
175 for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu != muons->end(); ++recoMu) {
176 muonMap[recoMu->pt()] = &*recoMu;
178 std::vector<const reco::Muon*> LeadingMuon;
179 for (std::map<float, const reco::Muon*>::reverse_iterator rit = muonMap.rbegin(); rit != muonMap.rend(); ++rit) {
180 LeadingMuon.push_back((*rit).second);
185 const unsigned int nTrig(triggerNames.
size());
186 bool _trig_SingleMu =
false;
187 bool _trig_DoubleMu =
false;
188 for (
unsigned int i = 0;
i < nTrig; ++
i) {
189 if (triggerNames.
triggerName(
i).find(singlemuonExpr_[0].substr(0, singlemuonExpr_[0].rfind(
"_v") + 2)) !=
191 triggerResults->accept(
i))
192 _trig_SingleMu =
true;
193 if (triggerNames.
triggerName(
i).find(doublemuonExpr_[0].substr(0, doublemuonExpr_[0].rfind(
"_v") + 2)) !=
195 triggerResults->accept(
i))
196 _trig_DoubleMu =
true;
199 cout <<
"[MuonRecoOneHLT] Trigger Fired ? " << (_trig_SingleMu || _trig_DoubleMu) << endl;
202 if (!_trig_SingleMu && !_trig_DoubleMu)
204 if (LeadingMuon.empty())
209 if ((*LeadingMuon[0]).isGlobalMuon()) {
210 LogTrace(
metname) <<
"[MuonRecoOneHLT] The mu is global - filling the histos";
211 if ((*LeadingMuon[0]).isTrackerMuon() && (*LeadingMuon[0]).isStandAloneMuon())
213 if (!((*LeadingMuon[0]).isTrackerMuon()) && (*LeadingMuon[0]).isStandAloneMuon())
215 if (!(*LeadingMuon[0]).isStandAloneMuon())
216 LogTrace(
metname) <<
"[MuonRecoOneHLT] ERROR: the mu is global but not standalone!";
219 reco::TrackRef recoCombinedGlbTrack = (*LeadingMuon[0]).combinedMuon();
225 etaGlbTrack[0]->Fill(recoCombinedGlbTrack->eta());
226 etaGlbTrack[1]->Fill(recoTkGlbTrack->eta());
227 etaGlbTrack[2]->Fill(recoStaGlbTrack->eta());
229 phiGlbTrack[0]->Fill(recoCombinedGlbTrack->phi());
230 phiGlbTrack[1]->Fill(recoTkGlbTrack->phi());
231 phiGlbTrack[2]->Fill(recoStaGlbTrack->phi());
233 chi2OvDFGlbTrack[0]->Fill(recoCombinedGlbTrack->normalizedChi2());
234 chi2OvDFGlbTrack[1]->Fill(recoTkGlbTrack->normalizedChi2());
235 chi2OvDFGlbTrack[2]->Fill(recoStaGlbTrack->normalizedChi2());
237 ptGlbTrack[0]->Fill(recoCombinedGlbTrack->pt());
238 ptGlbTrack[1]->Fill(recoTkGlbTrack->pt());
239 ptGlbTrack[2]->Fill(recoStaGlbTrack->pt());
243 LogTrace(
metname) <<
"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
245 reco::TrackRef recoCombinedGlbTrack = (*LeadingMuon[0]).combinedMuon();
247 etaTight->Fill(recoCombinedGlbTrack->eta());
248 phiTight->Fill(recoCombinedGlbTrack->phi());
249 chi2OvDFTight->Fill(recoCombinedGlbTrack->normalizedChi2());
250 ptTight->Fill(recoCombinedGlbTrack->pt());
254 if ((*LeadingMuon[0]).isTrackerMuon() && !((*LeadingMuon[0]).isGlobalMuon())) {
255 LogTrace(
metname) <<
"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
256 if ((*LeadingMuon[0]).isStandAloneMuon())
258 if (!((*LeadingMuon[0]).isStandAloneMuon()))
264 etaTrack->Fill(recoTrack->eta());
265 phiTrack->Fill(recoTrack->phi());
266 chi2OvDFTrack->Fill(recoTrack->normalizedChi2());
267 ptTrack->Fill(recoTrack->pt());
271 if ((*LeadingMuon[0]).isStandAloneMuon() && !((*LeadingMuon[0]).isGlobalMuon())) {
272 LogTrace(
metname) <<
"[MuonRecoOneHLT] The mu is STA only - filling the histos";
273 if (!((*LeadingMuon[0]).isTrackerMuon()))
279 etaStaTrack->Fill(recoStaTrack->eta());
280 phiStaTrack->Fill(recoStaTrack->phi());
281 chi2OvDFStaTrack->Fill(recoStaTrack->normalizedChi2());
282 ptStaTrack->Fill(recoStaTrack->pt());
285 if ((*LeadingMuon[0]).isCaloMuon() && !((*LeadingMuon[0]).isGlobalMuon()) && !((*LeadingMuon[0]).isTrackerMuon()) &&
286 !((*LeadingMuon[0]).isStandAloneMuon()))
__device__ WorkSpace float chi2Max
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::string metname
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...
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
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)
Log< level::Info, false > LogInfo
MuonRecoOneHLT(const edm::ParameterSet &)
Constructor.
std::string const & triggerName(unsigned int index) const
double sigmaZ() const
sigma z
T getParameter(std::string const &) const
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 &)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
int etaBin(const l1t::HGCalMulticluster *cl)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)