CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
OniaAddV0TracksProducer Class Reference

#include <OniaAddV0TracksProducer.h>

Inheritance diagram for OniaAddV0TracksProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 OniaAddV0TracksProducer (const edm::ParameterSet &ps)
 
- 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 endJob () override
 
void produce (edm::StreamID, edm::Event &event, const edm::EventSetup &esetup) const override
 

Private Attributes

std::atomic< int > events_v0
 
edm::EDGetTokenT< reco::VertexCompositeCandidateCollectionKShortCollectionToken_
 
edm::EDGetTokenT< reco::VertexCompositeCandidateCollectionLambdaCollectionToken_
 
std::atomic< int > total_kshort
 
std::atomic< int > total_lambda
 
std::atomic< int > total_v0
 

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

Add tracks from V0

Definition at line 23 of file OniaAddV0TracksProducer.h.

Constructor & Destructor Documentation

◆ OniaAddV0TracksProducer()

OniaAddV0TracksProducer::OniaAddV0TracksProducer ( const edm::ParameterSet ps)
explicit

Definition at line 7 of file OniaAddV0TracksProducer.cc.

10  consumes<reco::VertexCompositeCandidateCollection>(ps.getParameter<edm::InputTag>("LambdaTag"));
12  consumes<reco::VertexCompositeCandidateCollection>(ps.getParameter<edm::InputTag>("KShortTag"));
13 
14  produces<pat::CompositeCandidateCollection>("Kshort");
15  produces<pat::CompositeCandidateCollection>("Lambda");
16 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > KShortCollectionToken_
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > LambdaCollectionToken_

Member Function Documentation

◆ endJob()

void OniaAddV0TracksProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 66 of file OniaAddV0TracksProducer.cc.

References events_v0, total_kshort, total_lambda, and total_v0.

66  {
67  edm::LogVerbatim("OniaAddV0TracksSummary") << "############################\n"
68  "OniaAddV0Tracks producer report \n"
69  "############################\n"
70  "Total events with v0 : "
71  << events_v0
72  << "\n"
73  "Total v0 : "
74  << total_v0
75  << "\n"
76  "Total number of lambda : "
77  << total_lambda
78  << "\n"
79  "Total number of kshort : "
80  << total_kshort
81  << "\n"
82  "############################";
83 }
Log< level::Info, true > LogVerbatim

◆ produce()

void OniaAddV0TracksProducer::produce ( edm::StreamID  ,
edm::Event event,
const edm::EventSetup esetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 18 of file OniaAddV0TracksProducer.cc.

References events_v0, KShortCollectionToken_, LambdaCollectionToken_, eostools::move(), total_kshort, total_lambda, total_v0, and HLT_2022v12_cff::track.

18  {
19  // Create unique_ptr for each collection to be stored in the Event
20  std::unique_ptr<pat::CompositeCandidateCollection> Enhanced_kShortCandidates(new pat::CompositeCandidateCollection);
21  std::unique_ptr<pat::CompositeCandidateCollection> Enhanced_lambdaCandidates(new pat::CompositeCandidateCollection);
22 
24  event.getByToken(LambdaCollectionToken_, lcandidates);
25 
27  event.getByToken(KShortCollectionToken_, kcandidates);
28 
29  int exits_l = 0;
30  int exits_k = 0;
31  for (reco::VertexCompositeCandidateCollection::const_iterator ik = kcandidates->begin(); ik != kcandidates->end();
32  ++ik) {
34  edm::RefToBase<reco::Track> ktrk0((*(dynamic_cast<const reco::RecoChargedCandidate*>(ik->daughter(0)))).track());
35  edm::RefToBase<reco::Track> ktrk1((*(dynamic_cast<const reco::RecoChargedCandidate*>(ik->daughter(1)))).track());
36  kc.addUserData<reco::Track>("track0", *ktrk0);
37  kc.addUserData<reco::Track>("track1", *ktrk1);
38  Enhanced_kShortCandidates->emplace_back(std::move(kc));
39  exits_k++;
40  }
41 
42  for (reco::VertexCompositeCandidateCollection::const_iterator il = lcandidates->begin(); il != lcandidates->end();
43  ++il) {
45  edm::RefToBase<reco::Track> ltrk0((*(dynamic_cast<const reco::RecoChargedCandidate*>(il->daughter(0)))).track());
46  edm::RefToBase<reco::Track> ltrk1((*(dynamic_cast<const reco::RecoChargedCandidate*>(il->daughter(1)))).track());
47  lc.addUserData<reco::Track>("track0", *ltrk0);
48  lc.addUserData<reco::Track>("track1", *ltrk1);
49  Enhanced_lambdaCandidates->emplace_back(std::move(lc));
50  exits_l++;
51  }
52 
53  // Write the collections to the Event
54 
55  total_v0 += exits_k;
56  total_v0 += exits_l;
57  total_kshort += exits_k;
58  total_lambda += exits_l;
59  if (exits_k || exits_l)
60  events_v0++;
61 
62  event.put(std::move(Enhanced_kShortCandidates), "Kshort");
63  event.put(std::move(Enhanced_lambdaCandidates), "Lambda");
64 }
Analysis-level particle class.
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > KShortCollectionToken_
std::vector< CompositeCandidate > CompositeCandidateCollection
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > LambdaCollectionToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ events_v0

std::atomic<int> OniaAddV0TracksProducer::events_v0
mutableprivate

Definition at line 34 of file OniaAddV0TracksProducer.h.

Referenced by endJob(), and produce().

◆ KShortCollectionToken_

edm::EDGetTokenT<reco::VertexCompositeCandidateCollection> OniaAddV0TracksProducer::KShortCollectionToken_
private

Definition at line 32 of file OniaAddV0TracksProducer.h.

Referenced by produce().

◆ LambdaCollectionToken_

edm::EDGetTokenT<reco::VertexCompositeCandidateCollection> OniaAddV0TracksProducer::LambdaCollectionToken_
private

Definition at line 31 of file OniaAddV0TracksProducer.h.

Referenced by produce().

◆ total_kshort

std::atomic<int> OniaAddV0TracksProducer::total_kshort
mutableprivate

Definition at line 37 of file OniaAddV0TracksProducer.h.

Referenced by endJob(), and produce().

◆ total_lambda

std::atomic<int> OniaAddV0TracksProducer::total_lambda
mutableprivate

Definition at line 36 of file OniaAddV0TracksProducer.h.

Referenced by endJob(), and produce().

◆ total_v0

std::atomic<int> OniaAddV0TracksProducer::total_v0
mutableprivate

Definition at line 35 of file OniaAddV0TracksProducer.h.

Referenced by endJob(), and produce().