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 ()=default
 
- Public Member Functions inherited from hitTripletEDProducerT::ImplGeneratorBase< T_HitTripletGenerator >
 ImplGeneratorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
 
 ~ImplGeneratorBase ()=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 68 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 ( )
default

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 79 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 PixelTracks_cff::triplets.

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

74  {
75  T_SeedingHitSets::produces(producer);
76  T_IntermediateHitTriplets::produces(producer);
77  };