CMS 3D CMS Logo

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

#include <PixelTracksProducer.h>

Inheritance diagram for PixelTracksProducer:
edm::stream::EDProducer<>

Public Member Functions

 PixelTracksProducer (const edm::ParameterSet &conf)
 
void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 ~PixelTracksProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::EDGetTokenT< PixelTrackFilterfilterToken
 
edm::EDGetTokenT< PixelFitterfitterToken
 
edm::EDGetTokenT< TrajectorySeedCollectionseedProducerToken
 
std::unique_ptr< TrackingRegionProducertheRegionProducer
 

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 21 of file PixelTracksProducer.h.

Constructor & Destructor Documentation

◆ PixelTracksProducer()

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

Definition at line 35 of file PixelTracksProducer.cc.

35  : theRegionProducer(nullptr) {
36  produces<reco::TrackCollection>();
37  produces<TrackingRecHitCollection>();
38  produces<reco::TrackExtraCollection>();
39 
40  const edm::ParameterSet& regfactoryPSet = conf.getParameter<edm::ParameterSet>("RegionFactoryPSet");
41  std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName");
42  theRegionProducer = TrackingRegionProducerFactory::get()->create(regfactoryName, regfactoryPSet, consumesCollector());
43 
44  fitterToken = consumes<PixelFitter>(conf.getParameter<edm::InputTag>("Fitter"));
45  filterToken = consumes<PixelTrackFilter>(conf.getParameter<edm::InputTag>("Filter"));
46 
47  // The name of the seed producer
48  auto seedProducer = conf.getParameter<edm::InputTag>("SeedProducer");
49  seedProducerToken = consumes<TrajectorySeedCollection>(seedProducer);
50 }

References filterToken, fitterToken, get, edm::ParameterSet::getParameter(), seedProducerToken, AlCaHLTBitMon_QueryRunRegistry::string, and theRegionProducer.

◆ ~PixelTracksProducer()

PixelTracksProducer::~PixelTracksProducer ( )
overridedefault

Member Function Documentation

◆ produce()

void PixelTracksProducer::produce ( edm::Event ev,
const edm::EventSetup es 
)
override

Definition at line 56 of file PixelTracksProducer.cc.

56  {
57  std::unique_ptr<reco::TrackCollection> tracks(new reco::TrackCollection);
58  std::unique_ptr<TrackingRecHitCollection> recHits(new TrackingRecHitCollection);
59  std::unique_ptr<reco::TrackExtraCollection> trackExtras(new reco::TrackExtraCollection);
60  typedef std::vector<const TrackingRecHit*> RecHits;
61 
62  TracksWithRecHits pixeltracks;
63  TracksWithRecHits cleanedTracks;
64 
66  es.get<TrackerTopologyRcd>().get(httopo);
67  const TrackerTopology& ttopo = *httopo;
68 
70  e.getByToken(fitterToken, hfitter);
71  const PixelFitter& fitter = *hfitter;
72 
74  e.getByToken(filterToken, hfilter);
75  const PixelTrackFilter& theFilter = *hfilter;
76 
78  e.getByToken(seedProducerToken, theSeeds);
79 
80  // No seed -> output an empty track collection
81  if (theSeeds->empty()) {
82  e.put(std::move(tracks));
83  e.put(std::move(recHits));
84  e.put(std::move(trackExtras));
85  return;
86  }
87 
88  //only one region Global, but it is called at every event...
89  //maybe there is a smarter way to set it only once
90  //NEED TO FIX
91  typedef std::vector<std::unique_ptr<TrackingRegion> > Regions;
92  typedef Regions::const_iterator IR;
93  Regions regions = theRegionProducer->regions(e, es);
94  for (IR ir = regions.begin(), irEnd = regions.end(); ir < irEnd; ++ir) {
95  const TrackingRegion& region = **ir;
96 
97  // Loop over the seeds
98  TrajectorySeedCollection::const_iterator aSeed = theSeeds->begin();
99  TrajectorySeedCollection::const_iterator lastSeed = theSeeds->end();
100  for (; aSeed != lastSeed; ++aSeed) {
101  // Find the first hit and last hit of the Seed
102  TrajectorySeed::range theSeedingRecHitRange = aSeed->recHits();
103  edm::OwnVector<TrackingRecHit>::const_iterator aSeedingRecHit = theSeedingRecHitRange.first;
104  edm::OwnVector<TrackingRecHit>::const_iterator theLastSeedingRecHit = theSeedingRecHitRange.second;
105 
106  // Loop over the rechits
107  std::vector<const TrackingRecHit*> TripletHits(3, static_cast<const TrackingRecHit*>(nullptr));
108  for (unsigned i = 0; aSeedingRecHit != theLastSeedingRecHit; ++i, ++aSeedingRecHit)
109  TripletHits[i] = &(*aSeedingRecHit);
110 
111  // fitting the triplet
112  std::unique_ptr<reco::Track> track = fitter.run(TripletHits, region, es);
113 
114  // decide if track should be skipped according to filter
115  if (!theFilter(track.get(), TripletHits)) {
116  continue;
117  }
118 
119  // add tracks
120  pixeltracks.push_back(TrackWithRecHits(track.release(), TripletHits));
121  }
122  }
123 
124  int cc = 0;
125  int nTracks = pixeltracks.size();
126  for (int i = 0; i < nTracks; ++i) {
127  reco::Track* track = pixeltracks.at(i).first;
128  const RecHits& hits = pixeltracks.at(i).second;
129 
130  for (unsigned int k = 0; k < hits.size(); k++) {
131  TrackingRecHit* hit = (hits.at(k))->clone();
132  track->appendHitPattern(*hit, ttopo);
133  recHits->push_back(hit);
134  }
135 
136  tracks->push_back(*track);
137  delete track;
138  }
139 
142 
143  for (int k = 0; k < nTracks; ++k) {
144  // reco::TrackExtra* theTrackExtra = new reco::TrackExtra();
145  reco::TrackExtra theTrackExtra;
146 
147  //fill the TrackExtra with TrackingRecHitRef
148  // unsigned int nHits = tracks->at(k).numberOfValidHits();
149  const unsigned nHits = 3; // We are dealing with triplets!
150  theTrackExtra.setHits(ohRHProd, cc, nHits);
151  cc += nHits;
152 
153  trackExtras->push_back(theTrackExtra);
154  //trackExtras->push_back(*theTrackExtra);
155  //delete theTrackExtra;
156  }
157 
159 
160  for (int k = 0; k < nTracks; k++) {
161  const reco::TrackExtraRef theTrackExtraRef(ohTE, k);
162  (tracks->at(k)).setExtra(theTrackExtraRef);
163  }
164 
165  e.put(std::move(tracks));
166 }

