CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ZMuMu_MCanalyzer Class Reference
Inheritance diagram for ZMuMu_MCanalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 ZMuMu_MCanalyzer (const edm::ParameterSet &pset)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 
bool check_ifZmumu (const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
 
virtual void endJob () override
 
float getParticleEta (const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
 
Particle::LorentzVector getParticleP4 (const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
 
float getParticlePhi (const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
 
float getParticlePt (const int ipart, const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
 

Private Attributes

double alpha_
 
double beta_
 
bool bothMuons_
 
double dREcal_
 
double dRHcal_
 
double dRTrk_
 
double dRVetoTrk_
 
double etamax_
 
double etamin_
 
double etEcalThreshold_
 
double etHcalThreshold_
 
EDGetTokenT< GenParticleCollectiongenParticlesToken_
 
reco::CandidateBaseRef globalMuonCandRef_
 
TH1D * h_ProbeOk_eta
 
TH1D * h_ProbeOk_pt
 
TH1D * h_staProbe_eta
 
TH1D * h_staProbe_pt
 
TH1D * h_trackProbe_eta
 
TH1D * h_trackProbe_pt
 
string hltPath_
 
double isoMax_
 
double massMax_
 
double massMin_
 
EDGetTokenT< CandidateViewmuonsToken_
 
int n2GlobalMuonsMatched_passedIso
 
int n2GlobalMuonsMatched_passedIso2Trg
 
int nGlobalMuonsMatched_passed
 
int nGlobalMuonsMatched_passedIso
 
int nMu0onlyTriggered
 
int nMu1onlyTriggered
 
int nStaMuonsMatched_passedIso
 
int nTracksMuonsMatched_passedIso
 
int nZMuMu_matched
 
int nZMuSta_matched
 
int nZMuTrk_matched
 
OverlapChecker overlap_
 
double ptmin_
 
double ptThreshold_
 
bool relativeIsolation_
 
reco::CandidateBaseRef standAloneMuonCandRef_
 
reco::CandidateBaseRef trackMuonCandRef_
 
EDGetTokenT< CandidateViewtracksToken_
 
EDGetTokenT< GenParticleMatchzMuMuMatchMapToken_
 
EDGetTokenT< CandidateViewzMuMuToken_
 
EDGetTokenT< GenParticleMatchzMuStandAloneMatchMapToken_
 
EDGetTokenT< CandidateViewzMuStandAloneToken_
 
EDGetTokenT< GenParticleMatchzMuTrackMatchMapToken_
 
EDGetTokenT< CandidateViewzMuTrackToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 49 of file ZMuMu_MCanalyzer.cc.

Constructor & Destructor Documentation

ZMuMu_MCanalyzer::ZMuMu_MCanalyzer ( const edm::ParameterSet pset)

Definition at line 166 of file ZMuMu_MCanalyzer.cc.

References MuonErrorMatrixValues_cff::etaRange, h_ProbeOk_eta, h_ProbeOk_pt, h_staProbe_eta, h_staProbe_pt, h_trackProbe_eta, h_trackProbe_pt, TFileService::make(), n2GlobalMuonsMatched_passedIso, n2GlobalMuonsMatched_passedIso2Trg, nGlobalMuonsMatched_passed, nGlobalMuonsMatched_passedIso, nMu0onlyTriggered, nMu1onlyTriggered, nStaMuonsMatched_passedIso, nTracksMuonsMatched_passedIso, nZMuMu_matched, nZMuSta_matched, nZMuTrk_matched, and MuonErrorMatrixValues_cff::ptRange.

166  :
167  zMuMuToken_(consumes<CandidateView>(pset.getParameter<InputTag>("zMuMu"))),
168  zMuMuMatchMapToken_(mayConsume<GenParticleMatch>(pset.getParameter<InputTag>("zMuMuMatchMap"))),
169  zMuStandAloneToken_(consumes<CandidateView>(pset.getParameter<InputTag>("zMuStandAlone"))),
170  zMuStandAloneMatchMapToken_(mayConsume<GenParticleMatch>(pset.getParameter<InputTag>("zMuStandAloneMatchMap"))),
171  zMuTrackToken_(consumes<CandidateView>(pset.getParameter<InputTag>("zMuTrack"))),
172  zMuTrackMatchMapToken_(mayConsume<GenParticleMatch>(pset.getParameter<InputTag>("zMuTrackMatchMap"))),
173  muonsToken_(consumes<CandidateView>(pset.getParameter<InputTag>("muons"))),
174  tracksToken_(consumes<CandidateView>(pset.getParameter<InputTag>("tracks"))),
175  genParticlesToken_(consumes<GenParticleCollection>(pset.getParameter<InputTag>("genParticles"))),
176 
177  bothMuons_(pset.getParameter<bool>("bothMuons")),
178  etamin_(pset.getUntrackedParameter<double>("etamin")),
179  etamax_(pset.getUntrackedParameter<double>("etamax")),
180  ptmin_(pset.getUntrackedParameter<double>("ptmin")),
181  massMin_(pset.getUntrackedParameter<double>("zMassMin")),
182  massMax_(pset.getUntrackedParameter<double>("zMassMax")),
183  isoMax_(pset.getUntrackedParameter<double>("isomax")),
184  ptThreshold_(pset.getUntrackedParameter<double>("ptThreshold")),
185  etEcalThreshold_(pset.getUntrackedParameter<double>("etEcalThreshold")),
186  etHcalThreshold_(pset.getUntrackedParameter<double>("etHcalThreshold")),
187  dRVetoTrk_(pset.getUntrackedParameter<double>("deltaRVetoTrk")),
188  dRTrk_(pset.getUntrackedParameter<double>("deltaRTrk")),
189  dREcal_(pset.getUntrackedParameter<double>("deltaREcal")),
190  dRHcal_(pset.getUntrackedParameter<double>("deltaRHcal")),
191  alpha_(pset.getUntrackedParameter<double>("alpha")),
192  beta_(pset.getUntrackedParameter<double>("beta")),
193  relativeIsolation_(pset.getUntrackedParameter<bool>("relativeIsolation")),
194  hltPath_(pset.getUntrackedParameter<std::string >("hltPath")) {
196 
197  // binning of entries array (at moment defined by hand and not in cfg file)
198  double etaRange[8] = {-2.5,-2.,-1.2,-0.8,0.8,1.2,2.,2.5};
199  double ptRange[4] = {20.,40.,60.,100.};
200 
201  // general histograms
202  h_trackProbe_eta = fs->make<TH1D>("trackProbeEta","Eta of tracks",7,etaRange);
203  h_trackProbe_pt = fs->make<TH1D>("trackProbePt","Pt of tracks",3,ptRange);
204  h_staProbe_eta = fs->make<TH1D>("standAloneProbeEta","Eta of standAlone",7,etaRange);
205  h_staProbe_pt = fs->make<TH1D>("standAloneProbePt","Pt of standAlone",3,ptRange);
206  h_ProbeOk_eta = fs->make<TH1D>("probeOkEta","Eta of probe Ok",7,etaRange);
207  h_ProbeOk_pt = fs->make<TH1D>("probeOkPt","Pt of probe ok",3,ptRange);
208 
209  // clear global counters
216  nMu0onlyTriggered = 0;
217  nMu1onlyTriggered = 0;
218  nZMuMu_matched = 0;
219  nZMuSta_matched = 0;
220  nZMuTrk_matched = 0;
221 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
EDGetTokenT< CandidateView > zMuStandAloneToken_
EDGetTokenT< CandidateView > zMuMuToken_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
EDGetTokenT< CandidateView > muonsToken_
EDGetTokenT< GenParticleMatch > zMuTrackMatchMapToken_
EDGetTokenT< GenParticleCollection > genParticlesToken_
int n2GlobalMuonsMatched_passedIso2Trg
EDGetTokenT< GenParticleMatch > zMuMuMatchMapToken_
EDGetTokenT< CandidateView > zMuTrackToken_
EDGetTokenT< CandidateView > tracksToken_
EDGetTokenT< GenParticleMatch > zMuStandAloneMatchMapToken_

Member Function Documentation

void ZMuMu_MCanalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Definition at line 223 of file ZMuMu_MCanalyzer.cc.

References funct::abs(), alpha_, beta_, candidateIsolation(), reco::Candidate::daughter(), dREcal_, dRHcal_, dRTrk_, dRVetoTrk_, reco::Candidate::eta(), etamax_, etamin_, etEcalThreshold_, etHcalThreshold_, GenHFHadronMatcher_cfi::genParticles, genParticlesToken_, h_ProbeOk_eta, h_ProbeOk_pt, h_staProbe_eta, h_staProbe_pt, h_trackProbe_eta, h_trackProbe_pt, hltPath_, mps_fire::i, edm::Ref< C, T, F >::isNonnull(), isoMax_, RazorAnalyzer::lep1, ResonanceBuilder::mass, reco::Candidate::mass(), massMax_, massMin_, reco::Candidate::masterClone(), electronCleaner_cfi::muons, muonsToken_, n2GlobalMuonsMatched_passedIso, n2GlobalMuonsMatched_passedIso2Trg, nGlobalMuonsMatched_passed, nGlobalMuonsMatched_passedIso, nMu0onlyTriggered, nMu1onlyTriggered, nStaMuonsMatched_passedIso, nTracksMuonsMatched_passedIso, nZMuMu_matched, nZMuSta_matched, nZMuTrk_matched, reco::Candidate::pt(), hiDetachedQuadStep_cff::pt1, ptmin_, ptThreshold_, edm::View< T >::refAt(), relativeIsolation_, edm::View< T >::size(), l1t::tracks, tracksToken_, pat::PATObject< ObjectType >::triggerObjectMatchesByPath(), zMuMuMatchMapToken_, zMuMuToken_, zMuStandAloneMatchMapToken_, zMuStandAloneToken_, zMuTrackMatchMapToken_, and zMuTrackToken_.

223  {
224  Handle<CandidateView> zMuMu;
225  Handle<GenParticleMatch> zMuMuMatchMap; //Map of Z made by Mu global + Mu global
226  Handle<CandidateView> zMuStandAlone;
227  Handle<GenParticleMatch> zMuStandAloneMatchMap; //Map of Z made by Mu + StandAlone
228  Handle<CandidateView> zMuTrack;
229  Handle<GenParticleMatch> zMuTrackMatchMap; //Map of Z made by Mu + Track
230  Handle<CandidateView> muons; //Collection of Muons
231  Handle<CandidateView> tracks; //Collection of Tracks
232 
233  Handle<GenParticleCollection> genParticles; // Collection of Generatd Particles
234 
235  event.getByToken(zMuMuToken_, zMuMu);
236  event.getByToken(zMuStandAloneToken_, zMuStandAlone);
237  event.getByToken(zMuTrackToken_, zMuTrack);
238  event.getByToken(genParticlesToken_, genParticles);
239  event.getByToken(muonsToken_, muons);
240  event.getByToken(tracksToken_, tracks);
241 
242  /*
243  cout << "********* zMuMu size : " << zMuMu->size() << endl;
244  cout << "********* zMuStandAlone size : " << zMuStandAlone->size() << endl;
245  cout << "********* zMuTrack size : " << zMuTrack->size() << endl;
246  cout << "********* muons size : " << muons->size() << endl;
247  cout << "********* tracks size : " << tracks->size() << endl;
248  */
249  // std::cout<<"Run-> "<<event.id().run()<<std::endl;
250  // std::cout<<"Event-> "<<event.id().event()<<std::endl;
251 
252 
253  bool zMuMu_found = false;
254 
255  // loop on ZMuMu
256  if (zMuMu->size() > 0 ) {
257  event.getByToken(zMuMuMatchMapToken_, zMuMuMatchMap);
258  for(unsigned int i = 0; i < zMuMu->size(); ++i) { //loop on candidates
259  const Candidate & zMuMuCand = (*zMuMu)[i]; //the candidate
260  CandidateBaseRef zMuMuCandRef = zMuMu->refAt(i);
261 
262  const Candidate * lep0 = zMuMuCand.daughter( 0 );
263  const Candidate * lep1 = zMuMuCand.daughter( 1 );
264  const pat::Muon & muonDau0 = dynamic_cast<const pat::Muon &>(*lep0->masterClone());
265  // double trkiso0 = muonDau0.trackIso();
266  const pat::Muon & muonDau1 = dynamic_cast<const pat::Muon &>(*lep1->masterClone());
267  //double trkiso1 = muonDau1.trackIso();
268 
271 
272  double pt0 = zMuMuCand.daughter(0)->pt();
273  double pt1 = zMuMuCand.daughter(1)->pt();
274  double eta0 = zMuMuCand.daughter(0)->eta();
275  double eta1 = zMuMuCand.daughter(1)->eta();
276  double mass = zMuMuCand.mass();
277 
278  // HLT match
279  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
281  const pat::TriggerObjectStandAloneCollection mu1HLTMatches =
283 
284  bool trig0found = false;
285  bool trig1found = false;
286  if( mu0HLTMatches.size()>0 )
287  trig0found = true;
288  if( mu1HLTMatches.size()>0 )
289  trig1found = true;
290 
291  GenParticleRef zMuMuMatch = (*zMuMuMatchMap)[zMuMuCandRef];
292  if(zMuMuMatch.isNonnull()) { // ZMuMu matched
293  zMuMu_found = true;
294  nZMuMu_matched++;
295  if (pt0>ptmin_ && pt1>ptmin_ && abs(eta0)>etamin_ && abs(eta1) >etamin_ && abs(eta0)<etamax_ && abs(eta1) <etamax_ && mass >massMin_ && mass < massMax_ && (trig0found || trig1found)) { // kinematic and trigger cuts passed
296  nGlobalMuonsMatched_passed++; // first global Muon passed kine cuts
297  nGlobalMuonsMatched_passed++; // second global muon passsed kine cuts
298  if (iso0<isoMax_) nGlobalMuonsMatched_passedIso++; // first global muon passed the iso cut
299  if (iso1<isoMax_) nGlobalMuonsMatched_passedIso++; // second global muon passed the iso cut
300  if (iso0<isoMax_ && iso1<isoMax_) {
301  n2GlobalMuonsMatched_passedIso++; // both muons passed iso cut
302  if (trig0found && trig1found) n2GlobalMuonsMatched_passedIso2Trg++; // both muons have HLT
303  if (trig0found && !trig1found) nMu0onlyTriggered++;
304  if (trig1found && !trig0found) nMu1onlyTriggered++;
305  // histograms vs eta and pt
306  if (trig1found) { // check efficiency of muon0 not imposing the trigger on it
307  h_trackProbe_eta->Fill(eta0);
308  h_trackProbe_pt->Fill(pt0);
309  h_staProbe_eta->Fill(eta0);
310  h_staProbe_pt->Fill(pt0);
311  h_ProbeOk_eta->Fill(eta0);
312  h_ProbeOk_pt->Fill(pt0);
313  }
314  if (trig0found) { // check efficiency of muon1 not imposing the trigger on it
315  h_trackProbe_eta->Fill(eta1);
316  h_staProbe_eta->Fill(eta1);
317  h_trackProbe_pt->Fill(pt1);
318  h_staProbe_pt->Fill(pt1);
319  h_ProbeOk_eta->Fill(eta1);
320  h_ProbeOk_pt->Fill(pt1);
321  }
322  }
323  }
324  } // end MC match
325 
326  } // end loop on ZMuMu cand
327  } // end if ZMuMu size > 0
328 
329  // loop on ZMuSta
330  bool zMuSta_found = false;
331  if (!zMuMu_found && zMuStandAlone->size() > 0 ) {
332  event.getByToken(zMuStandAloneMatchMapToken_, zMuStandAloneMatchMap);
333  for(unsigned int i = 0; i < zMuStandAlone->size(); ++i) { //loop on candidates
334  const Candidate & zMuStandAloneCand = (*zMuStandAlone)[i]; //the candidate
335  CandidateBaseRef zMuStandAloneCandRef = zMuStandAlone->refAt(i);
336  GenParticleRef zMuStandAloneMatch = (*zMuStandAloneMatchMap)[zMuStandAloneCandRef];
337 
338  const Candidate * lep0 = zMuStandAloneCand.daughter( 0 );
339  const Candidate * lep1 = zMuStandAloneCand.daughter( 1 );
340  const pat::Muon & muonDau0 = dynamic_cast<const pat::Muon &>(*lep0->masterClone());
341  //double trkiso0 = muonDau0.trackIso();
342  // const pat::Muon & muonDau1 = dynamic_cast<const pat::Muon &>(*lep1->masterClone());
343  //double trkiso1 = muonDau1.trackIso();
344 
347 
348  double pt0 = zMuStandAloneCand.daughter(0)->pt();
349  double pt1 = zMuStandAloneCand.daughter(1)->pt();
350  double eta0 = zMuStandAloneCand.daughter(0)->eta();
351  double eta1 = zMuStandAloneCand.daughter(1)->eta();
352  double mass = zMuStandAloneCand.mass();
353 
354  // HLT match (check just dau0 the global)
355  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
357 
358  bool trig0found = false;
359  if( mu0HLTMatches.size()>0 )
360  trig0found = true;
361 
362  if(zMuStandAloneMatch.isNonnull()) { // ZMuStandAlone matched
363  zMuSta_found = true;
364  nZMuSta_matched++;
365  if (pt0>ptmin_ && pt1>ptmin_ && abs(eta0)>etamin_ && abs(eta1)>etamin_ && abs(eta0)<etamax_ && abs(eta1) <etamax_ && mass >massMin_ &&
366  mass < massMax_ && iso0<isoMax_ && iso1 < isoMax_ && trig0found) { // all cuts and trigger passed
368  // histograms vs eta and pt
369  h_staProbe_eta->Fill(eta1);
370  h_staProbe_pt->Fill(pt1);
371  }
372  } // end MC match
373  } // end loop on ZMuStandAlone cand
374  } // end if ZMuStandAlone size > 0
375 
376 
377  // loop on ZMuTrack
378  if (!zMuMu_found && !zMuSta_found && zMuTrack->size() > 0 ) {
379  event.getByToken(zMuTrackMatchMapToken_, zMuTrackMatchMap);
380  for(unsigned int i = 0; i < zMuTrack->size(); ++i) { //loop on candidates
381  const Candidate & zMuTrackCand = (*zMuTrack)[i]; //the candidate
382  CandidateBaseRef zMuTrackCandRef = zMuTrack->refAt(i);
383  const Candidate * lep0 = zMuTrackCand.daughter( 0 );
384  const Candidate * lep1 = zMuTrackCand.daughter( 1 );
385  const pat::Muon & muonDau0 = dynamic_cast<const pat::Muon &>(*lep0->masterClone());
386  //double trkiso0 = muonDau0.trackIso();
387  //const pat::GenericParticle & trackDau1 = dynamic_cast<const pat::GenericParticle &>(*lep1->masterClone());
388  //double trkiso1 = trackDau1.trackIso();
391 
392 
393  double pt0 = zMuTrackCand.daughter(0)->pt();
394  double pt1 = zMuTrackCand.daughter(1)->pt();
395  double eta0 = zMuTrackCand.daughter(0)->eta();
396  double eta1 = zMuTrackCand.daughter(1)->eta();
397  double mass = zMuTrackCand.mass();
398 
399  // HLT match (check just dau0 the global)
400  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
402 
403  bool trig0found = false;
404  if( mu0HLTMatches.size()>0 )
405  trig0found = true;
406 
407  GenParticleRef zMuTrackMatch = (*zMuTrackMatchMap)[zMuTrackCandRef];
408  if(zMuTrackMatch.isNonnull()) { // ZMuTrack matched
409  nZMuTrk_matched++;
410  if (pt0>ptmin_ && pt1>ptmin_ && abs(eta0)>etamin_ && abs(eta1)>etamin_ && abs(eta0)<etamax_ && abs(eta1) <etamax_ && mass >massMin_ &&
411  mass < massMax_ && iso0<isoMax_ && iso1 < isoMax_ && trig0found) { // all cuts and trigger passed
413  // histograms vs eta and pt
414  h_trackProbe_eta->Fill(eta1);
415  h_trackProbe_pt->Fill(pt1);
416  }
417  } // end MC match
418  } // end loop on ZMuTrack cand
419  } // end if ZMuTrack size > 0
420 
421 } // end analyze
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
double candidateIsolation(const reco::Candidate *c, double ptThreshold, double etEcalThreshold, double etHcalThreshold, double dRVetoTrk, double dRTrk, double dREcal, double dRHcal, double alpha, double beta, bool relativeIsolation)
EDGetTokenT< CandidateView > zMuStandAloneToken_
EDGetTokenT< CandidateView > zMuMuToken_
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
size_type size() const
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
RefToBase< value_type > refAt(size_type i) const
EDGetTokenT< CandidateView > muonsToken_
EDGetTokenT< GenParticleMatch > zMuTrackMatchMapToken_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:612
EDGetTokenT< GenParticleCollection > genParticlesToken_
int n2GlobalMuonsMatched_passedIso2Trg
virtual const CandidateBaseRef & masterClone() const =0
virtual double eta() const =0
momentum pseudorapidity
virtual double pt() const =0
transverse momentum
virtual double mass() const =0
mass
EDGetTokenT< GenParticleMatch > zMuMuMatchMapToken_
EDGetTokenT< CandidateView > zMuTrackToken_
lep1
print &#39;MRbb(1b)&#39;,event.mr_bb
EDGetTokenT< CandidateView > tracksToken_
Analysis-level muon class.
Definition: Muon.h:49
EDGetTokenT< GenParticleMatch > zMuStandAloneMatchMapToken_
bool ZMuMu_MCanalyzer::check_ifZmumu ( const Candidate dauGen0,
const Candidate dauGen1,
const Candidate dauGen2 
)
private

Definition at line 423 of file ZMuMu_MCanalyzer.cc.

References reco::Candidate::pdgId().

424 {
425  int partId0 = dauGen0->pdgId();
426  int partId1 = dauGen1->pdgId();
427  int partId2 = dauGen2->pdgId();
428  bool muplusFound=false;
429  bool muminusFound=false;
430  bool ZFound=false;
431  if (partId0==13 || partId1==13 || partId2==13) muminusFound=true;
432  if (partId0==-13 || partId1==-13 || partId2==-13) muplusFound=true;
433  if (partId0==23 || partId1==23 || partId2==23) ZFound=true;
434  return (muplusFound && muminusFound && ZFound);
435 }
virtual int pdgId() const =0
PDG identifier.
void ZMuMu_MCanalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 571 of file ZMuMu_MCanalyzer.cc.

References gather_cfg::cout, DEFINE_FWK_MODULE, n2GlobalMuonsMatched_passedIso, n2GlobalMuonsMatched_passedIso2Trg, nGlobalMuonsMatched_passed, nGlobalMuonsMatched_passedIso, nMu0onlyTriggered, nMu1onlyTriggered, nStaMuonsMatched_passedIso, nTracksMuonsMatched_passedIso, nZMuMu_matched, nZMuSta_matched, nZMuTrk_matched, and mathSSE::sqrt().

571  {
572 
573 
575  double err_effIso = sqrt(eff_Iso*(1-eff_Iso)/nGlobalMuonsMatched_passed);
576 
580  double effSta_afterIso = (2*n2GlobalMuonsMatched_passedIso2Trg+nMu0onlyTriggered+nMu1onlyTriggered)/n1_afterIso;
581  double effTrk_afterIso = (2*n2GlobalMuonsMatched_passedIso2Trg+nMu0onlyTriggered+nMu1onlyTriggered)/n2_afterIso;
582  double effHLT_afterIso = (2.* n2GlobalMuonsMatched_passedIso2Trg)/(2.* n2GlobalMuonsMatched_passedIso2Trg + nMu0onlyTriggered + nMu1onlyTriggered);
583  double err_effHLT_afterIso= sqrt( effHLT_afterIso * (1 - effHLT_afterIso)/nGLB_afterIso);
584  double err_effsta_afterIso = sqrt(effSta_afterIso*(1-effSta_afterIso)/n1_afterIso);
585  double err_efftrk_afterIso = sqrt(effTrk_afterIso*(1-effTrk_afterIso)/n2_afterIso);
586 
587 
588  cout << "------------------------------------ Counters --------------------------------" << endl;
589 
590  cout << "number of events zMuMu matched " << nZMuMu_matched << endl;
591  cout << "number of events zMuSta matched " << nZMuSta_matched << endl;
592  cout << "number of events zMuTk matched " << nZMuTrk_matched << endl;
593  cout << "number of events zMuMu with mu0 only triggered " << nMu0onlyTriggered << endl;
594  cout << "number of events zMuMu with mu1 only triggered " << nMu1onlyTriggered << endl;
595  cout << "=========================================" << endl;
596  cout << "n. of global muons MC matched and passing cuts: " << nGlobalMuonsMatched_passed << endl;
597  cout << "n. of global muons MC matched and passing also Iso cut: " << nGlobalMuonsMatched_passedIso << endl;
598  cout << "n. of Z -> 2 global muons MC matched and passing ALL cuts: " << n2GlobalMuonsMatched_passedIso << endl;
599  cout << "n. of ZMuSta MC matched and passing ALL cuts: " << nStaMuonsMatched_passedIso << endl;
600  cout << "n. of ZmuTrck MC matched and passing ALL cuts: " << nTracksMuonsMatched_passedIso << endl;
601  cout << "n. of Z -> 2 global muons MC matched and passing ALL cuts and both triggered: " << n2GlobalMuonsMatched_passedIso2Trg << endl;
602  cout << "=================================================================================" << endl;
603  cout << "Iso efficiency: " << eff_Iso << " +/- " << err_effIso << endl;
604  cout << "HLT efficiency: " << effHLT_afterIso << " +/- " << err_effHLT_afterIso << endl;
605  cout << "eff StandAlone (after Isocut) : " << effSta_afterIso << "+/-" << err_effsta_afterIso << endl;
606  cout << "eff Tracker (after Isocut) : " << effTrk_afterIso << "+/-" << err_efftrk_afterIso << endl;
607 
608 }
T sqrt(T t)
Definition: SSEVec.h:18
int n2GlobalMuonsMatched_passedIso2Trg
float ZMuMu_MCanalyzer::getParticleEta ( const int  ipart,
const Candidate dauGen0,
const Candidate dauGen1,
const Candidate dauGen2 
)
private

Definition at line 470 of file ZMuMu_MCanalyzer.cc.

References funct::abs(), reco::Candidate::daughter(), reco::Candidate::eta(), gen::k, reco::Candidate::numberOfDaughters(), reco::Candidate::pdgId(), and reco::Candidate::status().

471 {
472  int partId0 = dauGen0->pdgId();
473  int partId1 = dauGen1->pdgId();
474  int partId2 = dauGen2->pdgId();
475  float etapart=0.;
476  if (partId0 == ipart) {
477  for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
478  const Candidate * dauMuGen = dauGen0->daughter(k);
479  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
480  etapart = dauMuGen->eta();
481  }
482  }
483  }
484  if (partId1 == ipart) {
485  for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
486  const Candidate * dauMuGen = dauGen1->daughter(k);
487  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
488  etapart = dauMuGen->eta();
489  }
490  }
491  }
492  if (partId2 == ipart) {
493  for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
494  const Candidate * dauMuGen = dauGen2->daughter(k);
495  if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
496  etapart = dauMuGen->eta();
497  }
498  }
499  }
500  return etapart;
501 }
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual int status() const =0
status word
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
virtual double eta() const =0
momentum pseudorapidity
virtual size_type numberOfDaughters() const =0
number of daughters
Particle::LorentzVector ZMuMu_MCanalyzer::getParticleP4 ( const int  ipart,
const Candidate dauGen0,
const Candidate dauGen1,
const Candidate dauGen2 
)
private

