CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &event, const edm::EventSetup &setup)
 
bool check_ifZmumu (const Candidate *dauGen0, const Candidate *dauGen1, const Candidate *dauGen2)
 
virtual void endJob ()
 
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_
 
edm::InputTag genParticles_
 
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_
 
edm::InputTag muonIso_
 
edm::InputTag muonMatchMap_
 
edm::InputTag muons_
 
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_
 
edm::InputTag trackIso_
 
reco::CandidateBaseRef trackMuonCandRef_
 
edm::InputTag tracks_
 
edm::InputTag zMuMu_
 
edm::InputTag zMuMuMatchMap_
 
edm::InputTag zMuStandAlone_
 
edm::InputTag zMuStandAloneMatchMap_
 
edm::InputTag zMuTrack_
 
edm::InputTag zMuTrackMatchMap_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 51 of file ZMuMu_MCanalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 171 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, TFileDirectory::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.

171  :
172  zMuMu_(pset.getParameter<InputTag>("zMuMu")),
173  zMuMuMatchMap_(pset.getParameter<InputTag>("zMuMuMatchMap")),
174  zMuStandAlone_(pset.getParameter<InputTag>("zMuStandAlone")),
175  zMuStandAloneMatchMap_(pset.getParameter<InputTag>("zMuStandAloneMatchMap")),
176  zMuTrack_(pset.getParameter<InputTag>("zMuTrack")),
177  zMuTrackMatchMap_(pset.getParameter<InputTag>("zMuTrackMatchMap")),
178  muons_(pset.getParameter<InputTag>("muons")),
179  tracks_(pset.getParameter<InputTag>("tracks")),
180  genParticles_(pset.getParameter<InputTag>( "genParticles" ) ),
181 
182  bothMuons_(pset.getParameter<bool>("bothMuons")),
183  etamin_(pset.getUntrackedParameter<double>("etamin")),
184  etamax_(pset.getUntrackedParameter<double>("etamax")),
185  ptmin_(pset.getUntrackedParameter<double>("ptmin")),
186  massMin_(pset.getUntrackedParameter<double>("zMassMin")),
187  massMax_(pset.getUntrackedParameter<double>("zMassMax")),
188  isoMax_(pset.getUntrackedParameter<double>("isomax")),
189  ptThreshold_(pset.getUntrackedParameter<double>("ptThreshold")),
190  etEcalThreshold_(pset.getUntrackedParameter<double>("etEcalThreshold")),
191  etHcalThreshold_(pset.getUntrackedParameter<double>("etHcalThreshold")),
192  dRVetoTrk_(pset.getUntrackedParameter<double>("deltaRVetoTrk")),
193  dRTrk_(pset.getUntrackedParameter<double>("deltaRTrk")),
194  dREcal_(pset.getUntrackedParameter<double>("deltaREcal")),
195  dRHcal_(pset.getUntrackedParameter<double>("deltaRHcal")),
196  alpha_(pset.getUntrackedParameter<double>("alpha")),
197  beta_(pset.getUntrackedParameter<double>("beta")),
198  relativeIsolation_(pset.getUntrackedParameter<bool>("relativeIsolation")),
199  hltPath_(pset.getUntrackedParameter<std::string >("hltPath")) {
201 
202  // binning of entries array (at moment defined by hand and not in cfg file)
203  double etaRange[8] = {-2.5,-2.,-1.2,-0.8,0.8,1.2,2.,2.5};
204  double ptRange[4] = {20.,40.,60.,100.};
205 
206  // general histograms
207  h_trackProbe_eta = fs->make<TH1D>("trackProbeEta","Eta of tracks",7,etaRange);
208  h_trackProbe_pt = fs->make<TH1D>("trackProbePt","Pt of tracks",3,ptRange);
209  h_staProbe_eta = fs->make<TH1D>("standAloneProbeEta","Eta of standAlone",7,etaRange);
210  h_staProbe_pt = fs->make<TH1D>("standAloneProbePt","Pt of standAlone",3,ptRange);
211  h_ProbeOk_eta = fs->make<TH1D>("probeOkEta","Eta of probe Ok",7,etaRange);
212  h_ProbeOk_pt = fs->make<TH1D>("probeOkPt","Pt of probe ok",3,ptRange);
213 
214  // clear global counters
221  nMu0onlyTriggered = 0;
222  nMu1onlyTriggered = 0;
223  nZMuMu_matched = 0;
224  nZMuSta_matched = 0;
225  nZMuTrk_matched = 0;
226 }
T getParameter(std::string const &) const
edm::InputTag zMuStandAlone_
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag zMuTrackMatchMap_
edm::InputTag zMuMuMatchMap_
edm::InputTag zMuStandAloneMatchMap_
edm::InputTag zMuTrack_
edm::InputTag genParticles_
edm::InputTag muons_
int n2GlobalMuonsMatched_passedIso2Trg
edm::InputTag tracks_
T * make() const
make new ROOT object
edm::InputTag zMuMu_

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 228 of file ZMuMu_MCanalyzer.cc.

