CMS 3D CMS Logo

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

Public Member Functions

 PixelQuadrupletMergerEDProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~PixelQuadrupletMergerEDProducer ()=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 & itemsToGetFromEvent () 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

std::unique_ptr< SeedComparitorcomparitor_
 
edm::RunningAverage localRA_
 
QuadrupletSeedMerger merger_
 
std::unique_ptr< SeedCreatorseedCreator_
 
edm::EDGetTokenT< RegionsSeedingHitSetstripletToken_
 

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 21 of file PixelQuadrupletMergerEDProducer.cc.

Constructor & Destructor Documentation

PixelQuadrupletMergerEDProducer::PixelQuadrupletMergerEDProducer ( const edm::ParameterSet iConfig)

Definition at line 42 of file PixelQuadrupletMergerEDProducer.cc.

References comparitor_, edm::EDConsumerBase::consumesCollector(), beamerCreator::create(), reco::get(), edm::ParameterSet::getParameter(), merger_, seedCreator_, QuadrupletSeedMerger::setAddRemainingTriplets(), QuadrupletSeedMerger::setMergeTriplets(), QuadrupletSeedMerger::setTTRHBuilderLabel(), and AlCaHLTBitMon_QueryRunRegistry::string.

42  :
43  tripletToken_(consumes<RegionsSeedingHitSets>(iConfig.getParameter<edm::InputTag>("triplets"))),
45 {
46  merger_.setTTRHBuilderLabel(iConfig.getParameter<std::string>("ttrhBuilderLabel"));
47  merger_.setMergeTriplets(iConfig.getParameter<bool>("mergeTriplets"));
48  merger_.setAddRemainingTriplets(iConfig.getParameter<bool>("addRemainingTriplets"));
49 
50  edm::ParameterSet comparitorPSet = iConfig.getParameter<edm::ParameterSet>("SeedComparitorPSet");
51  std::string comparitorName = comparitorPSet.getParameter<std::string>("ComponentName");
52  if(comparitorName != "none") {
53  auto iC = consumesCollector();
54  comparitor_.reset(SeedComparitorFactory::get()->create(comparitorName, comparitorPSet, iC));
55  }
56 
57  edm::ParameterSet creatorPSet = iConfig.getParameter<edm::ParameterSet>("SeedCreatorPSet");
58  std::string creatorName = creatorPSet.getParameter<std::string>("ComponentName");
59  if(creatorName != "none") // pixel tracking does not use seed creator
60  seedCreator_.reset(SeedCreatorFactory::get()->create( creatorName, creatorPSet));
61 
62  produces<RegionsSeedingHitSets>();
63  produces<TrajectorySeedCollection>(); // need to keep these in memory because TrajectorySeed owns its RecHits
64 }
T getParameter(std::string const &) const
void setTTRHBuilderLabel(std::string)
def create(alignables, pedeDump, additionalData, outputFile, config)
edm::EDGetTokenT< RegionsSeedingHitSets > tripletToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::unique_ptr< SeedCreator > seedCreator_
std::unique_ptr< SeedComparitor > comparitor_
T get(const Candidate &c)
Definition: component.h:55
PixelQuadrupletMergerEDProducer::~PixelQuadrupletMergerEDProducer ( )
default

Member Function Documentation

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

Definition at line 66 of file PixelQuadrupletMergerEDProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::setAllowAnything(), and AlCaHLTBitMon_QueryRunRegistry::string.

66  {
68 
69  desc.add<edm::InputTag>("triplets", edm::InputTag("hitTripletMergerEDProducer"));
70  desc.add<std::string>("ttrhBuilderLabel", "PixelTTRHBuilderWithoutAngle");
71  desc.add<bool>("mergeTriplets", true);
72  desc.add<bool>("addRemainingTriplets", false);
73  // This would be really on the responsibility of
74  // QuadrupletSeedMerger and SeedingLayerSetsBuilder. The former is
75  // almost obsolete by now (so I don't want to put effort there), and
76  // the latter is better dealt in the context of SeedingLayersEDProducer.
78  descLayers.setAllowAnything();
79  desc.add<edm::ParameterSetDescription>("layerList", descLayers);
80 
81  // to keep old results
82  edm::ParameterSetDescription descComparitor;
83  descComparitor.add<std::string>("ComponentName", "none");
84  descComparitor.setAllowAnything();
85  desc.add<edm::ParameterSetDescription>("SeedComparitorPSet", descComparitor);
86  edm::ParameterSetDescription descCreator;
87  descCreator.add<std::string>("ComponentName", "none");
88  descCreator.setAllowAnything();
89  desc.add<edm::ParameterSetDescription>("SeedCreatorPSet", descCreator);
90 
91  descriptions.add("pixelQuadrupletMergerEDProducer", desc);
92 }
void setAllowAnything()
allow any parameter label/value pairs
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PixelQuadrupletMergerEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 94 of file PixelQuadrupletMergerEDProducer.cc.

References comparitor_, DEFINE_FWK_MODULE, SoftLeptonByDistance_cfi::distance, edm::Event::getByToken(), hfClusterShapes_cfi::hits, mps_fire::i, localRA_, LogDebug, LogTrace, merger_, QuadrupletSeedMerger::mergeTriplets(), eostools::move(), edm::Event::put(), SurveyInfoScenario_cff::seed, seedCreator_, HiRegitMuonDetachedTripletStep_cff::seedingHitSets, OrderedHitSeeds::size(), tripletToken_, edm::RunningAverage::update(), QuadrupletSeedMerger::update(), and edm::RunningAverage::upper().

