CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SeedGeneratorFromRegionHitsEDProducer.cc
Go to the documentation of this file.
2 
5 
7 
11 
14 
17 
20 
22 
23 
25  const edm::ParameterSet& cfg)
26  : theConfig(cfg), theGenerator(0), theRegionProducer(0), theClusterCheck(cfg.getParameter<edm::ParameterSet>("ClusterCheckPSet"))
27 {
28  theSilentOnClusterCheck = cfg.getParameter<edm::ParameterSet>("ClusterCheckPSet").getUntrackedParameter<bool>("silentClusterCheck",false);
29  produces<TrajectorySeedCollection>();
30 }
31 
33 {
34 }
35 
37  delete theRegionProducer;
38  delete theGenerator;
39 }
40 
42 {
43  edm::ParameterSet regfactoryPSet =
44  theConfig.getParameter<edm::ParameterSet>("RegionFactoryPSet");
45  std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName");
46  theRegionProducer = TrackingRegionProducerFactory::get()->create(regfactoryName,regfactoryPSet);
47 
48  edm::ParameterSet hitsfactoryPSet =
49  theConfig.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet");
50  std::string hitsfactoryName = hitsfactoryPSet.getParameter<std::string>("ComponentName");
51  OrderedHitsGenerator* hitsGenerator =
52  OrderedHitsGeneratorFactory::get()->create( hitsfactoryName, hitsfactoryPSet);
53 
54  edm::ParameterSet comparitorPSet =
55  theConfig.getParameter<edm::ParameterSet>("SeedComparitorPSet");
56  std::string comparitorName = comparitorPSet.getParameter<std::string>("ComponentName");
57  SeedComparitor * aComparitor = (comparitorName == "none") ?
58  0 : SeedComparitorFactory::get()->create( comparitorName, comparitorPSet);
59 
60  edm::ParameterSet creatorPSet =
61  theConfig.getParameter<edm::ParameterSet>("SeedCreatorPSet");
62  std::string creatorName = creatorPSet.getParameter<std::string>("ComponentName");
63  SeedCreator * aCreator = SeedCreatorFactory::get()->create( creatorName, creatorPSet);
64 
65  theGenerator = new SeedGeneratorFromRegionHits(hitsGenerator, aComparitor, aCreator);
66 
67 
68 }
69 
71 {
72  std::auto_ptr<TrajectorySeedCollection> result(new TrajectorySeedCollection());
73 
74  //protection for big ass events...
75  size_t clustsOrZero = theClusterCheck.tooManyClusters(ev);
76  if (clustsOrZero){
78  edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
79  ev.put(result);
80  return ;
81  }
82 
83  typedef std::vector<TrackingRegion* > Regions;
84  typedef Regions::const_iterator IR;
85  Regions regions = theRegionProducer->regions(ev,es);
86 
87  for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) {
88  const TrackingRegion & region = **ir;
89 
90  // make job
91  theGenerator->run(*result, region, ev,es);
92  }
93 
94  // clear memory
95  for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) delete (*ir);
96 
97  // put to event
98  ev.put(result);
99 }
virtual void endRun(edm::Run &run, const edm::EventSetup &es)
T getParameter(std::string const &) const
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
tuple result
Definition: query.py:137
size_t tooManyClusters(const edm::Event &e) const
virtual void produce(edm::Event &ev, const edm::EventSetup &es)
virtual void beginRun(edm::Run &run, const edm::EventSetup &es)
void run(TrajectorySeedCollection &seedCollection, const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es)
T get(const Candidate &c)
Definition: component.h:56
Definition: Run.h:33
virtual std::vector< TrackingRegion * > regions(const edm::Event &ev, const edm::EventSetup &es) const =0