Definition at line 536 of file ZMuMu_MCanalyzer.cc.

References funct::abs(), reco::Candidate::daughter(), gen::k, reco::Candidate::numberOfDaughters(), reco::Candidate::p4(), reco::Candidate::pdgId(), and reco::Candidate::status().

537 {
538  int partId0 = dauGen0->pdgId();
539  int partId1 = dauGen1->pdgId();
540  int partId2 = dauGen2->pdgId();
541  Particle::LorentzVector p4part(0.,0.,0.,0.);
542  if (partId0 == ipart) {
543  for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
544  const Candidate * dauMuGen = dauGen0->daughter(k);
545  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
546  p4part = dauMuGen->p4();
547  }
548  }
549  }
550  if (partId1 == ipart) {
551  for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
552  const Candidate * dauMuGen = dauGen1->daughter(k);
553  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
554  p4part = dauMuGen->p4();
555  }
556  }
557  }
558  if (partId2 == ipart) {
559  for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
560  const Candidate * dauMuGen = dauGen2->daughter(k);
561  if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
562  p4part = dauMuGen->p4();
563  }
564  }
565  }
566  return p4part;
567 }
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual int status() const =0
status word
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
virtual size_type numberOfDaughters() const =0
number of daughters
math::PtEtaPhiELorentzVectorF LorentzVector
float ZMuMu_MCanalyzer::getParticlePhi ( const int  ipart,
const Candidate dauGen0,
const Candidate dauGen1,
const Candidate dauGen2 
)
private