References abs, alpha_, beta_, candidateIsolation(), reco::Candidate::daughter(), dREcal_, dRHcal_, dRTrk_, dRVetoTrk_, reco::Candidate::eta(), etamax_, etamin_, etEcalThreshold_, etHcalThreshold_, genParticleCandidates2GenParticles_cfi::genParticles, genParticles_, h_ProbeOk_eta, h_ProbeOk_pt, h_staProbe_eta, h_staProbe_pt, h_trackProbe_eta, h_trackProbe_pt, hltPath_, i, edm::Ref< C, T, F >::isNonnull(), isoMax_, reco::Candidate::mass(), massMax_, massMin_, reco::Candidate::masterClone(), patZpeak::muons, muons_, n2GlobalMuonsMatched_passedIso, n2GlobalMuonsMatched_passedIso2Trg, nGlobalMuonsMatched_passed, nGlobalMuonsMatched_passedIso, nMu0onlyTriggered, nMu1onlyTriggered, nStaMuonsMatched_passedIso, nTracksMuonsMatched_passedIso, nZMuMu_matched, nZMuSta_matched, nZMuTrk_matched, reco::Candidate::pt(), ptmin_, ptThreshold_, relativeIsolation_, testEve_cfg::tracks, tracks_, pat::PATObject< ObjectType >::triggerObjectMatchesByPath(), ZMuMuAnalysisNtupler_cff::zMuMu, zMuMu_, zMuMuMatchMap_, zMuStandAlone_, zMuStandAloneMatchMap_, zMuTrack_, and zMuTrackMatchMap_.

