CMS 3D CMS Logo

List of all members | Public Member Functions
hitTripletEDProducerT::Impl< T_HitTripletGenerator, T_SeedingHitSets, T_IntermediateHitTriplets > Class Template Reference

#include <HitTripletEDProducerT.h>

Inheritance diagram for hitTripletEDProducerT::Impl< T_HitTripletGenerator, T_SeedingHitSets, T_IntermediateHitTriplets >:
hitTripletEDProducerT::ImplGeneratorBase< T_HitTripletGenerator > hitTripletEDProducerT::ImplBase

Public Member Functions

 Impl (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
void produce (const IntermediateHitDoublets &regionDoublets, edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void produces (edm::ProducerBase &producer) const override
 
 ~Impl () override=default
 
- Public Member Functions inherited from hitTripletEDProducerT::ImplGeneratorBase< T_HitTripletGenerator >
 ImplGeneratorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
 ~ImplGeneratorBase () override=default
 
- Public Member Functions inherited from hitTripletEDProducerT::ImplBase
 ImplBase ()=default
 
virtual ~ImplBase ()=default
 

Additional Inherited Members

- Protected Attributes inherited from hitTripletEDProducerT::ImplGeneratorBase< T_HitTripletGenerator >
T_HitTripletGenerator generator_
 
- Protected Attributes inherited from hitTripletEDProducerT::ImplBase
edm::RunningAverage localRA_
 

Detailed Description

template<typename T_HitTripletGenerator, typename T_SeedingHitSets, typename T_IntermediateHitTriplets>
class hitTripletEDProducerT::Impl< T_HitTripletGenerator, T_SeedingHitSets, T_IntermediateHitTriplets >

Definition at line 70 of file HitTripletEDProducerT.h.

Constructor & Destructor Documentation

template<typename T_HitTripletGenerator , typename T_SeedingHitSets , typename T_IntermediateHitTriplets >
hitTripletEDProducerT::Impl< T_HitTripletGenerator, T_SeedingHitSets, T_IntermediateHitTriplets >::Impl ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)
inline
template<typename T_HitTripletGenerator , typename T_SeedingHitSets , typename T_IntermediateHitTriplets >
hitTripletEDProducerT::Impl< T_HitTripletGenerator, T_SeedingHitSets, T_IntermediateHitTriplets >::~Impl ( )
overridedefault

Member Function Documentation

template<typename T_HitTripletGenerator , typename T_SeedingHitSets , typename T_IntermediateHitTriplets >
void hitTripletEDProducerT::Impl< T_HitTripletGenerator, T_SeedingHitSets, T_IntermediateHitTriplets >::produce ( const IntermediateHitDoublets regionDoublets,
edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverridevirtual

Implements hitTripletEDProducerT::ImplBase.

Definition at line 81 of file HitTripletEDProducerT.h.

References a, b, IntermediateHitDoublets::empty(), Exception, JetChargeProducer_cfi::exp, LayerHitMapCache::extend(), runEdmFileComparison::found, checklumidiff::l, IntermediateHitDoublets::layerPairsSize(), LayerTriplets::layers(), LogDebug, LogTrace, IntermediateHitDoublets::regionSize(), IntermediateHitDoublets::seedingLayerHits(), OrderedHitTriplets::size(), and DetachedQuadStep_cff::triplets.

82  {
83  const SeedingLayerSetsHits& seedingLayerHits = regionDoublets.seedingLayerHits();
84 
85  auto seedingHitSetsProducer = T_SeedingHitSets();
86  auto intermediateHitTripletsProducer = T_IntermediateHitTriplets(&seedingLayerHits);
87 
88  if(regionDoublets.empty()) {
89  seedingHitSetsProducer.putEmpty(iEvent);
90  intermediateHitTripletsProducer.putEmpty(iEvent);
91  return;
92  }
93 
94  seedingHitSetsProducer.reserve(regionDoublets.regionSize(), this->localRA_.upper());
95  intermediateHitTripletsProducer.reserve(regionDoublets.regionSize(), this->localRA_.upper());
96 
97  // match-making of pair and triplet layers
98  std::vector<LayerTriplets::LayerSetAndLayers> trilayers = LayerTriplets::layers(seedingLayerHits);
99 
101  triplets.reserve(this->localRA_.upper());
102  size_t triplets_total = 0;
103 
104  LogDebug("HitTripletEDProducer") << "Creating triplets for " << regionDoublets.regionSize() << " regions, and " << trilayers.size() << " pair+3rd layers from " << regionDoublets.layerPairsSize() << " layer pairs";
105 
106  for(const auto& regionLayerPairs: regionDoublets) {
107  const TrackingRegion& region = regionLayerPairs.region();
108 
109  auto hitCachePtr_filler_shs = seedingHitSetsProducer.beginRegion(&region, nullptr);
110  auto hitCachePtr_filler_iht = intermediateHitTripletsProducer.beginRegion(&region, std::get<0>(hitCachePtr_filler_shs));
111  auto hitCachePtr = std::get<0>(hitCachePtr_filler_iht);
112 
113  LayerHitMapCache& hitCache = *hitCachePtr;
114  hitCache.extend(regionLayerPairs.layerHitMapCache());
115 
116  LogTrace("HitTripletEDProducer") << " starting region";
117 
118  for(const auto& layerPair: regionLayerPairs) {
119  LogTrace("HitTripletEDProducer") << " starting layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex();
120 
121  auto found = std::find_if(trilayers.begin(), trilayers.end(), [&](const LayerTriplets::LayerSetAndLayers& a) {
122  return a.first[0].index() == layerPair.innerLayerIndex() && a.first[1].index() == layerPair.outerLayerIndex();
123  });
124  if(found == trilayers.end()) {
125  auto exp = cms::Exception("LogicError") << "Did not find the layer pair from vector<pair+third layers>. This is a sign of some internal inconsistency\n";
126  exp << "I was looking for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << ". Triplets have the following pairs:\n";
127  for(const auto& a: trilayers) {
128  exp << " " << a.first[0].index() << "," << a.first[1].index() << ": 3rd layers";
129  for(const auto& b: a.second) {
130  exp << " " << b.index();
131  }
132  exp << "\n";
133  }
134  throw exp;
135  }
136  const auto& thirdLayers = found->second;
137 
138  this->generator_.hitTriplets(region, triplets, iEvent, iSetup, layerPair.doublets(), thirdLayers,
139  intermediateHitTripletsProducer.tripletLastLayerIndexVector(), hitCache);
140 
141 #ifdef EDM_ML_DEBUG
142  LogTrace("HitTripletEDProducer") << " created " << triplets.size() << " triplets for layer pair " << layerPair.innerLayerIndex() << "," << layerPair.outerLayerIndex() << " and 3rd layers";
143  for(const auto& l: thirdLayers) {
144  LogTrace("HitTripletEDProducer") << " " << l.index();
145  }
146 #endif
147 
148  triplets_total += triplets.size();
149  seedingHitSetsProducer.fill(std::get<1>(hitCachePtr_filler_shs), triplets);
150  intermediateHitTripletsProducer.fill(std::get<1>(hitCachePtr_filler_iht), layerPair.layerPair(), thirdLayers, triplets);
151 
152  triplets.clear();
153  }
154  }
155  this->localRA_.update(triplets_total);
156 
157  seedingHitSetsProducer.put(iEvent);
158  intermediateHitTripletsProducer.put(iEvent);
159  }
#define LogDebug(id)
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
int upper() const
unsigned int size() const override
#define LogTrace(id)
std::pair< LayerSet, std::vector< Layer > > LayerSetAndLayers
Definition: LayerTriplets.h:16
double b
Definition: hdecay.h:120
void extend(const LayerHitMapCache &other)
double a
Definition: hdecay.h:121
void update(unsigned int q)
const SeedingLayerSetsHits & seedingLayerHits() const
template<typename T_HitTripletGenerator , typename T_SeedingHitSets , typename T_IntermediateHitTriplets >
void hitTripletEDProducerT::Impl< T_HitTripletGenerator, T_SeedingHitSets, T_IntermediateHitTriplets >::produces ( edm::ProducerBase producer) const
inlineoverridevirtual

Implements hitTripletEDProducerT::ImplBase.

Definition at line 76 of file HitTripletEDProducerT.h.

76  {
77  T_SeedingHitSets::produces(producer);
78  T_IntermediateHitTriplets::produces(producer);
79  };