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
AcceptanceHistoProducer Class Reference

#include <AcceptanceHistoProducer.h>

Inheritance diagram for AcceptanceHistoProducer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 AcceptanceHistoProducer (const edm::ParameterSet &cfg)
 
virtual ~AcceptanceHistoProducer ()
 
- 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
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 
void beginJob ()
 

Private Attributes

DQMStoredbe_
 
std::string dqmDir_
 
MonitorElementhEtaPosEtaNeg_
 
MonitorElementhPtNegEtaNeg_
 
MonitorElementhPtPosEtaPos_
 
MonitorElementhPtPosPtNeg_
 
edm::InputTag srcGenParticles_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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

Produces di-muon acceptance histograms and stores them in lumi section.

Author
Armin Burgmeier, DESY
Version
Revision:
1.2
Id:
AcceptanceHistoProducer.h,v 1.2 2012/11/07 17:03:01 aburgmei Exp

Definition at line 25 of file AcceptanceHistoProducer.h.

Constructor & Destructor Documentation

AcceptanceHistoProducer::AcceptanceHistoProducer ( const edm::ParameterSet cfg)
explicit

Definition at line 9 of file AcceptanceHistoProducer.cc.

AcceptanceHistoProducer::~AcceptanceHistoProducer ( )
virtual

Definition at line 16 of file AcceptanceHistoProducer.cc.

17 {
18 }

Member Function Documentation

