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) {
37  produces<RegionsSeedingHitSets>();
38  produces<edm::OwnVector<BaseTrackerRecHit> >();
39 }

◆ ~MultiHitFromChi2EDProducer()

MultiHitFromChi2EDProducer::~MultiHitFromChi2EDProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

◆ produce()

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

Definition at line 52 of file MultiHitFromChi2EDProducer.cc.

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 
122  region, multihits, iEvent, iSetup, layerPair.doublets(), thirdLayers, hitCache, refittedHitStorage);
123 
124 #ifdef EDM_ML_DEBUG
125  LogTrace("MultiHitFromChi2EDProducer")
126  << " created " << multihits.size() << " multihits for layer pair " << layerPair.innerLayerIndex() << ","
127  << layerPair.outerLayerIndex() << " and 3rd layers";
128  for (const auto& l : thirdLayers) {
129  LogTrace("MultiHitFromChi2EDProducer") << " " << l.index();
130  }
131 #endif
132 
133  for (const SeedingHitSet& hitSet : multihits) {
134  seedingHitSetsFiller.emplace_back(hitSet);
135  }
136  multihits.clear();
137  }
138  }
139  localRA_.update(seedingHitSets->size());
140 
141  auto storage = std::make_unique<edm::OwnVector<BaseTrackerRecHit> >();
142  storage->reserve(refittedHitStorage.size());
143  for (auto& ptr : refittedHitStorage)
144  storage->push_back(ptr.release());
145 
146  seedingHitSets->shrink_to_fit();
147  storage->shrink_to_fit();
149  iEvent.put(std::move(storage));
150 }

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

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().

OrderedMultiHits
Definition: OrderedMultiHits.h:8
SeedingHitSet
Definition: SeedingHitSet.h:6
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SeedingLayerSetsHits
Definition: SeedingLayerSetsHits.h:18
LayerHitMapCache::extend
void extend(const LayerHitMapCache &other)
Definition: LayerHitMapCache.h:71
MultiHitFromChi2EDProducer::doubletToken_
edm::EDGetTokenT< IntermediateHitDoublets > doubletToken_
Definition: MultiHitFromChi2EDProducer.cc:27
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
LayerHitMapCache
Definition: LayerHitMapCache.h:14
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
MultiHitGeneratorFromChi2::fillDescriptionsLabel
static const char * fillDescriptionsLabel()
Definition: MultiHitGeneratorFromChi2.h:38
edm::RunningAverage::update
void update(unsigned int q)
Definition: RunningAverage.h:35
b
double b
Definition: hdecay.h:118
SeedingLayerSetsHits::numberOfLayersInSet
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
Definition: SeedingLayerSetsHits.h:197
RegionsSeedingHitSets::dummyFiller
static RegionFiller dummyFiller()
Definition: RegionsSeedingHitSets.h:46
MultiHitFromChi2EDProducer::localRA_
edm::RunningAverage localRA_
Definition: MultiHitFromChi2EDProducer.cc:29
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
a
double a
Definition: hdecay.h:119
OrderedMultiHits::size
unsigned int size() const override
Definition: OrderedMultiHits.h:12
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88286
iEvent
int iEvent
Definition: GenABIO.cc:224
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
MultiHitGeneratorFromChi2::fillDescriptions
static void fillDescriptions(edm::ParameterSetDescription &desc)
Definition: MultiHitGeneratorFromChi2.cc:105
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::RunningAverage::upper
int upper() const
Definition: RunningAverage.h:30
MultiHitGeneratorFromChi2::hitSets
void hitSets(const TrackingRegion &region, OrderedMultiHits &trs, const edm::Event &ev, const edm::EventSetup &es, SeedingLayerSetsHits::SeedingLayerSet pairLayers, std::vector< SeedingLayerSetsHits::SeedingLayer > thirdLayers) override
Definition: MultiHitGeneratorFromChi2.cc:169
LayerTriplets::LayerSetAndLayers
std::pair< LayerSet, std::vector< Layer > > LayerSetAndLayers
Definition: LayerTriplets.h:16
Exception
Definition: hltDiff.cc:245
LayerHitMapCache::clear
void clear()
Definition: LayerHitMapCache.h:69
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackingRegion
Definition: TrackingRegion.h:41
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
LayerTriplets::layers
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
MultiHitFromChi2EDProducer::generator_
MultiHitGeneratorFromChi2 generator_
Definition: MultiHitFromChi2EDProducer.cc:31
MultiHitGeneratorFromChi2::initES
void initES(const edm::EventSetup &es) override
Definition: MultiHitGeneratorFromChi2.cc:135