CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SeedGeneratorFromRegionHits.cc
Go to the documentation of this file.
2 
6 
13 
14 
16 
17 #include <vector>
18 
21 
22 template <class T> T sqr( T t) {return t*t;}
23 
26  : theHitsGenerator(ohg), theComparitor(asc), theSeedCreator(asp)
27 { }
28 
30  OrderedHitsGenerator * aGenerator,
31  const edm::ParameterSet & cfg,
32  SeedComparitor * aComparitor)
33  : theHitsGenerator(aGenerator), theComparitor(aComparitor)
34 {
36 }
37 
38 
40 {
41  delete theHitsGenerator;
42  delete theComparitor;
43  delete theSeedCreator;
44 }
45 
47  const TrackingRegion & region, const edm::Event& ev, const edm::EventSetup& es)
48 {
49  const OrderedSeedingHits & hitss = theHitsGenerator->run(region, ev, es);
50 
51  unsigned int nHitss = hitss.size();
52  if (seedCollection.empty()) seedCollection.reserve(nHitss); // don't do multiple reserves in the case of multiple regions: it would make things even worse
53  // as it will cause N re-allocations instead of the normal log(N)/log(2)
54  for (unsigned int iHits = 0; iHits < nHitss; ++iHits) {
55  const SeedingHitSet & hits = hitss[iHits];
56  if (!theComparitor || theComparitor->compatible( hits, es) ) {
57  theSeedCreator->trajectorySeed(seedCollection, hits, region, es);
58  }
59  }
61 }
virtual const TrajectorySeed * trajectorySeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const TrackingRegion &region, const edm::EventSetup &es)=0
virtual unsigned int size() const =0
SeedGeneratorFromRegionHits(OrderedHitsGenerator *aGenerator, SeedComparitor *aComparitor=0, SeedCreator *aSeedCreator=0)
virtual const OrderedSeedingHits & run(const TrackingRegion &reg, const edm::Event &ev, const edm::EventSetup &es)=0
std::vector< TrajectorySeed > TrajectorySeedCollection
void run(TrajectorySeedCollection &seedCollection, const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es)
Square< F >::type sqr(const F &f)
Definition: Square.h:13
virtual bool compatible(const SeedingHitSet &hits, const edm::EventSetup &es)=0