CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TrackFromSeedProducer Class Reference

#include <FastSimulation/TrackFromSeedProducer/plugins/TrackFromSeedProducer.cc>

Inheritance diagram for TrackFromSeedProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackFromSeedProducer (const edm::ParameterSet &)
 
 ~TrackFromSeedProducer () override
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken
 
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecordgeoToken_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmfToken_
 
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedsToken
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecordttrhToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 50 of file TrackFromSeedProducer.cc.

Constructor & Destructor Documentation

◆ TrackFromSeedProducer()

TrackFromSeedProducer::TrackFromSeedProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 80 of file TrackFromSeedProducer.cc.

References AlignmentProducer_cff::beamSpotTag, beamSpotToken, edm::ParameterSet::getParameter(), uncleanedOnlyElectronSequence_cff::seedsTag, and seedsToken.

81  : geoToken_(esConsumes()),
84  ttrhToken_(esConsumes(edm::ESInputTag("", iConfig.getParameter<std::string>("TTRHBuilder")))) {
85  //register your products
86  produces<reco::TrackCollection>();
87  produces<TrackingRecHitCollection>();
88  produces<reco::TrackExtraCollection>();
89 
90  // read parametes
93 
94  //consumes
95  seedsToken = consumes<edm::View<TrajectorySeed> >(seedsTag);
96  beamSpotToken = consumes<reco::BeamSpot>(beamSpotTag);
97 }
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedsToken
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > geoToken_
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > ttrhToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_

◆ ~TrackFromSeedProducer()

TrackFromSeedProducer::~TrackFromSeedProducer ( )
override

Definition at line 99 of file TrackFromSeedProducer.cc.

99 {}

Member Function Documentation

◆ fillDescriptions()

void TrackFromSeedProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 193 of file TrackFromSeedProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

