CMS 3D CMS Logo

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

Public Member Functions

void produce (edm::Event &e, const edm::EventSetup &es) override
 
 TrajectorySeedProducer (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

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
 

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, beamerCreator::create(), TrackingLayer::createFromString(), Exception, edm::ParameterSet::exists(), reco::get(), edm::ParameterSet::getParameter(), hitMasksToken, SeedingTree< DATA >::insert(), mps_splice::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<edm::ParameterSet>("seedFinderSelector").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  {
137  seedFinderSelector.reset(new SeedFinderSelector(conf.getParameter<edm::ParameterSet>("seedFinderSelector"),consumesCollector()));
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
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 
)
override

Definition at line 151 of file TrajectorySeedProducer.cc.

References _seedingTree, clone(), DEFINE_FWK_MODULE, edm::EventSetup::get(), edm::Event::getByToken(), fastTrackingUtilities::hitIsMasked(), DetachedQuadStep_cff::hitMasks, 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 = nullptr;
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.empty())
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,nullptr);
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:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
edm::EDGetTokenT< FastTrackerRecHitCombinationCollection > recHitCombinationsToken
T get() const
Definition: EventSetup.h:68
bool isUninitialized() const
Definition: EDGetToken.h:73
SeedingTree< TrackingLayer > _seedingTree
T const * product() const
Definition: ESHandle.h:84
std::unique_ptr< SeedCreator > seedCreator
def move(src, dest)
Definition: eostools.py:511

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().