CMS 3D CMS Logo

SeedGeneratorFromRegionHitsEDProducer.cc
Go to the documentation of this file.
2 
6 
8 
12 
15 
18 
21 
23 
24 
26  const edm::ParameterSet& cfg)
27  : theRegionProducer(nullptr),
28  theClusterCheck(cfg.getParameter<edm::ParameterSet>("ClusterCheckPSet"),consumesCollector())
29 {
30  theSilentOnClusterCheck = cfg.getParameter<edm::ParameterSet>("ClusterCheckPSet").getUntrackedParameter<bool>("silentClusterCheck",false);
31 
32  moduleName = cfg.getParameter<std::string>("@module_label");
33 
34  edm::ParameterSet creatorPSet =
35  cfg.getParameter<edm::ParameterSet>("SeedCreatorPSet");
36 
37  edm::ParameterSet regfactoryPSet =
38  cfg.getParameter<edm::ParameterSet>("RegionFactoryPSet");
39  std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName");
40  theRegionProducer = std::unique_ptr<TrackingRegionProducer>{TrackingRegionProducerFactory::get()->create(regfactoryName,regfactoryPSet, consumesCollector())};
41 
42  edm::ConsumesCollector iC = consumesCollector();
43  edm::ParameterSet hitsfactoryPSet =
44  cfg.getParameter<edm::ParameterSet>("OrderedHitsFactoryPSet");
45  std::string hitsfactoryName = hitsfactoryPSet.getParameter<std::string>("ComponentName");
46 
47  edm::ParameterSet comparitorPSet =
48  cfg.getParameter<edm::ParameterSet>("SeedComparitorPSet");
49  std::string comparitorName = comparitorPSet.getParameter<std::string>("ComponentName");
50  std::unique_ptr<SeedComparitor> aComparitor;
51  if(comparitorName != "none") {
52  aComparitor = std::unique_ptr<SeedComparitor>{SeedComparitorFactory::get()->create( comparitorName, comparitorPSet, iC)};
53  }
54 
55  std::string creatorName = creatorPSet.getParameter<std::string>("ComponentName");
56 
57  theGenerator = std::make_unique<SeedGeneratorFromRegionHits>(OrderedHitsGeneratorFactory::get()->create( hitsfactoryName, hitsfactoryPSet, iC),
58  std::move(aComparitor),
59  SeedCreatorFactory::get()->create( creatorName, creatorPSet));
60 
61  produces<TrajectorySeedCollection>();
62 }
63 
65 {
66 }
67 
69 {
70  auto triplets = std::make_unique<TrajectorySeedCollection>();
71 
72  //protection for big ass events...
73  size_t clustsOrZero = theClusterCheck.tooManyClusters(ev);
74  if (clustsOrZero){
76  edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
77  ev.put(std::move(triplets));
78  return ;
79  }
80 
81  typedef std::vector<std::unique_ptr<TrackingRegion> > Regions;
82  typedef Regions::const_iterator IR;
83  Regions regions = theRegionProducer->regions(ev,es);
84 
85  for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) {
86  const TrackingRegion & region = **ir;
87 
88  // make job
89  theGenerator->run(*triplets, region, ev,es);
90  // std::cout << "created seeds for " << moduleName << " " << triplets->size() << std::endl;
91  }
92  triplets->shrink_to_fit();
93 
94  // put to event
95  ev.put(std::move(triplets));
96 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
#define nullptr
bool ev
return((rh^lh)&mask)
void produce(edm::Event &ev, const edm::EventSetup &es) override
std::unique_ptr< TrackingRegionProducer > theRegionProducer
size_t tooManyClusters(const edm::Event &e) const
HLT enums.
std::unique_ptr< SeedGeneratorFromRegionHits > theGenerator
def move(src, dest)
Definition: eostools.py:511
T get(const Candidate &c)
Definition: component.h:55