CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
MultiHitFromChi2EDProducer Class Reference
Inheritance diagram for MultiHitFromChi2EDProducer:
edm::stream::EDProducer<>

Public Member Functions

 MultiHitFromChi2EDProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~MultiHitFromChi2EDProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< IntermediateHitDoubletsdoubletToken_
 
MultiHitGeneratorFromChi2 generator_
 
edm::RunningAverage localRA_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 17 of file MultiHitFromChi2EDProducer.cc.

Constructor & Destructor Documentation

◆ MultiHitFromChi2EDProducer()

MultiHitFromChi2EDProducer::MultiHitFromChi2EDProducer ( const edm::ParameterSet iConfig)

Definition at line 34 of file MultiHitFromChi2EDProducer.cc.

35  : doubletToken_(consumes<IntermediateHitDoublets>(iConfig.getParameter<edm::InputTag>("doublets"))),
36  generator_(iConfig, consumesCollector()) {
37  produces<RegionsSeedingHitSets>();
38  produces<edm::OwnVector<BaseTrackerRecHit> >();
39 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MultiHitGeneratorFromChi2 generator_
edm::EDGetTokenT< IntermediateHitDoublets > doubletToken_

◆ ~MultiHitFromChi2EDProducer()

MultiHitFromChi2EDProducer::~MultiHitFromChi2EDProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

void MultiHitFromChi2EDProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 41 of file MultiHitFromChi2EDProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, MultiHitGeneratorFromChi2::fillDescriptions(), MultiHitGeneratorFromChi2::fillDescriptionsLabel(), ProducerED_cfi::InputTag, label, and AlCaHLTBitMon_QueryRunRegistry::string.

41  {
43 
44  desc.add<edm::InputTag>("doublets", edm::InputTag("hitPairEDProducer"));
45 
47 
49  descriptions.add(label, desc);
50 }
char const * label
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static const char * fillDescriptionsLabel()
static void fillDescriptions(edm::ParameterSetDescription &desc)

◆ produce()

void MultiHitFromChi2EDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 52 of file MultiHitFromChi2EDProducer.cc.

References a, b, LayerHitMapCache::clear(), doubletToken_, RegionsSeedingHitSets::dummyFiller(), Exception, JetChargeProducer_cfi::exp, LayerHitMapCache::extend(), newFWLiteAna::found, generator_, MultiHitGeneratorFromChi2::hitSets(), iEvent, MultiHitGeneratorFromChi2::initES(), MainPageGenerator::l, LayerTriplets::layers(), localRA_, LogDebug, LogTrace, eostools::move(), SeedingLayerSetsHits::numberOfLayersInSet(), nano_mu_digi_cff::region, HLT_2023v12_cff::seedingHitSets, OrderedMultiHits::size(), edm::RunningAverage::update(), and edm::RunningAverage::upper().

52  {
54  iEvent.getByToken(doubletToken_, hdoublets);
55  const auto& regionDoublets = *hdoublets;
56 
57  const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits();
58  if (seedingLayerHits.numberOfLayersInSet() < 3) {
59  throw cms::Exception("LogicError")
60  << "MultiHitFromChi2EDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got "
61  << seedingLayerHits.numberOfLayersInSet()
62  << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or "
63  "SeedingLayersEDProducer.";
64  }
65 
66  auto seedingHitSets = std::make_unique<RegionsSeedingHitSets>();
67  if (regionDoublets.empty()) {
69  return;
70  }
71  seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper());
72  generator_.initES(iSetup);
73 
74  // match-making of pair and triplet layers
75  std::vector<LayerTriplets::LayerSetAndLayers> trilayers = LayerTriplets::layers(seedingLayerHits);
76 
77  OrderedMultiHits multihits;
78  multihits.reserve(localRA_.upper());
79  std::vector<std::unique_ptr<BaseTrackerRecHit> > refittedHitStorage;
80  refittedHitStorage.reserve(localRA_.upper() * 2);
81 
82  LogDebug("MultiHitFromChi2EDProducer") << "Creating multihits for " << regionDoublets.regionSize() << " regions, and "
83  << trilayers.size() << " pair+3rd layers from "
84  << regionDoublets.layerPairsSize() << " layer pairs";
85 
86  LayerHitMapCache hitCache;
87  for (const auto& regionLayerPairs : regionDoublets) {
88  const TrackingRegion& region = regionLayerPairs.region();
89 
90  auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller();
91  seedingHitSetsFiller = seedingHitSets->beginRegion(&region);
92 
93  hitCache.clear();
94  hitCache.extend(regionLayerPairs.layerHitMapCache());
95 
96  LogTrace("MultiHitFromChi2EDProducer") << " starting region";
97 
98  for (const auto& layerPair : regionLayerPairs) {
99  LogTrace("MultiHitFromChi2EDProducer")
100  << " starting layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex();
101 
102  auto found = std::find_if(trilayers.begin(), trilayers.end(), [&](const LayerTriplets::LayerSetAndLayers& a) {
103  return a.first[0].index() == layerPair.innerLayerIndex() && a.first[1].index() == layerPair.outerLayerIndex();
104  });
105  if (found == trilayers.end()) {
106  auto exp = cms::Exception("LogicError") << "Did not find the layer pair from vector<pair+third layers>. This "
107  "is a sign of some internal inconsistency\n";
108  exp << "I was looking for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex()
109  << ". Triplets have the following pairs:\n";
110  for (const auto& a : trilayers) {
111  exp << " " << a.first[0].index() << "," << a.first[1].index() << ": 3rd layers";
112  for (const auto& b : a.second) {
113  exp << " " << b.index();
114  }
115  exp << "\n";
116  }
117  throw exp;
118  }
119  const auto& thirdLayers = found->second;
120 
121  generator_.hitSets(region, multihits, layerPair.doublets(), thirdLayers, hitCache, refittedHitStorage);
122 
123 #ifdef EDM_ML_DEBUG
124  LogTrace("MultiHitFromChi2EDProducer")
125  << " created " << multihits.size() << " multihits for layer pair " << layerPair.innerLayerIndex() << ","
126  << layerPair.outerLayerIndex() << " and 3rd layers";
127  for (const auto& l : thirdLayers) {
128  LogTrace("MultiHitFromChi2EDProducer") << " " << l.index();
129  }
130 #endif
131 
132  for (const SeedingHitSet& hitSet : multihits) {
133  seedingHitSetsFiller.emplace_back(hitSet);
134  }
135  multihits.clear();
136  }
137  }
138  localRA_.update(seedingHitSets->size());
139 
140  auto storage = std::make_unique<edm::OwnVector<BaseTrackerRecHit> >();
141  storage->reserve(refittedHitStorage.size());
142  for (auto& ptr : refittedHitStorage)
143  storage->push_back(ptr.release());
144 
145  seedingHitSets->shrink_to_fit();
146  storage->shrink_to_fit();
148  iEvent.put(std::move(storage));
149 }
unsigned int size() const override
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
#define LogTrace(id)
int iEvent
Definition: GenABIO.cc:224
static RegionFiller dummyFiller()
void initES(const edm::EventSetup &es) override
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
std::pair< LayerSet, std::vector< Layer > > LayerSetAndLayers
Definition: LayerTriplets.h:16
MultiHitGeneratorFromChi2 generator_
void hitSets(const TrackingRegion &region, OrderedMultiHits &trs, const edm::Event &ev, const edm::EventSetup &es, SeedingLayerSetsHits::SeedingLayerSet pairLayers, std::vector< SeedingLayerSetsHits::SeedingLayer > thirdLayers) override
double b
Definition: hdecay.h:120
void extend(const LayerHitMapCache &other)
double a
Definition: hdecay.h:121
edm::EDGetTokenT< IntermediateHitDoublets > doubletToken_
def move(src, dest)
Definition: eostools.py:511
void update(unsigned int q)
#define LogDebug(id)

Member Data Documentation

◆ doubletToken_

edm::EDGetTokenT<IntermediateHitDoublets> MultiHitFromChi2EDProducer::doubletToken_
private

Definition at line 27 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().

◆ generator_

MultiHitGeneratorFromChi2 MultiHitFromChi2EDProducer::generator_
private

Definition at line 31 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().

◆ localRA_

edm::RunningAverage MultiHitFromChi2EDProducer::localRA_
private

Definition at line 29 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().