References clone(), MillePedeFileConverter_cfg::e, filterToken, fitterToken, edm::EventSetup::get(), get, hfClusterShapes_cfi::hits, mps_fire::i, dqmdumpme::k, eostools::move(), nTracks(), FastTrackerRecHitMaskProducer_cfi::recHits, HLT_2018_cff::region, SiPixelRawToDigiRegional_cfi::Regions, PixelFitter::run(), seedProducerToken, reco::TrackExtraBase::setHits(), theRegionProducer, HLT_2018_cff::track, and PDWG_EXOHSCP_cff::tracks.

Member Data Documentation

◆ filterToken

edm::EDGetTokenT<PixelTrackFilter> PixelTracksProducer::filterToken
private

Definition at line 34 of file PixelTracksProducer.h.

Referenced by PixelTracksProducer(), and produce().

◆ fitterToken

edm::EDGetTokenT<PixelFitter> PixelTracksProducer::fitterToken
private

Definition at line 30 of file PixelTracksProducer.h.

Referenced by PixelTracksProducer(), and produce().

◆ seedProducerToken

edm::EDGetTokenT<TrajectorySeedCollection> PixelTracksProducer::seedProducerToken
private

Definition at line 33 of file PixelTracksProducer.h.

Referenced by PixelTracksProducer(), and produce().

◆ theRegionProducer

std::unique_ptr<TrackingRegionProducer> PixelTracksProducer::theRegionProducer
private

Definition at line 31 of file PixelTracksProducer.h.

Referenced by PixelTracksProducer(), and produce().

edm::RefProd< TrackingRecHitCollection >
nTracks
const unsigned int nTracks(const reco::Vertex &sv)
Definition: TemplatedVertexArbitrator.h:44
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
TrajectorySeed::range
std::pair< const_iterator, const_iterator > range
Definition: TrajectorySeed.h:21
TrackerTopology
Definition: TrackerTopology.h:16
PixelTracksProducer::fitterToken
edm::EDGetTokenT< PixelFitter > fitterToken
Definition: PixelTracksProducer.h:30
PixelTracksProducer::filterToken
edm::EDGetTokenT< PixelTrackFilter > filterToken
Definition: PixelTracksProducer.h:34
edm::Handle
Definition: AssociativeIterator.h:50
PixelFitter
Definition: PixelFitter.h:8
edm::Ref< TrackExtraCollection >
cc
reco::TrackExtra
Definition: TrackExtra.h:26
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
reco::Track
Definition: Track.h:27
edm::ESHandle< TrackerTopology >
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
dqmdumpme.k
k
Definition: dqmdumpme.py:60
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
PixelTracksProducer::seedProducerToken
edm::EDGetTokenT< TrajectorySeedCollection > seedProducerToken
Definition: PixelTracksProducer.h:33
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
pixeltrackfitting::TracksWithRecHits
std::vector< TrackWithRecHits > TracksWithRecHits
Definition: TracksWithHits.h:13
edm::ParameterSet
Definition: ParameterSet.h:36
PixelFitter::run
std::unique_ptr< reco::Track > run(const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region, const edm::EventSetup &setup) const
Definition: PixelFitter.h:15
get
#define get
reco::TrackExtraBase::setHits
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
Definition: TrackExtraBase.h:30
TrackingRecHit
Definition: TrackingRecHit.h:21
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
TrackingRegion
Definition: TrackingRegion.h:38
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
AlignmentPI::regions
regions
Definition: AlignmentPayloadInspectorHelper.h:76
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
PixelTracksProducer::theRegionProducer
std::unique_ptr< TrackingRegionProducer > theRegionProducer
Definition: PixelTracksProducer.h:31
pixeltrackfitting::TrackWithRecHits
std::pair< reco::Track *, std::vector< const TrackingRecHit * > > TrackWithRecHits
Definition: TracksWithHits.h:11
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
hit
Definition: SiStripHitEffFromCalibTree.cc:88
PixelTrackFilter
Definition: PixelTrackFilter.h:8
edm::OwnVector< TrackingRecHit >
SiPixelRawToDigiRegional_cfi.Regions
Regions
Definition: SiPixelRawToDigiRegional_cfi.py:7
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37