CMS 3D CMS Logo

CAHitNtupletEDProducerT.cc
Go to the documentation of this file.
10 
14 
15 namespace {
16  void fillNtuplets(RegionsSeedingHitSets::RegionFiller& seedingHitSetsFiller, const OrderedHitSeeds& quadruplets) {
17  for (const auto& quad : quadruplets) {
18  seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]);
19  }
20  }
21 } // namespace
22 
23 template <typename T_Generator>
25 public:
27  ~CAHitNtupletEDProducerT() override = default;
28 
29  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
30 
31  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
32 
33 private:
35 
37 
38  T_Generator generator_;
39 };
40 
41 template <typename T_Generator>
43  : doubletToken_(consumes<IntermediateHitDoublets>(iConfig.getParameter<edm::InputTag>("doublets"))),
44  generator_(iConfig, consumesCollector()) {
45  produces<RegionsSeedingHitSets>();
46 }
47 
48 template <typename T_Generator>
51 
52  desc.add<edm::InputTag>("doublets", edm::InputTag("hitPairEDProducer"));
54 
55  auto label = T_Generator::fillDescriptionsLabel() + std::string("EDProducer");
56  descriptions.add(label, desc);
57 }
58 
59 template <typename T_Generator>
62  iEvent.getByToken(doubletToken_, hdoublets);
63  const auto& regionDoublets = *hdoublets;
64 
65  const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits();
66  if (seedingLayerHits.numberOfLayersInSet() < T_Generator::minLayers) {
67  throw cms::Exception("LogicError")
68  << "CAHitNtupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= "
69  << T_Generator::minLayers << ", got " << seedingLayerHits.numberOfLayersInSet()
70  << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or "
71  "SeedingLayersEDProducer.";
72  }
73 
74  auto seedingHitSets = std::make_unique<RegionsSeedingHitSets>();
75  if (regionDoublets.empty()) {
77  return;
78  }
79  seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper());
80  generator_.initEvent(iEvent, iSetup);
81 
82  LogDebug("CAHitNtupletEDProducer") << "Creating ntuplets for " << regionDoublets.regionSize() << " regions, and "
83  << regionDoublets.layerPairsSize() << " layer pairs";
84  std::vector<OrderedHitSeeds> ntuplets;
85  ntuplets.resize(regionDoublets.regionSize());
86  for (auto& ntuplet : ntuplets)
87  ntuplet.reserve(localRA_.upper());
88 
89  generator_.hitNtuplets(regionDoublets, ntuplets, iSetup, seedingLayerHits);
90  int index = 0;
91  for (const auto& regionLayerPairs : regionDoublets) {
92  const TrackingRegion& region = regionLayerPairs.region();
93  auto seedingHitSetsFiller = seedingHitSets->beginRegion(&region);
94 
95  fillNtuplets(seedingHitSetsFiller, ntuplets[index]);
96  ntuplets[index].clear();
97  index++;
98  }
99  localRA_.update(seedingHitSets->size());
100 
102 }
103 
109 
ConfigurationDescriptions.h
RunningAverage.h
Handle.h
beam_dqm_sourceclient-live_cfg.minLayers
minLayers
Definition: beam_dqm_sourceclient-live_cfg.py:146
CAHitNtupletEDProducerT::~CAHitNtupletEDProducerT
~CAHitNtupletEDProducerT() override=default
CAHitNtupletEDProducerT::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: CAHitNtupletEDProducerT.cc:60
CAHitNtupletEDProducerT::generator_
T_Generator generator_
Definition: CAHitNtupletEDProducerT.cc:38
edm::EDGetTokenT< IntermediateHitDoublets >
edm
HLT enums.
Definition: AlignableModifier.h:19
CAHitNtupletEDProducerT
Definition: CAHitNtupletEDProducerT.cc:24
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SeedingLayerSetsHits
Definition: SeedingLayerSetsHits.h:18
CAHitNtupletEDProducerT::CAHitNtupletEDProducerT
CAHitNtupletEDProducerT(const edm::ParameterSet &iConfig)
Definition: CAHitNtupletEDProducerT.cc:42
EDProducer.h
IntermediateHitDoublets.h
edm::Handle
Definition: AssociativeIterator.h:50
OrderedHitSeeds
Definition: OrderedHitSeeds.h:9
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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:10126
fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
RegionsSeedingHitSets::RegionFiller::emplace_back
void emplace_back(Args &&... args)
Definition: RegionsSeedingHitSets.h:37
ParameterSetDescription.h
EDGetToken.h
SeedingLayerSetsHits::numberOfLayersInSet
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
Definition: SeedingLayerSetsHits.h:197
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
CAHitNtupletEDProducerT::doubletToken_
edm::EDGetTokenT< IntermediateHitDoublets > doubletToken_
Definition: CAHitNtupletEDProducerT.cc:34
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88267
ModuleDef.h
iEvent
int iEvent
Definition: GenABIO.cc:224
CAHitQuadrupletGenerator.h
IntermediateHitDoublets
Definition: IntermediateHitDoublets.h:131
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:58
RegionsSeedingHitSets.h
CAHitTripletGenerator.h
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
RegionsSeedingHitSets::RegionFiller
Helper class enforcing correct way of filling the doublets of a region.
Definition: RegionsSeedingHitSets.h:24
Exception
Definition: hltDiff.cc:245
OrderedHitSeeds.h
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
TrackingRegion
Definition: TrackingRegion.h:41
ConsumesCollector.h
CAHitNtupletEDProducerT::localRA_
edm::RunningAverage localRA_
Definition: CAHitNtupletEDProducerT.cc:36
ParameterSet.h
CAHitNtupletEDProducerT::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: CAHitNtupletEDProducerT.cc:49
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
edm::RunningAverage
Definition: RunningAverage.h:17