228  {
230  Handle<GenParticleMatch> zMuMuMatchMap; //Map of Z made by Mu global + Mu global
231  Handle<CandidateView> zMuStandAlone;
232  Handle<GenParticleMatch> zMuStandAloneMatchMap; //Map of Z made by Mu + StandAlone
233  Handle<CandidateView> zMuTrack;
234  Handle<GenParticleMatch> zMuTrackMatchMap; //Map of Z made by Mu + Track
235  Handle<CandidateView> muons; //Collection of Muons
236  Handle<CandidateView> tracks; //Collection of Tracks
237 
238  Handle<GenParticleCollection> genParticles; // Collection of Generatd Particles
239 
240  event.getByLabel(zMuMu_, zMuMu);
241  event.getByLabel(zMuStandAlone_, zMuStandAlone);
242  event.getByLabel(zMuTrack_, zMuTrack);
243  event.getByLabel(genParticles_, genParticles);
244  event.getByLabel(muons_, muons);
245  event.getByLabel(tracks_, tracks);
246 
247  /*
248  cout << "********* zMuMu size : " << zMuMu->size() << endl;
249  cout << "********* zMuStandAlone size : " << zMuStandAlone->size() << endl;
250  cout << "********* zMuTrack size : " << zMuTrack->size() << endl;
251  cout << "********* muons size : " << muons->size() << endl;
252  cout << "********* tracks size : " << tracks->size() << endl;
253  */
254  // std::cout<<"Run-> "<<event.id().run()<<std::endl;
255  // std::cout<<"Event-> "<<event.id().event()<<std::endl;
256 
257 
258  bool zMuMu_found = false;
259 
260  // loop on ZMuMu
261  if (zMuMu->size() > 0 ) {
262  event.getByLabel(zMuMuMatchMap_, zMuMuMatchMap);
263  for(unsigned int i = 0; i < zMuMu->size(); ++i) { //loop on candidates
264  const Candidate & zMuMuCand = (*zMuMu)[i]; //the candidate
265  CandidateBaseRef zMuMuCandRef = zMuMu->refAt(i);
266 
267  const Candidate * lep0 = zMuMuCand.daughter( 0 );
268  const Candidate * lep1 = zMuMuCand.daughter( 1 );
269  const pat::Muon & muonDau0 = dynamic_cast<const pat::Muon &>(*lep0->masterClone());
270  // double trkiso0 = muonDau0.trackIso();
271  const pat::Muon & muonDau1 = dynamic_cast<const pat::Muon &>(*lep1->masterClone());
272  //double trkiso1 = muonDau1.trackIso();
273 
276 
277  double pt0 = zMuMuCand.daughter(0)->pt();
278  double pt1 = zMuMuCand.daughter(1)->pt();
279  double eta0 = zMuMuCand.daughter(0)->eta();
280  double eta1 = zMuMuCand.daughter(1)->eta();
281  double mass = zMuMuCand.mass();
282 
283  // HLT match
284  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
286  const pat::TriggerObjectStandAloneCollection mu1HLTMatches =
288 
289  bool trig0found = false;
290  bool trig1found = false;
291  if( mu0HLTMatches.size()>0 )
292  trig0found = true;
293  if( mu1HLTMatches.size()>0 )
294  trig1found = true;
295 
296  GenParticleRef zMuMuMatch = (*zMuMuMatchMap)[zMuMuCandRef];
297  if(zMuMuMatch.isNonnull()) { // ZMuMu matched
298  zMuMu_found = true;
299  nZMuMu_matched++;
300  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
301  nGlobalMuonsMatched_passed++; // first global Muon passed kine cuts
302  nGlobalMuonsMatched_passed++; // second global muon passsed kine cuts
303  if (iso0<isoMax_) nGlobalMuonsMatched_passedIso++; // first global muon passed the iso cut
304  if (iso1<isoMax_) nGlobalMuonsMatched_passedIso++; // second global muon passed the iso cut
305  if (iso0<isoMax_ && iso1<isoMax_) {
306  n2GlobalMuonsMatched_passedIso++; // both muons passed iso cut
307  if (trig0found && trig1found) n2GlobalMuonsMatched_passedIso2Trg++; // both muons have HLT
308  if (trig0found && !trig1found) nMu0onlyTriggered++;
309  if (trig1found && !trig0found) nMu1onlyTriggered++;
310  // histograms vs eta and pt
311  if (trig1found) { // check efficiency of muon0 not imposing the trigger on it
312  h_trackProbe_eta->Fill(eta0);
313  h_trackProbe_pt->Fill(pt0);
314  h_staProbe_eta->Fill(eta0);
315  h_staProbe_pt->Fill(pt0);
316  h_ProbeOk_eta->Fill(eta0);
317  h_ProbeOk_pt->Fill(pt0);
318  }
319  if (trig0found) { // check efficiency of muon1 not imposing the trigger on it
320  h_trackProbe_eta->Fill(eta1);
321  h_staProbe_eta->Fill(eta1);
322  h_trackProbe_pt->Fill(pt1);
323  h_staProbe_pt->Fill(pt1);
324  h_ProbeOk_eta->Fill(eta1);
325  h_ProbeOk_pt->Fill(pt1);
326  }
327  }
328  }
329  } // end MC match
330 
331  } // end loop on ZMuMu cand
332  } // end if ZMuMu size > 0
333 
334  // loop on ZMuSta
335  bool zMuSta_found = false;
336  if (!zMuMu_found && zMuStandAlone->size() > 0 ) {
337  event.getByLabel(zMuStandAloneMatchMap_, zMuStandAloneMatchMap);
338  for(unsigned int i = 0; i < zMuStandAlone->size(); ++i) { //loop on candidates
339  const Candidate & zMuStandAloneCand = (*zMuStandAlone)[i]; //the candidate
340  CandidateBaseRef zMuStandAloneCandRef = zMuStandAlone->refAt(i);
341  GenParticleRef zMuStandAloneMatch = (*zMuStandAloneMatchMap)[zMuStandAloneCandRef];
342 
343  const Candidate * lep0 = zMuStandAloneCand.daughter( 0 );
344  const Candidate * lep1 = zMuStandAloneCand.daughter( 1 );
345  const pat::Muon & muonDau0 = dynamic_cast<const pat::Muon &>(*lep0->masterClone());
346  //double trkiso0 = muonDau0.trackIso();
347  // const pat::Muon & muonDau1 = dynamic_cast<const pat::Muon &>(*lep1->masterClone());
348  //double trkiso1 = muonDau1.trackIso();
349 
352 
353  double pt0 = zMuStandAloneCand.daughter(0)->pt();
354  double pt1 = zMuStandAloneCand.daughter(1)->pt();
355  double eta0 = zMuStandAloneCand.daughter(0)->eta();
356  double eta1 = zMuStandAloneCand.daughter(1)->eta();
357  double mass = zMuStandAloneCand.mass();
358 
359  // HLT match (check just dau0 the global)
360  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
362 
363  bool trig0found = false;
364  if( mu0HLTMatches.size()>0 )
365  trig0found = true;
366 
367  if(zMuStandAloneMatch.isNonnull()) { // ZMuStandAlone matched
368  zMuSta_found = true;
369  nZMuSta_matched++;
370  if (pt0>ptmin_ && pt1>ptmin_ && abs(eta0)>etamin_ && abs(eta1)>etamin_ && abs(eta0)<etamax_ && abs(eta1) <etamax_ && mass >massMin_ &&
371  mass < massMax_ && iso0<isoMax_ && iso1 < isoMax_ && trig0found) { // all cuts and trigger passed
373  // histograms vs eta and pt
374  h_staProbe_eta->Fill(eta1);
375  h_staProbe_pt->Fill(pt1);
376  }
377  } // end MC match
378  } // end loop on ZMuStandAlone cand
379  } // end if ZMuStandAlone size > 0
380 
381 
382  // loop on ZMuTrack
383  if (!zMuMu_found && !zMuSta_found && zMuTrack->size() > 0 ) {
384  event.getByLabel(zMuTrackMatchMap_, zMuTrackMatchMap);
385  for(unsigned int i = 0; i < zMuTrack->size(); ++i) { //loop on candidates
386  const Candidate & zMuTrackCand = (*zMuTrack)[i]; //the candidate
387  CandidateBaseRef zMuTrackCandRef = zMuTrack->refAt(i);
388  const Candidate * lep0 = zMuTrackCand.daughter( 0 );
389  const Candidate * lep1 = zMuTrackCand.daughter( 1 );
390  const pat::Muon & muonDau0 = dynamic_cast<const pat::Muon &>(*lep0->masterClone());
391  //double trkiso0 = muonDau0.trackIso();
392  //const pat::GenericParticle & trackDau1 = dynamic_cast<const pat::GenericParticle &>(*lep1->masterClone());
393  //double trkiso1 = trackDau1.trackIso();
396 
397 
398  double pt0 = zMuTrackCand.daughter(0)->pt();
399  double pt1 = zMuTrackCand.daughter(1)->pt();
400  double eta0 = zMuTrackCand.daughter(0)->eta();
401  double eta1 = zMuTrackCand.daughter(1)->eta();
402  double mass = zMuTrackCand.mass();
403 
404  // HLT match (check just dau0 the global)
405  const pat::TriggerObjectStandAloneCollection mu0HLTMatches =
407 
408  bool trig0found = false;
409  if( mu0HLTMatches.size()>0 )
410  trig0found = true;
411 
412  GenParticleRef zMuTrackMatch = (*zMuTrackMatchMap)[zMuTrackCandRef];
413  if(zMuTrackMatch.isNonnull()) { // ZMuTrack matched
414  nZMuTrk_matched++;
415  if (pt0>ptmin_ && pt1>ptmin_ && abs(eta0)>etamin_ && abs(eta1)>etamin_ && abs(eta0)<etamax_ && abs(eta1) <etamax_ && mass >massMin_ &&
416  mass < massMax_ && iso0<isoMax_ && iso1 < isoMax_ && trig0found) { // all cuts and trigger passed
418  // histograms vs eta and pt
419  h_trackProbe_eta->Fill(eta1);
420  h_trackProbe_pt->Fill(pt1);
421  }
422  } // end MC match
423  } // end loop on ZMuTrack cand
424  } // end if ZMuTrack size > 0
425 
426 } // end analyze
edm::InputTag zMuStandAlone_
int i
Definition: DBlmapReader.cc:9
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
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)
virtual float mass() const =0
mass
virtual float eta() const =0
momentum pseudorapidity
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
edm::InputTag zMuTrackMatchMap_
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
virtual float pt() const =0
transverse momentum
edm::InputTag zMuMuMatchMap_
edm::InputTag zMuStandAloneMatchMap_
edm::InputTag zMuTrack_
const TriggerObjectStandAloneCollection triggerObjectMatchesByPath(const std::string &namePath, const bool pathLastFilterAccepted=false, const bool pathL3FilterAccepted=true) const
Definition: PATObject.h:594
edm::InputTag genParticles_
edm::InputTag muons_
int n2GlobalMuonsMatched_passedIso2Trg
edm::InputTag tracks_
tuple tracks
Definition: testEve_cfg.py:39
tuple muons
Definition: patZpeak.py:38
Analysis-level muon class.
Definition: Muon.h:51
tuple zMuMu
zMuMu vector of PSet is common to all categories except zMuTrk category
virtual const CandidateBaseRef & masterClone() const =0
edm::InputTag zMuMu_
bool ZMuMu_MCanalyzer::check_ifZmumu ( const Candidate dauGen0,
const Candidate dauGen1,
const Candidate dauGen2 
)
private

