Public Member Functions | |
virtual void | analyze (const edm::Event &event, const edm::EventSetup &setup) |
virtual void | endJob () |
MCEfficiencyAnalyzer (const edm::ParameterSet &pset) | |
Private Attributes | |
double | deltaRStacut_ |
double | etacut_ |
InputTag | genParticles_ |
InputTag | Muons_ |
InputTag | MuonsMap_ |
int | nMuMC |
int | nMureco |
int | nNotMuMatching |
int | nSta |
int | nTrk |
double | ptcut_ |
InputTag | StandAlone_ |
InputTag | StandAloneMap_ |
InputTag | Tracks_ |
InputTag | TracksMap_ |
vector< double > | v_ |
InputTag | zMuMu_ |
Definition at line 29 of file MC_Efficiency_Analyzer.cc.
MCEfficiencyAnalyzer::MCEfficiencyAnalyzer | ( | const edm::ParameterSet & | pset | ) | [inline] |
Definition at line 32 of file MC_Efficiency_Analyzer.cc.
References nMuMC, nMureco, nNotMuMatching, nSta, and nTrk.
00032 : 00033 zMuMu_( pset.getParameter<InputTag>( "zMuMu" ) ), 00034 Muons_( pset.getParameter<InputTag>( "Muons" ) ), 00035 MuonsMap_( pset.getParameter<InputTag>( "MuonsMap" ) ), 00036 Tracks_( pset.getParameter<InputTag>( "Tracks" ) ), 00037 TracksMap_( pset.getParameter<InputTag>( "TracksMap" ) ), 00038 genParticles_( pset.getParameter<InputTag>( "genParticles" ) ), 00039 StandAlone_( pset.getParameter<InputTag>( "StandAlone" ) ), 00040 StandAloneMap_( pset.getParameter<InputTag>( "StandAloneMap" ) ), 00041 etacut_( pset.getParameter<double>( "etacut" ) ), 00042 ptcut_( pset.getParameter<double>( "ptcut" ) ), 00043 deltaRStacut_( pset.getParameter<double>( "deltaRStacut" ) ) 00044 00045 { 00046 nMuMC =0; nMureco =0; nTrk=0; nSta=0; nNotMuMatching =0 ; 00047 }
virtual void MCEfficiencyAnalyzer::analyze | ( | const edm::Event & | event, | |
const edm::EventSetup & | setup | |||
) | [inline, virtual] |
Implements edm::EDAnalyzer.
Definition at line 49 of file MC_Efficiency_Analyzer.cc.
References funct::abs(), GenMuonPlsPt100GeV_cfg::cout, d, reco::Candidate::daughter(), deltaR(), deltaRStacut_, e, lat::endl(), reco::Particle::eta(), etacut_, genParticles_cfi::genParticles, genParticles_, i, k, getDQMSummary::key, edm::es::l(), Muons_, MuonsMap_, n, nMuMC, nMureco, nNotMuMatching, nSta, nTrk, reco::Candidate::numberOfDaughters(), reco::Particle::pdgId(), reco::Particle::pt(), ptcut_, StandAlone_, StandAloneMap_, StDecayID::status, reco::Particle::status(), Tracks_, TracksMap_, v_, and zMuMu_.
00050 { 00051 00052 Handle<CandidateCollection> zMuMu; 00053 event.getByLabel(zMuMu_, zMuMu); 00054 00055 00056 Handle<CandidateCollection> Muons; 00057 event.getByLabel(Muons_, Muons); 00058 00059 Handle<CandidateCollection> Tracks; 00060 event.getByLabel(Tracks_, Tracks); 00061 00062 Handle<CandidateCollection> StandAlone; 00063 event.getByLabel(StandAlone_, StandAlone); 00064 00065 Handle<CandMatchMap> MuonsMap; 00066 event.getByLabel(MuonsMap_, MuonsMap); 00067 00068 Handle<CandMatchMap> TracksMap; 00069 event.getByLabel(TracksMap_, TracksMap); 00070 00071 Handle<CandMatchMap> StandAloneMap; 00072 event.getByLabel(StandAloneMap_, StandAloneMap); 00073 00074 Handle<GenParticleCollection> genParticles; 00075 event.getByLabel(genParticles_, genParticles); 00076 00077 //Getting muons from Z MC 00078 for( size_t k = 0; k < genParticles->size(); k++ ) 00079 { 00080 const Candidate & ZCand = (*genParticles)[ k ]; 00081 int status = ZCand.status(); 00082 00083 if (ZCand.pdgId()==23&& status==3 ) 00084 { 00085 // positive muons 00086 const Candidate * muCand1 = ZCand.daughter(0); 00087 if (muCand1->status()==3) 00088 { 00089 for (uint d =0 ; d< muCand1->numberOfDaughters(); d++) 00090 { 00091 const Candidate * muCandidate = muCand1->daughter(d); 00092 if (muCandidate->pdgId() == muCand1->pdgId() ) 00093 { 00094 muCand1 = muCand1->daughter(d); 00095 } 00096 } 00097 } 00098 // negative muons 00099 const Candidate * muCand2 = ZCand.daughter(1); 00100 if (muCand2->status()==3) 00101 { 00102 for (uint e =0 ; e< muCand2->numberOfDaughters(); e++) 00103 { 00104 const Candidate * muCandidate = muCand2->daughter(e); 00105 if (muCandidate->pdgId() == muCand2->pdgId() ) 00106 { 00107 muCand2 = muCand2->daughter(e); 00108 } 00109 } 00110 } 00111 00112 double deltaR_Mu_Sta =0; 00113 int nMurecoTemp = nMureco; 00114 // getting mu matched 00115 CandMatchMap::const_iterator i; 00116 for(i = MuonsMap->begin(); i != MuonsMap->end(); i++ ) 00117 { 00118 const Candidate/* & reco = * i -> key,*/ & mc = * i -> val; 00119 if ((muCand1 == &mc) && (mc.pt()>ptcut_) && (abs(mc.eta()<etacut_))) 00120 { 00121 nMuMC++; 00122 nMureco++; 00123 break; 00124 } 00125 } 00126 if (nMureco == nMurecoTemp ) // I.E. MU RECO NOT FOUND!!!! 00127 { 00128 int nTrkTemp = nTrk; 00129 int nStaTemp = nSta; 00130 00131 // getting tracks matched and doing the same, CONTROLLING IF MU IS RECONSTRUCTED AS A TRACK AND NOT AS A MU 00132 CandMatchMap::const_iterator l; 00133 for(l = TracksMap->begin(); l != TracksMap->end(); l++ ) 00134 { 00135 const Candidate /* & Trkreco = * l -> key, */ & Trkmc = * l -> val; 00136 if (( muCand1 == & Trkmc) && (Trkmc.pt()>ptcut_) && (abs(Trkmc.eta()<etacut_))) 00137 { 00138 nMuMC++; 00139 nTrk++; 00140 break; 00141 } 00142 } 00143 // the same for standalone 00144 CandMatchMap::const_iterator n; 00145 for(n = StandAloneMap->begin(); n != StandAloneMap->end(); n++ ) 00146 { 00147 const Candidate & Stareco = * n -> key, & Stamc = * n -> val; 00148 if ((muCand1 == &Stamc ) && (Stamc.pt()>ptcut_) && (abs(Stamc.eta()<etacut_))) 00149 { 00150 nMuMC++; 00151 nSta++; 00152 deltaR_Mu_Sta = deltaR(Stareco, *muCand1); 00153 00154 // cout<<"Ho trovato un sta reco "<<endl; 00155 break; 00156 } 00157 } 00158 // controlling if sta and trk are reconstrucetd both, and if so the get the deltaR beetween muon MC and reco sta, to controll correlation to this happening 00159 if ((nSta == nStaTemp + 1) && (nTrk == nTrkTemp + 1 ) ) 00160 { 00161 nNotMuMatching ++; 00162 if ((deltaR_Mu_Sta< deltaRStacut_)) 00163 { 00164 v_.push_back(deltaR_Mu_Sta) ; 00165 cout << "Not matching from trk and sta matched to MC mu, to reconstruct a recoMU" << endl; 00166 } 00167 } 00168 } 00169 } 00170 } 00171 }
Reimplemented from edm::EDAnalyzer.
Definition at line 174 of file MC_Efficiency_Analyzer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, nMuMC, nMureco, nNotMuMatching, nSta, nTrk, p2, and v_.
00175 { 00176 00177 00178 cout <<"--- nMuMC == "<<nMuMC<<endl; 00179 cout <<"--- nMureco == "<<nMureco<<endl; 00180 cout <<"--- nSta == "<<nSta<<endl; 00181 cout <<"--- nTrk == "<<nTrk<<endl; 00182 cout <<"--- nNotMuMatching from a trk and sta matched to a Mu MC == "<<nNotMuMatching<<endl; 00183 if (nMuMC!=0 ) 00184 { 00185 cout<<" effMu == "<<(double) nMureco/nMuMC<<endl; 00186 cout<<" effTrk == "<< (double)(nTrk + nMureco) /nMuMC<<endl; 00187 cout<<" effSta == "<< (double)(nSta + nMureco) / nMuMC<<endl; 00188 } 00189 00190 vector< int >::const_iterator p2; 00191 for (uint i =0 ; i < v_.size(); ++i ) 00192 { 00193 cout<<" delta R Mu Sta == "<< v_[i]<<endl; 00194 } 00195 }
double MCEfficiencyAnalyzer::deltaRStacut_ [private] |
double MCEfficiencyAnalyzer::etacut_ [private] |
InputTag MCEfficiencyAnalyzer::genParticles_ [private] |
InputTag MCEfficiencyAnalyzer::Muons_ [private] |
InputTag MCEfficiencyAnalyzer::MuonsMap_ [private] |
int MCEfficiencyAnalyzer::nMuMC [private] |
Definition at line 205 of file MC_Efficiency_Analyzer.cc.
Referenced by analyze(), endJob(), and MCEfficiencyAnalyzer().
int MCEfficiencyAnalyzer::nMureco [private] |
Definition at line 205 of file MC_Efficiency_Analyzer.cc.
Referenced by analyze(), endJob(), and MCEfficiencyAnalyzer().
int MCEfficiencyAnalyzer::nNotMuMatching [private] |
Definition at line 205 of file MC_Efficiency_Analyzer.cc.
Referenced by analyze(), endJob(), and MCEfficiencyAnalyzer().
int MCEfficiencyAnalyzer::nSta [private] |
Definition at line 205 of file MC_Efficiency_Analyzer.cc.
Referenced by analyze(), endJob(), and MCEfficiencyAnalyzer().
int MCEfficiencyAnalyzer::nTrk [private] |
Definition at line 205 of file MC_Efficiency_Analyzer.cc.
Referenced by analyze(), endJob(), and MCEfficiencyAnalyzer().
double MCEfficiencyAnalyzer::ptcut_ [private] |
InputTag MCEfficiencyAnalyzer::StandAlone_ [private] |
InputTag MCEfficiencyAnalyzer::StandAloneMap_ [private] |
InputTag MCEfficiencyAnalyzer::Tracks_ [private] |
InputTag MCEfficiencyAnalyzer::TracksMap_ [private] |
vector<double> MCEfficiencyAnalyzer::v_ [private] |
InputTag MCEfficiencyAnalyzer::zMuMu_ [private] |