CMS 3D CMS Logo

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

Public Member Functions

virtual void produce (edm::Event &e, const edm::EventSetup &es)
 
 TrajectorySeedProducer (const edm::ParameterSet &conf)
 
- 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)
 

Private Attributes

SeedingTree< TrackingLayer_seedingTree
 
edm::EDGetTokenT< std::vector< bool > > hitMasksToken
 
std::string measurementTrackerLabel
 
unsigned int nHitsPerSeed_
 
edm::EDGetTokenT< FastTrackerRecHitCombinationCollectionrecHitCombinationsToken
 
std::unique_ptr< SeedCreatorseedCreator
 
std::unique_ptr< SeedFinderSelectorseedFinderSelector
 
std::vector< std::vector< TrackingLayer > > seedingLayers
 
edm::EDGetTokenT< edm::OwnVector< TrackingRegion > > trackingRegionToken
 

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
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 59 of file TrajectorySeedProducer.cc.

Constructor & Destructor Documentation

TrajectorySeedProducer::TrajectorySeedProducer ( const edm::ParameterSet conf)

regions

Definition at line 92 of file TrajectorySeedProducer.cc.

References _seedingTree, edm::EDConsumerBase::consumesCollector(), beamerCreator::create(), TrackingLayer::createFromString(), Exception, edm::ParameterSet::exists(), reco::get(), edm::ParameterSet::getParameter(), hitMasksToken, SeedingTree< DATA >::insert(), geometryCSVtoXML::line, nHitsPerSeed_, recHitCombinationsToken, seedCreator, seedFinderSelector, AlCaHLTBitMon_QueryRunRegistry::string, and trackingRegionToken.

93 {
94  // products
95  produces<TrajectorySeedCollection>();
96 
97  // consumes
98  recHitCombinationsToken = consumes<FastTrackerRecHitCombinationCollection>(conf.getParameter<edm::InputTag>("recHitCombinations"));
99  if (conf.exists("hitMasks"))
100  {
101  hitMasksToken = consumes<std::vector<bool> >(conf.getParameter<edm::InputTag>("hitMasks"));
102  }
103 
104  // read Layers
105  std::vector<std::string> layerStringList = conf.getParameter<std::vector<std::string>>("layerList");
106  std::string layerBegin = *(layerStringList.cbegin());
107  nHitsPerSeed_ = 0;
108  for(auto it=layerStringList.cbegin(); it < layerStringList.cend(); ++it)
109  {
110  std::vector<TrackingLayer> trackingLayerList;
111  std::string line = *it;
113  unsigned int nHitsPerSeed = 0;
114  while (pos != std::string::npos)
115  {
116  pos=line.find("+");
117  std::string layer = line.substr(0, pos);
119  trackingLayerList.push_back(layerSpec);
120  line=line.substr(pos+1,std::string::npos);
121  nHitsPerSeed++;
122  }
123  if(it==layerStringList.cbegin())
124  {
125  nHitsPerSeed_ = nHitsPerSeed;
126  }
127  else if(nHitsPerSeed_!=nHitsPerSeed)
128  {
129  throw cms::Exception("FastSimTracking") << "All allowed seed layer definitions must have same elements";
130  }
131  _seedingTree.insert(trackingLayerList);
132  }
133 
134  // seed finder selector
135  if(conf.exists("seedFinderSelector"))
136  {
138  }
139 
141  trackingRegionToken = consumes<edm::OwnVector<TrackingRegion> >(conf.getParameter<edm::InputTag>("trackingRegions"));
142 
143  // seed creator
144  const edm::ParameterSet & seedCreatorPSet = conf.getParameter<edm::ParameterSet>("SeedCreatorPSet");
145  std::string seedCreatorName = seedCreatorPSet.getParameter<std::string>("ComponentName");
146  seedCreator.reset(SeedCreatorFactory::get()->create( seedCreatorName, seedCreatorPSet));
147 
148 }
T getParameter(std::string const &) const
def create(alignables, pedeDump, additionalData, outputFile, config)
edm::EDGetTokenT< std::vector< bool > > hitMasksToken
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::OwnVector< TrackingRegion > > trackingRegionToken
uint16_t size_type
bool insert(const std::vector< DATA > &dataList)
Definition: SeedingTree.h:172
std::unique_ptr< SeedFinderSelector > seedFinderSelector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
static TrackingLayer createFromString(std::string layerSpecification)
edm::EDGetTokenT< FastTrackerRecHitCombinationCollection > recHitCombinationsToken
SeedingTree< TrackingLayer > _seedingTree
std::unique_ptr< SeedCreator > seedCreator
T get(const Candidate &c)
Definition: component.h:55

Member Function Documentation

void TrajectorySeedProducer::produce ( edm::Event e,
const edm::EventSetup es 
)
virtual

Definition at line 151 of file TrajectorySeedProducer.cc.

References _seedingTree, clone(), DEFINE_FWK_MODULE, edm::EventSetup::get(), edm::Event::getByToken(), fastTrackingUtilities::hitIsMasked(), hitMasksToken, edm::EDGetTokenT< T >::isUninitialized(), eostools::move(), nHitsPerSeed_, nullptr, convertSQLitetoXML_cfg::output, edm::ESHandle< T >::product(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), recHitCombinationsToken, seedCreator, particleFlowClusterECALUncorrected_cfi::seedFinder, seedFinderSelector, fastTrackingUtilities::setRecHitCombinationIndex(), edm::OwnVector< T, P >::size(), and trackingRegionToken.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