Definition at line 428 of file ZMuMu_MCanalyzer.cc.

References reco::Candidate::pdgId().

429 {
430  int partId0 = dauGen0->pdgId();
431  int partId1 = dauGen1->pdgId();
432  int partId2 = dauGen2->pdgId();
433  bool muplusFound=false;
434  bool muminusFound=false;
435  bool ZFound=false;
436  if (partId0==13 || partId1==13 || partId2==13) muminusFound=true;
437  if (partId0==-13 || partId1==-13 || partId2==-13) muplusFound=true;
438  if (partId0==23 || partId1==23 || partId2==23) ZFound=true;
439  return muplusFound*muminusFound*ZFound;
440 }
virtual int pdgId() const =0
PDG identifier.
void ZMuMu_MCanalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 576 of file ZMuMu_MCanalyzer.cc.

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

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

Definition at line 475 of file ZMuMu_MCanalyzer.cc.

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

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

Definition at line 541 of file ZMuMu_MCanalyzer.cc.

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

542 {
543  int partId0 = dauGen0->pdgId();
544  int partId1 = dauGen1->pdgId();
545  int partId2 = dauGen2->pdgId();
546  Particle::LorentzVector p4part(0.,0.,0.,0.);
547  if (partId0 == ipart) {
548  for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
549  const Candidate * dauMuGen = dauGen0->daughter(k);
550  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
551  p4part = dauMuGen->p4();
552  }
553  }
554  }
555  if (partId1 == ipart) {
556  for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
557  const Candidate * dauMuGen = dauGen1->daughter(k);
558  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
559  p4part = dauMuGen->p4();
560  }
561  }
562  }
563  if (partId2 == ipart) {
564  for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
565  const Candidate * dauMuGen = dauGen2->daughter(k);
566  if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
567  p4part = dauMuGen->p4();
568  }
569  }
570  }
571  return p4part;
572 }
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
#define abs(x)
Definition: mlp_lapack.h:159
virtual size_type numberOfDaughters() const =0
number of daughters
int k[5][pyjets_maxn]
virtual int pdgId() const =0
PDG identifier.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:25
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
float ZMuMu_MCanalyzer::getParticlePhi ( const int  ipart,
const Candidate dauGen0,
const Candidate dauGen1,
const Candidate dauGen2 
)
private

