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.reset(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  OrderedHitsGenerator* hitsGenerator =
47  OrderedHitsGeneratorFactory::get()->create( hitsfactoryName, hitsfactoryPSet, iC);
48 
49  edm::ParameterSet comparitorPSet =
50  cfg.getParameter<edm::ParameterSet>("SeedComparitorPSet");
51  std::string comparitorName = comparitorPSet.getParameter<std::string>("ComponentName");
52  SeedComparitor * aComparitor = (comparitorName == "none") ?
53  nullptr : SeedComparitorFactory::get()->create( comparitorName, comparitorPSet, iC);
54 
55  std::string creatorName = creatorPSet.getParameter<std::string>("ComponentName");
56  SeedCreator * aCreator = SeedCreatorFactory::get()->create( creatorName, creatorPSet);
57 
58  theGenerator.reset(new SeedGeneratorFromRegionHits(hitsGenerator, aComparitor, aCreator));
59 
60  produces<TrajectorySeedCollection>();
61 }
62 
64 {
65 }
66 
68 {
69  auto triplets = std::make_unique<TrajectorySeedCollection>();
70 
71  //protection for big ass events...
72  size_t clustsOrZero = theClusterCheck.tooManyClusters(ev);
73  if (clustsOrZero){
75  edm::LogError("TooManyClusters") << "Found too many clusters (" << clustsOrZero << "), bailing out.\n";
76  ev.put(std::move(triplets));
77  return ;
78  }
79 
80  typedef std::vector<std::unique_ptr<TrackingRegion> > Regions;
81  typedef Regions::const_iterator IR;
82  Regions regions = theRegionProducer->regions(ev,es);
83 
84  for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) {
85  const TrackingRegion & region = **ir;
86 
87  // make job
88  theGenerator->run(*triplets, region, ev,es);
89  // std::cout << "created seeds for " << moduleName << " " << triplets->size() << std::endl;
90  }
91  triplets->shrink_to_fit();
92 
93  // put to event
94  ev.put(std::move(triplets));
95 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
def create(alignables, pedeDump, additionalData, outputFile, config)
bool ev
#define nullptr
void produce(edm::Event &ev, const edm::EventSetup &es) override
std::unique_ptr< TrackingRegionProducer > theRegionProducer
size_t tooManyClusters(const edm::Event &e) const
return(e1-e2)*(e1-e2)+dp *dp
HLT enums.
std::unique_ptr< SeedGeneratorFromRegionHits > theGenerator
def move(src, dest)
Definition: eostools.py:510
T get(const Candidate &c)
Definition: component.h:55