41 etacut_( pset.getParameter<double>(
"etacut" ) ),
42 ptcut_( pset.getParameter<double>(
"ptcut" ) ),
43 deltaRStacut_( pset.getParameter<double>(
"deltaRStacut" ) )
46 nMuMC =0; nMureco =0; nTrk=0; nSta=0; nNotMuMatching =0 ;
53 event.getByToken(zMuMuToken_, zMuMu);
57 event.getByToken(MuonsToken_, Muons);
60 event.getByToken(TracksToken_, Tracks);
63 event.getByToken(StandAloneToken_, StandAlone);
66 event.getByToken(MuonsMapToken_, MuonsMap);
69 event.getByToken(TracksMapToken_, TracksMap);
72 event.getByToken(StandAloneMapToken_, StandAloneMap);
75 event.getByToken(genParticlesToken_, genParticles);
78 for(
unsigned int k = 0;
k < genParticles->size();
k++ )
80 const Candidate & ZCand = (*genParticles)[
k ];
83 if (ZCand.
pdgId()==23&& status==3 )
105 if (muCandidate->
pdgId() == muCand2->
pdgId() )
112 double deltaR_Mu_Sta =0;
113 int nMurecoTemp = nMureco;
115 CandMatchMap::const_iterator
i;
116 for(i = MuonsMap->
begin(); i != MuonsMap->
end(); i++ )
119 if ((muCand1 == &mc) && (mc.
pt()>ptcut_) && (
std::abs(mc.
eta())<etacut_))
126 if (nMureco == nMurecoTemp )
132 CandMatchMap::const_iterator
l;
133 for(l = TracksMap->
begin(); l != TracksMap->
end(); l++ )
136 if (( muCand1 == & Trkmc) && (Trkmc.
pt()>ptcut_) && (
std::abs(Trkmc.
eta())<etacut_))
144 CandMatchMap::const_iterator
n;
145 for(n = StandAloneMap->
begin(); n != StandAloneMap->
end(); n++ )
148 if ((muCand1 == &Stamc ) && (Stamc.pt()>ptcut_) && (
std::abs(Stamc.eta())<etacut_))
152 deltaR_Mu_Sta =
deltaR(Stareco, *muCand1);
159 if ((nSta == nStaTemp + 1) && (nTrk == nTrkTemp + 1 ) )
162 if ((deltaR_Mu_Sta< deltaRStacut_))
164 v_.push_back(deltaR_Mu_Sta) ;
165 cout <<
"Not matching from trk and sta matched to MC mu, to reconstruct a recoMU" << endl;
178 cout <<
"--- nMuMC == "<<nMuMC<<endl;
179 cout <<
"--- nMureco == "<<nMureco<<endl;
180 cout <<
"--- nSta == "<<nSta<<endl;
181 cout <<
"--- nTrk == "<<nTrk<<endl;
182 cout <<
"--- nNotMuMatching from a trk and sta matched to a Mu MC == "<<nNotMuMatching<<endl;
185 cout<<
" effMu == "<<(double) nMureco/nMuMC<<endl;
186 cout<<
" effTrk == "<< (double)(nTrk + nMureco) /nMuMC<<endl;
187 cout<<
" effSta == "<< (double)(nSta + nMureco) / nMuMC<<endl;
190 vector< int >::const_iterator
p2;
191 for (
unsigned int i =0 ;
i < v_.size(); ++
i )
193 cout<<
" delta R Mu Sta == "<< v_[
i]<<endl;
212 int nMuMC, nMureco,
nTrk, nSta, nNotMuMatching;
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
EDGetTokenT< CandidateCollection > TracksToken_
const_iterator end() const
last iterator over the map (read only)
#define DEFINE_FWK_MODULE(type)
MCEfficiencyAnalyzer(const edm::ParameterSet &pset)
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
EDGetTokenT< CandidateCollection > zMuMuToken_
def setup(process, global_tag, zero_tesla=False)
EDGetTokenT< CandidateCollection > StandAloneToken_
virtual int status() const =0
status word
EDGetTokenT< CandMatchMap > TracksMapToken_
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
double deltaR(double eta1, double eta2, double phi1, double phi2)
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
virtual double eta() const =0
momentum pseudorapidity
virtual double pt() const =0
transverse momentum
EDGetTokenT< CandMatchMap > StandAloneMapToken_
EDGetTokenT< CandMatchMap > MuonsMapToken_
EDGetTokenT< GenParticleCollection > genParticlesToken_
const_iterator begin() const
first iterator over the map (read only)
EDGetTokenT< CandidateCollection > MuonsToken_
virtual size_type numberOfDaughters() const =0
number of daughters