Definition at line 508 of file ZMuMu_MCanalyzer.cc.

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

509 {
510  int partId0 = dauGen0->pdgId();
511  int partId1 = dauGen1->pdgId();
512  int partId2 = dauGen2->pdgId();
513  float phipart=0.;
514  if (partId0 == ipart) {
515  for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
516  const Candidate * dauMuGen = dauGen0->daughter(k);
517  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
518  phipart = dauMuGen->phi();
519  }
520  }
521  }
522  if (partId1 == ipart) {
523  for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
524  const Candidate * dauMuGen = dauGen1->daughter(k);
525  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
526  phipart = dauMuGen->phi();
527  }
528  }
529  }
530  if (partId2 == ipart) {
531  for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
532  const Candidate * dauMuGen = dauGen2->daughter(k);
533  if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
534  phipart = dauMuGen->phi();
535  }
536  }
537  }
538  return phipart;
539 }
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
#define abs(x)
Definition: mlp_lapack.h:159
virtual float phi() const =0
momentum azimuthal angle
virtual size_type numberOfDaughters() const =0
number of daughters
int k[5][pyjets_maxn]
virtual int pdgId() const =0
PDG identifier.
float ZMuMu_MCanalyzer::getParticlePt ( const int  ipart,
const Candidate dauGen0,
const Candidate dauGen1,
const Candidate dauGen2 
)
private

