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
 
 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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

edm::EDGetTokenT< PixelTrackFilterfilterToken
 
edm::EDGetTokenT< PixelFitterfitterToken
 
edm::EDGetTokenT< TrajectorySeedCollectionseedProducerToken
 
std::unique_ptr< TrackingRegionProducertheRegionProducer
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdttopoToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 19 of file PixelTracksProducer.h.

Constructor & Destructor Documentation

◆ PixelTracksProducer()

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

Definition at line 31 of file PixelTracksProducer.cc.

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

32  : theRegionProducer(nullptr), ttopoToken(esConsumes()) {
33  produces<reco::TrackCollection>();
34  produces<TrackingRecHitCollection>();
35  produces<reco::TrackExtraCollection>();
36 
37  const edm::ParameterSet& regfactoryPSet = conf.getParameter<edm::ParameterSet>("RegionFactoryPSet");
38  std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName");
39  theRegionProducer = TrackingRegionProducerFactory::get()->create(regfactoryName, regfactoryPSet, consumesCollector());
40 
41  fitterToken = consumes<PixelFitter>(conf.getParameter<edm::InputTag>("Fitter"));
42  filterToken = consumes<PixelTrackFilter>(conf.getParameter<edm::InputTag>("Filter"));
43 
44  // The name of the seed producer
45  auto seedProducer = conf.getParameter<edm::InputTag>("SeedProducer");
46  seedProducerToken = consumes<TrajectorySeedCollection>(seedProducer);
47 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken
edm::EDGetTokenT< TrajectorySeedCollection > seedProducerToken
edm::EDGetTokenT< PixelTrackFilter > filterToken
std::unique_ptr< TrackingRegionProducer > theRegionProducer
#define get
edm::EDGetTokenT< PixelFitter > fitterToken

◆ ~PixelTracksProducer()

PixelTracksProducer::~PixelTracksProducer ( )
overridedefault

Member Function Documentation

◆ produce()

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

Definition at line 53 of file PixelTracksProducer.cc.

References gpuPixelDoublets::cc, clone(), MillePedeFileConverter_cfg::e, filterToken, fitterToken, edm::EventSetup::getData(), hfClusterShapes_cfi::hits, mps_fire::i, dqmdumpme::k, eostools::move(), nHits, BeamSpotPI::nTracks, rpcPointValidation_cfi::recHit, FastTrackerRecHitMaskProducer_cfi::recHits, HLT_2023v12_cff::region, SiPixelRawToDigiRegional_cfi::Regions, PixelFitter::run(), seedProducerToken, reco::TrackExtraBase::setHits(), theRegionProducer, HLT_2023v12_cff::track, pwdgSkimBPark_cfi::tracks, and ttopoToken.

53  {
54  std::unique_ptr<reco::TrackCollection> tracks(new reco::TrackCollection);
55  std::unique_ptr<TrackingRecHitCollection> recHits(new TrackingRecHitCollection);
56  std::unique_ptr<reco::TrackExtraCollection> trackExtras(new reco::TrackExtraCollection);
57  typedef std::vector<const TrackingRecHit*> RecHits;
58 
59  TracksWithRecHits pixeltracks;
60  TracksWithRecHits cleanedTracks;
61 
62  const TrackerTopology& ttopo = es.getData(ttopoToken);
63 
65  e.getByToken(fitterToken, hfitter);
66  const PixelFitter& fitter = *hfitter;
67 
69  e.getByToken(filterToken, hfilter);
70  const PixelTrackFilter& theFilter = *hfilter;
71 
73  e.getByToken(seedProducerToken, theSeeds);
74 
75  // No seed -> output an empty track collection
76  if (theSeeds->empty()) {
77  e.put(std::move(tracks));
78  e.put(std::move(recHits));
79  e.put(std::move(trackExtras));
80  return;
81  }
82 
83  //only one region Global, but it is called at every event...
84  //maybe there is a smarter way to set it only once
85  //NEED TO FIX
86  typedef std::vector<std::unique_ptr<TrackingRegion> > Regions;
87  typedef Regions::const_iterator IR;
88  Regions regions = theRegionProducer->regions(e, es);
89  for (IR ir = regions.begin(), irEnd = regions.end(); ir < irEnd; ++ir) {
90  const TrackingRegion& region = **ir;
91 
92  // Loop over the seeds
93  TrajectorySeedCollection::const_iterator aSeed = theSeeds->begin();
94  TrajectorySeedCollection::const_iterator lastSeed = theSeeds->end();
95  for (; aSeed != lastSeed; ++aSeed) {
96  // Loop over the rechits
97  std::vector<const TrackingRecHit*> TripletHits(3, static_cast<const TrackingRecHit*>(nullptr));
98  unsigned int iRecHit = 0;
99  for (auto const& recHit : aSeed->recHits()) {
100  TripletHits[iRecHit] = &recHit;
101  ++iRecHit;
102  }
103 
104  // fitting the triplet
105  std::unique_ptr<reco::Track> track = fitter.run(TripletHits, region);
106 
107  // decide if track should be skipped according to filter
108  if (!theFilter(track.get(), TripletHits)) {
109  continue;
110  }
111 
112  // add tracks
113  pixeltracks.push_back(TrackWithRecHits(track.release(), TripletHits));
114  }
115  }
116 
117  int cc = 0;
118  int nTracks = pixeltracks.size();
119  for (int i = 0; i < nTracks; ++i) {
120  reco::Track* track = pixeltracks.at(i).first;
121  const RecHits& hits = pixeltracks.at(i).second;
122 
123  for (unsigned int k = 0; k < hits.size(); k++) {
124  TrackingRecHit* hit = (hits.at(k))->clone();
125  track->appendHitPattern(*hit, ttopo);
126  recHits->push_back(hit);
127  }
128 
129  tracks->push_back(*track);
130  delete track;
131  }
132 
135 
136  for (int k = 0; k < nTracks; ++k) {
137  // reco::TrackExtra* theTrackExtra = new reco::TrackExtra();
138  reco::TrackExtra theTrackExtra;
139 
140  //fill the TrackExtra with TrackingRecHitRef
141  // unsigned int nHits = tracks->at(k).numberOfValidHits();
142  const unsigned nHits = 3; // We are dealing with triplets!
143  theTrackExtra.setHits(ohRHProd, cc, nHits);
144  cc += nHits;
145 
146  trackExtras->push_back(theTrackExtra);
147  //trackExtras->push_back(*theTrackExtra);
148  //delete theTrackExtra;
149  }
150 
152 
153  for (int k = 0; k < nTracks; k++) {
154  const reco::TrackExtraRef theTrackExtraRef(ohTE, k);
155  (tracks->at(k)).setExtra(theTrackExtraRef);
156  }
157 
158  e.put(std::move(tracks));
159 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > ttopoToken
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
std::pair< reco::Track *, std::vector< const TrackingRecHit * > > TrackWithRecHits
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::unique_ptr< reco::Track > run(const std::vector< const TrackingRecHit *> &hits, const TrackingRegion &region) const
Definition: PixelFitter.h:15
edm::EDGetTokenT< TrajectorySeedCollection > seedProducerToken
edm::EDGetTokenT< PixelTrackFilter > filterToken
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
std::unique_ptr< TrackingRegionProducer > theRegionProducer
std::vector< TrackWithRecHits > TracksWithRecHits
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
edm::EDGetTokenT< PixelFitter > fitterToken
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ filterToken

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

Definition at line 32 of file PixelTracksProducer.h.

Referenced by PixelTracksProducer(), and produce().

◆ fitterToken

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

Definition at line 28 of file PixelTracksProducer.h.

Referenced by PixelTracksProducer(), and produce().

◆ seedProducerToken

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

Definition at line 31 of file PixelTracksProducer.h.

Referenced by PixelTracksProducer(), and produce().

◆ theRegionProducer

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

Definition at line 29 of file PixelTracksProducer.h.

Referenced by PixelTracksProducer(), and produce().

◆ ttopoToken

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> PixelTracksProducer::ttopoToken
private

Definition at line 33 of file PixelTracksProducer.h.

Referenced by produce().