CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
gamma_radiative_analyzer Class Reference
Inheritance diagram for gamma_radiative_analyzer:
edm::EDAnalyzer

Public Member Functions

 gamma_radiative_analyzer (const edm::ParameterSet &pset)
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup)
 
virtual void endJob ()
 

Private Attributes

double dRTrk_
 
double dRVeto_
 
bool FSR_mu
 
bool FSR_mu0
 
bool FSR_mu1
 
bool FSR_tk
 
TH2D * h_gamma_pt_eta_
 
TH2D * h_mu_pt_eta_FSR_
 
TH2D * h_mu_pt_eta_no_FSR_
 
int numOfEvent
 
int numofGamma
 
double ptThreshold_
 
int zmmcounter
 
int zmscounter
 
int zmtcounter
 
edm::InputTag zMuMu_
 
edm::InputTag zMuMuMatchMap_
 
edm::InputTag zMuSa_
 
edm::InputTag zMuSaMatchMap_
 
edm::InputTag zMuTk_
 
edm::InputTag zMuTkMatchMap_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 51 of file gamma_radiative_analysis.cc.

Constructor & Destructor Documentation

gamma_radiative_analyzer::gamma_radiative_analyzer ( const edm::ParameterSet pset)

Definition at line 73 of file gamma_radiative_analysis.cc.

References h_gamma_pt_eta_, h_mu_pt_eta_FSR_, h_mu_pt_eta_no_FSR_, TFileDirectory::make(), numOfEvent, numofGamma, zmmcounter, zmscounter, and zmtcounter.

73  :
74  zMuMu_(pset.getParameter<InputTag>("zMuMu")),
75  zMuMuMatchMap_(pset.getParameter<InputTag>("zMuMuMatchMap")),
76  zMuTk_(pset.getParameter<InputTag>("zMuTk")),
77  zMuTkMatchMap_(pset.getParameter<InputTag>("zMuTkMatchMap")),
78  zMuSa_(pset.getParameter<InputTag>("zMuSa")),
79  zMuSaMatchMap_(pset.getParameter<InputTag>("zMuSaMatchMap")){
80  zmmcounter=0;
81  zmscounter=0;
82  zmtcounter=0;
83  numOfEvent=0;
84  numofGamma=0;
86 
87  // general histograms
88  h_gamma_pt_eta_= fs->make<TH2D>("h_gamma_pt_eta","pt vs eta of gamma",100,20,100,100,-2.0,2.0);
89  h_mu_pt_eta_FSR_= fs->make<TH2D>("h_mu_pt_eta_FSR","pt vs eta of muon with FSR",100,20,100,100,-2.0,2.0 );
90  h_mu_pt_eta_no_FSR_= fs->make<TH2D>("h_mu_pt_eta_no_FSR","pt vs eta of of muon withot FSR",100,20,100,100,-2.0,2.0);
91 }
T getParameter(std::string const &) const
T * make() const
make new ROOT object

Member Function Documentation

void gamma_radiative_analyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 93 of file gamma_radiative_analysis.cc.

References abs, reco::Candidate::daughter(), reco::Candidate::eta(), reco::LeafCandidate::eta(), FSR_mu, FSR_mu0, FSR_mu1, FSR_tk, pat::Lepton< LeptonType >::genLepton(), pat::PATObject< ObjectType >::genParticle(), h_gamma_pt_eta_, h_mu_pt_eta_FSR_, h_mu_pt_eta_no_FSR_, i, edm::Ref< C, T, F >::isNonnull(), j, reco::Candidate::mass(), reco::Candidate::masterClone(), reco::CompositeRefCandidateT< D >::mother(), reco::Candidate::numberOfDaughters(), numOfEvent, numofGamma, reco::Candidate::pdgId(), reco::Candidate::pt(), reco::LeafCandidate::pt(), zmmcounter, zmscounter, zmtcounter, ZMuMuAnalysisNtupler_cff::zMuMu, zMuMu_, zMuMuMatchMap_, ZMuMuAnalysisNtupler_cff::zMuSa, zMuSa_, zMuSaMatchMap_, zMuTk_, and zMuTkMatchMap_.

