CMS 3D CMS Logo

SeedCreatorFromRegionHitsEDProducerT.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkSeedGenerator_SeedCreatorFromRegionHitsEDProducerT_H
2 #define RecoTracker_TkSeedGenerator_SeedCreatorFromRegionHitsEDProducerT_H
3 
13 
17 
19 
20 template <typename T_SeedCreator>
22 public:
24  ~SeedCreatorFromRegionHitsEDProducerT() override = default;
25 
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
27 
28  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
29 
30 private:
32  T_SeedCreator seedCreator_;
33  std::unique_ptr<SeedComparitor> comparitor_;
34 };
35 
36 template <typename T_SeedCreator>
38  const edm::ParameterSet& iConfig)
39  : seedingHitSetsToken_(consumes<RegionsSeedingHitSets>(iConfig.getParameter<edm::InputTag>("seedingHitSets"))),
40  seedCreator_(iConfig) {
41  edm::ConsumesCollector iC = consumesCollector();
42  edm::ParameterSet comparitorPSet = iConfig.getParameter<edm::ParameterSet>("SeedComparitorPSet");
43  std::string comparitorName = comparitorPSet.getParameter<std::string>("ComponentName");
44  if (comparitorName != "none") {
45  comparitor_ = SeedComparitorFactory::get()->create(comparitorName, comparitorPSet, iC);
46  }
47 
48  produces<TrajectorySeedCollection>();
49 }
50 
51 template <typename T_SeedCreator>
53  edm::ConfigurationDescriptions& descriptions) {
55 
56  desc.add<edm::InputTag>("seedingHitSets", edm::InputTag("hitPairEDProducer"));
58 
59  edm::ParameterSetDescription descComparitor;
60  descComparitor.add<std::string>("ComponentName", "none");
61  descComparitor.setAllowAnything(); // until we have moved SeedComparitor too to EDProducers
62  desc.add<edm::ParameterSetDescription>("SeedComparitorPSet", descComparitor);
63 
64  auto label = std::string("seedCreatorFromRegion") + T_SeedCreator::fillDescriptionsLabel() + "EDProducer";
65  descriptions.add(label, desc);
66 }
67 
68 template <typename T_SeedCreator>
70  edm::Handle<RegionsSeedingHitSets> hseedingHitSets;
71  iEvent.getByToken(seedingHitSetsToken_, hseedingHitSets);
72  const auto& seedingHitSets = *hseedingHitSets;
73 
74  auto seeds = std::make_unique<TrajectorySeedCollection>();
75  seeds->reserve(seedingHitSets.size());
76 
77  if (comparitor_)
78  comparitor_->init(iEvent, iSetup);
79 
80  for (const auto& regionSeedingHitSets : seedingHitSets) {
81  const TrackingRegion& region = regionSeedingHitSets.region();
82  seedCreator_.init(region, iSetup, comparitor_.get());
83 
84  for (const SeedingHitSet& hits : regionSeedingHitSets) {
85  // TODO: do we really need a comparitor at this point? It is
86  // used in triplet and quadruplet generators, as well as inside
87  // seedCreator.
88  if (!comparitor_ || comparitor_->compatible(hits)) {
89  seedCreator_.makeSeed(*seeds, hits);
90  }
91  }
92  }
93 
94  seeds->shrink_to_fit();
95  iEvent.put(std::move(seeds));
96 }
97 
98 #endif
ConfigurationDescriptions.h
SeedCreatorFromRegionHitsEDProducerT::seedingHitSetsToken_
edm::EDGetTokenT< RegionsSeedingHitSets > seedingHitSetsToken_
Definition: SeedCreatorFromRegionHitsEDProducerT.h:31
Handle.h
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
SeedCreatorFromRegionHitsEDProducerT::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: SeedCreatorFromRegionHitsEDProducerT.h:52
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
SeedingHitSet
Definition: SeedingHitSet.h:6
edm::EDGetTokenT< RegionsSeedingHitSets >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SeedCreatorFromRegionHitsEDProducerT
Definition: SeedCreatorFromRegionHitsEDProducerT.h:21
EDProducer.h
edm::Handle
Definition: AssociativeIterator.h:50
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HLT_FULL_cff.seedingHitSets
seedingHitSets
Definition: HLT_FULL_cff.py:10133
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterSetDescription.h
RegionsSeedingHitSets
Definition: RegionsSeedingHitSets.h:12
EDGetToken.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
SeedCreatorFromRegionHitsEDProducerT::seedCreator_
T_SeedCreator seedCreator_
Definition: SeedCreatorFromRegionHitsEDProducerT.h:32
SeedCreatorFromRegionHitsEDProducerT::~SeedCreatorFromRegionHitsEDProducerT
~SeedCreatorFromRegionHitsEDProducerT() override=default
edm::ParameterSet
Definition: ParameterSet.h:47
SeedCreatorFromRegionHitsEDProducerT::comparitor_
std::unique_ptr< SeedComparitor > comparitor_
Definition: SeedCreatorFromRegionHitsEDProducerT.h:33
SeedComparitorFactory.h
Event.h
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:36
edm::EventSetup
Definition: EventSetup.h:58
RegionsSeedingHitSets.h
edm::ParameterSetDescription::setAllowAnything
void setAllowAnything()
allow any parameter label/value pairs
Definition: ParameterSetDescription.cc:37
get
#define get
TrajectorySeedCollection.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SeedCreatorFromRegionHitsEDProducerT::SeedCreatorFromRegionHitsEDProducerT
SeedCreatorFromRegionHitsEDProducerT(const edm::ParameterSet &iConfig)
Definition: SeedCreatorFromRegionHitsEDProducerT.h:37
SeedCreatorFromRegionHitsEDProducerT::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: SeedCreatorFromRegionHitsEDProducerT.h:69
SeedComparitor.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetachedQuadStep_cff.seeds
seeds
Definition: DetachedQuadStep_cff.py:195
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackingRegion
Definition: TrackingRegion.h:41
ConsumesCollector.h
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
label
const char * label
Definition: PFTauDecayModeTools.cc:11