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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MultiHitFromChi2EDProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~MultiHitFromChi2EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 17 of file MultiHitFromChi2EDProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 34 of file MultiHitFromChi2EDProducer.cc.

34  :
35  doubletToken_(consumes<IntermediateHitDoublets>(iConfig.getParameter<edm::InputTag>("doublets"))),
36  generator_(iConfig)
37 {
38  produces<RegionsSeedingHitSets>();
39  produces<edm::OwnVector<BaseTrackerRecHit> >();
40 }
T getParameter(std::string const &) const
MultiHitGeneratorFromChi2 generator_
edm::EDGetTokenT< IntermediateHitDoublets > doubletToken_
MultiHitFromChi2EDProducer::~MultiHitFromChi2EDProducer ( )
default

Member Function Documentation

void MultiHitFromChi2EDProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static
void MultiHitFromChi2EDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 53 of file MultiHitFromChi2EDProducer.cc.

References a, b, LayerHitMapCache::clear(), DEFINE_FWK_MODULE, doubletToken_, RegionsSeedingHitSets::dummyFiller(), Exception, JetChargeProducer_cfi::exp, LayerHitMapCache::extend(), runEdmFileComparison::found, generator_, edm::Event::getByToken(), MultiHitGeneratorFromChi2::hitSets(), MultiHitGeneratorFromChi2::initES(), checklumidiff::l, LayerTriplets::layers(), localRA_, LogDebug, LogTrace, eostools::move(), SeedingLayerSetsHits::numberOfLayersInSet(), edm::Event::put(), HiRegitMuonDetachedTripletStep_cff::seedingHitSets, OrderedMultiHits::size(), edm::RunningAverage::update(), and edm::RunningAverage::upper().

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

Member Data Documentation

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

Definition at line 27 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().

MultiHitGeneratorFromChi2 MultiHitFromChi2EDProducer::generator_
private

Definition at line 31 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().

edm::RunningAverage MultiHitFromChi2EDProducer::localRA_
private

Definition at line 29 of file MultiHitFromChi2EDProducer.cc.

Referenced by produce().