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 &&)=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 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<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 = 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

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 }

Member Function Documentation

◆ endJob()

void OniaAddV0TracksProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::global::EDProducerBase.

Definition at line 66 of file OniaAddV0TracksProducer.cc.

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 }

References events_v0, total_kshort, total_lambda, and total_v0.

◆ 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.

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 }

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

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

OniaAddV0TracksProducer::LambdaCollectionToken_
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > LambdaCollectionToken_
Definition: OniaAddV0TracksProducer.h:31
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
pat::CompositeCandidate
Analysis-level particle class.
Definition: CompositeCandidate.h:31
OniaAddV0TracksProducer::total_kshort
std::atomic< int > total_kshort
Definition: OniaAddV0TracksProducer.h:37
pat::CompositeCandidateCollection
std::vector< CompositeCandidate > CompositeCandidateCollection
Definition: CompositeCandidate.h:22
edm::Handle< reco::VertexCompositeCandidateCollection >
OniaAddV0TracksProducer::KShortCollectionToken_
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > KShortCollectionToken_
Definition: OniaAddV0TracksProducer.h:32
reco::Track
Definition: Track.h:27
OniaAddV0TracksProducer::total_v0
std::atomic< int > total_v0
Definition: OniaAddV0TracksProducer.h:35
OniaAddV0TracksProducer::total_lambda
std::atomic< int > total_lambda
Definition: OniaAddV0TracksProducer.h:36
OniaAddV0TracksProducer::events_v0
std::atomic< int > events_v0
Definition: OniaAddV0TracksProducer.h:34
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::RefToBase< reco::Track >
edm::InputTag
Definition: InputTag.h:15