152 {
153 
154  // services
155  edm::ESHandle<TrackerTopology> trackerTopology;
156 
157  es.get<TrackerTopologyRcd>().get(trackerTopology);
158 
159  // input data
161  e.getByToken(recHitCombinationsToken, recHitCombinations);
162  const std::vector<bool> * hitMasks = 0;
164  {
165  edm::Handle<std::vector<bool> > hitMasksHandle;
166  e.getByToken(hitMasksToken,hitMasksHandle);
167  hitMasks = &(*hitMasksHandle);
168  }
169 
170  // output data
171  std::unique_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection());
172 
173  // read the regions;
175  e.getByToken(trackingRegionToken, hregions);
176  const auto& regions = *hregions;
177  // and make sure there is at least one region
178  if(regions.size() == 0)
179  {
180  e.put(std::move(output));
181  return;
182  }
183 
184  // instantiate the seed finder
185  SeedFinder seedFinder(_seedingTree,*trackerTopology.product());
187  {
188  seedFinderSelector->initEvent(e,es);
189  seedFinder.addHitSelector(seedFinderSelector.get(),nHitsPerSeed_);
190  }
191 
192  // loop over the combinations
193  for ( unsigned icomb=0; icomb<recHitCombinations->size(); ++icomb)
194  {
195  FastTrackerRecHitCombination recHitCombination = (*recHitCombinations)[icomb];
196 
197  // create a list of hits cleaned from masked hits
198  std::vector<const FastTrackerRecHit * > seedHitCandidates;
199  for (const auto & _hit : recHitCombination )
200  {
201  if(hitMasks && fastTrackingUtilities::hitIsMasked(_hit.get(),*hitMasks))
202  {
203  continue;
204  }
205  seedHitCandidates.push_back(_hit.get());
206  }
207 
208  // loop over the regions
209  for(const auto& region: regions)
210  {
211  // set the region used in the selector
213  {
214  seedFinderSelector->setTrackingRegion(&region);
215  }
216 
217  // find hits compatible with the seed requirements
218  std::vector<unsigned int> seedHitNumbers = seedFinder.getSeed(seedHitCandidates);
219 
220  // create a seed from those hits
221  if (seedHitNumbers.size()>1)
222  {
223 
224  // copy the hits
226  for(unsigned iIndex = 0;iIndex < seedHitNumbers.size();++iIndex)
227  {
228  seedHits.push_back(seedHitCandidates[seedHitNumbers[iIndex]]->clone());
229  }
230  // make them aware of the combination they originate from
232 
233  // create the seed
234  seedCreator->init(region,es,0);
235  seedCreator->makeSeed(
236  *output,
238  &seedHits[0],
239  &seedHits[1],
240  seedHits.size() >=3 ? &seedHits[2] : nullptr,
241  seedHits.size() >=4 ? &seedHits[3] : nullptr
242  )
243  );
244  break; // break the loop over the regions
245  }
246  }
247  }
248  e.put(std::move(output));
249 
250 }
void setRecHitCombinationIndex(edm::OwnVector< T > &recHits, int32_t icomb)
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:460
edm::EDGetTokenT< std::vector< bool > > hitMasksToken
size_type size() const
Definition: OwnVector.h:264
#define nullptr
edm::EDGetTokenT< edm::OwnVector< TrackingRegion > > trackingRegionToken
void push_back(D *&d)
Definition: OwnVector.h:290
std::vector< TrajectorySeed > TrajectorySeedCollection
std::unique_ptr< SeedFinderSelector > seedFinderSelector
bool hitIsMasked(const FastTrackerRecHit *hit, const std::vector< bool > &hitMasks)
std::vector< FastTrackerRecHitRef > FastTrackerRecHitCombination
const T & get() const
Definition: EventSetup.h:56
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
edm::EDGetTokenT< FastTrackerRecHitCombinationCollection > recHitCombinationsToken
bool isUninitialized() const
Definition: EDGetToken.h:73
SeedingTree< TrackingLayer > _seedingTree
T const * product() const
Definition: ESHandle.h:86
std::unique_ptr< SeedCreator > seedCreator
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

SeedingTree<TrackingLayer> TrajectorySeedProducer::_seedingTree
private

Definition at line 74 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

edm::EDGetTokenT<std::vector<bool> > TrajectorySeedProducer::hitMasksToken
private

Definition at line 67 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

std::string TrajectorySeedProducer::measurementTrackerLabel
private

Definition at line 77 of file TrajectorySeedProducer.cc.

unsigned int TrajectorySeedProducer::nHitsPerSeed_
private

Definition at line 71 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

edm::EDGetTokenT<FastTrackerRecHitCombinationCollection> TrajectorySeedProducer::recHitCombinationsToken
private

Definition at line 66 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

std::unique_ptr<SeedCreator> TrajectorySeedProducer::seedCreator
private

Definition at line 76 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

std::unique_ptr<SeedFinderSelector> TrajectorySeedProducer::seedFinderSelector
private

Definition at line 79 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

std::vector<std::vector<TrackingLayer> > TrajectorySeedProducer::seedingLayers
private

Definition at line 73 of file TrajectorySeedProducer.cc.

edm::EDGetTokenT<edm::OwnVector<TrackingRegion> > TrajectorySeedProducer::trackingRegionToken
private

Definition at line 68 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().