CMS 3D CMS Logo

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