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";
153 posVtx =
bs.position();
154 errVtx(0, 0) =
bs.BeamWidthX();
155 errVtx(1, 1) =
bs.BeamWidthY();
156 errVtx(2, 2) =
bs.sigmaZ();
170 if (!
muons.isValid())
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);
186 bool _trig_SingleMu =
false;
187 bool _trig_DoubleMu =
false;
188 for (
unsigned int i = 0;
i < nTrig; ++
i) {
192 _trig_SingleMu =
true;
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();
237 ptGlbTrack[0]->Fill(recoCombinedGlbTrack->pt());
243 LogTrace(
metname) <<
"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
245 reco::TrackRef recoCombinedGlbTrack = (*LeadingMuon[0]).combinedMuon();
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()))
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()))
285 if ((*LeadingMuon[0]).isCaloMuon() && !((*LeadingMuon[0]).isGlobalMuon()) && !((*LeadingMuon[0]).isTrackerMuon()) &&
286 !((*LeadingMuon[0]).isStandAloneMuon()))