CMS 3D CMS Logo

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

Public Member Functions

 ParticleDecayProducer (const edm::ParameterSet &)
 
 ~ParticleDecayProducer () override=default
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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::StreamID, edm::Event &e, edm::EventSetup const &c) const override
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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.

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

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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::CandidateCollection > genCandidatesToken_
std::vector< std::string > valias
const std::vector< int > daughtersPdgId_
const std::string decayChain_

◆ ~ParticleDecayProducer()

ParticleDecayProducer::~ParticleDecayProducer ( )
overridedefault

Member Function Documentation

◆ produce()

void ParticleDecayProducer::produce ( edm::StreamID  ,
edm::Event e,
edm::EventSetup const &  c 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 56 of file ParticleDecayProducer.cc.

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.

56  {
57  // get gen particle candidates
58  const edm::Handle<CandidateCollection> genCandidatesCollection = iEvent.getHandle(genCandidatesToken_);
59 
60  unique_ptr<CandidateCollection> mothercands(new CandidateCollection);
61  unique_ptr<CandidateCollection> daughterscands(new CandidateCollection);
62  size_t daughtersize = daughtersPdgId_.size();
63  for (CandidateCollection::const_iterator p = genCandidatesCollection->begin(); p != genCandidatesCollection->end();
64  ++p) {
65  if (p->pdgId() == motherPdgId_ && p->status() == 3) {
66  mothercands->push_back(p->clone());
67  size_t ndau = p->numberOfDaughters();
68  for (size_t i = 0; i < ndau; ++i) {
69  for (size_t j = 0; j < daughtersize; ++j) {
70  if (p->daughter(i)->pdgId() == daughtersPdgId_[j] && p->daughter(i)->status() == 3) {
71  daughterscands->push_back(p->daughter(i)->clone());
72  }
73  }
74  }
75  }
76  }
77 
78  iEvent.put(std::move(mothercands), decayChain_ + "Mother");
79  daughterscands->sort(GreaterByPt<reco::Candidate>());
80 
81  for (unsigned int row = 0; row < daughtersize; ++row) {
82  unique_ptr<CandidateCollection> leptonscands_(new CandidateCollection);
83  leptonscands_->push_back((daughterscands->begin() + row)->clone());
84  iEvent.put(std::move(leptonscands_), valias.at(row));
85  }
86 }
edm::EDGetTokenT< reco::CandidateCollection > genCandidatesToken_
iterator begin()
Definition: OwnVector.h:280
std::vector< std::string > valias
const std::vector< int > daughtersPdgId_
int iEvent
Definition: GenABIO.cc:224
const std::string decayChain_
iterator end()
Definition: OwnVector.h:285
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ daughtersPdgId_

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

Definition at line 24 of file ParticleDecayProducer.cc.

Referenced by ParticleDecayProducer(), and produce().

◆ decayChain_

const 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_

const 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().