CMS 3D CMS Logo

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

#include <ShallowSimTracksProducer.h>

Inheritance diagram for ShallowSimTracksProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ShallowSimTracksProducer (const edm::ParameterSet &)
 
- 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

const edm::EDGetTokenT< reco::TrackToTrackingParticleAssociatorassociator_token_
 
const std::string Prefix
 
const std::string Suffix
 
const edm::EDGetTokenT< TrackingParticleCollectiontrackingParticles_token_
 
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_token_
 

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

Definition at line 12 of file ShallowSimTracksProducer.h.

Constructor & Destructor Documentation

◆ ShallowSimTracksProducer()

ShallowSimTracksProducer::ShallowSimTracksProducer ( const edm::ParameterSet conf)
explicit

Definition at line 11 of file ShallowSimTracksProducer.cc.

12  : Prefix(conf.getParameter<std::string>("Prefix")),
13  Suffix(conf.getParameter<std::string>("Suffix")),
15  consumes<TrackingParticleCollection>(conf.getParameter<edm::InputTag>("TrackingParticles"))),
17  consumes<reco::TrackToTrackingParticleAssociator>(conf.getParameter<edm::InputTag>("Associator"))),
19  produces<std::vector<unsigned>>(Prefix + "multi" + Suffix);
20  produces<std::vector<int>>(Prefix + "type" + Suffix);
21  produces<std::vector<float>>(Prefix + "charge" + Suffix);
22  produces<std::vector<float>>(Prefix + "momentum" + Suffix);
23  produces<std::vector<float>>(Prefix + "pt" + Suffix);
24  produces<std::vector<double>>(Prefix + "theta" + Suffix);
25  produces<std::vector<double>>(Prefix + "phi" + Suffix);
26  produces<std::vector<double>>(Prefix + "eta" + Suffix);
27  produces<std::vector<double>>(Prefix + "qoverp" + Suffix);
28  produces<std::vector<double>>(Prefix + "vx" + Suffix);
29  produces<std::vector<double>>(Prefix + "vy" + Suffix);
30  produces<std::vector<double>>(Prefix + "vz" + Suffix);
31 }

References Prefix, and Suffix.

Member Function Documentation

◆ produce()

void ShallowSimTracksProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 33 of file ShallowSimTracksProducer.cc.

33  {
35  event.getByToken(tracks_token_, tracks);
39  event.getByToken(associator_token_, associator);
40 
41  unsigned size = tracks->size();
42  auto multi = std::make_unique<std::vector<unsigned>>(size, 0);
43  auto type = std::make_unique<std::vector<int>>(size, 0);
44  auto charge = std::make_unique<std::vector<float>>(size, 0);
45  auto momentum = std::make_unique<std::vector<float>>(size, -1);
46  auto pt = std::make_unique<std::vector<float>>(size, -1);
47  auto theta = std::make_unique<std::vector<double>>(size, -1000);
48  auto phi = std::make_unique<std::vector<double>>(size, -1000);
49  auto eta = std::make_unique<std::vector<double>>(size, -1000);
50  auto dxy = std::make_unique<std::vector<double>>(size, -1000);
51  auto dsz = std::make_unique<std::vector<double>>(size, -1000);
52  auto qoverp = std::make_unique<std::vector<double>>(size, -1000);
53  auto vx = std::make_unique<std::vector<double>>(size, -1000);
54  auto vy = std::make_unique<std::vector<double>>(size, -1000);
55  auto vz = std::make_unique<std::vector<double>>(size, -1000);
56 
58 
60  association++) {
61  const reco::Track* track = association->key.get();
62  const int matches = association->val.size();
63  if (matches > 0) {
64  const TrackingParticle* tparticle = association->val[0].first.get();
66 
67  multi->at(i) = matches;
68  type->at(i) = tparticle->pdgId();
69  charge->at(i) = tparticle->charge();
70  momentum->at(i) = tparticle->p();
71  pt->at(i) = tparticle->pt();
72  theta->at(i) = tparticle->theta();
73  phi->at(i) = tparticle->phi();
74  eta->at(i) = tparticle->eta();
75  qoverp->at(i) = tparticle->charge() / tparticle->p();
76 
77  const TrackingVertex* tvertex = tparticle->parentVertex().get();
78  vx->at(i) = tvertex->position().x();
79  vy->at(i) = tvertex->position().y();
80  vz->at(i) = tvertex->position().z();
81  }
82  }
83 
84  event.put(std::move(multi), Prefix + "multi" + Suffix);
85  event.put(std::move(type), Prefix + "type" + Suffix);
86  event.put(std::move(charge), Prefix + "charge" + Suffix);
87  event.put(std::move(momentum), Prefix + "momentum" + Suffix);
88  event.put(std::move(pt), Prefix + "pt" + Suffix);
89  event.put(std::move(theta), Prefix + "theta" + Suffix);
90  event.put(std::move(phi), Prefix + "phi" + Suffix);
91  event.put(std::move(eta), Prefix + "eta" + Suffix);
92  event.put(std::move(qoverp), Prefix + "qoverp" + Suffix);
93  event.put(std::move(vx), Prefix + "vx" + Suffix);
94  event.put(std::move(vy), Prefix + "vy" + Suffix);
95  event.put(std::move(vz), Prefix + "vz" + Suffix);
96 }

