CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CombinedHitPairGeneratorForPhotonConversion.cc
Go to the documentation of this file.
9 
10 
11 using namespace std;
12 using namespace ctfseeding;
13 
15  : initialised(false), theConfig(cfg)
16 {
17  theMaxElement = cfg.getParameter<unsigned int>("maxElement");
18  maxHitPairsPerTrackAndGenerator = cfg.getParameter<unsigned int>("maxHitPairsPerTrackAndGenerator");
19 
20 }
21 
23 {
24  theMaxElement = cfg.getParameter<unsigned int>("maxElement");
25  maxHitPairsPerTrackAndGenerator = cfg.getParameter<unsigned int>("maxHitPairsPerTrackAndGenerator");
26 
27  std::string layerBuilderName = cfg.getParameter<std::string>("SeedingLayers");
29  es.get<TrackerDigiGeometryRecord>().get(layerBuilderName, layerBuilder);
30 
31  SeedingLayerSets layerSets = layerBuilder->layers(es);
32  init(layerSets);
33 }
34 
36 {
37  initialised = true;
38  typedef SeedingLayerSets::const_iterator IL;
39  for (IL il=layerSets.begin(), ilEnd=layerSets.end(); il != ilEnd; ++il) {
40  const SeedingLayers & set = *il;
41  if (set.size() != 2) continue;
42  add( set[0], set[1] );
43  }
44 }
45 
47 {
48  Container::const_iterator it;
49  for (it = theGenerators.begin(); it!= theGenerators.end(); it++) {
50  delete (*it);
51  }
52  theGenerators.clear();
53 }
54 
56 
58 {
60 }
61 
63  const ConversionRegion& convRegion,
64  const TrackingRegion& region, const edm::Event & ev, const edm::EventSetup& es)
65 {
66  thePairs.clear();
67  hitPairs(convRegion, region, thePairs, ev, es);
68  return thePairs;
69 }
70 
71 
73  const ConversionRegion& convRegion,
74  const TrackingRegion& region, OrderedHitPairs & result,
75  const edm::Event& ev, const edm::EventSetup& es)
76 {
77  if (theESWatcher.check(es) || !initialised ) {
78  cleanup();
79  init(theConfig,es);
80  }
81 
82  Container::const_iterator i;
83  OrderedHitPairs resultTmp;
84  resultTmp.reserve(maxHitPairsPerTrackAndGenerator);
85 
86  for (i=theGenerators.begin(); i!=theGenerators.end() && result.size() < theMaxElement; i++) {
87  resultTmp.clear();
88  (**i).hitPairs(convRegion, region, resultTmp, ev, es);
89  result.insert(result.end(),resultTmp.begin(),resultTmp.end());
90  }
91  //theLayerCache.clear(); //Don't want to clear now, because have to loop on all the tracks. will be cleared later, calling a specific method
92 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
virtual unsigned int size() const
virtual void hitPairs(const TrackingRegion &, OrderedHitPairs &, const edm::Event &, const edm::EventSetup &)
form base class
const OrderedHitPairs & run(const ConversionRegion &convRegion, const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es)
tuple result
Definition: query.py:137
void add(const ctfseeding::SeedingLayer &inner, const ctfseeding::SeedingLayer &outer)
const T & get() const
Definition: EventSetup.h:55
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:59
void init(const ctfseeding::SeedingLayerSets &layerSets)
std::vector< SeedingLayer > SeedingLayers
std::vector< std::vector< SeedingLayer > > SeedingLayerSets