193  {
194  //The following says we do not know what parameters are allowed so do no validation
195  // Please change this to state exactly what you do use, even if it is no parameters
197  desc.setUnknown();
198  descriptions.addDefault(desc);
199 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void TrackFromSeedProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 102 of file TrackFromSeedProducer.cc.

References pwdgSkimBPark_cfi::beamSpot, beamSpotToken, PerigeeConversions::ftsToPerigeeError(), geoToken_, edm::EventSetup::getData(), GlobalTrackingGeometry::idToDet(), iEvent, TrajectoryStateClosestToBeamLine::isValid(), mfToken_, FreeTrajectoryState::momentum(), eostools::move(), FreeTrajectoryState::position(), rpcPointValidation_cfi::recHit, fileCollector::seed, HLT_2024v10_cff::seeds, seedsToken, DiMuonV_cfg::tracks, TrajectoryStateClosestToBeamLine::trackStateAtPCA(), trajectoryStateTransform::transientState(), tTopoToken_, ttrhToken_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

102  {
103  using namespace edm;
104  using namespace reco;
105  using namespace std;
106 
107  // output collection
108  unique_ptr<TrackCollection> tracks(new TrackCollection);
109  unique_ptr<TrackingRecHitCollection> rechits(new TrackingRecHitCollection);
110  unique_ptr<TrackExtraCollection> trackextras(new TrackExtraCollection);
111 
112  // product references
113  TrackExtraRefProd ref_trackextras = iEvent.getRefBeforePut<TrackExtraCollection>();
114  TrackingRecHitRefProd ref_rechits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
115 
116  // input collection
118  iEvent.getByToken(seedsToken, hseeds);
119  const auto& seeds = *hseeds;
120 
121  // beam spot
123  iEvent.getByToken(beamSpotToken, beamSpot);
124 
125  // some objects to build to tracks
126  TSCBLBuilderNoMaterial tscblBuilder;
127 
128  const auto& tTRHBuilder = &iSetup.getData(ttrhToken_);
129  const auto& theMF = &iSetup.getData(mfToken_);
130  const TrackerTopology& ttopo = iSetup.getData(tTopoToken_);
131  const GlobalTrackingGeometry* const geometry_ = &iSetup.getData(geoToken_);
132 
133  // create tracks from seeds
134  int nfailed = 0;
135  for (size_t iSeed = 0; iSeed < seeds.size(); ++iSeed) {
136  auto const& seed = seeds[iSeed];
137  // try to create a track
139  if (seed.nHits() == 0) { //this is for deepCore seeds only
140  const Surface* deepCore_sruface = &geometry_->idToDet(seed.startingState().detId())->specificSurface();
141  state = trajectoryStateTransform::transientState(seed.startingState(), deepCore_sruface, theMF);
142  } else {
143  TransientTrackingRecHit::RecHitPointer lastRecHit = tTRHBuilder->build(&*(seed.recHits().end() - 1));
144  state = trajectoryStateTransform::transientState(seed.startingState(), lastRecHit->surface(), theMF);
145  }
146  TrajectoryStateClosestToBeamLine tsAtClosestApproachSeed =
147  tscblBuilder(*state.freeState(), *beamSpot); //as in TrackProducerAlgorithm
148  if (tsAtClosestApproachSeed.isValid()) {
149  const reco::TrackBase::Point vSeed1(tsAtClosestApproachSeed.trackStateAtPCA().position().x(),
150  tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
151  tsAtClosestApproachSeed.trackStateAtPCA().position().z());
152  const reco::TrackBase::Vector pSeed(tsAtClosestApproachSeed.trackStateAtPCA().momentum().x(),
153  tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
154  tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
155  //GlobalPoint vSeed(vSeed1.x()-beamSpot->x0(),vSeed1.y()-beamSpot->y0(),vSeed1.z()-beamSpot->z0());
156  PerigeeTrajectoryError seedPerigeeErrors =
157  PerigeeConversions::ftsToPerigeeError(tsAtClosestApproachSeed.trackStateAtPCA());
158  tracks->emplace_back(0., 0., vSeed1, pSeed, state.charge(), seedPerigeeErrors.covarianceMatrix());
159  } else {
160  edm::LogVerbatim("SeedValidator") << "TrajectoryStateClosestToBeamLine not valid";
161  // use magic values chi2<0, ndof<0, charge=0 to denote a case where the fit has failed
162  // If this definition is changed, change also interface/trackFromSeedFitFailed.h
163  tracks->emplace_back(
165  nfailed++;
166  }
167 
168  tracks->back().appendHits(seed.recHits().begin(), seed.recHits().end(), ttopo);
169  // store the hits
170  size_t firsthitindex = rechits->size();
171  for (auto const& recHit : seed.recHits()) {
172  rechits->push_back(recHit);
173  }
174 
175  // create a trackextra, just to store the hit range
176  trackextras->push_back(TrackExtra());
177  trackextras->back().setHits(ref_rechits, firsthitindex, rechits->size() - firsthitindex);
178  trackextras->back().setSeedRef(edm::RefToBase<TrajectorySeed>(hseeds, iSeed));
179  // create link between track and trackextra
180  tracks->back().setExtra(TrackExtraRef(ref_trackextras, trackextras->size() - 1));
181  }
182 
183  if (nfailed > 0) {
184  edm::LogInfo("SeedValidator") << "failed to create tracks from " << nfailed << " out of " << seeds.size()
185  << " seeds ";
186  }
187  iEvent.put(std::move(tracks));
188  iEvent.put(std::move(rechits));
189  iEvent.put(std::move(trackextras));
190 }
Log< level::Info, true > LogVerbatim
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > mfToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
T z() const
Definition: PV3DBase.h:61
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:16
const GeomDet * idToDet(DetId) const override
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedsToken
GlobalVector momentum() const
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > geoToken_
std::shared_ptr< TrackingRecHit const > RecHitPointer
Log< level::Info, false > LogInfo
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
const edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > ttrhToken_
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
fixed size matrix
HLT enums.
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:77
def move(src, dest)
Definition: eostools.py:511
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74

Member Data Documentation

◆ beamSpotToken

edm::EDGetTokenT<reco::BeamSpot> TrackFromSeedProducer::beamSpotToken
private

Definition at line 62 of file TrackFromSeedProducer.cc.

Referenced by produce(), and TrackFromSeedProducer().

◆ geoToken_

const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> TrackFromSeedProducer::geoToken_
private

Definition at line 63 of file TrackFromSeedProducer.cc.

Referenced by produce().

◆ mfToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> TrackFromSeedProducer::mfToken_
private

Definition at line 65 of file TrackFromSeedProducer.cc.

Referenced by produce().

◆ seedsToken

edm::EDGetTokenT<edm::View<TrajectorySeed> > TrackFromSeedProducer::seedsToken
private

Definition at line 61 of file TrackFromSeedProducer.cc.

Referenced by produce(), and TrackFromSeedProducer().

◆ tTopoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TrackFromSeedProducer::tTopoToken_
private

Definition at line 64 of file TrackFromSeedProducer.cc.

Referenced by produce().

◆ ttrhToken_

const edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> TrackFromSeedProducer::ttrhToken_
private

Definition at line 66 of file TrackFromSeedProducer.cc.

Referenced by produce().