CMS 3D CMS Logo

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 using namespace edm;
47 using namespace std;
48 using namespace reco;
49 using namespace isodeposit;
50 
52 public:
54 
55 private:
56  void analyze(const edm::Event& event, const edm::EventSetup& setup) override;
57  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,
74  *h_ProbeOk_eta_no_FSR, *h_ProbeOk_pt_no_FSR;
75  TH1D *h_trackProbe_eta_FSR, *h_trackProbe_pt_FSR, *h_staProbe_eta_FSR, *h_staProbe_pt_FSR, *h_ProbeOk_eta_FSR,
76  *h_ProbeOk_pt_FSR;
77  //boolean
78  bool FSR_mu, FSR_tk, FSR_mu0, FSR_mu1;
79  bool trig0found, trig1found;
80  //counter
81  int zmmcounter, zmscounter, zmtcounter, evntcounter;
82 };
83 
85 
87  : zMuMuToken_(consumes<CandidateView>(pset.getParameter<InputTag>("zMuMu"))),
88  zMuMuMatchMapToken_(mayConsume<GenParticleMatch>(pset.getParameter<InputTag>("zMuMuMatchMap"))),
89  zMuTkToken_(consumes<CandidateView>(pset.getParameter<InputTag>("zMuTk"))),
90  zMuTkMatchMapToken_(mayConsume<GenParticleMatch>(pset.getParameter<InputTag>("zMuTkMatchMap"))),
91  zMuSaToken_(consumes<CandidateView>(pset.getParameter<InputTag>("zMuSa"))),
92  zMuSaMatchMapToken_(mayConsume<GenParticleMatch>(pset.getParameter<InputTag>("zMuSaMatchMap"))),
93  dRVeto_(pset.getUntrackedParameter<double>("veto")),
94  dRTrk_(pset.getUntrackedParameter<double>("deltaRTrk")),
95  ptThreshold_(pset.getUntrackedParameter<double>("ptThreshold")) {
96  zmmcounter = 0;
97  zmscounter = 0;
98  zmtcounter = 0;
99  evntcounter = 0;
101 
102  // general histograms
103  h_zmass_FSR = fs->make<TH1D>("h_zmass_FRS", "Invariant Z mass distribution", 200, 0, 200);
104  h_zmass_no_FSR = fs->make<TH1D>("h_zmass_no_FSR", "Invariant Z mass distribution", 200, 0, 200);
105  h_zMuSamass_FSR = fs->make<TH1D>("h_zMuSamass_FRS", "Invariant Z mass distribution", 200, 0, 200);
106  h_zMuSamass_no_FSR = fs->make<TH1D>("h_zMuSamass_no_FSR", "Invariant Z mass distribution", 200, 0, 200);
107  h_zMuTkmass_FSR = fs->make<TH1D>("h_zMuTkmass_FRS", "Invariant Z mass distribution", 200, 0, 200);
108  h_zMuTkmass_no_FSR = fs->make<TH1D>("h_zMuTkmass_no_FSR", "Invariant Z mass distribution", 200, 0, 200);
109  h_Iso_ = fs->make<TH1D>("h_iso", "Isolation distribution of muons without FSR", 100, 0, 20);
110  h_Iso_FSR_ = fs->make<TH1D>("h_iso_FSR", "Isolation distribution of muons with FSR ", 100, 0, 20);
111  h_Iso_3D_ = fs->make<TH3D>(
112  "h_iso_3D", "Isolation distribution of muons without FSR", 100, 20, 100, 100, -2.0, 2.0, 100, 0, 20);
113  h_Iso_FSR_3D_ = fs->make<TH3D>(
114  "h_iso_FSR_3D", "Isolation distribution of muons with FSR ", 100, 20, 100, 100, -2.0, 2.0, 100, 0, 20);
116  fs->make<TH2D>("h_staProbe_pt_eta_no_FSR", "Pt vs Eta StandAlone without FSR ", 100, 20, 100, 100, -2.0, 2.0);
118  fs->make<TH2D>("h_staProbe_pt_eta_FSR", "Pt vs Eta StandAlone with FSR ", 100, 20, 100, 100, -2.0, 2.0);
120  fs->make<TH2D>("h_ProbeOk_pt_eta_no_FSR", "Pt vs Eta probeOk without FSR ", 100, 20, 100, 100, -2.0, 2.0);
122  fs->make<TH2D>("h_ProbeOk_pt_eta_FSR", "Pt vs Eta probeOk with FSR ", 100, 20, 100, 100, -2.0, 2.0);
123 
124  h_trackProbe_eta_no_FSR = fs->make<TH1D>("trackProbeEta_no_FSR", "Eta of tracks", 100, -2.0, 2.0);
125  h_trackProbe_pt_no_FSR = fs->make<TH1D>("trackProbePt_no_FSR", "Pt of tracks", 100, 0, 100);
126  h_staProbe_eta_no_FSR = fs->make<TH1D>("standAloneProbeEta_no_FSR", "Eta of standAlone", 100, -2.0, 2.0);
127  h_staProbe_pt_no_FSR = fs->make<TH1D>("standAloneProbePt_no_FSR", "Pt of standAlone", 100, 0, 100);
128  h_ProbeOk_eta_no_FSR = fs->make<TH1D>("probeOkEta_no_FSR", "Eta of probe Ok", 100, -2.0, 2.0);
129  h_ProbeOk_pt_no_FSR = fs->make<TH1D>("probeOkPt_no_FSR", "Pt of probe ok", 100, 0, 100);
130 
131  h_trackProbe_eta_FSR = fs->make<TH1D>("trackProbeEta_FSR", "Eta of tracks", 100, -2.0, 2.0);
132  h_trackProbe_pt_FSR = fs->make<TH1D>("trackProbePt_FSR", "Pt of tracks", 100, 0, 100);
133  h_staProbe_eta_FSR = fs->make<TH1D>("standAloneProbeEta_FSR", "Eta of standAlone", 100, -2.0, 2.0);
134  h_staProbe_pt_FSR = fs->make<TH1D>("standAloneProbePt_FSR", "Pt of standAlone", 100, 0, 100);
135  h_ProbeOk_eta_FSR = fs->make<TH1D>("probeOkEta_FSR", "Eta of probe Ok", 100, -2.0, 2.0);
136  h_ProbeOk_pt_FSR = fs->make<TH1D>("probeOkPt_FSR", "Pt of probe ok", 100, 0, 100);
137 }
138 
140  evntcounter++;
141  Handle<CandidateView> zMuMu; //Collection of Z made by Mu global + Mu global
142  Handle<GenParticleMatch> zMuMuMatchMap; //Map of Z made by Mu global + Mu global with MC
143  event.getByToken(zMuMuToken_, zMuMu);
144  Handle<CandidateView> zMuTk; //Collection of Z made by Mu global + Track
145  Handle<GenParticleMatch> zMuTkMatchMap;
146  event.getByToken(zMuTkToken_, zMuTk);
147  Handle<CandidateView> zMuSa; //Collection of Z made by Mu global + Sa
148  Handle<GenParticleMatch> zMuSaMatchMap;
149  event.getByToken(zMuSaToken_, zMuSa);
150  cout << "********** New Event ***********" << endl;
151  // ZMuMu
152  if (!zMuMu->empty()) {
153  event.getByToken(zMuMuMatchMapToken_, zMuMuMatchMap);
154  for (unsigned int i = 0; i < zMuMu->size(); ++i) { //loop on candidates
155 
156  const Candidate& zMuMuCand = (*zMuMu)[i]; //the candidate
157  CandidateBaseRef zMuMuCandRef = zMuMu->refAt(i);
158 
159  CandidateBaseRef dau0 = zMuMuCand.daughter(0)->masterClone();
160  CandidateBaseRef dau1 = zMuMuCand.daughter(1)->masterClone();
161  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0); //cast in patMuon
162  const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
163 
164  double zmass = zMuMuCand.mass();
165  double pt0 = mu0.pt();
166  double pt1 = mu1.pt();
167  double eta0 = mu0.eta();
168  double eta1 = mu1.eta();
169  if (pt0 > 20 && pt1 > 20 && abs(eta0) < 2 && abs(eta1) < 2 && zmass > 20 && zmass < 200) {
170  GenParticleRef zMuMuMatch = (*zMuMuMatchMap)[zMuMuCandRef];
171  if (zMuMuMatch.isNonnull()) { // ZMuMu matched
172  zmmcounter++;
173  cout << " Zmumu cuts && matched" << endl;
174  FSR_mu0 = false;
175  FSR_mu1 = false;
176 
177  //Isodeposit
178  const pat::IsoDeposit* mu0TrackIso = mu0.isoDeposit(pat::TrackIso);
179  const pat::IsoDeposit* mu1TrackIso = mu1.isoDeposit(pat::TrackIso);
180  Direction mu0Dir = Direction(mu0.eta(), mu0.phi());
181  Direction mu1Dir = Direction(mu1.eta(), mu1.phi());
182 
183  reco::IsoDeposit::AbsVetos vetos_mu0;
184  vetos_mu0.push_back(new ConeVeto(mu0Dir, dRVeto_));
185  vetos_mu0.push_back(new ThresholdVeto(ptThreshold_));
186 
187  reco::IsoDeposit::AbsVetos vetos_mu1;
188  vetos_mu1.push_back(new ConeVeto(mu1Dir, dRVeto_));
189  vetos_mu1.push_back(new ThresholdVeto(ptThreshold_));
190 
191  double Tracker_isovalue_mu0 = mu0TrackIso->sumWithin(dRTrk_, vetos_mu0);
192  double Tracker_isovalue_mu1 = mu1TrackIso->sumWithin(dRTrk_, vetos_mu1);
193 
194  //trigger study
195  trig0found = false;
196  trig1found = false;
197  const pat::TriggerObjectStandAloneCollection mu0HLTMatches = mu0.triggerObjectMatchesByPath("HLT_Mu9");
198  const pat::TriggerObjectStandAloneCollection mu1HLTMatches = mu1.triggerObjectMatchesByPath("HLT_Mu9");
199  if (!mu0HLTMatches.empty())
200  trig0found = true;
201  if (!mu1HLTMatches.empty())
202  trig1found = true;
203 
204  //MonteCarlo Study
205  const reco::GenParticle* muMc0 = mu0.genLepton();
206  const reco::GenParticle* muMc1 = mu1.genLepton();
207  const Candidate* motherMu0 = muMc0->mother();
208  int num_dau_muon0 = motherMu0->numberOfDaughters();
209  const Candidate* motherMu1 = muMc1->mother();
210  int num_dau_muon1 = motherMu1->numberOfDaughters();
211  cout << " muone0" << endl;
212  cout << " num di daughters = " << num_dau_muon0 << endl;
213  if (num_dau_muon0 > 1) {
214  for (int j = 0; j < num_dau_muon0; ++j) {
215  int id = motherMu0->daughter(j)->pdgId();
216  cout << " dauther[" << j << "] pdgId = " << id << endl;
217  if (id == 22)
218  FSR_mu0 = true;
219  }
220  } //end check of gamma
221 
222  cout << " muone1" << endl;
223  cout << " num di daughters = " << num_dau_muon1 << endl;
224  if (num_dau_muon1 > 1) {
225  for (int j = 0; j < num_dau_muon1; ++j) {
226  int id = motherMu1->daughter(j)->pdgId();
227  cout << " dauther[" << j << "] pdgId = " << id << endl;
228  if (id == 22)
229  FSR_mu1 = true;
230  }
231  } //end check of gamma
232 
233  if (FSR_mu0 || FSR_mu1)
234  h_zmass_FSR->Fill(zmass);
235  else
236  h_zmass_no_FSR->Fill(zmass);
237 
238  if (trig1found) { // check efficiency of muon0 not imposing the trigger on it
239  cout << "muon 1 is triggered " << endl;
240  if (FSR_mu0) {
241  cout << "and muon 0 does FSR" << endl;
242  h_trackProbe_eta_FSR->Fill(eta0);
243  h_trackProbe_pt_FSR->Fill(pt0);
244  h_staProbe_eta_FSR->Fill(eta0);
245  h_staProbe_pt_FSR->Fill(pt0);
246  h_staProbe_pt_eta_FSR_->Fill(pt0, eta0);
247  h_ProbeOk_eta_FSR->Fill(eta0);
248  h_ProbeOk_pt_FSR->Fill(pt0);
249  h_ProbeOk_pt_eta_FSR_->Fill(pt0, eta0);
250  } else {
251  cout << "and muon 0 doesn't FSR" << endl;
252  h_trackProbe_eta_no_FSR->Fill(eta0);
253  h_trackProbe_pt_no_FSR->Fill(pt0);
254  h_staProbe_eta_no_FSR->Fill(eta0);
255  h_staProbe_pt_no_FSR->Fill(pt0);
256  h_staProbe_pt_eta_no_FSR_->Fill(pt0, eta0);
257  h_ProbeOk_eta_no_FSR->Fill(eta0);
258  h_ProbeOk_pt_no_FSR->Fill(pt0);
259  h_ProbeOk_pt_eta_no_FSR_->Fill(pt0, eta0);
260  }
261  if (FSR_mu0) {
262  h_Iso_FSR_->Fill(Tracker_isovalue_mu0);
263  h_Iso_FSR_3D_->Fill(pt0, eta0, Tracker_isovalue_mu0);
264  } else {
265  h_Iso_->Fill(Tracker_isovalue_mu0);
266  h_Iso_3D_->Fill(pt0, eta0, Tracker_isovalue_mu0);
267  }
268  }
269  if (trig0found) { // check efficiency of muon1 not imposing the trigger on it
270  cout << "muon 0 is triggered" << endl;
271  if (FSR_mu1) {
272  cout << "and muon 1 does FSR" << endl;
273  h_trackProbe_eta_FSR->Fill(eta1);
274  h_staProbe_eta_FSR->Fill(eta1);
275  h_trackProbe_pt_FSR->Fill(pt1);
276  h_staProbe_pt_FSR->Fill(pt1);
277  h_ProbeOk_eta_FSR->Fill(eta1);
278  h_ProbeOk_pt_FSR->Fill(pt1);
281 
282  } else {
283  cout << "and muon 1 doesn't FSR" << endl;
287  h_staProbe_pt_no_FSR->Fill(pt1);
288  h_ProbeOk_eta_no_FSR->Fill(eta1);
289  h_ProbeOk_pt_no_FSR->Fill(pt1);
292  }
293  if (FSR_mu1) {
294  h_Iso_FSR_->Fill(Tracker_isovalue_mu1);
295  h_Iso_FSR_3D_->Fill(pt1, eta1, Tracker_isovalue_mu1);
296  } else {
297  h_Iso_->Fill(Tracker_isovalue_mu1);
298  h_Iso_3D_->Fill(pt1, eta1, Tracker_isovalue_mu1);
299  }
300  }
301  } // end MC match
302  } //end of cuts
303  } // end loop on ZMuMu cand
304  } // end if ZMuMu size > 0
305 
306  // ZMuSa
307  if (!zMuSa->empty()) {
308  event.getByToken(zMuSaMatchMapToken_, zMuSaMatchMap);
309  for (unsigned int i = 0; i < zMuSa->size(); ++i) { //loop on candidates
310 
311  const Candidate& zMuSaCand = (*zMuSa)[i]; //the candidate
312  CandidateBaseRef zMuSaCandRef = zMuSa->refAt(i);
313  const Candidate* lep0 = zMuSaCand.daughter(0);
314  const Candidate* lep1 = zMuSaCand.daughter(1);
315  const CandidateBaseRef& dau0 = lep0->masterClone();
316  const CandidateBaseRef& dau1 = lep1->masterClone();
317  const pat::Muon& mu0 = dynamic_cast<const pat::Muon&>(*dau0); //cast in patMuon
318  const pat::Muon& mu1 = dynamic_cast<const pat::Muon&>(*dau1);
319 
320  double zmass = zMuSaCand.mass();
321  double pt0 = mu0.pt();
322  double pt1 = mu1.pt();
323  double eta0 = mu0.eta();
324  double eta1 = mu1.eta();
325  if (pt0 > 20 && pt1 > 20 && abs(eta0) < 2 && abs(eta1) < 2 && zmass > 20 && zmass < 200) {
326  GenParticleRef zMuSaMatch = (*zMuSaMatchMap)[zMuSaCandRef];
327  if (zMuSaMatch.isNonnull()) { // ZMuSa matched
328  cout << " Zmusa cuts && matched" << endl;
329  FSR_mu0 = false;
330  FSR_mu1 = false;
331  zmscounter++;
332  //Isodeposit
333  const pat::IsoDeposit* mu0TrackIso = mu0.isoDeposit(pat::TrackIso);
334  const pat::IsoDeposit* mu1TrackIso = mu1.isoDeposit(pat::TrackIso);
335  Direction mu0Dir = Direction(mu0.eta(), mu0.phi());
336  Direction mu1Dir = Direction(mu1.eta(), mu1.phi());
337 
338  reco::IsoDeposit::AbsVetos vetos_mu0;
339  vetos_mu0.push_back(new ConeVeto(mu0Dir, dRVeto_));
340  vetos_mu0.push_back(new ThresholdVeto(ptThreshold_));
341 
342  reco::IsoDeposit::AbsVetos vetos_mu1;
343  vetos_mu1.push_back(new ConeVeto(mu1Dir, dRVeto_));
344  vetos_mu1.push_back(new ThresholdVeto(ptThreshold_));
345 
346  double Tracker_isovalue_mu0 = mu0TrackIso->sumWithin(dRTrk_, vetos_mu0);
347  double Tracker_isovalue_mu1 = mu1TrackIso->sumWithin(dRTrk_, vetos_mu1);
348 
349  // HLT match (check just dau0 the global)
350  const pat::TriggerObjectStandAloneCollection mu0HLTMatches = mu0.triggerObjectMatchesByPath("HLT_Mu9");
351  const pat::TriggerObjectStandAloneCollection mu1HLTMatches = mu1.triggerObjectMatchesByPath("HLT_Mu9");
352  trig0found = false;
353  trig1found = false;
354  if (!mu0HLTMatches.empty())
355  trig0found = true;
356  if (!mu1HLTMatches.empty())
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)
373  FSR_mu0 = true;
374  }
375  } //end check of gamma
376 
377  cout << " muone1" << endl;
378  cout << " num di daughters = " << num_dau_muon1 << endl;
379  if (num_dau_muon1 > 1) {
380  for (int j = 0; j < num_dau_muon1; ++j) {
381  int id = motherMu1->daughter(j)->pdgId();
382  cout << " dauther[" << j << "] pdgId = " << id << endl;
383  if (id == 22)
384  FSR_mu1 = true;
385  }
386  } //end check of gamma
387  if (FSR_mu0 || FSR_mu1)
388  h_zMuSamass_FSR->Fill(zmass);
389  else
390  h_zMuSamass_no_FSR->Fill(zmass);
391  if (lep0->isGlobalMuon() && trig0found) {
392  if (FSR_mu1) {
393  h_staProbe_eta_FSR->Fill(eta1);
394  h_staProbe_pt_FSR->Fill(pt1);
396 
397  } else {
399  h_staProbe_pt_no_FSR->Fill(pt1);
401  }
402  if (FSR_mu1) {
403  h_Iso_FSR_->Fill(Tracker_isovalue_mu1);
404  h_Iso_FSR_3D_->Fill(pt1, eta1, Tracker_isovalue_mu1);
405  } else {
406  h_Iso_->Fill(Tracker_isovalue_mu1);
407  h_Iso_3D_->Fill(pt1, eta1, Tracker_isovalue_mu1);
408  }
409  }
410  if (lep1->isGlobalMuon() && trig1found) {
411  if (FSR_mu0) {
412  h_staProbe_eta_FSR->Fill(eta0);
413  h_staProbe_pt_FSR->Fill(pt0);
414  h_staProbe_pt_eta_FSR_->Fill(pt0, eta0);
415 
416  } else {
417  h_staProbe_eta_no_FSR->Fill(eta0);
418  h_staProbe_pt_no_FSR->Fill(pt0);
419  h_staProbe_pt_eta_FSR_->Fill(pt0, eta0);
420  }
421  if (FSR_mu0) {
422  h_Iso_FSR_->Fill(Tracker_isovalue_mu0);
423  h_Iso_FSR_3D_->Fill(pt0, eta0, Tracker_isovalue_mu0);
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->empty()) {
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  double zmass = zMuTkCand.mass();
446  double pt0 = mu0.pt();
447  double pt1 = mu1.pt();
448  double eta0 = mu0.eta();
449  double eta1 = mu1.eta();
450  if (pt0 > 20 && pt1 > 20 && abs(eta0) < 2 && abs(eta1) < 2 && zmass > 20 && zmass < 200) { //kinematical cuts
451  GenParticleRef zMuTkMatch = (*zMuTkMatchMap)[zMuTkCandRef];
452  if (zMuTkMatch.isNonnull()) { // ZMuTk matched
453  FSR_mu = false;
454  FSR_tk = false;
455  cout << " ZmuTk cuts && matched" << endl;
456  zmtcounter++;
457  //Isodeposit
458  const pat::IsoDeposit* muTrackIso = mu0.isoDeposit(pat::TrackIso);
459  const pat::IsoDeposit* tkTrackIso = mu1.isoDeposit(pat::TrackIso);
460  Direction muDir = Direction(mu0.eta(), mu0.phi());
461  Direction tkDir = Direction(mu1.eta(), mu1.phi());
462 
463  IsoDeposit::AbsVetos vetos_mu;
464  vetos_mu.push_back(new ConeVeto(muDir, dRVeto_));
465  vetos_mu.push_back(new ThresholdVeto(ptThreshold_));
466 
468  vetos_tk.push_back(new ConeVeto(tkDir, dRVeto_));
469  vetos_tk.push_back(new ThresholdVeto(ptThreshold_));
470 
471  double Tracker_isovalue_mu = muTrackIso->sumWithin(dRTrk_, vetos_mu);
472  double Tracker_isovalue_tk = tkTrackIso->sumWithin(dRTrk_, vetos_tk);
473 
474  //MonteCarlo Study
475  const reco::GenParticle* muMc0 = mu0.genLepton();
476  const reco::GenParticle* muMc1 = mu1.genParticle();
477  const Candidate* motherMu0 = muMc0->mother();
478  const Candidate* motherMu1 = muMc1->mother();
479  int num_dau_muon0 = motherMu0->numberOfDaughters();
480  int num_dau_muon1 = motherMu1->numberOfDaughters();
481  cout << "numero di figli muone0 = " << num_dau_muon0 << endl;
482  cout << "numero di figli muone1 = " << num_dau_muon1 << endl;
483 
484  cout << " muon" << endl;
485  cout << " num di daughters = " << num_dau_muon0 << endl;
486  if (num_dau_muon0 > 1) {
487  for (int j = 0; j < num_dau_muon0; ++j) {
488  int id = motherMu0->daughter(j)->pdgId();
489  cout << " dau[" << j << "] pdg ID = " << id << endl;
490  if (id == 22) {
491  FSR_mu = true;
492  }
493  }
494  } //end check of gamma
495  else
496  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
509  cout << " dau[0] pdg ID = " << motherMu1->daughter(0)->pdgId() << endl;
510  cout << "Mu Isolation = " << Tracker_isovalue_mu << endl;
511  cout << "Track Isolation = " << Tracker_isovalue_tk << endl;
512  if (FSR_mu) {
513  h_Iso_FSR_->Fill(Tracker_isovalue_mu);
514  h_Iso_FSR_3D_->Fill(pt0, eta0, Tracker_isovalue_mu);
515  } else {
516  h_Iso_->Fill(Tracker_isovalue_mu);
517  h_Iso_3D_->Fill(pt0, eta0, Tracker_isovalue_mu);
518  }
519  if (FSR_tk) {
520  h_Iso_FSR_->Fill(Tracker_isovalue_tk);
521  h_Iso_FSR_3D_->Fill(pt1, eta1, Tracker_isovalue_tk);
522  h_trackProbe_eta_FSR->Fill(eta1);
523  h_trackProbe_pt_FSR->Fill(pt1);
524  } else {
525  h_Iso_->Fill(Tracker_isovalue_tk);
526  h_Iso_3D_->Fill(pt1, eta1, Tracker_isovalue_tk);
529  }
530  } // end MC match
531  } //end Kine-cuts
532  } // end loop on ZMuTk cand
533  } // end if ZMuTk size > 0
534 } // end analyze
535 
537  cout << " ============= Summary ==========" << endl;
538  cout << " Numero di eventi " << evntcounter << endl;
539  cout << " 1)Numero di ZMuMu matched dopo i tagli cinematici = " << zmmcounter << endl;
540  cout << " 2)Numero di ZMuSa matched dopo i tagli cinematici = " << zmscounter << endl;
541  cout << " 3)Numero di ZMuTk matched dopo i tagli cinematici = " << zmtcounter << endl;
542  double n1 = h_Iso_FSR_->Integral();
543  double icut1 = h_Iso_FSR_->Integral(0, 15);
544  double eff_iso_FSR = (double)icut1 / (double)n1;
545  double err_iso_FSR = sqrt(eff_iso_FSR * (1 - eff_iso_FSR) / n1);
546  double n2 = h_Iso_->Integral();
547  double icut2 = h_Iso_->Integral(0, 15);
548  double eff_iso = (double)icut2 / (double)n2;
549  double err_iso = sqrt(eff_iso * (1 - eff_iso) / n2);
550  cout << " ============= Isolation Efficiecy ==========" << endl;
551  cout << "Isolation Efficiency = " << eff_iso << " +/- " << err_iso << endl;
552  cout << "Isolation Efficiency with FSR = " << eff_iso_FSR << " +/- " << err_iso_FSR << endl;
553 }
554 
556 
RazorAnalyzer.lep1
lep1
print 'MRbb(1b)',event.mr_bb
Definition: RazorAnalyzer.py:261
ZMuMu_Radiative_analyzer::dRVeto_
double dRVeto_
Definition: ZMuMu_radiative_analysis.cc:65
reco::Candidate::daughter
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
ZMuMu_Radiative_analyzer::h_Iso_
TH1D * h_Iso_
Definition: ZMuMu_radiative_analysis.cc:70
ZMuMu_Radiative_analyzer::zmmcounter
int zmmcounter
Definition: ZMuMu_radiative_analysis.cc:81
Handle.h
mps_fire.i
i
Definition: mps_fire.py:355
Muon.h
ZMuMu_Radiative_analyzer::ZMuMu_Radiative_analyzer
ZMuMu_Radiative_analyzer(const edm::ParameterSet &pset)
Definition: ZMuMu_radiative_analysis.cc:86
IsoDepositVetos.h
ZMuMuAnalysisNtupler_cff.zMuMu
zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
Definition: ZMuMuAnalysisNtupler_cff.py:340
edm::View::empty
bool empty() const
ZMuMu_Radiative_analyzer::h_trackProbe_eta_no_FSR
TH1D * h_trackProbe_eta_no_FSR
Definition: ZMuMu_radiative_analysis.cc:73
ZMuMu_Radiative_analyzer::h_ProbeOk_eta_FSR
TH1D * h_ProbeOk_eta_FSR
Definition: ZMuMu_radiative_analysis.cc:75
reco::GenParticle
Definition: GenParticle.h:21
reco::Candidate::mass
virtual double mass() const =0
mass
ZMuMu_Radiative_analyzer::h_zMuSamass_FSR
TH1D * h_zMuSamass_FSR
Definition: ZMuMu_radiative_analysis.cc:68
edm::View::refAt
RefToBase< value_type > refAt(size_type i) const
edm::EDGetTokenT< CandidateView >
reco::CompositeRefCandidateT::mother
const Candidate * mother(size_type=0) const override
return mother at a given position, i = 0, ... numberOfMothers() - 1 (read only mode)
edm
HLT enums.
Definition: AlignableModifier.h:19
Muon.h
ZMuMu_Radiative_analyzer::h_trackProbe_pt_no_FSR
TH1D * h_trackProbe_pt_no_FSR
Definition: ZMuMu_radiative_analysis.cc:73
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GenericParticle.h
ZMuMu_Radiative_analyzer::h_staProbe_pt_eta_no_FSR_
TH2D * h_staProbe_pt_eta_no_FSR_
Definition: ZMuMu_radiative_analysis.cc:72
HLT_2018_cff.eta1
eta1
Definition: HLT_2018_cff.py:8220
HLT_2018_cff.pt1
pt1
Definition: HLT_2018_cff.py:8550
ZMuMu_Radiative_analyzer::h_zMuTkmass_no_FSR
TH1D * h_zMuTkmass_no_FSR
Definition: ZMuMu_radiative_analysis.cc:69
EDAnalyzer.h
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
pat::Muon
Analysis-level muon class.
Definition: Muon.h:51
ZMuMu_Radiative_analyzer::analyze
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
Definition: ZMuMu_radiative_analysis.cc:139
Lepton.h
IsolationCollection
edm::ValueMap< float > IsolationCollection
Definition: ZMuMu_radiative_analysis.cc:84
ZMuMu_Radiative_analyzer::h_zMuSamass_no_FSR
TH1D * h_zMuSamass_no_FSR
Definition: ZMuMu_radiative_analysis.cc:68
edm::Handle
Definition: AssociativeIterator.h:50
RecoCandidate.h
IsoDepositDirection.h
ZMuMu_Radiative_analyzer::h_staProbe_eta_FSR
TH1D * h_staProbe_eta_FSR
Definition: ZMuMu_radiative_analysis.cc:75
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
ZMuMu_Radiative_analyzer::h_Iso_3D_
TH3D * h_Iso_3D_
Definition: ZMuMu_radiative_analysis.cc:71
CandMatchMap.h
edm::Ref< GenParticleCollection >
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
ZMuMu_Radiative_analyzer::trig0found
bool trig0found
Definition: ZMuMu_radiative_analysis.cc:79
ZMuMu_Radiative_analyzer
Definition: ZMuMu_radiative_analysis.cc:51
GenParticle.h
CandidateFwd.h
ZMuMu_Radiative_analyzer::FSR_mu
bool FSR_mu
Definition: ZMuMu_radiative_analysis.cc:78
ZMuMu_Radiative_analyzer::h_staProbe_eta_no_FSR
TH1D * h_staProbe_eta_no_FSR
Definition: ZMuMu_radiative_analysis.cc:73
reco::isodeposit::ConeVeto
Definition: IsoDepositVetos.h:9
MakerMacros.h
ZMuMu_Radiative_analyzer::h_staProbe_pt_FSR
TH1D * h_staProbe_pt_FSR
Definition: ZMuMu_radiative_analysis.cc:75
ZMuMu_Radiative_analyzer::evntcounter
int evntcounter
Definition: ZMuMu_radiative_analysis.cc:81
ZMuMu_Radiative_analyzer::h_staProbe_pt_no_FSR
TH1D * h_staProbe_pt_no_FSR
Definition: ZMuMu_radiative_analysis.cc:73
pat::Lepton::isoDeposit
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:182
ZMuMu_Radiative_analyzer::h_ProbeOk_pt_eta_FSR_
TH2D * h_ProbeOk_pt_eta_FSR_
Definition: ZMuMu_radiative_analysis.cc:72
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ZMuMu_Radiative_analyzer::h_staProbe_pt_eta_FSR_
TH2D * h_staProbe_pt_eta_FSR_
Definition: ZMuMu_radiative_analysis.cc:72
ZMuMu_Radiative_analyzer::endJob
void endJob() override
Definition: ZMuMu_radiative_analysis.cc:536
Service.h
ZMuMuAnalysisNtupler_cff.zMuSa
zMuSa
zMUSa vector of PSet is specific for zMuSa category
Definition: ZMuMuAnalysisNtupler_cff.py:591
ZMuMu_Radiative_analyzer::zmscounter
int zmscounter
Definition: ZMuMu_radiative_analysis.cc:81
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::IsoDeposit::AbsVetos
isodeposit::AbsVetos AbsVetos
Definition: IsoDeposit.h:53
Particle.h
reco::Candidate::numberOfDaughters
virtual size_type numberOfDaughters() const =0
number of daughters
pat::Lepton::genLepton
const reco::GenParticle * genLepton() const
Definition: Lepton.h:39
Isolation.h
ZMuMu_Radiative_analyzer::FSR_mu1
bool FSR_mu1
Definition: ZMuMu_radiative_analysis.cc:78
ZMuMu_Radiative_analyzer::zMuMuMatchMapToken_
EDGetTokenT< GenParticleMatch > zMuMuMatchMapToken_
Definition: ZMuMu_radiative_analysis.cc:60
IsoDeposit.h
edm::View::size
size_type size() const
TFileService.h
ZMuMu_Radiative_analyzer::h_ProbeOk_pt_FSR
TH1D * h_ProbeOk_pt_FSR
Definition: ZMuMu_radiative_analysis.cc:75
edm::View
Definition: CaloClusterFwd.h:14
ZMuMu_Radiative_analyzer::FSR_tk
bool FSR_tk
Definition: ZMuMu_radiative_analysis.cc:78
ZMuMu_Radiative_analyzer::zMuSaToken_
EDGetTokenT< CandidateView > zMuSaToken_
Definition: ZMuMu_radiative_analysis.cc:63
pat::GenericParticle
Analysis-level Generic Particle class (e.g. for hadron or muon not fully reconstructed)
Definition: GenericParticle.h:38
edm::ParameterSet
Definition: ParameterSet.h:36
CandAssociation.h
Event.h
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
ZMuMu_Radiative_analyzer::h_zMuTkmass_FSR
TH1D * h_zMuTkmass_FSR
Definition: ZMuMu_radiative_analysis.cc:69
ZMuMu_Radiative_analyzer::FSR_mu0
bool FSR_mu0
Definition: ZMuMu_radiative_analysis.cc:78
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
pat::TrackIso
Definition: Isolation.h:10
edm::Service< TFileService >
pat::GenericParticle::isoDeposit
const IsoDeposit * isoDeposit(IsolationKeys key) const
Returns the IsoDeposit associated with some key, or a null pointer if it is not available.
Definition: GenericParticle.h:242
reco::IsoDeposit::sumWithin
double sumWithin(double coneSize, const AbsVetos &vetos=AbsVetos(), bool skipDepositVeto=false) const
Definition: IsoDeposit.cc:137
ZMuMu_Radiative_analyzer::zMuSaMatchMapToken_
EDGetTokenT< GenParticleMatch > zMuSaMatchMapToken_
Definition: ZMuMu_radiative_analysis.cc:64
pat::TriggerObjectStandAloneCollection
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
Definition: TriggerObjectStandAlone.h:219
pat::PATObject::triggerObjectMatchesByPath
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:682
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::Association
Definition: Association.h:18
edm::EventSetup
Definition: EventSetup.h:57
ZMuMu_Radiative_analyzer::h_ProbeOk_pt_no_FSR
TH1D * h_ProbeOk_pt_no_FSR
Definition: ZMuMu_radiative_analysis.cc:73
ZMuMu_Radiative_analyzer::zMuTkMatchMapToken_
EDGetTokenT< GenParticleMatch > zMuTkMatchMapToken_
Definition: ZMuMu_radiative_analysis.cc:62
ZMuMu_Radiative_analyzer::zmtcounter
int zmtcounter
Definition: ZMuMu_radiative_analysis.cc:81
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
InputTag.h
reco::isodeposit::ThresholdVeto
Definition: IsoDepositVetos.h:21
reco::Candidate
Definition: Candidate.h:27
ZMuMu_Radiative_analyzer::h_zmass_no_FSR
TH1D * h_zmass_no_FSR
Definition: ZMuMu_radiative_analysis.cc:67
ValueMap.h
ZMuMu_Radiative_analyzer::ptThreshold_
double ptThreshold_
Definition: ZMuMu_radiative_analysis.cc:65
std
Definition: JetResolutionObject.h:76
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
pat::PATObject::genParticle
const reco::GenParticle * genParticle(size_t idx=0) const
Definition: PATObject.h:290
edm::ValueMap< float >
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
ZMuMu_Radiative_analyzer::trig1found
bool trig1found
Definition: ZMuMu_radiative_analysis.cc:79
ZMuMu_Radiative_analyzer::h_Iso_FSR_
TH1D * h_Iso_FSR_
Definition: ZMuMu_radiative_analysis.cc:70
EventSetup.h
reco::IsoDeposit
Definition: IsoDeposit.h:49
ZMuMu_Radiative_analyzer::h_zmass_FSR
TH1D * h_zmass_FSR
Definition: ZMuMu_radiative_analysis.cc:67
edm::RefToBase< Candidate >
reco::Candidate::masterClone
virtual const CandidateBaseRef & masterClone() const =0
ZMuMu_Radiative_analyzer::h_ProbeOk_eta_no_FSR
TH1D * h_ProbeOk_eta_no_FSR
Definition: ZMuMu_radiative_analysis.cc:73
AssociationVector.h
OverlapChecker.h
Candidate.h
IsoDepositFwd.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ZMuMu_Radiative_analyzer::dRTrk_
double dRTrk_
Definition: ZMuMu_radiative_analysis.cc:65
ParameterSet.h
ZMuMu_Radiative_analyzer::zMuTkToken_
EDGetTokenT< CandidateView > zMuTkToken_
Definition: ZMuMu_radiative_analysis.cc:61
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
ZMuMu_Radiative_analyzer::h_trackProbe_eta_FSR
TH1D * h_trackProbe_eta_FSR
Definition: ZMuMu_radiative_analysis.cc:75
ZMuMu_Radiative_analyzer::h_ProbeOk_pt_eta_no_FSR_
TH2D * h_ProbeOk_pt_eta_no_FSR_
Definition: ZMuMu_radiative_analysis.cc:72
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
ZMuMu_Radiative_analyzer::h_Iso_FSR_3D_
TH3D * h_Iso_FSR_3D_
Definition: ZMuMu_radiative_analysis.cc:71
TriggerObjectStandAlone.h
reco::Candidate::isGlobalMuon
virtual bool isGlobalMuon() const =0
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
ZMuMu_Radiative_analyzer::zMuMuToken_
EDGetTokenT< CandidateView > zMuMuToken_
Definition: ZMuMu_radiative_analysis.cc:59
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
PATObject.h
ZMuMu_Radiative_analyzer::h_trackProbe_pt_FSR
TH1D * h_trackProbe_pt_FSR
Definition: ZMuMu_radiative_analysis.cc:75