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 hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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  // Loop over the rechits
102  std::vector<const TrackingRecHit*> TripletHits(3, static_cast<const TrackingRecHit*>(nullptr));
103  unsigned int iRecHit = 0;
104  for (auto const& recHit : aSeed->recHits()) {
105  TripletHits[iRecHit] = &recHit;
106  ++iRecHit;
107  }
108 
109  // fitting the triplet
110  std::unique_ptr<reco::Track> track = fitter.run(TripletHits, region, es);
111 
112  // decide if track should be skipped according to filter
113  if (!theFilter(track.get(), TripletHits)) {
114  continue;
115  }
116 
117  // add tracks
118  pixeltracks.push_back(TrackWithRecHits(track.release(), TripletHits));
119  }
120  }
121 
122  int cc = 0;
123  int nTracks = pixeltracks.size();
124  for (int i = 0; i < nTracks; ++i) {
125  reco::Track* track = pixeltracks.at(i).first;
126  const RecHits& hits = pixeltracks.at(i).second;
127 
128  for (unsigned int k = 0; k < hits.size(); k++) {
129  TrackingRecHit* hit = (hits.at(k))->clone();
130  track->appendHitPattern(*hit, ttopo);
131  recHits->push_back(hit);
132  }
133 
134  tracks->push_back(*track);
135  delete track;
136  }
137 
140 
141  for (int k = 0; k < nTracks; ++k) {
142  // reco::TrackExtra* theTrackExtra = new reco::TrackExtra();
143  reco::TrackExtra theTrackExtra;
144 
145  //fill the TrackExtra with TrackingRecHitRef
146  // unsigned int nHits = tracks->at(k).numberOfValidHits();
147  const unsigned nHits = 3; // We are dealing with triplets!
148  theTrackExtra.setHits(ohRHProd, cc, nHits);
149  cc += nHits;
150 
151  trackExtras->push_back(theTrackExtra);
152  //trackExtras->push_back(*theTrackExtra);
153  //delete theTrackExtra;
154  }
155 
157 
158  for (int k = 0; k < nTracks; k++) {
159  const reco::TrackExtraRef theTrackExtraRef(ohTE, k);
160  (tracks->at(k)).setExtra(theTrackExtraRef);
161  }
162 
163  e.put(std::move(tracks));
164 }

References clone(), MillePedeFileConverter_cfg::e, filterToken, fitterToken, edm::EventSetup::get(), get, hfClusterShapes_cfi::hits, mps_fire::i, dqmdumpme::k, eostools::move(), BeamSpotPI::nTracks, rpcPointValidation_cfi::recHit, FastTrackerRecHitMaskProducer_cfi::recHits, HLT_FULL_cff::region, SiPixelRawToDigiRegional_cfi::Regions, PixelFitter::run(), seedProducerToken, reco::TrackExtraBase::setHits(), theRegionProducer, HLT_FULL_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 >
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11776
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
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
BeamSpotPI::nTracks
Definition: BeamSpotPayloadInspectorHelper.h:41
edm::Handle
Definition: AssociativeIterator.h:50
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
PixelFitter
Definition: PixelFitter.h:8
edm::Ref< TrackExtraCollection >
cc
reco::TrackExtra
Definition: TrackExtra.h:26
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
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
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:47
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
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:84949
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
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackingRegion
Definition: TrackingRegion.h:41
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