void AcceptanceHistoProducer::analyze ( const edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 40 of file AcceptanceHistoProducer.cc.

References funct::abs(), reco::LeafCandidate::charge(), reco::CompositeRefCandidateT< D >::daughter(), reco::LeafCandidate::eta(), MonitorElement::Fill(), genParticleCandidates2GenParticles_cfi::genParticles, edm::Event::getByLabel(), hEtaPosEtaNeg_, hPtNegEtaNeg_, hPtPosEtaPos_, hPtPosPtNeg_, i, NULL, reco::CompositeRefCandidateT< D >::numberOfDaughters(), reco::LeafCandidate::pdgId(), reco::LeafCandidate::pt(), srcGenParticles_, and reco::LeafCandidate::status().

41 {
42  assert(hPtPosPtNeg_ != NULL);
43  assert(hEtaPosEtaNeg_ != NULL);
44  assert(hPtPosEtaPos_ != NULL);
45  assert(hPtNegEtaNeg_ != NULL);
46 
48  evt.getByLabel(srcGenParticles_, genParticles);
49 
50  // Look for the two muons from the matrix element (status=3)
51  const reco::GenParticle* genPosMuonME = NULL;
52  const reco::GenParticle* genNegMuonME = NULL;
53  for(unsigned int i = 0; i < genParticles->size(); ++i)
54  {
55  const reco::GenParticle& part = (*genParticles)[i];
56  if(abs(part.pdgId()) == 13 && part.status() == 3)
57  {
58  if(part.charge() < 0)
59  if(!genNegMuonME)
60  genNegMuonME = &part;
61  if(part.charge() > 0)
62  if(!genPosMuonME)
63  genPosMuonME = &part;
64  }
65  }
66 
67  if(genPosMuonME && genNegMuonME)
68  {
69  const reco::GenParticle* genPosMuon = genPosMuonME;
70  const reco::GenParticle* genNegMuon = genNegMuonME;
71 
72  // Follow the decay chain to find the stable decay products (status=1)
73  while(genPosMuon->status() != 1 && genPosMuon->numberOfDaughters() > 0)
74  {
75  unsigned int i;
76  for(i = 0; i < genPosMuon->numberOfDaughters(); ++i)
77  {
78  const reco::GenParticle* daughter = dynamic_cast<const reco::GenParticle*>(genPosMuon->daughter(i));
79  if(abs(daughter->pdgId()) == 13)
80  { genPosMuon = daughter; break; }
81  }
82 
83  // No more muon daugthers? Maybe mu->e decay...
84  if(i == genPosMuon->numberOfDaughters())
85  break;
86  }
87 
88  while(genNegMuon->status() != 1 && genNegMuon->numberOfDaughters() > 0)
89  {
90  unsigned int i;
91  for(i = 0; i < genNegMuon->numberOfDaughters(); ++i)
92  {
93  const reco::GenParticle* daughter = dynamic_cast<const reco::GenParticle*>(genNegMuon->daughter(i));
94  if(abs(daughter->pdgId()) == 13)
95  { genNegMuon = daughter; break; }
96  }
97 
98  // No more muon daugthers? Maybe mu->e decay...
99  if(i == genNegMuon->numberOfDaughters())
100  break;
101  }
102 
103  // Loop might have broken earlier if there are no more daugthers, or if
104  // the decay chain does not end in a muon.
105  if(genPosMuon->status() == 1 && genNegMuon->status() == 1)
106  {
107  hPtPosPtNeg_->Fill(genPosMuon->pt(), genNegMuon->pt());
108  hEtaPosEtaNeg_->Fill(genPosMuon->eta(), genNegMuon->eta());
109  hPtPosEtaPos_->Fill(genPosMuon->pt(), genPosMuon->eta());
110  hPtNegEtaNeg_->Fill(genNegMuon->pt(), genNegMuon->eta());
111  }
112  }
113 }
int i
Definition: DBlmapReader.cc:9
virtual int pdgId() const
PDG identifier.
virtual float pt() const
transverse momentum
virtual int status() const
status word
#define NULL
Definition: scimark2.h:8
void Fill(long long x)
virtual float eta() const
momentum pseudorapidity
virtual size_t numberOfDaughters() const
number of daughters
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
virtual int charge() const
electric charge
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
part
Definition: HCALResponse.h:20
void AcceptanceHistoProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 20 of file AcceptanceHistoProducer.cc.

References DQMStore::book2DD(), dbe_, dqmDir_, hEtaPosEtaNeg_, hPtNegEtaNeg_, hPtPosEtaPos_, hPtPosPtNeg_, cppFunctionSkipper::operator, DQMStore::setCurrentFolder(), MonitorElement::setLumiFlag(), and MonitorElement::setResetMe().

21 {
23 
24  dbe_->setCurrentFolder("MCEmbedding/ZmumuAcceptance/" + dqmDir_);
25  hPtPosPtNeg_ = dbe_->book2DD("PtPosPtNeg", "Positive muon transverse momentum vs. negative muon transverse momentum;p_{T}^{+};p_{T}^{-}", 500, 0.0, 500.0, 500, 0.0, 500.0);
26  hEtaPosEtaNeg_ = dbe_->book2DD("EtaPosEtaNeg", "Positive muon pseudorapdity vs. negative muon pseudorapidity;#eta^{+};#eta^{-}", 500, -2.5, 2.5, 500, -2.5, 2.5);
27  hPtPosEtaPos_ = dbe_->book2DD("PtPosEtaPos", "Positive muon transverse momentum vs. positive muon pseudorapidity;p_{T}^{+};#eta^{+}", 500, 0.0, 500.0, 500, -2.5, 2.5);
28  hPtNegEtaNeg_ = dbe_->book2DD("PtNegEtaNeg", "Negative muon transverse momentum vs. negative muon pseudorapidity;p_{T}^{-};#eta^{-}", 500, 0.0, 500.0, 500, -2.5, 2.5);
29 
30  hPtPosPtNeg_->setResetMe(true);
38 }
MonitorElement * book2DD(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D double histogram.
Definition: DQMStore.cc:1126
void setResetMe(bool)
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667

Member Data Documentation

DQMStore* AcceptanceHistoProducer::dbe_
private

Definition at line 42 of file AcceptanceHistoProducer.h.

Referenced by beginJob().

std::string AcceptanceHistoProducer::dqmDir_
private

Definition at line 39 of file AcceptanceHistoProducer.h.

Referenced by beginJob().

MonitorElement* AcceptanceHistoProducer::hEtaPosEtaNeg_
private

Definition at line 45 of file AcceptanceHistoProducer.h.

Referenced by analyze(), and beginJob().

MonitorElement* AcceptanceHistoProducer::hPtNegEtaNeg_
private

Definition at line 47 of file AcceptanceHistoProducer.h.

Referenced by analyze(), and beginJob().

MonitorElement* AcceptanceHistoProducer::hPtPosEtaPos_
private

Definition at line 46 of file AcceptanceHistoProducer.h.

Referenced by analyze(), and beginJob().

MonitorElement* AcceptanceHistoProducer::hPtPosPtNeg_
private

Definition at line 44 of file AcceptanceHistoProducer.h.

Referenced by analyze(), and beginJob().

edm::InputTag AcceptanceHistoProducer::srcGenParticles_
private

Definition at line 40 of file AcceptanceHistoProducer.h.

Referenced by analyze().