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();
148 LogInfo(
"RecoMuonValidator") <<
"reco::PrimaryVertex not found, use BeamSpot position instead\n";
157 errVtx(2,2) = bs.
sigmaZ();
175 std::map<float,reco::Muon> muonMap;
176 for (reco::MuonCollection::const_iterator recoMu = muons->begin(); recoMu!=muons->end(); ++recoMu){
177 muonMap[recoMu->pt()] = *recoMu;
179 std::vector<reco::Muon> LeadingMuon;
180 for( std::map<float,reco::Muon>::reverse_iterator rit=muonMap.rbegin(); rit!=muonMap.rend(); ++rit){
181 LeadingMuon.push_back( (*rit).second );
186 const unsigned int nTrig(triggerNames.
size());
187 bool _trig_SingleMu =
false;
188 bool _trig_DoubleMu =
false;
189 for (
unsigned int i=0;
i<nTrig;++
i){
191 _trig_SingleMu =
true;
193 _trig_DoubleMu =
true;
196 cout <<
"[MuonRecoOneHLT] Trigger Fired ? "<< (_trig_SingleMu || _trig_DoubleMu) << endl;
199 if (!_trig_SingleMu && !_trig_DoubleMu)
return;
200 if (LeadingMuon.size() == 0)
return;
204 if(LeadingMuon[0].isGlobalMuon()) {
205 LogTrace(
metname)<<
"[MuonRecoOneHLT] The mu is global - filling the histos";
206 if(LeadingMuon[0].isTrackerMuon() && LeadingMuon[0].isStandAloneMuon())
muReco->
Fill(1);
207 if(!(LeadingMuon[0].isTrackerMuon()) && LeadingMuon[0].isStandAloneMuon())
muReco->
Fill(2);
208 if(!LeadingMuon[0].isStandAloneMuon())
209 LogTrace(
metname)<<
"[MuonRecoOneHLT] ERROR: the mu is global but not standalone!";
212 reco::TrackRef recoCombinedGlbTrack = LeadingMuon[0].combinedMuon();
230 ptGlbTrack[0]->Fill(recoCombinedGlbTrack->pt());
237 LogTrace(
metname)<<
"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
239 reco::TrackRef recoCombinedGlbTrack = LeadingMuon[0].combinedMuon();
248 if(LeadingMuon[0].isTrackerMuon() && !(LeadingMuon[0].isGlobalMuon())) {
249 LogTrace(
metname)<<
"[MuonRecoOneHLT] The mu is tracker only - filling the histos";
250 if(LeadingMuon[0].isStandAloneMuon())
muReco->
Fill(3);
251 if(!(LeadingMuon[0].isStandAloneMuon()))
muReco->
Fill(4);
263 if(LeadingMuon[0].isStandAloneMuon() && !(LeadingMuon[0].isGlobalMuon())) {
264 LogTrace(
metname)<<
"[MuonRecoOneHLT] The mu is STA only - filling the histos";
265 if(!(LeadingMuon[0].isTrackerMuon()))
muReco->
Fill(5);
276 if(LeadingMuon[0].isCaloMuon() && !(LeadingMuon[0].isGlobalMuon()) && !(LeadingMuon[0].isTrackerMuon()) && !(LeadingMuon[0].isStandAloneMuon()))
edm::EDGetTokenT< edm::TriggerResults > theTriggerResultsLabel_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
MonitorElement * phiTight
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotLabel_
MonitorElement * chi2OvDFTrack
edm::EDGetTokenT< reco::VertexCollection > theVertexLabel_
math::Error< dimension >::type Error
covariance error matrix (3x3)
Strings::size_type size() const
MonitorElement * etaTight
MonitorElement * etaStaTrack
std::vector< std::string > doublemuonExpr_
MonitorElement * chi2OvDFStaTrack
math::XYZPoint Point
point in the space
double BeamWidthX() const
beam width X
std::vector< MonitorElement * > phiGlbTrack
static std::string const triggerResults
MonitorElement * ptStaTrack
std::vector< std::string > singlemuonExpr_
std::vector< MonitorElement * > ptGlbTrack
MonitorElement * etaTrack
std::vector< MonitorElement * > etaGlbTrack
MonitorElement * phiTrack
edm::EDGetTokenT< reco::MuonCollection > theMuonCollectionLabel_
std::string const & triggerName(unsigned int index) const
double sigmaZ() const
sigma z
double BeamWidthY() const
beam width Y
MuonServiceProxy * theService
static int position[264][3]
MonitorElement * phiStaTrack
const Point & position() const
position
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
MonitorElement * chi2OvDFTight
std::vector< MonitorElement * > chi2OvDFGlbTrack