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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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::TrajectorySeedProducer ( const edm::ParameterSet conf)

regions

Definition at line 87 of file TrajectorySeedProducer.cc.

87  {
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);
137 }

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

Member Function Documentation

◆ produce()

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

Definition at line 139 of file TrajectorySeedProducer.cc.

139  {
140  // services
141  edm::ESHandle<TrackerTopology> trackerTopology;
142 
143  es.get<TrackerTopologyRcd>().get(trackerTopology);
144 
145  // input data
148  const std::vector<bool>* hitMasks = nullptr;
150  edm::Handle<std::vector<bool>> hitMasksHandle;
151  e.getByToken(hitMasksToken, hitMasksHandle);
152  hitMasks = &(*hitMasksHandle);
153  }
154 
155  // output data
156  std::unique_ptr<TrajectorySeedCollection> output(new TrajectorySeedCollection());
157 
158  // read the regions;
160  e.getByToken(trackingRegionToken, hregions);
161  const auto& regions = *hregions;
162  // and make sure there is at least one region
163  if (regions.empty()) {
164  e.put(std::move(output));
165  return;
166  }
167 
168  // instantiate the seed finder
169  SeedFinder seedFinder(_seedingTree, *trackerTopology.product());
170  if (seedFinderSelector) {
171  seedFinderSelector->initEvent(e, es);
172  seedFinder.addHitSelector(seedFinderSelector.get(), nHitsPerSeed_);
173  }
174 
175  // loop over the combinations
176  for (unsigned icomb = 0; icomb < recHitCombinations->size(); ++icomb) {
177  FastTrackerRecHitCombination recHitCombination = (*recHitCombinations)[icomb];
178 
179  // create a list of hits cleaned from masked hits
180  std::vector<const FastTrackerRecHit*> seedHitCandidates;
181  for (const auto& _hit : recHitCombination) {
183  continue;
184  }
185  seedHitCandidates.push_back(_hit.get());
186  }
187 
188  // loop over the regions
189  for (const auto& region : regions) {
190  // set the region used in the selector
191  if (seedFinderSelector) {
192  seedFinderSelector->setTrackingRegion(&region);
193  }
194 
195  // find hits compatible with the seed requirements
196  std::vector<unsigned int> seedHitNumbers = seedFinder.getSeed(seedHitCandidates);
197 
198  // create a seed from those hits
199  if (seedHitNumbers.size() > 1) {
200  // copy the hits
202  for (unsigned iIndex = 0; iIndex < seedHitNumbers.size(); ++iIndex) {
203  seedHits.push_back(seedHitCandidates[seedHitNumbers[iIndex]]->clone());
204  }
205  // make them aware of the combination they originate from
207 
208  // create the seed
209  seedCreator->init(region, es, nullptr);
210  seedCreator->makeSeed(*output,
211  SeedingHitSet(&seedHits[0],
212  &seedHits[1],
213  seedHits.size() >= 3 ? &seedHits[2] : nullptr,
214  seedHits.size() >= 4 ? &seedHits[3] : nullptr));
215  break; // break the loop over the regions
216  }
217  }
218  }
219  e.put(std::move(output));
220 }

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

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 64 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 63 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.

◆ trackingRegionToken

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

Definition at line 65 of file TrajectorySeedProducer.cc.

Referenced by produce(), and TrajectorySeedProducer().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
SeedFinder
Definition: SeedFinder.h:17
DetachedQuadStep_cff.hitMasks
hitMasks
Definition: DetachedQuadStep_cff.py:99
TrajectorySeedCollection
std::vector< TrajectorySeed > TrajectorySeedCollection
Definition: TrajectorySeedCollection.h:6
SeedingHitSet
Definition: SeedingHitSet.h:6
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
HLT_2018_cff.seedFinder
seedFinder
Definition: HLT_2018_cff.py:11927
pos
Definition: PixelAliasList.h:18
fastTrackingUtilities::setRecHitCombinationIndex
void setRecHitCombinationIndex(edm::OwnVector< T > &recHits, int32_t icomb)
Definition: FastTrackingUtilities.h:11
fastTrackingUtilities::hitIsMasked
bool hitIsMasked(const FastTrackerRecHit *hit, const std::vector< bool > &hitMasks)
Definition: FastTrackingUtilities.h:39
TrajectorySeedProducer::seedFinderSelector
std::unique_ptr< SeedFinderSelector > seedFinderSelector
Definition: TrajectorySeedProducer.cc:76
edm::Handle< FastTrackerRecHitCombinationCollection >
TrajectorySeedProducer::seedCreator
std::unique_ptr< SeedCreator > seedCreator
Definition: TrajectorySeedProducer.cc:73
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
clone
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
edm::EDGetTokenT::isUninitialized
bool isUninitialized() const
Definition: EDGetToken.h:70
SeedingTree::insert
bool insert(const std::vector< DATA > &dataList)
Definition: SeedingTree.h:126
edm::ESHandle< TrackerTopology >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
edm::ParameterSet
Definition: ParameterSet.h:36
TrajectorySeedProducer::_seedingTree
SeedingTree< TrackingLayer > _seedingTree
Definition: TrajectorySeedProducer.cc:71
TrajectorySeedProducer::trackingRegionToken
edm::EDGetTokenT< edm::OwnVector< TrackingRegion > > trackingRegionToken
Definition: TrajectorySeedProducer.cc:65
TrajectorySeedProducer::nHitsPerSeed_
unsigned int nHitsPerSeed_
Definition: TrajectorySeedProducer.cc:68
get
#define get
TrajectorySeedProducer::recHitCombinationsToken
edm::EDGetTokenT< FastTrackerRecHitCombinationCollection > recHitCombinationsToken
Definition: TrajectorySeedProducer.cc:63
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackCandidateProducer_cfi.recHitCombinations
recHitCombinations
Definition: TrackCandidateProducer_cfi.py:5
eostools.move
def move(src, dest)
Definition: eostools.py:511
TrackingLayer
Definition: TrackingLayer.h:9
FastTrackerRecHitCombination
std::vector< FastTrackerRecHitRef > FastTrackerRecHitCombination
Definition: FastTrackerRecHitCollection.h:11
TrajectorySeedProducer::hitMasksToken
edm::EDGetTokenT< std::vector< bool > > hitMasksToken
Definition: TrajectorySeedProducer.cc:64
Exception
Definition: hltDiff.cc:246
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
TrackingLayer::createFromString
static TrackingLayer createFromString(std::string layerSpecification)
Definition: TrackingLayer.cc:79
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
AlignmentPI::regions
regions
Definition: AlignmentPayloadInspectorHelper.h:76
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
mps_splice.line
line
Definition: mps_splice.py:76
edm::OwnVector::size
size_type size() const
Definition: OwnVector.h:300
edm::InputTag
Definition: InputTag.h:15
edm::OwnVector
Definition: OwnVector.h:24
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37