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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 OniaAddV0TracksProducer (const edm::ParameterSet &ps)
 
- 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
 
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)
 
 ~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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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::Event &event, const edm::EventSetup &esetup) override
 

Private Attributes

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

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
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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<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)
 

Detailed Description

Add tracks from V0

Definition at line 22 of file OniaAddV0TracksProducer.h.

Constructor & Destructor Documentation

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

Definition at line 7 of file OniaAddV0TracksProducer.cc.

References gather_cfg::cout, events_v0, edm::ParameterSet::getParameter(), KShortCollectionToken_, LambdaCollectionToken_, total_kshort, total_lambda, and total_v0.

7  {
9  consumes<reco::VertexCompositeCandidateCollection>(ps.getParameter<edm::InputTag>("LambdaTag"));
11  consumes<reco::VertexCompositeCandidateCollection>(ps.getParameter<edm::InputTag>("KShortTag"));
12 
13  produces<pat::CompositeCandidateCollection>("Kshort");
14  produces<pat::CompositeCandidateCollection>("Lambda");
15 
16  events_v0 = 0;
17  total_v0 = 0;
18  total_lambda = 0;
19  total_kshort = 0;
20  std::cout << "running OniaAddV0TracksProducer..." << std::endl;
21 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > KShortCollectionToken_
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > LambdaCollectionToken_

Member Function Documentation

void OniaAddV0TracksProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 71 of file OniaAddV0TracksProducer.cc.

References gather_cfg::cout, DEFINE_FWK_MODULE, events_v0, total_kshort, total_lambda, and total_v0.

71  {
72  std::cout << "############################" << std::endl;
73  std::cout << "OniaAddV0Tracks producer report " << std::endl;
74  std::cout << "############################" << std::endl;
75  std::cout << "Total events with v0 : " << events_v0 << std::endl;
76  std::cout << "Total v0 : " << total_v0 << std::endl;
77  std::cout << "Total number of lambda : " << total_lambda << std::endl;
78  std::cout << "Total number of kshort : " << total_kshort << std::endl;
79  std::cout << "############################" << std::endl;
80 }
void OniaAddV0TracksProducer::produce ( edm::Event event,
const edm::EventSetup esetup 
)
overrideprivate

Definition at line 23 of file OniaAddV0TracksProducer.cc.

References pat::PATObject< ObjectType >::addUserData(), events_v0, KShortCollectionToken_, LambdaCollectionToken_, eostools::move(), total_kshort, total_lambda, total_v0, and HLT_2018_cff::track.

23  {
24  // Create unique_ptr for each collection to be stored in the Event
25  std::unique_ptr<pat::CompositeCandidateCollection> Enhanced_kShortCandidates(new pat::CompositeCandidateCollection);
26  std::unique_ptr<pat::CompositeCandidateCollection> Enhanced_lambdaCandidates(new pat::CompositeCandidateCollection);
27 
29  event.getByToken(LambdaCollectionToken_, lcandidates);
30 
32  event.getByToken(KShortCollectionToken_, kcandidates);
33 
34  int exits_l = 0;
35  int exits_k = 0;
36  for (reco::VertexCompositeCandidateCollection::const_iterator ik = kcandidates->begin(); ik != kcandidates->end();
37  ++ik) {
39  edm::RefToBase<reco::Track> ktrk0((*(dynamic_cast<const reco::RecoChargedCandidate*>(ik->daughter(0)))).track());
40  edm::RefToBase<reco::Track> ktrk1((*(dynamic_cast<const reco::RecoChargedCandidate*>(ik->daughter(1)))).track());
41  kc->addUserData<reco::Track>("track0", *ktrk0);
42  kc->addUserData<reco::Track>("track1", *ktrk1);
43  Enhanced_kShortCandidates->push_back(*kc);
44  exits_k++;
45  }
46 
47  for (reco::VertexCompositeCandidateCollection::const_iterator il = lcandidates->begin(); il != lcandidates->end();
48  ++il) {
50  edm::RefToBase<reco::Track> ltrk0((*(dynamic_cast<const reco::RecoChargedCandidate*>(il->daughter(0)))).track());
51  edm::RefToBase<reco::Track> ltrk1((*(dynamic_cast<const reco::RecoChargedCandidate*>(il->daughter(1)))).track());
52  lc->addUserData<reco::Track>("track0", *ltrk0);
53  lc->addUserData<reco::Track>("track1", *ltrk1);
54  Enhanced_lambdaCandidates->push_back(*lc);
55  exits_l++;
56  }
57 
58  // Write the collections to the Event
59 
60  total_v0 += exits_k;
61  total_v0 += exits_l;
62  total_kshort += exits_k;
63  total_lambda += exits_l;
64  if (exits_k || exits_l)
65  events_v0++;
66 
67  event.put(std::move(Enhanced_kShortCandidates), "Kshort");
68  event.put(std::move(Enhanced_lambdaCandidates), "Lambda");
69 }
Analysis-level particle class.
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > KShortCollectionToken_
std::vector< CompositeCandidate > CompositeCandidateCollection
edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > LambdaCollectionToken_
void addUserData(const std::string &label, const T &data, bool transientOnly=false, bool overwrite=false)
Definition: PATObject.h:353
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

int OniaAddV0TracksProducer::events_v0
private

Definition at line 33 of file OniaAddV0TracksProducer.h.

Referenced by endJob(), OniaAddV0TracksProducer(), and produce().

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

Definition at line 31 of file OniaAddV0TracksProducer.h.

Referenced by OniaAddV0TracksProducer(), and produce().

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

Definition at line 30 of file OniaAddV0TracksProducer.h.

Referenced by OniaAddV0TracksProducer(), and produce().

int OniaAddV0TracksProducer::total_kshort
private

Definition at line 36 of file OniaAddV0TracksProducer.h.

Referenced by endJob(), OniaAddV0TracksProducer(), and produce().

int OniaAddV0TracksProducer::total_lambda
private

Definition at line 35 of file OniaAddV0TracksProducer.h.

Referenced by endJob(), OniaAddV0TracksProducer(), and produce().

int OniaAddV0TracksProducer::total_v0
private

Definition at line 34 of file OniaAddV0TracksProducer.h.

Referenced by endJob(), OniaAddV0TracksProducer(), and produce().