94  {
96  iEvent.getByToken(tripletToken_, htriplets);
97  const auto& regionTriplets = *htriplets;
98 
99  auto seedingHitSets = std::make_unique<RegionsSeedingHitSets>();
100  if(regionTriplets.empty()) {
101  iEvent.put(std::move(seedingHitSets));
102  return;
103  }
104  seedingHitSets->reserve(regionTriplets.regionSize(), localRA_.upper());
105 
106  // to keep old results
107  auto tmpSeedCollection = std::make_unique<TrajectorySeedCollection>();
108 
109  OrderedHitSeeds quadruplets;
110  quadruplets.reserve(localRA_.upper());
111 
112  OrderedHitSeeds tripletsPerRegion;
113  tripletsPerRegion.reserve(localRA_.upper());
114 
115  LogDebug("PixelQuadrupletMergerEDProducer") << "Creating quadruplets for " << regionTriplets.regionSize() << " regions from " << regionTriplets.size() << " triplets";
116  merger_.update(iSetup);
117 
118  // to keep old results
119  if(comparitor_) comparitor_->init(iEvent, iSetup);
120 
121  for(const auto& regionSeedingHitSets: regionTriplets) {
122  const TrackingRegion& region = regionSeedingHitSets.region();
123  auto seedingHitSetsFiller = seedingHitSets->beginRegion(&region);
124 
125 
126  // Keeping same resuls has been made really difficult...
127  // Especially when supporting both pixel tracking and seeding
128  // Following is from SeedGeneratorFromRegionHits
129  if(seedCreator_) {
130  seedCreator_->init(region, iSetup, comparitor_.get());
131  for(const auto& hits: regionSeedingHitSets) {
132  if(!comparitor_ || comparitor_->compatible(hits)) {
133  seedCreator_->makeSeed(*tmpSeedCollection, hits);
134  }
135  }
136 
137  // then convert seeds back to hits
138  // awful, but hopefully only temporary to preserve old results
139  for(const auto& seed: *tmpSeedCollection) {
140  auto hitRange = seed.recHits();
141  assert(std::distance(hitRange.first, hitRange.second) == 3);
142  tripletsPerRegion.emplace_back(static_cast<SeedingHitSet::ConstRecHitPointer>(&*(hitRange.first)),
143  static_cast<SeedingHitSet::ConstRecHitPointer>(&*(hitRange.first+1)),
144  static_cast<SeedingHitSet::ConstRecHitPointer>(&*(hitRange.first+2)));
145  }
146  }
147  else {
148  for(const auto& hits: regionSeedingHitSets) {
149  tripletsPerRegion.emplace_back(hits[0], hits[1], hits[2]);
150  }
151  }
152 
153  LogTrace("PixelQuadrupletEDProducer") << " starting region, number of triplets " << tripletsPerRegion.size();
154 
155  const auto& quadruplets = merger_.mergeTriplets(tripletsPerRegion, iSetup);
156 
157  LogTrace("PixelQuadrupletEDProducer") << " created " << quadruplets.size() << " quadruplets";
158 
159  for(size_t i=0; i!= quadruplets.size(); ++i) {
160  const auto& quad = quadruplets[i];
161  seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]);
162  }
163 
164  tripletsPerRegion.clear();
165  }
166  localRA_.update(seedingHitSets->size());
167 
168  seedingHitSets->shrink_to_fit();
169  tmpSeedCollection->shrink_to_fit();
170  iEvent.put(std::move(seedingHitSets));
171  iEvent.put(std::move(tmpSeedCollection));
172 }
#define LogDebug(id)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::EDGetTokenT< RegionsSeedingHitSets > tripletToken_
virtual unsigned int size() const
int upper() const
std::unique_ptr< SeedCreator > seedCreator_
#define LogTrace(id)
void update(const edm::EventSetup &)
const OrderedSeedingHits & mergeTriplets(const OrderedSeedingHits &, const edm::EventSetup &)
std::unique_ptr< SeedComparitor > comparitor_
def move(src, dest)
Definition: eostools.py:510
void update(unsigned int q)

Member Data Documentation

std::unique_ptr<SeedComparitor> PixelQuadrupletMergerEDProducer::comparitor_
private

Definition at line 38 of file PixelQuadrupletMergerEDProducer.cc.

Referenced by PixelQuadrupletMergerEDProducer(), and produce().

edm::RunningAverage PixelQuadrupletMergerEDProducer::localRA_
private

Definition at line 33 of file PixelQuadrupletMergerEDProducer.cc.

Referenced by produce().

QuadrupletSeedMerger PixelQuadrupletMergerEDProducer::merger_
private

Definition at line 35 of file PixelQuadrupletMergerEDProducer.cc.

Referenced by PixelQuadrupletMergerEDProducer(), and produce().

std::unique_ptr<SeedCreator> PixelQuadrupletMergerEDProducer::seedCreator_
private

Definition at line 39 of file PixelQuadrupletMergerEDProducer.cc.

Referenced by PixelQuadrupletMergerEDProducer(), and produce().

edm::EDGetTokenT<RegionsSeedingHitSets> PixelQuadrupletMergerEDProducer::tripletToken_
private

Definition at line 31 of file PixelQuadrupletMergerEDProducer.cc.

Referenced by produce().