CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
PixelQuadrupletEDProducer Class Reference
Inheritance diagram for PixelQuadrupletEDProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PixelQuadrupletEDProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PixelQuadrupletEDProducer () override=default
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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

PixelQuadrupletGenerator generator_
 
edm::RunningAverage localRA_
 
edm::EDGetTokenT< IntermediateHitTripletstripletToken_
 

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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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 18 of file PixelQuadrupletEDProducer.cc.

Constructor & Destructor Documentation

PixelQuadrupletEDProducer::PixelQuadrupletEDProducer ( const edm::ParameterSet iConfig)

Definition at line 35 of file PixelQuadrupletEDProducer.cc.

35  :
36  tripletToken_(consumes<IntermediateHitTriplets>(iConfig.getParameter<edm::InputTag>("triplets"))),
37  generator_(iConfig, consumesCollector())
38 {
39  produces<RegionsSeedingHitSets>();
40 }
T getParameter(std::string const &) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< IntermediateHitTriplets > tripletToken_
PixelQuadrupletGenerator generator_
PixelQuadrupletEDProducer::~PixelQuadrupletEDProducer ( )
overridedefault

Member Function Documentation

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

Definition at line 42 of file PixelQuadrupletEDProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and PixelQuadrupletGenerator::fillDescriptions().

