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< std::vector< std::unique_ptr< 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(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, nano_mu_digi_cff::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(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:307
edm::EDGetTokenT< std::vector< bool > > hitMasksToken
bool exists(std::string const &parameterName) const
checks if a parameter exists
uint16_t size_type
edm::EDGetTokenT< std::vector< std::unique_ptr< TrackingRegion > > > trackingRegionToken
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, nano_mu_digi_cff::region, seedCreator, HLT_2024v14_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;
157  auto const& regions = e.get(trackingRegionToken);
158  // and make sure there is at least one region
159  if (regions.empty()) {
160  e.put(std::move(output));
161  return;
162  }
163 
164  // instantiate the seed finder
165  SeedFinder seedFinder(_seedingTree, trackerTopology);
166  if (seedFinderSelector) {
167  seedFinderSelector->initEvent(e, es);
168  seedFinder.addHitSelector(seedFinderSelector.get(), nHitsPerSeed_);
169  }
170 
171  // loop over the combinations
172  for (unsigned icomb = 0; icomb < recHitCombinations->size(); ++icomb) {
173  FastTrackerRecHitCombination recHitCombination = (*recHitCombinations)[icomb];
174 
175  // create a list of hits cleaned from masked hits
176  std::vector<const FastTrackerRecHit*> seedHitCandidates;
177  for (const auto& _hit : recHitCombination) {
179  continue;
180  }
181  seedHitCandidates.push_back(_hit.get());
182  }
183 
184  // loop over the regions
185  for (const auto& region : regions) {
186  // set the region used in the selector
187  if (seedFinderSelector) {
188  seedFinderSelector->setTrackingRegion(region.get());
189  }
190 
191  // find hits compatible with the seed requirements
192  std::vector<unsigned int> seedHitNumbers = seedFinder.getSeed(seedHitCandidates);
193 
194  // create a seed from those hits
195  if (seedHitNumbers.size() > 1) {
196  // copy the hits
198  for (unsigned iIndex = 0; iIndex < seedHitNumbers.size(); ++iIndex) {
199  seedHits.push_back(seedHitCandidates[seedHitNumbers[iIndex]]->clone());
200  }
201  // make them aware of the combination they originate from
203 
204  // create the seed
205  seedCreator->init(*region, es, nullptr);
206  seedCreator->makeSeed(*output,
207  SeedingHitSet(&seedHits[0],
208  &seedHits[1],
209  seedHits.size() >= 3 ? &seedHits[2] : nullptr,
210  seedHits.size() >= 4 ? &seedHits[3] : nullptr));
211  break; // break the loop over the regions
212  }
213  }
214  }
215  e.put(std::move(output));
216 }
void setRecHitCombinationIndex(edm::OwnVector< T > &recHits, int32_t icomb)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::EDGetTokenT< std::vector< bool > > hitMasksToken
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:98
edm::EDGetTokenT< std::vector< std::unique_ptr< 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 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
Definition: output.py:1
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<std::vector<std::unique_ptr<TrackingRegion> > > TrajectorySeedProducer::trackingRegionToken
private

Definition at line 64 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().