Definition at line 503 of file ZMuMu_MCanalyzer.cc.

References funct::abs(), reco::Candidate::daughter(), gen::k, reco::Candidate::numberOfDaughters(), reco::Candidate::pdgId(), reco::Candidate::phi(), and reco::Candidate::status().

504 {
505  int partId0 = dauGen0->pdgId();
506  int partId1 = dauGen1->pdgId();
507  int partId2 = dauGen2->pdgId();
508  float phipart=0.;
509  if (partId0 == ipart) {
510  for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
511  const Candidate * dauMuGen = dauGen0->daughter(k);
512  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
513  phipart = dauMuGen->phi();
514  }
515  }
516  }
517  if (partId1 == ipart) {
518  for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
519  const Candidate * dauMuGen = dauGen1->daughter(k);
520  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
521  phipart = dauMuGen->phi();
522  }
523  }
524  }
525  if (partId2 == ipart) {
526  for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
527  const Candidate * dauMuGen = dauGen2->daughter(k);
528  if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
529  phipart = dauMuGen->phi();
530  }
531  }
532  }
533  return phipart;
534 }
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual int status() const =0
status word
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
virtual size_type numberOfDaughters() const =0
number of daughters
virtual double phi() const =0
momentum azimuthal angle
float ZMuMu_MCanalyzer::getParticlePt ( const int  ipart,
const Candidate dauGen0,
const Candidate dauGen1,
const Candidate dauGen2 
)
private

