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::EDPutTokenT< std::vector< std::unique_ptr< BaseTrackerRecHit > > > hitsPutToken_
 
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 20 of file MultiHitFromChi2EDProducer.cc.

Constructor & Destructor Documentation

◆ MultiHitFromChi2EDProducer()

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

Definition at line 38 of file MultiHitFromChi2EDProducer.cc.

39  : doubletToken_(consumes<IntermediateHitDoublets>(iConfig.getParameter<edm::InputTag>("doublets"))),
40  hitsPutToken_{produces()},
41  generator_(iConfig, consumesCollector()) {
42  produces<RegionsSeedingHitSets>();
43 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDPutTokenT< std::vector< std::unique_ptr< BaseTrackerRecHit > > > hitsPutToken_
MultiHitGeneratorFromChi2 generator_
edm::EDGetTokenT< IntermediateHitDoublets > doubletToken_

◆ ~MultiHitFromChi2EDProducer()

MultiHitFromChi2EDProducer::~MultiHitFromChi2EDProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 45 of file MultiHitFromChi2EDProducer.cc.

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

45  {
47 
48  desc.add<edm::InputTag>("doublets", edm::InputTag("hitPairEDProducer"));
49 
51 
53  descriptions.add(label, desc);
54 }
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 56 of file MultiHitFromChi2EDProducer.cc.

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

56  {
58  iEvent.getByToken(doubletToken_, hdoublets);
59  const auto& regionDoublets = *hdoublets;
60 
61  const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits();
62  if (seedingLayerHits.numberOfLayersInSet() < 3) {
63  throw cms::Exception("LogicError")
64  << "MultiHitFromChi2EDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 3, got "
65  << seedingLayerHits.numberOfLayersInSet()
66  << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or "
67  "SeedingLayersEDProducer.";
68  }
69 
70  auto seedingHitSets = std::make_unique<RegionsSeedingHitSets>();
71  if (regionDoublets.empty()) {
73  return;
74  }
75  seedingHitSets->reserve(regionDoublets.regionSize(), localRA_.upper());
76  generator_.initES(iSetup);
77 
78  // match-making of pair and triplet layers
79  std::vector<LayerTriplets::LayerSetAndLayers> trilayers = LayerTriplets::layers(seedingLayerHits);
80 
81  OrderedMultiHits multihits;
82  multihits.reserve(localRA_.upper());
83  std::vector<std::unique_ptr<BaseTrackerRecHit>> refittedHitStorage;
84  refittedHitStorage.reserve(localRA_.upper() * 2);
85 
86  LogDebug("MultiHitFromChi2EDProducer") << "Creating multihits for " << regionDoublets.regionSize() << " regions, and "
87  << trilayers.size() << " pair+3rd layers from "
88  << regionDoublets.layerPairsSize() << " layer pairs";
89 
90  LayerHitMapCache hitCache;
91  for (const auto& regionLayerPairs : regionDoublets) {
92  const TrackingRegion& region = regionLayerPairs.region();
93 
94  auto seedingHitSetsFiller = RegionsSeedingHitSets::dummyFiller();
95  seedingHitSetsFiller = seedingHitSets->beginRegion(&region);
96 
97  hitCache.clear();
98  hitCache.extend(regionLayerPairs.layerHitMapCache());
99 
100  LogTrace("MultiHitFromChi2EDProducer") << " starting region";
101 
102  for (const auto& layerPair : regionLayerPairs) {
103  LogTrace("MultiHitFromChi2EDProducer")
104  << " starting layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex();
105 
106  auto found = std::find_if(trilayers.begin(), trilayers.end(), [&](const LayerTriplets::LayerSetAndLayers& a) {
107  return a.first[0].index() == layerPair.innerLayerIndex() && a.first[1].index() == layerPair.outerLayerIndex();
108  });
109  if (found == trilayers.end()) {
110  auto exp = cms::Exception("LogicError") << "Did not find the layer pair from vector<pair+third layers>. This "
111  "is a sign of some internal inconsistency\n";
112  exp << "I was looking for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex()
113  << ". Triplets have the following pairs:\n";
114  for (const auto& a : trilayers) {
115  exp << " " << a.first[0].index() << "," << a.first[1].index() << ": 3rd layers";
116  for (const auto& b : a.second) {
117  exp << " " << b.index();
118  }
119  exp << "\n";
120  }
121  throw exp;
122  }
123  const auto& thirdLayers = found->second;
124 
125  generator_.hitSets(region, multihits, layerPair.doublets(), thirdLayers, hitCache, refittedHitStorage);
126 
127 #ifdef EDM_ML_DEBUG
128  LogTrace("MultiHitFromChi2EDProducer")
129  << " created " << multihits.size() << " multihits for layer pair " << layerPair.innerLayerIndex() << ","
130  << layerPair.outerLayerIndex() << " and 3rd layers";
131  for (const auto& l : thirdLayers) {
132  LogTrace("MultiHitFromChi2EDProducer") << " " << l.index();
133  }
134 #endif
135 
136  for (const SeedingHitSet& hitSet : multihits) {
137  seedingHitSetsFiller.emplace_back(hitSet);
138  }
139  multihits.clear();
140  }
141  }
142  localRA_.update(seedingHitSets->size());
143 
144  seedingHitSets->shrink_to_fit();
145  refittedHitStorage.shrink_to_fit();
147  iEvent.emplace(hitsPutToken_, std::move(refittedHitStorage));
148 }
unsigned int size() const override
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
edm::EDPutTokenT< std::vector< std::unique_ptr< BaseTrackerRecHit > > > hitsPutToken_
#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 30 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().

◆ generator_

MultiHitGeneratorFromChi2 MultiHitFromChi2EDProducer::generator_
private

Definition at line 35 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().

◆ hitsPutToken_

edm::EDPutTokenT<std::vector<std::unique_ptr<BaseTrackerRecHit> > > MultiHitFromChi2EDProducer::hitsPutToken_
private

Definition at line 31 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().

◆ localRA_

edm::RunningAverage MultiHitFromChi2EDProducer::localRA_
private

Definition at line 33 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().