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::stream::EDProducer<>

Public Member Functions

 ShallowSimTracksProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) 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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 12 of file ShallowSimTracksProducer.h.

Constructor & Destructor Documentation

◆ ShallowSimTracksProducer()

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

Definition at line 10 of file ShallowSimTracksProducer.cc.

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

References Prefix, and Suffix.

Member Function Documentation

◆ produce()

void ShallowSimTracksProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 32 of file ShallowSimTracksProducer.cc.

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

References genericTrackCandidates_cff::associations, LCToCPAssociation_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, oniaPATMuonsWithTrigger_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_FULL_cff::track, muonClassificationByHits_cfi::trackingParticles, trackingParticles_token_, 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().

LCToCPAssociation_cfi.associator
associator
Definition: LCToCPAssociation_cfi.py:4
genericTrackCandidates_cff.associations
associations
Definition: genericTrackCandidates_cff.py:45
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
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
oniaPATMuonsWithTrigger_cff.matches
matches
Definition: oniaPATMuonsWithTrigger_cff.py:77
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:70
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
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
tracks
const uint32_t *__restrict__ const HitContainer *__restrict__ TkSoA *__restrict__ tracks
Definition: CAHitNtupletGeneratorKernelsImpl.h:159
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > >
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
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
ShallowSimTracksProducer::Suffix
const std::string Suffix
Definition: ShallowSimTracksProducer.h:18
DDAxes::phi
eostools.move
def move(src, dest)
Definition: eostools.py:511
hgcal::association
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
Definition: LayerClusterAssociatorByEnergyScoreImpl.h:44
PVValHelper::dxy
Definition: PVValidationHelpers.h:48
TrackingParticle::p
double p() const
Magnitude of momentum vector. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:112
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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