Definition at line 437 of file ZMuMu_MCanalyzer.cc.

References funct::abs(), reco::Candidate::daughter(), gen::k, reco::Candidate::numberOfDaughters(), reco::Candidate::pdgId(), reco::Candidate::pt(), and reco::Candidate::status().

438 {
439  int partId0 = dauGen0->pdgId();
440  int partId1 = dauGen1->pdgId();
441  int partId2 = dauGen2->pdgId();
442  float ptpart=0.;
443  if (partId0 == ipart) {
444  for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
445  const Candidate * dauMuGen = dauGen0->daughter(k);
446  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
447  ptpart = dauMuGen->pt();
448  }
449  }
450  }
451  if (partId1 == ipart) {
452  for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
453  const Candidate * dauMuGen = dauGen1->daughter(k);
454  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
455  ptpart = dauMuGen->pt();
456  }
457  }
458  }
459  if (partId2 == ipart) {
460  for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
461  const Candidate * dauMuGen = dauGen2->daughter(k);
462  if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
463  ptpart = dauMuGen->pt();
464  }
465  }
466  }
467  return ptpart;
468 }
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual int status() const =0
status word
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
virtual double pt() const =0
transverse momentum
virtual size_type numberOfDaughters() const =0
number of daughters

Member Data Documentation

