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"));
35 etaBin =
parameters.getParameter<
int>(
"etaBin");
40 ptMax =
parameters.getParameter<
double>(
"ptMax");
41 chi2Bin =
parameters.getParameter<
int>(
"chi2Bin");
42 chi2Min =
parameters.getParameter<
double>(
"chi2Min");
43 chi2Max =
parameters.getParameter<
double>(
"chi2Max");
44 phiBin =
parameters.getParameter<
int>(
"phiBin");
45 phiMin =
parameters.getParameter<
double>(
"phiMin");
46 phiMax =
parameters.getParameter<
double>(
"phiMax");
50 delete _SingleMuonEventFlag;
51 delete _DoubleMuonEventFlag;
57 cout <<
"[MuonRecoOneHLT] beginRun " << endl;
58 cout <<
"[MuonRecoOneHLT] Is MuonEventFlag On? "<< _SingleMuonEventFlag->on() << endl;
64 muReco = ibooker.
book1D(
"Muon_Reco",
"Muon Reconstructed Tracks", 6, 1, 7);
66 muReco->setBinLabel(2,
"glb+sta");
67 muReco->setBinLabel(3,
"tk+sta");
68 muReco->setBinLabel(4,
"tk");
69 muReco->setBinLabel(5,
"sta");
70 muReco->setBinLabel(6,
"calo");
74 etaGlbTrack.push_back(ibooker.
book1D(histname+
"Glb_eta",
"#eta_{GLB}", etaBin,
etaMin,
etaMax));
75 etaGlbTrack.push_back(ibooker.
book1D(histname+
"Tk_eta",
"#eta_{TKfromGLB}", etaBin,
etaMin,
etaMax));
76 etaGlbTrack.push_back(ibooker.
book1D(histname+
"Sta_eta",
"#eta_{STAfromGLB}", etaBin,
etaMin,
etaMax));
82 phiGlbTrack.push_back(ibooker.
book1D(histname+
"Glb_phi",
"#phi_{GLB}", phiBin, phiMin, phiMax));
84 phiGlbTrack.push_back(ibooker.
book1D(histname+
"Tk_phi",
"#phi_{TKfromGLB}", phiBin, phiMin, phiMax));
85 phiGlbTrack[1]->setAxisTitle(
"rad");
86 phiGlbTrack.push_back(ibooker.
book1D(histname+
"Sta_phi",
"#phi_{STAfromGLB}", phiBin, phiMin, phiMax));
87 phiGlbTrack[2]->setAxisTitle(
"rad");
88 phiTight = ibooker.
book1D(
"TightMuon_phi",
"#phi_{GLB}", phiBin, phiMin, phiMax);
89 phiTrack = ibooker.
book1D(
"TkMuon_phi",
"#phi_{TK}", phiBin, phiMin, phiMax);
91 phiStaTrack = ibooker.
book1D(
"StaMuon_phi",
"#phi_{STA}", phiBin, phiMin, phiMax);
95 chi2OvDFGlbTrack.push_back(ibooker.
book1D(histname+
"Glb_chi2OverDf",
"#chi_{2}OverDF_{GLB}", chi2Bin, chi2Min, chi2Max));
96 chi2OvDFGlbTrack.push_back(ibooker.
book1D(histname+
"Tk_chi2OverDf",
"#chi_{2}OverDF_{TKfromGLB}", phiBin, chi2Min, chi2Max));
97 chi2OvDFGlbTrack.push_back(ibooker.
book1D(histname+
"Sta_chi2OverDf",
"#chi_{2}OverDF_{STAfromGLB}", chi2Bin, chi2Min, chi2Max));
98 chi2OvDFTight = ibooker.
book1D(
"TightMuon_chi2OverDf",
"#chi_{2}OverDF_{GLB}", chi2Bin, chi2Min, chi2Max);
99 chi2OvDFTrack = ibooker.
book1D(
"TkMuon_chi2OverDf",
"#chi_{2}OverDF_{TK}", chi2Bin, chi2Min, chi2Max);
100 chi2OvDFStaTrack = ibooker.
book1D(
"StaMuon_chi2OverDf",
"#chi_{2}OverDF_{STA}", chi2Bin, chi2Min, chi2Max);
103 ptGlbTrack.push_back(ibooker.
book1D(histname+
"Glb_pt",
"pt_{GLB}", ptBin,
ptMin, ptMax));
105 ptGlbTrack.push_back(ibooker.
book1D(histname+
"Tk_pt",
"pt_{TKfromGLB}", ptBin,
ptMin, ptMax));
106 ptGlbTrack[1]->setAxisTitle(
"GeV");
107 ptGlbTrack.push_back(ibooker.
book1D(histname+
"Sta_pt",
"pt_{STAfromGLB}", ptBin,
ptMin, ptMax));
108 ptGlbTrack[2]->setAxisTitle(
"GeV");
109 ptTight = ibooker.
book1D(
"TightMuon_pt",
"pt_{GLB}", ptBin,
ptMin, ptMax);
111 ptTrack = ibooker.
book1D(
"TkMuon_pt",
"pt_{TK}", ptBin,
ptMin, ptMax);
113 ptStaTrack = ibooker.
book1D(
"StaMuon_pt",
"pt_{STA}", ptBin,
ptMin, ptMax);
116 if ( _SingleMuonEventFlag->on() ) _SingleMuonEventFlag->initRun( iRun, iSetup );
117 if ( _DoubleMuonEventFlag->on() ) _DoubleMuonEventFlag->initRun( iRun, iSetup );
119 if (_SingleMuonEventFlag->on() && _SingleMuonEventFlag->expressionsFromDB(_SingleMuonEventFlag->hltDBKey(), iSetup)[0] !=
"CONFIG_ERROR")
120 singlemuonExpr_ = _SingleMuonEventFlag->expressionsFromDB(_SingleMuonEventFlag->hltDBKey(),iSetup);
121 if (_DoubleMuonEventFlag->on() && _DoubleMuonEventFlag->expressionsFromDB(_DoubleMuonEventFlag->hltDBKey(), iSetup)[0] !=
"CONFIG_ERROR")
122 singlemuonExpr_ = _DoubleMuonEventFlag->expressionsFromDB(_DoubleMuonEventFlag->hltDBKey(),iSetup);
125 theService->update(iSetup);
131 unsigned int theIndexOfThePrimaryVertex = 999.;
136 for (
unsigned int ind=0; ind<vertex->size(); ++ind) {
137 if ( (*vertex)[ind].isValid() && !((*vertex)[ind].isFake()) ) {
138 theIndexOfThePrimaryVertex = ind;
144 if (theIndexOfThePrimaryVertex<100) {
145 posVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
position();
146 errVtx = ((*vertex)[theIndexOfThePrimaryVertex]).
error();
149 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
152 iEvent.
getByToken(theBeamSpotLabel_,recoBeamSpotHandle);
158 errVtx(2,2) = bs.
sigmaZ();
167 iEvent.
getByToken(theMuonCollectionLabel_,muons);
170 iEvent.
getByToken(theTriggerResultsLabel_, triggerResults);
176 std::map<float,const reco::Muon*> muonMap;
177 for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu!=muons->end(); ++recoMu){
178 muonMap[recoMu->pt()] = &*recoMu;
180 std::vector<const reco::Muon*> LeadingMuon;
181 for( std::map<float,const reco::Muon*>::reverse_iterator rit=muonMap.rbegin(); rit!=muonMap.rend(); ++rit){
182 LeadingMuon.push_back( (*rit).second );
187 const unsigned int nTrig(triggerNames.
size());
188 bool _trig_SingleMu =
false;
189 bool _trig_DoubleMu =
false;
190 for (
unsigned int i=0;
i<nTrig;++
i){
191 if (triggerNames.
triggerName(
i).find(singlemuonExpr_[0].substr(0,singlemuonExpr_[0].rfind(
"_v")+2))!=std::string::npos && triggerResults->accept(
i))
192 _trig_SingleMu =
true;
193 if (triggerNames.
triggerName(
i).find(doublemuonExpr_[0].substr(0,doublemuonExpr_[0].rfind(
"_v")+2))!=std::string::npos && triggerResults->accept(
i))
194 _trig_DoubleMu =
true;
197 cout <<
"[MuonRecoOneHLT] Trigger Fired ? "<< (_trig_SingleMu || _trig_DoubleMu) << endl;
200 if (!_trig_SingleMu && !_trig_DoubleMu)
return;
201 if (LeadingMuon.size() == 0)
return;
205 if((*LeadingMuon[0]).isGlobalMuon()) {
206 LogTrace(
metname)<<
"[MuonRecoOneHLT] The mu is global - filling the histos";
207 if((*LeadingMuon[0]).isTrackerMuon() && (*LeadingMuon[0]).isStandAloneMuon()) muReco->Fill(1);
208 if(!((*LeadingMuon[0]).isTrackerMuon()) && (*LeadingMuon[0]).isStandAloneMuon()) muReco->Fill(2);
209 if(!(*LeadingMuon[0]).isStandAloneMuon())
210 LogTrace(
metname)<<
"[MuonRecoOneHLT] ERROR: the mu is global but not standalone!";
213 reco::TrackRef recoCombinedGlbTrack = (*LeadingMuon[0]).combinedMuon();
219 etaGlbTrack[0]->Fill(recoCombinedGlbTrack->eta());
220 etaGlbTrack[1]->Fill(recoTkGlbTrack->eta());
221 etaGlbTrack[2]->Fill(recoStaGlbTrack->eta());
223 phiGlbTrack[0]->Fill(recoCombinedGlbTrack->phi());
224 phiGlbTrack[1]->Fill(recoTkGlbTrack->phi());
225 phiGlbTrack[2]->Fill(recoStaGlbTrack->phi());
227 chi2OvDFGlbTrack[0]->Fill(recoCombinedGlbTrack->normalizedChi2());
228 chi2OvDFGlbTrack[1]->Fill(recoTkGlbTrack->normalizedChi2());
229 chi2OvDFGlbTrack[2]->Fill(recoStaGlbTrack->normalizedChi2());
231 ptGlbTrack[0]->Fill(recoCombinedGlbTrack->pt());
232 ptGlbTrack[1]->Fill(recoTkGlbTrack->pt());
233 ptGlbTrack[2]->Fill(recoStaGlbTrack->pt());
238 LogTrace(
metname)<<
"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
240 reco::TrackRef recoCombinedGlbTrack = (*LeadingMuon[0]).combinedMuon();
242 etaTight->Fill(recoCombinedGlbTrack->eta());
243 phiTight->Fill(recoCombinedGlbTrack->phi());
244 chi2OvDFTight->Fill(recoCombinedGlbTrack->normalizedChi2());
245 ptTight->Fill(recoCombinedGlbTrack->pt());
249 if((*LeadingMuon[0]).isTrackerMuon() && !((*LeadingMuon[0]).isGlobalMuon())) {
250 LogTrace(
metname)<<
"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
251 if((*LeadingMuon[0]).isStandAloneMuon()) muReco->Fill(3);
252 if(!((*LeadingMuon[0]).isStandAloneMuon())) muReco->Fill(4);
257 etaTrack->Fill(recoTrack->eta());
258 phiTrack->Fill(recoTrack->phi());
259 chi2OvDFTrack->Fill(recoTrack->normalizedChi2());
260 ptTrack->Fill(recoTrack->pt());
264 if((*LeadingMuon[0]).isStandAloneMuon() && !((*LeadingMuon[0]).isGlobalMuon())) {
265 LogTrace(
metname)<<
"[MuonRecoOneHLT] The mu is STA only - filling the histos";
266 if(!((*LeadingMuon[0]).isTrackerMuon())) muReco->Fill(5);
271 etaStaTrack->Fill(recoStaTrack->eta());
272 phiStaTrack->Fill(recoStaTrack->phi());
273 chi2OvDFStaTrack->Fill(recoStaTrack->normalizedChi2());
274 ptStaTrack->Fill(recoStaTrack->pt());
277 if((*LeadingMuon[0]).isCaloMuon() && !((*LeadingMuon[0]).isGlobalMuon()) && !((*LeadingMuon[0]).isTrackerMuon()) && !((*LeadingMuon[0]).isStandAloneMuon()))
T getParameter(std::string const &) const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
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 &)
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)
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
MonitorElement * book1D(Args &&...args)
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
static std::string const triggerResults
~MuonRecoOneHLT()
Destructor.
void setCurrentFolder(const std::string &fullpath)
MuonRecoOneHLT(const edm::ParameterSet &)
Constructor.
std::string const & triggerName(unsigned int index) const
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 &)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)