CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PixelTrackReconstruction.cc
Go to the documentation of this file.
2 
6 
9 
13 
16 
19 
23 
27 
28 #include <vector>
29 
30 using namespace pixeltrackfitting;
31 using namespace ctfseeding;
32 using edm::ParameterSet;
33 
35  : theConfig(cfg), theFitter(0), theFilter(0), theCleaner(0), theGenerator(0), theRegionProducer(0)
36 { }
37 
39 {
40  halt();
41 }
42 
44 {
45  delete theFilter; theFilter=0;
46  delete theFitter; theFitter=0;
47  delete theCleaner; theCleaner=0;
48  delete theGenerator; theGenerator=0;
50 }
51 
53 {
54  ParameterSet regfactoryPSet = theConfig.getParameter<ParameterSet>("RegionFactoryPSet");
55  std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName");
56  theRegionProducer = TrackingRegionProducerFactory::get()->create(regfactoryName,regfactoryPSet);
57 
58  ParameterSet orderedPSet =
59  theConfig.getParameter<ParameterSet>("OrderedHitsFactoryPSet");
60  std::string orderedName = orderedPSet.getParameter<std::string>("ComponentName");
61  theGenerator = OrderedHitsGeneratorFactory::get()->create( orderedName, orderedPSet);
62 
63  ParameterSet fitterPSet = theConfig.getParameter<ParameterSet>("FitterPSet");
64  std::string fitterName = fitterPSet.getParameter<std::string>("ComponentName");
65  theFitter = PixelFitterFactory::get()->create( fitterName, fitterPSet);
66 
67  ParameterSet filterPSet = theConfig.getParameter<ParameterSet>("FilterPSet");
68  std::string filterName = filterPSet.getParameter<std::string>("ComponentName");
69  if (filterName != "none") {
70  theFilter = theConfig.getParameter<bool>("useFilterWithES") ?
71  PixelTrackFilterWithESFactory::get()->create( filterName, filterPSet, es) :
72  PixelTrackFilterFactory::get()->create( filterName, filterPSet);
73  }
74 
75  ParameterSet cleanerPSet = theConfig.getParameter<ParameterSet>("CleanerPSet");
76  std::string cleanerName = cleanerPSet.getParameter<std::string>("ComponentName");
77  if (cleanerName != "none") theCleaner = PixelTrackCleanerFactory::get()->create( cleanerName, cleanerPSet);
78 
79 }
80 
82 {
83  typedef std::vector<TrackingRegion* > Regions;
84  typedef Regions::const_iterator IR;
85  Regions regions = theRegionProducer->regions(ev,es);
86 
87  if (theFilter) theFilter->update(ev);
88 
89  for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) {
90  const TrackingRegion & region = **ir;
91 
92  const OrderedSeedingHits & triplets = theGenerator->run(region,ev,es);
93  unsigned int nTriplets = triplets.size();
94 
95  // producing tracks
96  for (unsigned int iTriplet = 0; iTriplet < nTriplets; ++iTriplet) {
97  const SeedingHitSet & triplet = triplets[iTriplet];
98 
99  std::vector<const TrackingRecHit *> hits;
100  for (unsigned int iHit = 0, nHits = triplet.size(); iHit < nHits; ++iHit) {
101  hits.push_back( triplet[iHit]->hit() );
102  }
103 
104  // fitting
105  reco::Track* track = theFitter->run( ev, es, hits, region);
106  if (!track) continue;
107 
108  // decide if track should be skipped according to filter
109  if (theFilter && !(*theFilter)(track, hits) ) {
110  delete track;
111  continue;
112  }
113 
114  // add tracks
115  tracks.push_back(TrackWithTTRHs(track, triplet));
116  }
117  theGenerator->clear();
118  }
119 
120  // skip ovelrapped tracks
121  if (theCleaner) tracks = PixelTrackCleanerWrapper(theCleaner).clean(tracks);
122 
123  // clean memory
124  for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) delete (*ir);
125 }
T getParameter(std::string const &) const
std::pair< reco::Track *, SeedingHitSet > TrackWithTTRHs
void init(const edm::EventSetup &es)
virtual reco::Track * run(const edm::EventSetup &es, const std::vector< const TrackingRecHit * > &hits, const TrackingRegion &region) const
Definition: PixelFitter.h:17
virtual unsigned int size() const =0
OrderedHitsGenerator * theGenerator
TrackingRegionProducer * theRegionProducer
pixeltrackfitting::TracksWithTTRHs clean(const pixeltrackfitting::TracksWithTTRHs &initialT_TTRHs)
std::vector< TrackWithTTRHs > TracksWithTTRHs
virtual const OrderedSeedingHits & run(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es)=0
virtual void update(edm::Event &ev)
void run(pixeltrackfitting::TracksWithTTRHs &tah, edm::Event &ev, const edm::EventSetup &es)
tuple tracks
Definition: testEve_cfg.py:39
unsigned int size() const
Definition: SeedingHitSet.h:31
PixelTrackReconstruction(const edm::ParameterSet &conf)
T get(const Candidate &c)
Definition: component.h:56
virtual std::vector< TrackingRegion * > regions(const edm::Event &ev, const edm::EventSetup &es) const =0