double ZMuMu_MCanalyzer::alpha_
private

Definition at line 75 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::beta_
private

Definition at line 75 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

bool ZMuMu_MCanalyzer::bothMuons_
private

Definition at line 71 of file ZMuMu_MCanalyzer.cc.

double ZMuMu_MCanalyzer::dREcal_
private

Definition at line 75 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::dRHcal_
private

Definition at line 75 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::dRTrk_
private

Definition at line 75 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::dRVetoTrk_
private

Definition at line 75 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::etamax_
private

Definition at line 73 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::etamin_
private

Definition at line 73 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::etEcalThreshold_
private

Definition at line 75 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::etHcalThreshold_
private

Definition at line 75 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

EDGetTokenT<GenParticleCollection> ZMuMu_MCanalyzer::genParticlesToken_
private

Definition at line 69 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

reco::CandidateBaseRef ZMuMu_MCanalyzer::globalMuonCandRef_
private

Definition at line 79 of file ZMuMu_MCanalyzer.cc.

TH1D * ZMuMu_MCanalyzer::h_ProbeOk_eta
private

Definition at line 83 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D * ZMuMu_MCanalyzer::h_ProbeOk_pt
private

Definition at line 83 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D * ZMuMu_MCanalyzer::h_staProbe_eta
private

Definition at line 83 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D * ZMuMu_MCanalyzer::h_staProbe_pt
private