Definition at line 442 of file ZMuMu_MCanalyzer.cc.

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

443 {
444  int partId0 = dauGen0->pdgId();
445  int partId1 = dauGen1->pdgId();
446  int partId2 = dauGen2->pdgId();
447  float ptpart=0.;
448  if (partId0 == ipart) {
449  for(unsigned int k = 0; k < dauGen0->numberOfDaughters(); ++k) {
450  const Candidate * dauMuGen = dauGen0->daughter(k);
451  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
452  ptpart = dauMuGen->pt();
453  }
454  }
455  }
456  if (partId1 == ipart) {
457  for(unsigned int k = 0; k < dauGen1->numberOfDaughters(); ++k) {
458  const Candidate * dauMuGen = dauGen1->daughter(k);
459  if(dauMuGen->pdgId() == ipart && dauMuGen->status() ==1) {
460  ptpart = dauMuGen->pt();
461  }
462  }
463  }
464  if (partId2 == ipart) {
465  for(unsigned int k = 0; k < dauGen2->numberOfDaughters(); ++k) {
466  const Candidate * dauMuGen = dauGen2->daughter(k);
467  if(abs(dauMuGen->pdgId()) == ipart && dauMuGen->status() ==1) {
468  ptpart = dauMuGen->pt();
469  }
470  }
471  }
472  return ptpart;
473 }
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
#define abs(x)
Definition: mlp_lapack.h:159
virtual size_type numberOfDaughters() const =0
number of daughters
virtual float pt() const =0
transverse momentum
int k[5][pyjets_maxn]
virtual int pdgId() const =0
PDG identifier.

Member Data Documentation

double ZMuMu_MCanalyzer::alpha_
private

Definition at line 74 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::beta_
private

Definition at line 74 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

bool ZMuMu_MCanalyzer::bothMuons_
private

Definition at line 70 of file ZMuMu_MCanalyzer.cc.

double ZMuMu_MCanalyzer::dREcal_
private

Definition at line 74 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::dRHcal_
private

Definition at line 74 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::dRTrk_
private

Definition at line 74 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::dRVetoTrk_
private

Definition at line 74 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::etamax_
private

Definition at line 72 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::etamin_
private

Definition at line 72 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::etEcalThreshold_
private

Definition at line 74 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::etHcalThreshold_
private

Definition at line 74 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

edm::InputTag ZMuMu_MCanalyzer::genParticles_
private

Definition at line 68 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