42  {
44 
45  desc.add<edm::InputTag>("triplets", edm::InputTag("hitTripletEDProducer"));
47 
48  descriptions.add("pixelQuadrupletEDProducer", desc);
49 }
static void fillDescriptions(edm::ParameterSetDescription &desc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PixelQuadrupletEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 51 of file PixelQuadrupletEDProducer.cc.

References a, b, DEFINE_FWK_MODULE, Exception, JetChargeProducer_cfi::exp, LayerHitMapCache::extend(), runEdmFileComparison::found, generator_, edm::Event::getByToken(), PixelQuadrupletGenerator::hitQuadruplets(), checklumidiff::l, LayerQuadruplets::layers(), localRA_, LogDebug, LogTrace, eostools::move(), SeedingLayerSetsHits::numberOfLayersInSet(), edm::Event::put(), HiRegitMuonDetachedTripletStep_cff::seedingHitSets, OrderedHitSeeds::size(), tripletToken_, edm::RunningAverage::update(), and edm::RunningAverage::upper().

51  {
53  iEvent.getByToken(tripletToken_, htriplets);
54  const auto& regionTriplets = *htriplets;
55 
56  const SeedingLayerSetsHits& seedingLayerHits = regionTriplets.seedingLayerHits();
57  if(seedingLayerHits.numberOfLayersInSet() < 4) {
58  throw cms::Exception("LogicError") << "PixelQuadrupletEDProducer expects SeedingLayerSetsHits::numberOfLayersInSet() to be >= 4, got " << seedingLayerHits.numberOfLayersInSet() << ". This is likely caused by a configuration error of this module, HitPairEDProducer, or SeedingLayersEDProducer.";
59  }
60 
61  auto seedingHitSets = std::make_unique<RegionsSeedingHitSets>();
62  if(regionTriplets.empty()) {
63  iEvent.put(std::move(seedingHitSets));
64  return;
65  }
66  seedingHitSets->reserve(regionTriplets.regionSize(), localRA_.upper());
67 
68  // match-making of triplet and quadruplet layers
69  std::vector<LayerQuadruplets::LayerSetAndLayers> quadlayers = LayerQuadruplets::layers(seedingLayerHits);
70 
71  LogDebug("PixelQuadrupletEDProducer") << "Creating quadruplets for " << regionTriplets.regionSize() << " regions, and " << quadlayers.size() << " triplet+4th layers from " << regionTriplets.tripletsSize() << " triplets";
72 
73  OrderedHitSeeds quadruplets;
74  quadruplets.reserve(localRA_.upper());
75 
76  for(const auto& regionLayerTriplets: regionTriplets) {
77  const TrackingRegion& region = regionLayerTriplets.region();
78  auto seedingHitSetsFiller = seedingHitSets->beginRegion(&region);
79 
80  LayerHitMapCache hitCache;
81  hitCache.extend(regionLayerTriplets.layerHitMapCache());
82 
83  LogTrace("PixelQuadrupletEDProducer") << " starting region, number of layer triplets " << regionLayerTriplets.layerTripletsSize();
84 
85  for(const auto& layerTriplet: regionLayerTriplets) {
86  LogTrace("PixelQuadrupletEDProducer") << " starting layer triplet " << layerTriplet.innerLayerIndex() << "," << layerTriplet.middleLayerIndex() << "," << layerTriplet.outerLayerIndex();
87  auto found = std::find_if(quadlayers.begin(), quadlayers.end(), [&](const LayerQuadruplets::LayerSetAndLayers& a) {
88  return a.first[0].index() == layerTriplet.innerLayerIndex() &&
89  a.first[1].index() == layerTriplet.middleLayerIndex() &&
90  a.first[2].index() == layerTriplet.outerLayerIndex();
91  });
92  if(found == quadlayers.end()) {
93  auto exp = cms::Exception("LogicError") << "Did not find the layer triplet from vector<triplet+fourth layers>. This is a sign of some internal inconsistency\n";
94  exp << "I was looking for layer triplet " << layerTriplet.innerLayerIndex() << "," << layerTriplet.middleLayerIndex() << "," << layerTriplet.outerLayerIndex()
95  << ". Quadruplets have the following triplets:\n";
96  for(const auto& a: quadlayers) {
97  exp << " " << a.first[0].index() << "," << a.first[1].index() << "," << a.first[2].index() << ": 4th layers";
98  for(const auto& b: a.second) {
99  exp << " " << b.index();
100  }
101  exp << "\n";
102  }
103  throw exp;
104  }
105  const auto& fourthLayers = found->second;
106 
107  generator_.hitQuadruplets(region, quadruplets, iEvent, iSetup, layerTriplet.begin(), layerTriplet.end(), fourthLayers, hitCache);
108 
109 #ifdef EDM_ML_DEBUG
110  LogTrace("PixelQuadrupletEDProducer") << " created " << quadruplets.size() << " quadruplets for layer triplet " << layerTriplet.innerLayerIndex() << "," << layerTriplet.middleLayerIndex() << "," << layerTriplet.outerLayerIndex() << " and 4th layers";
111  for(const auto& l: fourthLayers) {
112  LogTrace("PixelQuadrupletEDProducer") << " " << l.index();
113  }
114 #endif
115 
116  for(const auto& quad: quadruplets) {
117  seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]);
118  }
119  quadruplets.clear();
120  }
121  }
122  localRA_.update(seedingHitSets->size());
123 
124  seedingHitSets->shrink_to_fit();
125  iEvent.put(std::move(seedingHitSets));
126 }
#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:127
std::pair< LayerSet, std::vector< Layer > > LayerSetAndLayers
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
int upper() const
unsigned int size() const override
void hitQuadruplets(const TrackingRegion &region, OrderedHitSeeds &result, const edm::Event &ev, const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayerSet &tripletLayers, const std::vector< SeedingLayerSetsHits::SeedingLayer > &fourthLayers) override
edm::EDGetTokenT< IntermediateHitTriplets > tripletToken_
#define LogTrace(id)
double b
Definition: hdecay.h:120
void extend(const LayerHitMapCache &other)
double a
Definition: hdecay.h:121
PixelQuadrupletGenerator generator_
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
def move(src, dest)
Definition: eostools.py:510
void update(unsigned int q)

Member Data Documentation

PixelQuadrupletGenerator PixelQuadrupletEDProducer::generator_
private

Definition at line 32 of file PixelQuadrupletEDProducer.cc.

Referenced by produce().

edm::RunningAverage PixelQuadrupletEDProducer::localRA_
private

Definition at line 30 of file PixelQuadrupletEDProducer.cc.

Referenced by produce().

edm::EDGetTokenT<IntermediateHitTriplets> PixelQuadrupletEDProducer::tripletToken_
private

Definition at line 28 of file PixelQuadrupletEDProducer.cc.

Referenced by produce().