Definition at line 83 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D* ZMuMu_MCanalyzer::h_trackProbe_eta
private

Definition at line 83 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D * ZMuMu_MCanalyzer::h_trackProbe_pt
private

Definition at line 83 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

string ZMuMu_MCanalyzer::hltPath_
private

Definition at line 78 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::isoMax_
private

Definition at line 73 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::massMax_
private

Definition at line 73 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::massMin_
private

Definition at line 73 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

EDGetTokenT<CandidateView> ZMuMu_MCanalyzer::muonsToken_
private

Definition at line 67 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

int ZMuMu_MCanalyzer::n2GlobalMuonsMatched_passedIso
private

Definition at line 88 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::n2GlobalMuonsMatched_passedIso2Trg
private

Definition at line 91 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nGlobalMuonsMatched_passed
private

Definition at line 86 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nGlobalMuonsMatched_passedIso
private

Definition at line 87 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nMu0onlyTriggered
private

Definition at line 92 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nMu1onlyTriggered
private

Definition at line 93 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nStaMuonsMatched_passedIso
private

Definition at line 89 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nTracksMuonsMatched_passedIso
private

Definition at line 90 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nZMuMu_matched
private

Definition at line 95 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nZMuSta_matched
private

Definition at line 96 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nZMuTrk_matched
private