reco::CandidateBaseRef ZMuMu_MCanalyzer::globalMuonCandRef_
private

Definition at line 78 of file ZMuMu_MCanalyzer.cc.

TH1D * ZMuMu_MCanalyzer::h_ProbeOk_eta
private

Definition at line 82 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D * ZMuMu_MCanalyzer::h_ProbeOk_pt
private

Definition at line 82 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D * ZMuMu_MCanalyzer::h_staProbe_eta
private

Definition at line 82 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D * ZMuMu_MCanalyzer::h_staProbe_pt
private

Definition at line 82 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D* ZMuMu_MCanalyzer::h_trackProbe_eta
private

Definition at line 82 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

TH1D * ZMuMu_MCanalyzer::h_trackProbe_pt
private

Definition at line 82 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze(), and ZMuMu_MCanalyzer().

string ZMuMu_MCanalyzer::hltPath_
private

Definition at line 77 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::isoMax_
private

Definition at line 72 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::massMax_
private

Definition at line 72 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::massMin_
private

Definition at line 72 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

edm::InputTag ZMuMu_MCanalyzer::muonIso_
private

Definition at line 66 of file ZMuMu_MCanalyzer.cc.

edm::InputTag ZMuMu_MCanalyzer::muonMatchMap_
private

Definition at line 66 of file ZMuMu_MCanalyzer.cc.

edm::InputTag ZMuMu_MCanalyzer::muons_
private

Definition at line 66 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

int ZMuMu_MCanalyzer::n2GlobalMuonsMatched_passedIso
private

Definition at line 87 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::n2GlobalMuonsMatched_passedIso2Trg
private

Definition at line 90 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nGlobalMuonsMatched_passed
private

Definition at line 85 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nGlobalMuonsMatched_passedIso
private

Definition at line 86 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nMu0onlyTriggered
private

Definition at line 91 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nMu1onlyTriggered
private

Definition at line 92 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nStaMuonsMatched_passedIso
private

Definition at line 88 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nTracksMuonsMatched_passedIso
private

Definition at line 89 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nZMuMu_matched
private

Definition at line 94 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nZMuSta_matched
private

Definition at line 95 of file ZMuMu_MCanalyzer.cc.

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

int ZMuMu_MCanalyzer::nZMuTrk_matched
private

Definition at line 96 of file ZMuMu_MCanalyzer.cc.

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

OverlapChecker ZMuMu_MCanalyzer::overlap_
private

Definition at line 79 of file ZMuMu_MCanalyzer.cc.

double ZMuMu_MCanalyzer::ptmin_
private

Definition at line 72 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

double ZMuMu_MCanalyzer::ptThreshold_
private

Definition at line 74 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

bool ZMuMu_MCanalyzer::relativeIsolation_
private

Definition at line 76 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

reco::CandidateBaseRef ZMuMu_MCanalyzer::standAloneMuonCandRef_
private

Definition at line 78 of file ZMuMu_MCanalyzer.cc.

edm::InputTag ZMuMu_MCanalyzer::trackIso_
private

Definition at line 67 of file ZMuMu_MCanalyzer.cc.

reco::CandidateBaseRef ZMuMu_MCanalyzer::trackMuonCandRef_
private

Definition at line 78 of file ZMuMu_MCanalyzer.cc.

edm::InputTag ZMuMu_MCanalyzer::tracks_
private

Definition at line 67 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

edm::InputTag ZMuMu_MCanalyzer::zMuMu_
private

Definition at line 63 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

edm::InputTag ZMuMu_MCanalyzer::zMuMuMatchMap_
private

Definition at line 63 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

edm::InputTag ZMuMu_MCanalyzer::zMuStandAlone_
private

Definition at line 64 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

edm::InputTag ZMuMu_MCanalyzer::zMuStandAloneMatchMap_
private

Definition at line 64 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

edm::InputTag ZMuMu_MCanalyzer::zMuTrack_
private

Definition at line 65 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().

edm::InputTag ZMuMu_MCanalyzer::zMuTrackMatchMap_
private

Definition at line 65 of file ZMuMu_MCanalyzer.cc.

Referenced by analyze().