CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ParticleDecayProducer Class Reference
Inheritance diagram for ParticleDecayProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ParticleDecayProducer (const edm::ParameterSet &)
 
 ~ParticleDecayProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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
 
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 produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< int > daughtersPdgId_
 
std::string decayChain_
 
edm::EDGetTokenT< reco::CandidateCollectiongenCandidatesToken_
 
int motherPdgId_
 
std::vector< std::string > valias
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- 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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Original Author: Nicola De Filippis

Definition at line 15 of file ParticleDecayProducer.cc.

Constructor & Destructor Documentation

◆ ParticleDecayProducer()

ParticleDecayProducer::ParticleDecayProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 40 of file ParticleDecayProducer.cc.

41  : genCandidatesToken_(consumes<CandidateCollection>(iConfig.getParameter<InputTag>("src"))),
42  motherPdgId_(iConfig.getParameter<int>("motherPdgId")),
43  daughtersPdgId_(iConfig.getParameter<vector<int> >("daughtersPdgId")),
44  decayChain_(iConfig.getParameter<std::string>("decayChain")) {
45  string alias;
46  produces<CandidateCollection>(alias = decayChain_ + "Mother").setBranchAlias(alias);
47  for (unsigned int j = 0; j < daughtersPdgId_.size(); ++j) {
48  ostringstream index, collection;
49  index << j;
50  collection << decayChain_ << "Lepton" << index.str();
51  valias.push_back(collection.str());
52  produces<CandidateCollection>(valias.at(j)).setBranchAlias(valias.at(j));
53  }
54 }

References SiStripOfflineCRack_cfg::alias, universalConfigTemplate::collection, daughtersPdgId_, decayChain_, dqmiolumiharvest::j, and valias.

◆ ~ParticleDecayProducer()

ParticleDecayProducer::~ParticleDecayProducer ( )
override

Definition at line 57 of file ParticleDecayProducer.cc.

57 {}

Member Function Documentation

◆ produce()

void ParticleDecayProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 59 of file ParticleDecayProducer.cc.

59  {
60  // get gen particle candidates
61  edm::Handle<CandidateCollection> genCandidatesCollection;
62  iEvent.getByToken(genCandidatesToken_, genCandidatesCollection);
63 
64  unique_ptr<CandidateCollection> mothercands(new CandidateCollection);
65  unique_ptr<CandidateCollection> daughterscands(new CandidateCollection);
66  size_t daughtersize = daughtersPdgId_.size();
67  for (CandidateCollection::const_iterator p = genCandidatesCollection->begin(); p != genCandidatesCollection->end();
68  ++p) {
69  if (p->pdgId() == motherPdgId_ && p->status() == 3) {
70  mothercands->push_back(p->clone());
71  size_t ndau = p->numberOfDaughters();
72  for (size_t i = 0; i < ndau; ++i) {
73  for (size_t j = 0; j < daughtersize; ++j) {
74  if (p->daughter(i)->pdgId() == daughtersPdgId_[j] && p->daughter(i)->status() == 3) {
75  daughterscands->push_back(p->daughter(i)->clone());
76  }
77  }
78  }
79  }
80  }
81 
82  iEvent.put(std::move(mothercands), decayChain_ + "Mother");
83  daughterscands->sort(GreaterByPt<reco::Candidate>());
84 
85  for (unsigned int row = 0; row < daughtersize; ++row) {
86  unique_ptr<CandidateCollection> leptonscands_(new CandidateCollection);
87  leptonscands_->push_back((daughterscands->begin() + row)->clone());
88  iEvent.put(std::move(leptonscands_), valias.at(row));
89  }
90 }

References edm::OwnVector< T, P >::begin(), clone(), daughtersPdgId_, decayChain_, edm::OwnVector< T, P >::end(), genCandidatesToken_, mps_fire::i, iEvent, dqmiolumiharvest::j, motherPdgId_, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, and valias.

Member Data Documentation

◆ daughtersPdgId_

std::vector<int> ParticleDecayProducer::daughtersPdgId_
private

Definition at line 24 of file ParticleDecayProducer.cc.

Referenced by ParticleDecayProducer(), and produce().

◆ decayChain_

std::string ParticleDecayProducer::decayChain_
private

Definition at line 25 of file ParticleDecayProducer.cc.

Referenced by ParticleDecayProducer(), and produce().

◆ genCandidatesToken_

edm::EDGetTokenT<reco::CandidateCollection> ParticleDecayProducer::genCandidatesToken_
private

Definition at line 22 of file ParticleDecayProducer.cc.

Referenced by produce().

◆ motherPdgId_

int ParticleDecayProducer::motherPdgId_
private

Definition at line 23 of file ParticleDecayProducer.cc.

Referenced by produce().

◆ valias

std::vector<std::string> ParticleDecayProducer::valias
private

Definition at line 26 of file ParticleDecayProducer.cc.

Referenced by ParticleDecayProducer(), and produce().

mps_fire.i
i
Definition: mps_fire.py:355
GreaterByPt
Definition: PtComparator.h:24
edm::OwnVector::end
iterator end()
Definition: OwnVector.h:285
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::Handle
Definition: AssociativeIterator.h:50
ParticleDecayProducer::decayChain_
std::string decayChain_
Definition: ParticleDecayProducer.cc:25
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
ParticleDecayProducer::daughtersPdgId_
std::vector< int > daughtersPdgId_
Definition: ParticleDecayProducer.cc:24
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
iEvent
int iEvent
Definition: GenABIO.cc:224
ParticleDecayProducer::valias
std::vector< std::string > valias
Definition: ParticleDecayProducer.cc:26
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
ParticleDecayProducer::genCandidatesToken_
edm::EDGetTokenT< reco::CandidateCollection > genCandidatesToken_
Definition: ParticleDecayProducer.cc:22
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:129
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::OwnVector::begin
iterator begin()
Definition: OwnVector.h:280
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
ParticleDecayProducer::motherPdgId_
int motherPdgId_
Definition: ParticleDecayProducer.cc:23
edm::InputTag
Definition: InputTag.h:15
edm::OwnVector
Definition: OwnVector.h:24