CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ZMuMu_radiative_analysis.cc
Go to the documentation of this file.
1 /* \class ZMuMu_Radiative_analyzer
2  *
3  * author: Pasquale Noli
4  *
5  * ZMuMu Radiative analyzer
6  *
7  *
8  */
38 #include <iostream>
39 #include <iterator>
40 #include <cmath>
41 #include <vector>
42 #include "TH1.h"
43 #include "TH2.h"
44 #include "TH3.h"
45 
46 
47 using namespace edm;
48 using namespace std;
49 using namespace reco;
50 using namespace isodeposit;
51 
53 public:
55 private:
56  virtual void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
57  virtual void endJob() override;
58 
65  double dRVeto_, dRTrk_, ptThreshold_;
66  //histograms
67  TH1D *h_zmass_FSR,*h_zmass_no_FSR;
68  TH1D *h_zMuSamass_FSR,*h_zMuSamass_no_FSR;
69  TH1D *h_zMuTkmass_FSR,*h_zMuTkmass_no_FSR;
70  TH1D *h_Iso_,*h_Iso_FSR_ ;
71  TH3D *h_Iso_3D_, *h_Iso_FSR_3D_;
72  TH2D *h_staProbe_pt_eta_no_FSR_, *h_staProbe_pt_eta_FSR_, *h_ProbeOk_pt_eta_no_FSR_, *h_ProbeOk_pt_eta_FSR_;
73  TH1D *h_trackProbe_eta_no_FSR, *h_trackProbe_pt_no_FSR, *h_staProbe_eta_no_FSR, *h_staProbe_pt_no_FSR, *h_ProbeOk_eta_no_FSR, *h_ProbeOk_pt_no_FSR;
74  TH1D *h_trackProbe_eta_FSR, *h_trackProbe_pt_FSR, *h_staProbe_eta_FSR, *h_staProbe_pt_FSR, *h_ProbeOk_eta_FSR, *h_ProbeOk_pt_FSR;
75  //boolean
76  bool FSR_mu, FSR_tk, FSR_mu0, FSR_mu1;
77  bool trig0found, trig1found;
78  //counter
79  int zmmcounter , zmscounter, zmtcounter, evntcounter;
80  };
81 
82 
84 
86  zMuMuToken_(consumes<CandidateView>(pset.getParameter<InputTag>("zMuMu"))),
87  zMuMuMatchMapToken_(mayConsume<GenParticleMatch>(pset.getParameter<InputTag>("zMuMuMatchMap"))),
88  zMuTkToken_(consumes<CandidateView>(pset.getParameter<InputTag>("zMuTk"))),
89  zMuTkMatchMapToken_(mayConsume<GenParticleMatch>(pset.getParameter<InputTag>("zMuTkMatchMap"))),
90  zMuSaToken_(consumes<CandidateView>(pset.getParameter<InputTag>("zMuSa"))),
91  zMuSaMatchMapToken_(mayConsume<GenParticleMatch>(pset.getParameter<InputTag>("zMuSaMatchMap"))),
92  dRVeto_(pset.getUntrackedParameter<double>("veto")),
93  dRTrk_(pset.getUntrackedParameter<double>("deltaRTrk")),
94  ptThreshold_(pset.getUntrackedParameter<double>("ptThreshold")){
95  zmmcounter=0;
96  zmscounter=0;
97  zmtcounter=0;
98  evntcounter=0;
100 
101  // general histograms
102  h_zmass_FSR= fs->make<TH1D>("h_zmass_FRS","Invariant Z mass distribution",200,0,200);
103  h_zmass_no_FSR= fs->make<TH1D>("h_zmass_no_FSR","Invariant Z mass distribution",200,0,200);
104  h_zMuSamass_FSR= fs->make<TH1D>("h_zMuSamass_FRS","Invariant Z mass distribution",200,0,200);
105  h_zMuSamass_no_FSR= fs->make<TH1D>("h_zMuSamass_no_FSR","Invariant Z mass distribution",200,0,200);
106  h_zMuTkmass_FSR= fs->make<TH1D>("h_zMuTkmass_FRS","Invariant Z mass distribution",200,0,200);
107  h_zMuTkmass_no_FSR= fs->make<TH1D>("h_zMuTkmass_no_FSR","Invariant Z mass distribution",200,0,200);
108  h_Iso_= fs->make<TH1D>("h_iso","Isolation distribution of muons without FSR",100,0,20);
109  h_Iso_FSR_= fs->make<TH1D>("h_iso_FSR","Isolation distribution of muons with FSR ",100,0,20);
110  h_Iso_3D_= fs->make<TH3D>("h_iso_3D","Isolation distribution of muons without FSR",100,20,100,100,-2.0,2.0,100,0,20);
111  h_Iso_FSR_3D_= fs->make<TH3D>("h_iso_FSR_3D","Isolation distribution of muons with FSR ",100,20,100,100,-2.0,2.0,100,0,20);
112  h_staProbe_pt_eta_no_FSR_= fs->make<TH2D>("h_staProbe_pt_eta_no_FSR","Pt vs Eta StandAlone without FSR ",100,20,100,100,-2.0,2.0);
113  h_staProbe_pt_eta_FSR_= fs->make<TH2D>("h_staProbe_pt_eta_FSR","Pt vs Eta StandAlone with FSR ",100,20,100,100,-2.0,2.0);
114  h_ProbeOk_pt_eta_no_FSR_= fs->make<TH2D>("h_ProbeOk_pt_eta_no_FSR","Pt vs Eta probeOk without FSR ",100,20,100,100,-2.0,2.0);
115  h_ProbeOk_pt_eta_FSR_= fs->make<TH2D>("h_ProbeOk_pt_eta_FSR","Pt vs Eta probeOk with FSR ",100,20,100,100,-2.0,2.0);
116 
117  h_trackProbe_eta_no_FSR = fs->make<TH1D>("trackProbeEta_no_FSR","Eta of tracks",100,-2.0,2.0);
118  h_trackProbe_pt_no_FSR = fs->make<TH1D>("trackProbePt_no_FSR","Pt of tracks",100,0,100);
119  h_staProbe_eta_no_FSR = fs->make<TH1D>("standAloneProbeEta_no_FSR","Eta of standAlone",100,-2.0,2.0);
120  h_staProbe_pt_no_FSR = fs->make<TH1D>("standAloneProbePt_no_FSR","Pt of standAlone",100,0,100);
121  h_ProbeOk_eta_no_FSR = fs->make<TH1D>("probeOkEta_no_FSR","Eta of probe Ok",100,-2.0,2.0);
122  h_ProbeOk_pt_no_FSR = fs->make<TH1D>("probeOkPt_no_FSR","Pt of probe ok",100,0,100);
123 
124  h_trackProbe_eta_FSR = fs->make<TH1D>("trackProbeEta_FSR","Eta of tracks",100,-2.0,2.0);
125  h_trackProbe_pt_FSR = fs->make<TH1D>("trackProbePt_FSR","Pt of tracks",100,0,100);
126  h_staProbe_eta_FSR = fs->make<TH1D>("standAloneProbeEta_FSR","Eta of standAlone",100,-2.0,2.0);
127  h_staProbe_pt_FSR = fs->make<TH1D>("standAloneProbePt_FSR","Pt of standAlone",100,0,100);
128  h_ProbeOk_eta_FSR = fs->make<TH1D>("probeOkEta_FSR","Eta of probe Ok",100,-2.0,2.0);
129  h_ProbeOk_pt_FSR = fs->make<TH1D>("probeOkPt_FSR","Pt of probe ok",100,0,100);
130 
131 
132 
133 }
134 
136  evntcounter++;
137  Handle<CandidateView> zMuMu; //Collection of Z made by Mu global + Mu global
138  Handle<GenParticleMatch> zMuMuMatchMap; //Map of Z made by Mu global + Mu global with MC
139  event.getByToken(zMuMuToken_, zMuMu);
140  Handle<CandidateView> zMuTk; //Collection of Z made by Mu global + Track
141  Handle<GenParticleMatch> zMuTkMatchMap;
142  event.getByToken(zMuTkToken_, zMuTk);
143  Handle<CandidateView> zMuSa; //Collection of Z made by Mu global + Sa
144  Handle<GenParticleMatch> zMuSaMatchMap;
145  event.getByToken(zMuSaToken_, zMuSa);
146  cout << "********** New Event ***********"<<endl;
147  // ZMuMu
148  if (zMuMu->size() > 0 ) {
149  event.getByToken(zMuMuMatchMapToken_, zMuMuMatchMap);
150  for(unsigned int i = 0; i < zMuMu->size(); ++i) { //loop on candidates
151 
152  const Candidate & zMuMuCand = (*zMuMu)[i]; //the candidate
153  CandidateBaseRef zMuMuCandRef = zMuMu->refAt(i);
154 
155 
156  CandidateBaseRef dau0 = zMuMuCand.daughter(0)->masterClone();
157  CandidateBaseRef dau1 = zMuMuCand.daughter(1)->masterClone();
158  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0);//cast in patMuon
159  const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
160 
161  double zmass= zMuMuCand.mass();
162  double pt0 = mu0.pt();
163  double pt1 = mu1.pt();
164  double eta0 = mu0.eta();
165  double eta1 = mu1.eta();
166  if(pt0>20 && pt1 > 20 && abs(eta0)<2 && abs(eta1)<2 && zmass > 20 && zmass < 200){
167  GenParticleRef zMuMuMatch = (*zMuMuMatchMap)[zMuMuCandRef];
168  if(zMuMuMatch.isNonnull()) { // ZMuMu matched
169  zmmcounter++;
170  cout<<" Zmumu cuts && matched" <<endl;
171  FSR_mu0 = false;
172  FSR_mu1 = false;
173 
174  //Isodeposit
175  const pat::IsoDeposit * mu0TrackIso =mu0.isoDeposit(pat::TrackIso);
176  const pat::IsoDeposit * mu1TrackIso =mu1.isoDeposit(pat::TrackIso);
177  Direction mu0Dir = Direction(mu0.eta(),mu0.phi());
178  Direction mu1Dir = Direction(mu1.eta(),mu1.phi());
179 
180  reco::IsoDeposit::AbsVetos vetos_mu0;
181  vetos_mu0.push_back(new ConeVeto( mu0Dir, dRVeto_ ));
182  vetos_mu0.push_back(new ThresholdVeto( ptThreshold_ ));
183 
184  reco::IsoDeposit::AbsVetos vetos_mu1;
185  vetos_mu1.push_back(new ConeVeto( mu1Dir, dRVeto_ ));
186  vetos_mu1.push_back(new ThresholdVeto( ptThreshold_ ));
187 
188  double Tracker_isovalue_mu0 = mu0TrackIso->sumWithin(dRTrk_,vetos_mu0);
189  double Tracker_isovalue_mu1 = mu1TrackIso->sumWithin(dRTrk_,vetos_mu1);
190 
191  //trigger study
192  trig0found = false;
193  trig1found = false;
194  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
195  mu0.triggerObjectMatchesByPath( "HLT_Mu9" );
196  const pat::TriggerObjectStandAloneCollection mu1HLTMatches =
197  mu1.triggerObjectMatchesByPath( "HLT_Mu9" );
198  if( mu0HLTMatches.size()>0 )
199  trig0found = true;
200  if( mu1HLTMatches.size()>0 )
201  trig1found = true;
202 
203  //MonteCarlo Study
204  const reco::GenParticle * muMc0 = mu0.genLepton();
205  const reco::GenParticle * muMc1 = mu1.genLepton();
206  const Candidate * motherMu0 = muMc0->mother();
207  int num_dau_muon0 = motherMu0->numberOfDaughters();
208  const Candidate * motherMu1 = muMc1->mother();
209  int num_dau_muon1 = motherMu1->numberOfDaughters();
210  cout<<" muone0"<<endl;
211  cout<<" num di daughters = "<< num_dau_muon0 <<endl;
212  if( num_dau_muon0 > 1 ){
213  for(int j = 0; j < num_dau_muon0; ++j){
214  int id =motherMu0 ->daughter(j)->pdgId();
215  cout<<" dauther["<<j<<"] pdgId = "<<id<<endl;
216  if(id == 22) FSR_mu0=true;
217  }
218  }//end check of gamma
219 
220  cout<<" muone1"<<endl;
221  cout<<" num di daughters = "<< num_dau_muon1 <<endl;
222  if( num_dau_muon1 > 1 ){
223  for(int j = 0; j < num_dau_muon1; ++j){
224  int id = motherMu1->daughter(j)->pdgId();
225  cout<<" dauther["<<j<<"] pdgId = "<<id<<endl;
226  if(id == 22) FSR_mu1=true;
227  }
228  }//end check of gamma
229 
230  if(FSR_mu0 || FSR_mu1 )h_zmass_FSR->Fill(zmass);
231  else h_zmass_no_FSR->Fill(zmass);
232 
233  if (trig1found) { // check efficiency of muon0 not imposing the trigger on it
234  cout<<"muon 1 is triggered "<<endl;
235  if(FSR_mu0){
236  cout<< "and muon 0 does FSR"<<endl;
237  h_trackProbe_eta_FSR->Fill(eta0);
238  h_trackProbe_pt_FSR->Fill(pt0);
239  h_staProbe_eta_FSR->Fill(eta0);
240  h_staProbe_pt_FSR->Fill(pt0);
241  h_staProbe_pt_eta_FSR_->Fill(pt0,eta0);
242  h_ProbeOk_eta_FSR->Fill(eta0);
243  h_ProbeOk_pt_FSR->Fill(pt0);
244  h_ProbeOk_pt_eta_FSR_->Fill(pt0,eta0);
245  }else{
246  cout<<"and muon 0 doesn't FSR"<<endl;
247  h_trackProbe_eta_no_FSR->Fill(eta0);
248  h_trackProbe_pt_no_FSR->Fill(pt0);
249  h_staProbe_eta_no_FSR->Fill(eta0);
250  h_staProbe_pt_no_FSR->Fill(pt0);
251  h_staProbe_pt_eta_no_FSR_->Fill(pt0,eta0);
252  h_ProbeOk_eta_no_FSR->Fill(eta0);
253  h_ProbeOk_pt_no_FSR->Fill(pt0);
254  h_ProbeOk_pt_eta_no_FSR_->Fill(pt0,eta0);
255  }
256  if(FSR_mu0){
257  h_Iso_FSR_->Fill(Tracker_isovalue_mu0);
258  h_Iso_FSR_3D_->Fill(pt0,eta0,Tracker_isovalue_mu0);
259  }
260  else{
261  h_Iso_->Fill(Tracker_isovalue_mu0);
262  h_Iso_3D_->Fill(pt0,eta0,Tracker_isovalue_mu0);
263  }
264  }
265  if (trig0found) { // check efficiency of muon1 not imposing the trigger on it
266  cout<<"muon 0 is triggered"<<endl;
267  if(FSR_mu1){
268  cout<<"and muon 1 does FSR"<<endl;
269  h_trackProbe_eta_FSR->Fill(eta1);
270  h_staProbe_eta_FSR->Fill(eta1);
271  h_trackProbe_pt_FSR->Fill(pt1);
272  h_staProbe_pt_FSR->Fill(pt1);
273  h_ProbeOk_eta_FSR->Fill(eta1);
274  h_ProbeOk_pt_FSR->Fill(pt1);
275  h_staProbe_pt_eta_FSR_->Fill(pt1,eta1);
276  h_ProbeOk_pt_eta_FSR_->Fill(pt1,eta1);
277 
278  }else{
279  cout<<"and muon 1 doesn't FSR"<<endl;
280  h_trackProbe_eta_no_FSR->Fill(eta1);
281  h_staProbe_eta_no_FSR->Fill(eta1);
282  h_trackProbe_pt_no_FSR->Fill(pt1);
283  h_staProbe_pt_no_FSR->Fill(pt1);
284  h_ProbeOk_eta_no_FSR->Fill(eta1);
285  h_ProbeOk_pt_no_FSR->Fill(pt1);
286  h_staProbe_pt_eta_no_FSR_->Fill(pt1,eta1);
287  h_ProbeOk_pt_eta_no_FSR_->Fill(pt1,eta1);
288 
289 
290  }
291  if(FSR_mu1){
292  h_Iso_FSR_->Fill(Tracker_isovalue_mu1);
293  h_Iso_FSR_3D_->Fill(pt1,eta1,Tracker_isovalue_mu1);
294  }else{
295  h_Iso_->Fill(Tracker_isovalue_mu1);
296  h_Iso_3D_->Fill(pt1,eta1,Tracker_isovalue_mu1);
297  }
298  }
299  }// end MC match
300  }//end of cuts
301  }// end loop on ZMuMu cand
302  }// end if ZMuMu size > 0
303 
304  // ZMuSa
305  if (zMuSa->size() > 0 ) {
306  event.getByToken(zMuSaMatchMapToken_, zMuSaMatchMap);
307  for(unsigned int i = 0; i < zMuSa->size(); ++i) { //loop on candidates
308 
309  const Candidate & zMuSaCand = (*zMuSa)[i]; //the candidate
310  CandidateBaseRef zMuSaCandRef = zMuSa->refAt(i);
311  const Candidate * lep0 =zMuSaCand.daughter(0);
312  const Candidate * lep1 =zMuSaCand.daughter(1);
313  CandidateBaseRef dau0 = lep0->masterClone();
314  CandidateBaseRef dau1 = lep1->masterClone();
315  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0);//cast in patMuon
316  const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
317 
318  double zmass= zMuSaCand.mass();
319  double pt0 = mu0.pt();
320  double pt1 = mu1.pt();
321  double eta0 = mu0.eta();
322  double eta1 = mu1.eta();
323  if(pt0>20 && pt1 > 20 && abs(eta0)<2 && abs(eta1)<2 && zmass > 20 && zmass < 200){
324  GenParticleRef zMuSaMatch = (*zMuSaMatchMap)[zMuSaCandRef];
325  if(zMuSaMatch.isNonnull()) { // ZMuSa matched
326  cout<<" Zmusa cuts && matched" <<endl;
327  FSR_mu0 = false;
328  FSR_mu1 = false;
329  zmscounter++;
330  //Isodeposit
331  const pat::IsoDeposit * mu0TrackIso =mu0.isoDeposit(pat::TrackIso);
332  const pat::IsoDeposit * mu1TrackIso =mu1.isoDeposit(pat::TrackIso);
333  Direction mu0Dir = Direction(mu0.eta(),mu0.phi());
334  Direction mu1Dir = Direction(mu1.eta(),mu1.phi());
335 
336  reco::IsoDeposit::AbsVetos vetos_mu0;
337  vetos_mu0.push_back(new ConeVeto( mu0Dir, dRVeto_ ));
338  vetos_mu0.push_back(new ThresholdVeto( ptThreshold_ ));
339 
340  reco::IsoDeposit::AbsVetos vetos_mu1;
341  vetos_mu1.push_back(new ConeVeto( mu1Dir, dRVeto_ ));
342  vetos_mu1.push_back(new ThresholdVeto( ptThreshold_ ));
343 
344  double Tracker_isovalue_mu0 = mu0TrackIso->sumWithin(dRTrk_,vetos_mu0);
345  double Tracker_isovalue_mu1 = mu1TrackIso->sumWithin(dRTrk_,vetos_mu1);
346 
347  // HLT match (check just dau0 the global)
348  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
349  mu0.triggerObjectMatchesByPath( "HLT_Mu9" );
350  const pat::TriggerObjectStandAloneCollection mu1HLTMatches =
351  mu1.triggerObjectMatchesByPath( "HLT_Mu9" );
352  trig0found = false;
353  trig1found = false;
354  if( mu0HLTMatches.size()>0 )
355  trig0found = true;
356  if( mu1HLTMatches.size()>0 )
357  trig1found = true;
358 
359  //MonteCarlo Study
360  const reco::GenParticle * muMc0 = mu0.genLepton();
361  const reco::GenParticle * muMc1 = mu1.genLepton();
362  const Candidate * motherMu0 = muMc0->mother();
363  const Candidate * motherMu1 = muMc1->mother();
364  int num_dau_muon0 = motherMu0->numberOfDaughters();
365  int num_dau_muon1 = motherMu1->numberOfDaughters();
366  cout<<" muone0"<<endl;
367  cout<<" num di daughters = "<< num_dau_muon0 <<endl;
368  if( num_dau_muon0 > 1 ){
369  for(int j = 0; j < num_dau_muon0; ++j){
370  int id =motherMu0 ->daughter(j)->pdgId();
371  cout<<" dauther["<<j<<"] pdgId = "<<id<<endl;
372  if(id == 22) FSR_mu0=true;
373  }
374  }//end check of gamma
375 
376  cout<<" muone1"<<endl;
377  cout<<" num di daughters = "<< num_dau_muon1 <<endl;
378  if( num_dau_muon1 > 1 ){
379  for(int j = 0; j < num_dau_muon1; ++j){
380  int id = motherMu1->daughter(j)->pdgId();
381  cout<<" dauther["<<j<<"] pdgId = "<<id<<endl;
382  if(id == 22) FSR_mu1=true;
383  }
384  }//end check of gamma
385  if(FSR_mu0 || FSR_mu1 )h_zMuSamass_FSR->Fill(zmass);
386  else h_zMuSamass_no_FSR->Fill(zmass);
387  if(lep0->isGlobalMuon() && trig0found){
388  if(FSR_mu1){
389  h_staProbe_eta_FSR->Fill(eta1);
390  h_staProbe_pt_FSR->Fill(pt1);
391  h_staProbe_pt_eta_FSR_->Fill(pt1,eta1);
392 
393  }else{
394  h_staProbe_eta_no_FSR->Fill(eta1);
395  h_staProbe_pt_no_FSR->Fill(pt1);
396  h_staProbe_pt_eta_no_FSR_->Fill(pt1,eta1);
397 
398  }
399  if(FSR_mu1){
400  h_Iso_FSR_->Fill(Tracker_isovalue_mu1);
401  h_Iso_FSR_3D_->Fill(pt1,eta1,Tracker_isovalue_mu1);
402  }
403  else{
404  h_Iso_->Fill(Tracker_isovalue_mu1);
405  h_Iso_3D_->Fill(pt1,eta1,Tracker_isovalue_mu1);
406  }
407  }
408  if(lep1->isGlobalMuon() && trig1found){
409  if(FSR_mu0){
410  h_staProbe_eta_FSR->Fill(eta0);
411  h_staProbe_pt_FSR->Fill(pt0);
412  h_staProbe_pt_eta_FSR_->Fill(pt0,eta0);
413 
414  }else{
415  h_staProbe_eta_no_FSR->Fill(eta0);
416  h_staProbe_pt_no_FSR->Fill(pt0);
417  h_staProbe_pt_eta_FSR_->Fill(pt0,eta0);
418 
419  }
420  if(FSR_mu0){
421  h_Iso_FSR_->Fill(Tracker_isovalue_mu0);
422  h_Iso_FSR_3D_->Fill(pt0,eta0,Tracker_isovalue_mu0);
423  }
424  else{
425  h_Iso_->Fill(Tracker_isovalue_mu0);
426  h_Iso_3D_->Fill(pt0,eta0,Tracker_isovalue_mu0);
427  }
428  }
429  }// end MC match
430  }//end of cuts
431  }// end loop on ZMuSa cand
432  }// end if ZMuSa size > 0
433 
434  //ZMuTk
435  if (zMuTk->size() > 0 ) {
436  event.getByToken(zMuTkMatchMapToken_, zMuTkMatchMap);
437  for(unsigned int i = 0; i < zMuTk->size(); ++i) { //loop on candidates
438  const Candidate & zMuTkCand = (*zMuTk)[i]; //the candidate
439  CandidateBaseRef zMuTkCandRef = zMuTk->refAt(i);
440  CandidateBaseRef dau0 = zMuTkCand.daughter(0)->masterClone();
441  CandidateBaseRef dau1 = zMuTkCand.daughter(1)->masterClone();
442  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0);//cast in patMuon
443  const pat::GenericParticle& mu1 = dynamic_cast<const pat::GenericParticle &>(*dau1);
444 
445 
446  double zmass= zMuTkCand.mass();
447  double pt0 = mu0.pt();
448  double pt1 = mu1.pt();
449  double eta0 = mu0.eta();
450  double eta1 = mu1.eta();
451  if(pt0>20 && pt1 > 20 && abs(eta0)<2 && abs(eta1)<2 && zmass > 20 && zmass < 200){//kinematical cuts
452  GenParticleRef zMuTkMatch = (*zMuTkMatchMap)[zMuTkCandRef];
453  if(zMuTkMatch.isNonnull()) { // ZMuTk matched
454  FSR_mu = false;
455  FSR_tk = false;
456  cout<<" ZmuTk cuts && matched"<<endl;
457  zmtcounter++;
458  //Isodeposit
459  const pat::IsoDeposit * muTrackIso =mu0.isoDeposit(pat::TrackIso);
460  const pat::IsoDeposit * tkTrackIso =mu1.isoDeposit(pat::TrackIso);
461  Direction muDir = Direction(mu0.eta(),mu0.phi());
462  Direction tkDir = Direction(mu1.eta(),mu1.phi());
463 
464  IsoDeposit::AbsVetos vetos_mu;
465  vetos_mu.push_back(new ConeVeto( muDir, dRVeto_ ));
466  vetos_mu.push_back(new ThresholdVeto( ptThreshold_ ));
467 
469  vetos_tk.push_back(new ConeVeto( tkDir, dRVeto_ ));
470  vetos_tk.push_back(new ThresholdVeto( ptThreshold_ ));
471 
472  double Tracker_isovalue_mu = muTrackIso->sumWithin(dRTrk_,vetos_mu);
473  double Tracker_isovalue_tk = tkTrackIso->sumWithin(dRTrk_,vetos_tk);
474 
475  //MonteCarlo Study
476  const reco::GenParticle * muMc0 = mu0.genLepton();
477  const reco::GenParticle * muMc1 = mu1.genParticle() ;
478  const Candidate * motherMu0 = muMc0->mother();
479  const Candidate * motherMu1 = muMc1->mother();
480  int num_dau_muon0 = motherMu0->numberOfDaughters();
481  int num_dau_muon1 = motherMu1->numberOfDaughters();
482  cout<<"numero di figli muone0 = " << num_dau_muon0 <<endl;
483  cout<<"numero di figli muone1 = " << num_dau_muon1 <<endl;
484 
485  cout<<" muon"<<endl;
486  cout<<" num di daughters = "<< num_dau_muon0 <<endl;
487  if( num_dau_muon0 > 1 ){
488  for(int j = 0; j < num_dau_muon0; ++j){
489  int id = motherMu0->daughter(j)->pdgId();
490  cout<<" dau["<<j<<"] pdg ID = "<<id<<endl;
491  if(id == 22) {
492  FSR_mu=true;
493  }
494  }
495  }//end check of gamma
496  else cout<<" dau[0] pdg ID = "<<motherMu0->daughter(0)->pdgId()<<endl;
497  cout<<" traccia"<<endl;
498  cout<<" num di daughters = "<< num_dau_muon1 <<endl;
499  if( num_dau_muon1 > 1 ){
500  for(int j = 0; j < num_dau_muon1; ++j){
501  int id = motherMu1->daughter(j)->pdgId();
502  cout<<" dau["<<j<<"] pdg ID = "<<id<<endl;
503  if(id == 22) {
504  FSR_tk=true;
505  }
506  }
507  }//end check of gamma
508  else cout<<" dau[0] pdg ID = "<<motherMu1->daughter(0)->pdgId()<<endl;
509  cout<<"Mu Isolation = "<< Tracker_isovalue_mu <<endl;
510  cout<<"Track Isolation = "<< Tracker_isovalue_tk <<endl;
511  if(FSR_mu){
512  h_Iso_FSR_->Fill(Tracker_isovalue_mu);
513  h_Iso_FSR_3D_->Fill(pt0,eta0,Tracker_isovalue_mu);
514  }
515  else{
516  h_Iso_->Fill( Tracker_isovalue_mu);
517  h_Iso_3D_->Fill(pt0,eta0,Tracker_isovalue_mu);
518 
519  }
520  if(FSR_tk){
521  h_Iso_FSR_->Fill(Tracker_isovalue_tk);
522  h_Iso_FSR_3D_->Fill(pt1,eta1,Tracker_isovalue_tk);
523  h_trackProbe_eta_FSR->Fill(eta1);
524  h_trackProbe_pt_FSR->Fill(pt1);
525  }
526  else{
527  h_Iso_->Fill( Tracker_isovalue_tk);
528  h_Iso_3D_->Fill(pt1,eta1,Tracker_isovalue_tk);
529  h_trackProbe_eta_no_FSR->Fill(eta1);
530  h_trackProbe_pt_no_FSR->Fill(pt1);
531  }
532  }// end MC match
533  }//end Kine-cuts
534  }// end loop on ZMuTk cand
535  }// end if ZMuTk size > 0
536 }// end analyze
537 
538 
539 
541  cout<<" ============= Summary =========="<<endl;
542  cout <<" Numero di eventi "<< evntcounter << endl;
543  cout <<" 1)Numero di ZMuMu matched dopo i tagli cinematici = "<< zmmcounter << endl;
544  cout <<" 2)Numero di ZMuSa matched dopo i tagli cinematici = "<< zmscounter << endl;
545  cout <<" 3)Numero di ZMuTk matched dopo i tagli cinematici = "<< zmtcounter << endl;
546  double n1= h_Iso_FSR_->Integral();
547  double icut1= h_Iso_FSR_->Integral(0,15);
548  double eff_iso_FSR = (double)icut1/(double)n1;
549  double err_iso_FSR = sqrt(eff_iso_FSR*(1-eff_iso_FSR)/n1);
550  double n2= h_Iso_->Integral();
551  double icut2= h_Iso_->Integral(0,15);
552  double eff_iso= (double)icut2/(double)n2;
553  double err_iso = sqrt(eff_iso*(1-eff_iso)/n2);
554  cout<<" ============= Isolation Efficiecy =========="<<endl;
555  cout<<"Isolation Efficiency = "<< eff_iso <<" +/- "<< err_iso <<endl;
556  cout<<"Isolation Efficiency with FSR = "<< eff_iso_FSR <<" +/- "<< err_iso_FSR <<endl;
557 
558  }
559 
561 
563 
EDGetTokenT< GenParticleMatch > zMuMuMatchMapToken_
int i
Definition: DBlmapReader.cc:9
virtual void analyze(const edm::Event &event, const edm::EventSetup &setup) override
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:42
virtual float mass() const =0
mass
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:236
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
EDGetTokenT< GenParticleMatch > zMuTkMatchMapToken_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
const IsoDeposit * isoDeposit(IsolationKeys key) const
Returns the IsoDeposit associated with some key, or a null pointer if it is not available.
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
const IsoDeposit * isoDeposit(IsolationKeys key) const
Returns the IsoDeposit associated with some key, or a null pointer if it is not available.
Definition: Lepton.h:165
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Definition: IsoDeposit.cc:138
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed) ...
virtual size_type numberOfDaughters() const =0
number of daughters
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
edm::ValueMap< float > IsolationCollection
EDGetTokenT< CandidateView > zMuSaToken_
T sqrt(T t)
Definition: SSEVec.h:48
tuple zMuSa
zMUSa vector of PSet is specific for zMuSa category
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:596
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
ZMuMu_Radiative_analyzer(const edm::ParameterSet &pset)
EDGetTokenT< CandidateView > zMuMuToken_
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
virtual int pdgId() const =0
PDG identifier.
EDGetTokenT< GenParticleMatch > zMuSaMatchMapToken_
EDGetTokenT< CandidateView > zMuTkToken_
std::vector< AbsVeto * > AbsVetos
Definition: IsoDeposit.h:40
tuple cout
Definition: gather_cfg.py:121
isodeposit::AbsVetos AbsVetos
Definition: IsoDeposit.h:51
virtual void endJob() override
virtual float pt() const GCC11_FINAL
transverse momentum
Analysis-level muon class.
Definition: Muon.h:50
virtual const Candidate * mother(size_type=0) const
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode) ...
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
virtual bool isGlobalMuon() const =0
virtual const CandidateBaseRef & masterClone() const =0