93  {
94  Handle<CandidateView> zMuMu; //Collection of Z made by Mu global + Mu global
95  Handle<GenParticleMatch> zMuMuMatchMap; //Map of Z made by Mu global + Mu global with MC
96  event.getByLabel(zMuMu_, zMuMu);
97  Handle<CandidateView> zMuTk; //Collection of Z made by Mu global + Track
98  Handle<GenParticleMatch> zMuTkMatchMap;
99  event.getByLabel(zMuTk_, zMuTk);
100  Handle<CandidateView> zMuSa; //Collection of Z made by Mu global + Sa
101  Handle<GenParticleMatch> zMuSaMatchMap;
102  event.getByLabel(zMuSa_, zMuSa);
103  numOfEvent++;
104  // ZMuMu
105  if (zMuMu->size() > 0 ) {
106  event.getByLabel(zMuMuMatchMap_, zMuMuMatchMap);
107  for(unsigned int i = 0; i < zMuMu->size(); ++i) { //loop on candidates
108 
109  const Candidate & zMuMuCand = (*zMuMu)[i]; //the candidate
110  CandidateBaseRef zMuMuCandRef = zMuMu->refAt(i);
111 
112 
113  CandidateBaseRef dau0 = zMuMuCand.daughter(0)->masterClone();
114  CandidateBaseRef dau1 = zMuMuCand.daughter(1)->masterClone();
115  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0);//cast in patMuon
116  const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
117 
118  double zmass= zMuMuCand.mass();
119  double pt0 = mu0.pt();
120  double pt1 = mu1.pt();
121  double eta0 = mu0.eta();
122  double eta1 = mu1.eta();
123  if(pt0>20 && pt1 > 20 && abs(eta0)<2 && abs(eta1)<2 && zmass > 20 && zmass < 200){
124  GenParticleRef zMuMuMatch = (*zMuMuMatchMap)[zMuMuCandRef];
125  if(zMuMuMatch.isNonnull()) { // ZMuMu matched
126  zmmcounter++;
127  FSR_mu0 = false;
128  FSR_mu1 = false;
129 
130  //MonteCarlo Study
131  const reco::GenParticle * muMc0 = mu0.genLepton();
132  const reco::GenParticle * muMc1 = mu1.genLepton();
133  const Candidate * motherMu0 = muMc0->mother();
134  const Candidate * motherMu1 = muMc1->mother();
135  int num_dau_muon0 = motherMu0->numberOfDaughters();
136  int num_dau_muon1 = motherMu1->numberOfDaughters();
137  if( num_dau_muon0 > 1 ){
138  for(int j = 0; j < num_dau_muon0; ++j){
139  int id =motherMu0 ->daughter(j)->pdgId();
140  if(id == 22){
141  double etaG = motherMu0 ->daughter(j)->eta();
142  double ptG = motherMu0 ->daughter(j)->pt();
143  h_gamma_pt_eta_->Fill(ptG,etaG);
144  h_mu_pt_eta_FSR_->Fill(pt0,eta0);
145  FSR_mu0=true;
146  numofGamma++;
147  }
148  }
149  }//end check of gamma
150  if(!FSR_mu0) h_mu_pt_eta_no_FSR_->Fill(pt0,eta0);
151  if( num_dau_muon1 > 1 ){
152  for(int j = 0; j < num_dau_muon1; ++j){
153  int id = motherMu1->daughter(j)->pdgId();
154  if(id == 22){
155  double etaG = motherMu1 ->daughter(j)->eta();
156  double ptG = motherMu1 ->daughter(j)->pt();
157  h_gamma_pt_eta_->Fill(ptG,etaG);
158  h_mu_pt_eta_FSR_->Fill(pt1,eta1);
159  FSR_mu1=true;
160  numofGamma++;
161  }
162  }
163  }//end check of gamma
164  if(!FSR_mu1) h_mu_pt_eta_no_FSR_->Fill(pt1,eta1);
165  }// end MC match
166  }//end of cuts
167  }// end loop on ZMuMu cand
168  }// end if ZMuMu size > 0
169 
170  // ZMuSa
171  if (zMuSa->size() > 0 ) {
172  event.getByLabel(zMuSaMatchMap_, zMuSaMatchMap);
173  for(unsigned int i = 0; i < zMuSa->size(); ++i) { //loop on candidates
174 
175  const Candidate & zMuSaCand = (*zMuSa)[i]; //the candidate
176  CandidateBaseRef zMuSaCandRef = zMuSa->refAt(i);
177 
178 
179  CandidateBaseRef dau0 = zMuSaCand.daughter(0)->masterClone();
180  CandidateBaseRef dau1 = zMuSaCand.daughter(1)->masterClone();
181  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0);//cast in patMuon
182  const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
183 
184  double zmass= zMuSaCand.mass();
185  double pt0 = mu0.pt();
186  double pt1 = mu1.pt();
187  double eta0 = mu0.eta();
188  double eta1 = mu1.eta();
189  if(pt0>20 && pt1 > 20 && abs(eta0)<2 && abs(eta1)<2 && zmass > 20 && zmass < 200){
190  GenParticleRef zMuSaMatch = (*zMuSaMatchMap)[zMuSaCandRef];
191  if(zMuSaMatch.isNonnull()) { // ZMuSa matched
192  FSR_mu0 = false;
193  FSR_mu1 = false;
194  zmscounter++;
195  //MonteCarlo Study
196  const reco::GenParticle * muMc0 = mu0.genLepton();
197  const reco::GenParticle * muMc1 = mu1.genLepton();
198  const Candidate * motherMu0 = muMc0->mother();
199  const Candidate * motherMu1 = muMc1->mother();
200  int num_dau_muon0 = motherMu0->numberOfDaughters();
201  int num_dau_muon1 = motherMu1->numberOfDaughters();
202  if( num_dau_muon0 > 1 ){
203  for(int j = 0; j < num_dau_muon0; ++j){
204  int id =motherMu0 ->daughter(j)->pdgId();
205  if(id == 22){
206  double etaG = motherMu0 ->daughter(j)->eta();
207  double ptG = motherMu0 ->daughter(j)->pt();
208  h_gamma_pt_eta_->Fill(ptG,etaG);
209  h_mu_pt_eta_FSR_->Fill(pt0,eta0);
210  numofGamma++;
211  FSR_mu0=true;
212  }
213  }
214  }//end check of gamma
215  if(!FSR_mu0) h_mu_pt_eta_no_FSR_->Fill(pt0,eta0);
216  if( num_dau_muon1 > 1 ){
217  for(int j = 0; j < num_dau_muon1; ++j){
218  int id = motherMu1->daughter(j)->pdgId();
219  if(id == 22){
220  double etaG = motherMu1 ->daughter(j)->eta();
221  double ptG = motherMu1 ->daughter(j)->pt();
222  h_gamma_pt_eta_->Fill(ptG,etaG);
223  h_mu_pt_eta_FSR_->Fill(pt1,eta1);
224  numofGamma++;
225  FSR_mu1=true;
226  }
227  }
228  }//end check of gamma
229  if(!FSR_mu1) h_mu_pt_eta_no_FSR_->Fill(pt1,eta1);
230  }// end MC match
231  }//end of cuts
232  }// end loop on ZMuSa cand
233  }// end if ZMuSa size > 0
234 
235 
236 
237  //ZMuTk
238  if (zMuTk->size() > 0 ) {
239  event.getByLabel(zMuTkMatchMap_, zMuTkMatchMap);
240  for(unsigned int i = 0; i < zMuTk->size(); ++i) { //loop on candidates
241  const Candidate & zMuTkCand = (*zMuTk)[i]; //the candidate
242  CandidateBaseRef zMuTkCandRef = zMuTk->refAt(i);
243 
244 
245  CandidateBaseRef dau0 = zMuTkCand.daughter(0)->masterClone();
246  CandidateBaseRef dau1 = zMuTkCand.daughter(1)->masterClone();
247  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0);//cast in patMuon
248  const pat::GenericParticle& mu1 = dynamic_cast<const pat::GenericParticle &>(*dau1);
249 
250 
251  double zmass= zMuTkCand.mass();
252  double pt0 = mu0.pt();
253  double pt1 = mu1.pt();
254  double eta0 = mu0.eta();
255  double eta1 = mu1.eta();
256  if(pt0>20 && pt1 > 20 && abs(eta0)<2 && abs(eta1)<2 && zmass > 20 && zmass < 200){//kinematical cuts
257  GenParticleRef zMuTkMatch = (*zMuTkMatchMap)[zMuTkCandRef];
258  if(zMuTkMatch.isNonnull()) { // ZMuTk matched
259  FSR_mu = false;
260  FSR_tk = false;
261  zmtcounter++;
262  //MonteCarlo Study
263  const reco::GenParticle * muMc0 = mu0.genLepton();
264  const reco::GenParticle * muMc1 = mu1.genParticle() ;
265  const Candidate * motherMu0 = muMc0->mother();
266  const Candidate * motherMu1 = muMc1->mother();
267  int num_dau_muon0 = motherMu0->numberOfDaughters();
268  int num_dau_muon1 = motherMu1->numberOfDaughters();
269  if( num_dau_muon0 > 1 ){
270  for(int j = 0; j < num_dau_muon0; ++j){
271  int id = motherMu0->daughter(j)->pdgId();
272  if(id == 22){
273  double etaG = motherMu0 ->daughter(j)->eta();
274  double ptG = motherMu0 ->daughter(j)->pt();
275  h_gamma_pt_eta_->Fill(ptG,etaG);
276  h_mu_pt_eta_FSR_->Fill(pt0,eta0);
277  numofGamma++;
278  FSR_mu0=true;
279  }
280  }
281  }//end check of gamma
282  if(!FSR_mu0) h_mu_pt_eta_no_FSR_->Fill(pt0,eta0);
283  if( num_dau_muon1 > 1 ){
284  for(int j = 0; j < num_dau_muon1; ++j){
285  int id = motherMu1->daughter(j)->pdgId();
286  if(id == 22){
287  double etaG = motherMu1 ->daughter(j)->eta();
288  double ptG = motherMu1 ->daughter(j)->pt();
289  h_gamma_pt_eta_->Fill(ptG,etaG);
290  h_mu_pt_eta_FSR_->Fill(pt1,eta1);
291  numofGamma++;
292  FSR_mu1=true;
293  }
294  }
295  }//end check of gamma
296  if(!FSR_mu1) h_mu_pt_eta_no_FSR_->Fill(pt1,eta1);
297  }// end MC match
298  }//end Kine-cuts
299  }// end loop on ZMuTk cand
300  }// end if ZMuTk size > 0
301 }// end analyze
int i
Definition: DBlmapReader.cc:9
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
const reco::GenParticle * genLepton() const
Definition: Lepton.h:44
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:229
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
#define abs(x)
Definition: mlp_lapack.h:159
virtual double eta() const
momentum pseudorapidity
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:248
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed) ...
virtual size_type numberOfDaughters() const =0
number of daughters
tuple zMuSa
zMUSa vector of PSet is specific for zMuSa category
int j
Definition: DBlmapReader.cc:9
virtual int pdgId() const =0
PDG identifier.
virtual double pt() const
transverse momentum
Analysis-level muon class.
Definition: Muon.h:47
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
tuple zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
virtual double eta() const =0
momentum pseudorapidity
virtual const CandidateBaseRef & masterClone() const =0
void gamma_radiative_analyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 305 of file gamma_radiative_analysis.cc.