Definition at line 97 of file ZMuMu_MCanalyzer.cc.

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

OverlapChecker ZMuMu_MCanalyzer::overlap_
private

Definition at line 80 of file ZMuMu_MCanalyzer.cc.

double ZMuMu_MCanalyzer::ptmin_
private

Definition at line 73 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::ptThreshold_
private

Definition at line 75 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

bool ZMuMu_MCanalyzer::relativeIsolation_
private

Definition at line 77 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

reco::CandidateBaseRef ZMuMu_MCanalyzer::standAloneMuonCandRef_
private

Definition at line 79 of file ZMuMu_MCanalyzer.cc.

reco::CandidateBaseRef ZMuMu_MCanalyzer::trackMuonCandRef_
private

Definition at line 79 of file ZMuMu_MCanalyzer.cc.

EDGetTokenT<CandidateView> ZMuMu_MCanalyzer::tracksToken_
private

Definition at line 68 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

EDGetTokenT<GenParticleMatch> ZMuMu_MCanalyzer::zMuMuMatchMapToken_
private

Definition at line 62 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

EDGetTokenT<CandidateView> ZMuMu_MCanalyzer::zMuMuToken_
private

Definition at line 61 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

EDGetTokenT<GenParticleMatch> ZMuMu_MCanalyzer::zMuStandAloneMatchMapToken_
private

Definition at line 64 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

EDGetTokenT<CandidateView> ZMuMu_MCanalyzer::zMuStandAloneToken_
private

Definition at line 63 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

EDGetTokenT<GenParticleMatch> ZMuMu_MCanalyzer::zMuTrackMatchMapToken_
private

Definition at line 66 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

EDGetTokenT<CandidateView> ZMuMu_MCanalyzer::zMuTrackToken_
private

Definition at line 65 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().