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 &, const edm::EventSetup &) override
 
 TrajectorySeedProducer (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopologyESToken_
 
edm::EDGetTokenT< edm::OwnVector< TrackingRegion > > trackingRegionToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 58 of file TrajectorySeedProducer.cc.

Constructor & Destructor Documentation

◆ TrajectorySeedProducer()

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

regions

Definition at line 87 of file TrajectorySeedProducer.cc.

References _seedingTree, TrackingLayer::createFromString(), Exception, edm::ParameterSet::exists(), get, edm::ParameterSet::getParameter(), hitMasksToken, SeedingTree< DATA >::insert(), phase1PixelTopology::layer, mps_splice::line, nHitsPerSeed_, recHitCombinationsToken, seedCreator, seedFinderSelector, AlCaHLTBitMon_QueryRunRegistry::string, and trackingRegionToken.

88  // products
89  produces<TrajectorySeedCollection>();
90 
91  // consumes
93  consumes<FastTrackerRecHitCombinationCollection>(conf.getParameter<edm::InputTag>("recHitCombinations"));
94  if (conf.exists("hitMasks")) {
95  hitMasksToken = consumes<std::vector<bool>>(conf.getParameter<edm::InputTag>("hitMasks"));
96  }
97 
98  // read Layers
99  std::vector<std::string> layerStringList =
100  conf.getParameter<edm::ParameterSet>("seedFinderSelector").getParameter<std::vector<std::string>>("layerList");
101  std::string layerBegin = *(layerStringList.cbegin());
102  nHitsPerSeed_ = 0;
103  for (auto it = layerStringList.cbegin(); it < layerStringList.cend(); ++it) {
104  std::vector<TrackingLayer> trackingLayerList;
105  std::string line = *it;
107  unsigned int nHitsPerSeed = 0;
108  while (pos != std::string::npos) {
109  pos = line.find('+');
110  std::string layer = line.substr(0, pos);
112  trackingLayerList.push_back(layerSpec);
113  line = line.substr(pos + 1, std::string::npos);
114  nHitsPerSeed++;
115  }
116  if (it == layerStringList.cbegin()) {
117  nHitsPerSeed_ = nHitsPerSeed;
118  } else if (nHitsPerSeed_ != nHitsPerSeed) {
119  throw cms::Exception("FastSimTracking") << "All allowed seed layer definitions must have same elements";
120  }
121  _seedingTree.insert(trackingLayerList);
122  }
123 
124  // seed finder selector
125  if (conf.exists("seedFinderSelector")) {
126  seedFinderSelector = std::make_unique<SeedFinderSelector>(
127  conf.getParameter<edm::ParameterSet>("seedFinderSelector"), consumesCollector());
128  }
129 
131  trackingRegionToken = consumes<edm::OwnVector<TrackingRegion>>(conf.getParameter<edm::InputTag>("trackingRegions"));
132 
133  // seed creator
134  const edm::ParameterSet& seedCreatorPSet = conf.getParameter<edm::ParameterSet>("SeedCreatorPSet");
135  std::string seedCreatorName = seedCreatorPSet.getParameter<std::string>("ComponentName");
136  seedCreator = SeedCreatorFactory::get()->create(seedCreatorName, seedCreatorPSet, consumesCollector());
137 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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
constexpr std::array< uint8_t, layerIndexSize > layer
bool insert(const std::vector< DATA > &dataList)
Definition: SeedingTree.h:126
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyESToken_
std::unique_ptr< SeedFinderSelector > seedFinderSelector
static TrackingLayer createFromString(std::string layerSpecification)
edm::EDGetTokenT< FastTrackerRecHitCombinationCollection > recHitCombinationsToken
#define get
SeedingTree< TrackingLayer > _seedingTree
std::unique_ptr< SeedCreator > seedCreator

Member Function Documentation

◆ produce()

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

Definition at line 139 of file TrajectorySeedProducer.cc.

References _seedingTree, clone(), MillePedeFileConverter_cfg::e, edm::EventSetup::getData(), fastTrackingUtilities::hitIsMasked(), DetachedQuadStep_cff::hitMasks, hitMasksToken, edm::EDGetTokenT< T >::isUninitialized(), eostools::move(), nHitsPerSeed_, convertSQLitetoXML_cfg::output, edm::OwnVector< T, P >::push_back(), TrackCandidateProducer_cfi::recHitCombinations, recHitCombinationsToken, HLT_2022v12_cff::region, seedCreator, HLT_2022v12_cff::seedFinder, seedFinderSelector, fastTrackingUtilities::setRecHitCombinationIndex(), edm::OwnVector< T, P >::size(), trackerTopologyESToken_, and trackingRegionToken.

139  {
140  // services
141  auto const& trackerTopology = es.getData(trackerTopologyESToken_);
142 
143  // input data
146  const std::vector<bool>* hitMasks = nullptr;
148  edm::Handle<std::vector<bool>> hitMasksHandle;
149  e.getByToken(hitMasksToken, hitMasksHandle);
150  hitMasks = &(*hitMasksHandle);
151  }
152 
153  // output data
154  std::unique_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection());
155 
156  // read the regions;
158  e.getByToken(trackingRegionToken, hregions);
159  const auto& regions = *hregions;
160  // and make sure there is at least one region
161  if (regions.empty()) {
162  e.put(std::move(output));
163  return;
164  }
165 
166  // instantiate the seed finder
167  SeedFinder seedFinder(_seedingTree, trackerTopology);
168  if (seedFinderSelector) {
169  seedFinderSelector->initEvent(e, es);
170  seedFinder.addHitSelector(seedFinderSelector.get(), nHitsPerSeed_);
171  }
172 
173  // loop over the combinations
174  for (unsigned icomb = 0; icomb < recHitCombinations->size(); ++icomb) {
175  FastTrackerRecHitCombination recHitCombination = (*recHitCombinations)[icomb];
176 
177  // create a list of hits cleaned from masked hits
178  std::vector<const FastTrackerRecHit*> seedHitCandidates;
179  for (const auto& _hit : recHitCombination) {
181  continue;
182  }
183  seedHitCandidates.push_back(_hit.get());
184  }
185 
186  // loop over the regions
187  for (const auto& region : regions) {
188  // set the region used in the selector
189  if (seedFinderSelector) {
190  seedFinderSelector->setTrackingRegion(&region);
191  }
192 
193  // find hits compatible with the seed requirements
194  std::vector<unsigned int> seedHitNumbers = seedFinder.getSeed(seedHitCandidates);
195 
196  // create a seed from those hits
197  if (seedHitNumbers.size() > 1) {
198  // copy the hits
200  for (unsigned iIndex = 0; iIndex < seedHitNumbers.size(); ++iIndex) {
201  seedHits.push_back(seedHitCandidates[seedHitNumbers[iIndex]]->clone());
202  }
203  // make them aware of the combination they originate from
205 
206  // create the seed
207  seedCreator->init(region, es, nullptr);
208  seedCreator->makeSeed(*output,
209  SeedingHitSet(&seedHits[0],
210  &seedHits[1],
211  seedHits.size() >= 3 ? &seedHits[2] : nullptr,
212  seedHits.size() >= 4 ? &seedHits[3] : nullptr));
213  break; // break the loop over the regions
214  }
215  }
216  }
217  e.put(std::move(output));
218 }
void setRecHitCombinationIndex(edm::OwnVector< T > &recHits, int32_t icomb)
edm::EDGetTokenT< std::vector< bool > > hitMasksToken
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
edm::EDGetTokenT< edm::OwnVector< TrackingRegion > > trackingRegionToken
void push_back(D *&d)
Definition: OwnVector.h:326
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyESToken_
std::vector< TrajectorySeed > TrajectorySeedCollection
std::unique_ptr< SeedFinderSelector > seedFinderSelector
size_type size() const
Definition: OwnVector.h:300
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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
SeedingTree< TrackingLayer > _seedingTree
std::unique_ptr< SeedCreator > seedCreator
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ _seedingTree

SeedingTree<TrackingLayer> TrajectorySeedProducer::_seedingTree
private

Definition at line 71 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

◆ hitMasksToken

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

Definition at line 63 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

◆ measurementTrackerLabel

std::string TrajectorySeedProducer::measurementTrackerLabel
private

Definition at line 74 of file TrajectorySeedProducer.cc.

◆ nHitsPerSeed_

unsigned int TrajectorySeedProducer::nHitsPerSeed_
private

Definition at line 68 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

◆ recHitCombinationsToken

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

Definition at line 62 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

◆ seedCreator

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

Definition at line 73 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

◆ seedFinderSelector

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

Definition at line 76 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

◆ seedingLayers

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

Definition at line 70 of file TrajectorySeedProducer.cc.

◆ trackerTopologyESToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TrajectorySeedProducer::trackerTopologyESToken_
private

Definition at line 65 of file TrajectorySeedProducer.cc.

Referenced by produce().

◆ trackingRegionToken

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

Definition at line 64 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().