References gather_cfg::cout, numOfEvent, numofGamma, zmmcounter, zmscounter, and zmtcounter.

305  {
306  cout <<" ============= Summary =========="<<endl;
307  cout <<" Numero di eventi = "<< numOfEvent << endl;
308  cout <<" 1)Numero di ZMuMu matched dopo i tagli cinematici = "<< zmmcounter << endl;
309  cout <<" 2)Numero di ZMuSa matched dopo i tagli cinematici = "<< zmscounter << endl;
310  cout <<" 3)Numero di ZMuTk matched dopo i tagli cinematici = "<< zmtcounter << endl;
311  cout <<" 4)Number of gamma = "<< numofGamma << endl;
312  }
tuple cout
Definition: gather_cfg.py:41

Member Data Documentation

double gamma_radiative_analyzer::dRTrk_
private

Definition at line 59 of file gamma_radiative_analysis.cc.

double gamma_radiative_analyzer::dRVeto_
private

Definition at line 59 of file gamma_radiative_analysis.cc.

bool gamma_radiative_analyzer::FSR_mu
private

Definition at line 64 of file gamma_radiative_analysis.cc.

Referenced by analyze().

bool gamma_radiative_analyzer::FSR_mu0
private

Definition at line 64 of file gamma_radiative_analysis.cc.