References TrackValidation_cff::association, genericTrackCandidates_cff::associations, ctfWithMaterialTrackMCMatch_cfi::associator, associator_token_, ALCARECOTkAlJpsiMuMu_cff::charge, TrackingParticle::charge(), edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > >::const_iterator, PVValHelper::dxy, PVValHelper::eta, TrackingParticle::eta(), shallow::findTrackIndex(), edm::Ref< C, T, F >::get(), mps_fire::i, patCandidatesForDimuonsSequences_cff::matches, eostools::move(), trackerHitRTTI::multi, TrackingParticle::p(), TrackingParticle::parentVertex(), TrackingParticle::pdgId(), phi, TrackingParticle::phi(), TrackingVertex::position(), Prefix, DiDispStaMuonMonitor_cfi::pt, TrackingParticle::pt(), findQualityFiles::size, Suffix, TrackingParticle::theta(), theta(), HLT_2018_cff::track, muonClassificationByHits_cfi::trackingParticles, trackingParticles_token_, PDWG_EXOHSCP_cff::tracks, and tracks_token_.

Member Data Documentation

◆ associator_token_

const edm::EDGetTokenT<reco::TrackToTrackingParticleAssociator> ShallowSimTracksProducer::associator_token_
private

Definition at line 20 of file ShallowSimTracksProducer.h.

Referenced by produce().

◆ Prefix

const std::string ShallowSimTracksProducer::Prefix
private

Definition at line 17 of file ShallowSimTracksProducer.h.

Referenced by produce(), and ShallowSimTracksProducer().

◆ Suffix

const std::string ShallowSimTracksProducer::Suffix
private

Definition at line 18 of file ShallowSimTracksProducer.h.

Referenced by produce(), and ShallowSimTracksProducer().

◆ trackingParticles_token_

const edm::EDGetTokenT<TrackingParticleCollection> ShallowSimTracksProducer::trackingParticles_token_
private

Definition at line 19 of file ShallowSimTracksProducer.h.

Referenced by produce().

◆ tracks_token_

const edm::EDGetTokenT<edm::View<reco::Track> > ShallowSimTracksProducer::tracks_token_
private

Definition at line 21 of file ShallowSimTracksProducer.h.

Referenced by produce().

genericTrackCandidates_cff.associations
associations
Definition: genericTrackCandidates_cff.py:45
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
TrackingParticle::eta
double eta() const
Momentum pseudorapidity. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:151
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
TrackingVertex::position
const LorentzVector & position() const
Definition: TrackingVertex.h:71
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
TrackingParticle::parentVertex
const TrackingVertexRef & parentVertex() const
Definition: TrackingParticle.h:90
edm::Handle
Definition: AssociativeIterator.h:50
TrackingParticle::charge
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:98
TrackingParticle::pt
double pt() const
Transverse momentum. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:142
ShallowSimTracksProducer::trackingParticles_token_
const edm::EDGetTokenT< TrackingParticleCollection > trackingParticles_token_
Definition: ShallowSimTracksProducer.h:19
ShallowSimTracksProducer::tracks_token_
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_token_
Definition: ShallowSimTracksProducer.h:21
PVValHelper::eta
Definition: PVValidationHelpers.h:69
TrackingParticle
Monte Carlo truth information used for tracking validation.
Definition: TrackingParticle.h:29
TrackingParticle::phi
double phi() const
Momentum azimuthal angle. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:145
TrackingParticle::theta
double theta() const
Momentum polar angle. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:148
reco::Track
Definition: Track.h:27
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
ctfWithMaterialTrackMCMatch_cfi.associator
associator
Definition: ctfWithMaterialTrackMCMatch_cfi.py:7
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
ShallowSimTracksProducer::Prefix
const std::string Prefix
Definition: ShallowSimTracksProducer.h:17
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > >::const_iterator
friend struct const_iterator
Definition: AssociationMap.h:274
edm::View
Definition: CaloClusterFwd.h:14
ShallowSimTracksProducer::associator_token_
const edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > associator_token_
Definition: ShallowSimTracksProducer.h:20
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > >
TrackingVertex
Definition: TrackingVertex.h:22
muonClassificationByHits_cfi.trackingParticles
trackingParticles
Definition: muonClassificationByHits_cfi.py:28
TrackingParticle::pdgId
int pdgId() const
PDG ID.
Definition: TrackingParticle.h:61
trackerHitRTTI::multi
Definition: trackerHitRTTI.h:14
TrackValidation_cff.association
association
Definition: TrackValidation_cff.py:286
ShallowSimTracksProducer::Suffix
const std::string Suffix
Definition: ShallowSimTracksProducer.h:18
DDAxes::phi
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
type
type
Definition: HCALResponse.h:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
PVValHelper::dxy
Definition: PVValidationHelpers.h:47
TrackingParticle::p
double p() const
Magnitude of momentum vector. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:112
patCandidatesForDimuonsSequences_cff.matches
matches
Definition: patCandidatesForDimuonsSequences_cff.py:131
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
edm::InputTag
Definition: InputTag.h:15
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
shallow::findTrackIndex
int findTrackIndex(const edm::Handle< edm::View< reco::Track > > &h, const reco::Track *t)
Definition: ShallowTools.cc:25