CMS 3D CMS Logo

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

Public Member Functions

 ZMassHistogrammer (const edm::ParameterSet &pset)
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup) override
 

Private Attributes

edm::EDGetTokenT< reco::CandidateViewgenToken_
 
TH1F * h_mZ_
 
TH1F * h_mZMC_
 
edm::EDGetTokenT< reco::CandidateViewzToken_
 

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 7 of file ZMassHistogrammer.cc.

Constructor & Destructor Documentation

◆ ZMassHistogrammer()

ZMassHistogrammer::ZMassHistogrammer ( const edm::ParameterSet pset)

Definition at line 31 of file ZMassHistogrammer.cc.

32  : zToken_(consumes<reco::CandidateView>(pset.getParameter<InputTag>("z"))),
33  genToken_(consumes<reco::CandidateView>(pset.getParameter<InputTag>("gen"))) {
34  cout << ">>> Z Mass constructor" << endl;
36  h_mZ_ = fs->make<TH1F>("ZMass", "Z mass (GeV/c^{2})", 100, 0, 200);
37  h_mZMC_ = fs->make<TH1F>("ZMCMass", "Z MC mass (GeV/c^{2})", 100, 0, 200);
38 }

References gather_cfg::cout, h_mZ_, h_mZMC_, and TFileService::make().

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 40 of file ZMassHistogrammer.cc.

40  {
41  cout << ">>> Z Mass analyze" << endl;
44  event.getByToken(zToken_, z);
45  event.getByToken(genToken_, gen);
46  for (unsigned int i = 0; i < z->size(); ++i) {
47  const Candidate& zCand = (*z)[i];
48  h_mZ_->Fill(zCand.mass());
49  }
50  for (unsigned int i = 0; i < gen->size(); ++i) {
51  const Candidate& genCand = (*gen)[i];
52  if ((genCand.pdgId() == 23) && (genCand.status() == 2)) //this is an intermediate Z0
53  cout << ">>> intermediate Z0 found, with " << genCand.numberOfDaughters() << " daughters" << endl;
54  if ((genCand.pdgId() == 23) && (genCand.status() == 3)) { //this is a Z0
55  cout << ">>> Z0 found, with " << genCand.numberOfDaughters() << " daughters" << endl;
56  h_mZMC_->Fill(genCand.mass());
57  if (genCand.numberOfDaughters() == 3) { //Z0 decays in mu+ mu-, the 3rd daughter is the same Z0
58  const Candidate* dauGen0 = genCand.daughter(0);
59  const Candidate* dauGen1 = genCand.daughter(1);
60  const Candidate* dauGen2 = genCand.daughter(2);
61  cout << ">>> daughter MC 0 PDG Id " << dauGen0->pdgId() << ", status " << dauGen0->status() << ", charge "
62  << dauGen0->charge() << endl;
63  cout << ">>> daughter MC 1 PDG Id " << dauGen1->pdgId() << ", status " << dauGen1->status() << ", charge "
64  << dauGen1->charge() << endl;
65  cout << ">>> daughter MC 2 PDG Id " << dauGen2->pdgId() << ", status " << dauGen2->status() << ", charge "
66  << dauGen2->charge() << endl;
67  }
68  }
69  }
70 }

References reco::Candidate::charge(), gather_cfg::cout, reco::Candidate::daughter(), relval_steps::gen(), genToken_, h_mZ_, h_mZMC_, mps_fire::i, reco::Candidate::mass(), reco::Candidate::numberOfDaughters(), reco::Candidate::pdgId(), reco::Candidate::status(), z, and zToken_.

Member Data Documentation

◆ genToken_

edm::EDGetTokenT<reco::CandidateView> ZMassHistogrammer::genToken_
private

Definition at line 14 of file ZMassHistogrammer.cc.

Referenced by analyze().

◆ h_mZ_

TH1F* ZMassHistogrammer::h_mZ_
private

Definition at line 15 of file ZMassHistogrammer.cc.

Referenced by analyze(), and ZMassHistogrammer().

◆ h_mZMC_

TH1F * ZMassHistogrammer::h_mZMC_
private

Definition at line 15 of file ZMassHistogrammer.cc.

Referenced by analyze(), and ZMassHistogrammer().

◆ zToken_

edm::EDGetTokenT<reco::CandidateView> ZMassHistogrammer::zToken_
private

Definition at line 13 of file ZMassHistogrammer.cc.

Referenced by analyze().

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)
mps_fire.i
i
Definition: mps_fire.py:428
reco::Candidate::mass
virtual double mass() const =0
mass
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ZMassHistogrammer::genToken_
edm::EDGetTokenT< reco::CandidateView > genToken_
Definition: ZMassHistogrammer.cc:14
reco::Candidate::status
virtual int status() const =0
status word
edm::Handle
Definition: AssociativeIterator.h:50
reco::Candidate::charge
virtual int charge() const =0
electric charge
DDAxes::z
reco::Candidate::numberOfDaughters
virtual size_type numberOfDaughters() const =0
number of daughters
gen
Definition: PythiaDecays.h:13
ZMassHistogrammer::zToken_
edm::EDGetTokenT< reco::CandidateView > zToken_
Definition: ZMassHistogrammer.cc:13
ZMassHistogrammer::h_mZMC_
TH1F * h_mZMC_
Definition: ZMassHistogrammer.cc:15
edm::Service< TFileService >
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
reco::Candidate
Definition: Candidate.h:27
relval_steps.gen
def gen(fragment, howMuch)
Production test section ####.
Definition: relval_steps.py:509
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
ZMassHistogrammer::h_mZ_
TH1F * h_mZ_
Definition: ZMassHistogrammer.cc:15