Referenced by analyze().

bool gamma_radiative_analyzer::FSR_mu1
private

Definition at line 64 of file gamma_radiative_analysis.cc.

Referenced by analyze().

bool gamma_radiative_analyzer::FSR_tk
private

Definition at line 64 of file gamma_radiative_analysis.cc.

Referenced by analyze().

TH2D* gamma_radiative_analyzer::h_gamma_pt_eta_
private

Definition at line 61 of file gamma_radiative_analysis.cc.

Referenced by analyze(), and gamma_radiative_analyzer().

TH2D * gamma_radiative_analyzer::h_mu_pt_eta_FSR_
private

Definition at line 61 of file gamma_radiative_analysis.cc.

Referenced by analyze(), and gamma_radiative_analyzer().

TH2D * gamma_radiative_analyzer::h_mu_pt_eta_no_FSR_
private

Definition at line 61 of file gamma_radiative_analysis.cc.

Referenced by analyze(), and gamma_radiative_analyzer().

int gamma_radiative_analyzer::numOfEvent
private

Definition at line 67 of file gamma_radiative_analysis.cc.

Referenced by analyze(), endJob(), and gamma_radiative_analyzer().

int gamma_radiative_analyzer::numofGamma
private

Definition at line 67 of file gamma_radiative_analysis.cc.

Referenced by analyze(), endJob(), and gamma_radiative_analyzer().

double gamma_radiative_analyzer::ptThreshold_
private

Definition at line 59 of file gamma_radiative_analysis.cc.

int gamma_radiative_analyzer::zmmcounter
private

Definition at line 67 of file gamma_radiative_analysis.cc.

Referenced by analyze(), endJob(), and gamma_radiative_analyzer().

int gamma_radiative_analyzer::zmscounter
private

Definition at line 67 of file gamma_radiative_analysis.cc.

Referenced by analyze(), endJob(), and gamma_radiative_analyzer().

int gamma_radiative_analyzer::zmtcounter
private

Definition at line 67 of file gamma_radiative_analysis.cc.

Referenced by analyze(), endJob(), and gamma_radiative_analyzer().

edm::InputTag gamma_radiative_analyzer::zMuMu_
private

Definition at line 58 of file gamma_radiative_analysis.cc.

Referenced by analyze().

edm::InputTag gamma_radiative_analyzer::zMuMuMatchMap_
private

Definition at line 58 of file gamma_radiative_analysis.cc.

Referenced by analyze().

edm::InputTag gamma_radiative_analyzer::zMuSa_
private

Definition at line 58 of file gamma_radiative_analysis.cc.

Referenced by analyze().

edm::InputTag gamma_radiative_analyzer::zMuSaMatchMap_
private

Definition at line 58 of file gamma_radiative_analysis.cc.

Referenced by analyze().

edm::InputTag gamma_radiative_analyzer::zMuTk_
private

Definition at line 58 of file gamma_radiative_analysis.cc.

Referenced by analyze().

edm::InputTag gamma_radiative_analyzer::zMuTkMatchMap_
private

Definition at line 58 of file gamma_radiative_analysis.cc.

Referenced by analyze().