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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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
 
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedsToken
 
std::string tTRHBuilderName
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 48 of file TrackFromSeedProducer.cc.

Constructor & Destructor Documentation

◆ TrackFromSeedProducer()

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

Definition at line 75 of file TrackFromSeedProducer.cc.

75  {
76  //register your products
77  produces<reco::TrackCollection>();
78  produces<TrackingRecHitCollection>();
79  produces<reco::TrackExtraCollection>();
80 
81  // read parametes
84  tTRHBuilderName = iConfig.getParameter<std::string>("TTRHBuilder");
85 
86  //consumes
87  seedsToken = consumes<edm::View<TrajectorySeed> >(seedsTag);
88  beamSpotToken = consumes<reco::BeamSpot>(beamSpotTag);
89 }

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

◆ ~TrackFromSeedProducer()

TrackFromSeedProducer::~TrackFromSeedProducer ( )
override

Definition at line 91 of file TrackFromSeedProducer.cc.

91 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 185 of file TrackFromSeedProducer.cc.

185  {
186  //The following says we do not know what parameters are allowed so do no validation
187  // Please change this to state exactly what you do use, even if it is no parameters
189  desc.setUnknown();
190  descriptions.addDefault(desc);
191 }

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

◆ produce()

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

Implements edm::global::EDProducerBase.

Definition at line 94 of file TrackFromSeedProducer.cc.

94  {
95  using namespace edm;
96  using namespace reco;
97  using namespace std;
98 
99  // output collection
100  unique_ptr<TrackCollection> tracks(new TrackCollection);
101  unique_ptr<TrackingRecHitCollection> rechits(new TrackingRecHitCollection);
102  unique_ptr<TrackExtraCollection> trackextras(new TrackExtraCollection);
103 
104  // product references
105  TrackExtraRefProd ref_trackextras = iEvent.getRefBeforePut<TrackExtraCollection>();
106  TrackingRecHitRefProd ref_rechits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
107 
108  // input collection
110  iEvent.getByToken(seedsToken, hseeds);
111  const auto& seeds = *hseeds;
112 
113  // beam spot
115  iEvent.getByToken(beamSpotToken, beamSpot);
116 
117  // some objects to build to tracks
118  TSCBLBuilderNoMaterial tscblBuilder;
119 
121  iSetup.get<TransientRecHitRecord>().get(tTRHBuilderName, tTRHBuilder);
122 
124  iSetup.get<IdealMagneticFieldRecord>().get(theMF);
125 
127  iSetup.get<TrackerTopologyRcd>().get(httopo);
128  const TrackerTopology& ttopo = *httopo;
129 
130  // create tracks from seeds
131  int nfailed = 0;
132  for (size_t iSeed = 0; iSeed < seeds.size(); ++iSeed) {
133  auto const& seed = seeds[iSeed];
134  // try to create a track
135  TransientTrackingRecHit::RecHitPointer lastRecHit = tTRHBuilder->build(&*(seed.recHits().second - 1));
137  trajectoryStateTransform::transientState(seed.startingState(), lastRecHit->surface(), theMF.product());
138  TrajectoryStateClosestToBeamLine tsAtClosestApproachSeed =
139  tscblBuilder(*state.freeState(), *beamSpot); //as in TrackProducerAlgorithm
140  if (tsAtClosestApproachSeed.isValid()) {
141  const reco::TrackBase::Point vSeed1(tsAtClosestApproachSeed.trackStateAtPCA().position().x(),
142  tsAtClosestApproachSeed.trackStateAtPCA().position().y(),
143  tsAtClosestApproachSeed.trackStateAtPCA().position().z());
144  const reco::TrackBase::Vector pSeed(tsAtClosestApproachSeed.trackStateAtPCA().momentum().x(),
145  tsAtClosestApproachSeed.trackStateAtPCA().momentum().y(),
146  tsAtClosestApproachSeed.trackStateAtPCA().momentum().z());
147  //GlobalPoint vSeed(vSeed1.x()-beamSpot->x0(),vSeed1.y()-beamSpot->y0(),vSeed1.z()-beamSpot->z0());
148  PerigeeTrajectoryError seedPerigeeErrors =
149  PerigeeConversions::ftsToPerigeeError(tsAtClosestApproachSeed.trackStateAtPCA());
150  tracks->emplace_back(0., 0., vSeed1, pSeed, state.charge(), seedPerigeeErrors.covarianceMatrix());
151  } else {
152  edm::LogVerbatim("SeedValidator") << "TrajectoryStateClosestToBeamLine not valid";
153  // use magic values chi2<0, ndof<0, charge=0 to denote a case where the fit has failed
154  // If this definition is changed, change also interface/trackFromSeedFitFailed.h
155  tracks->emplace_back(
157  nfailed++;
158  }
159 
160  tracks->back().appendHits(seed.recHits().first, seed.recHits().second, ttopo);
161  // store the hits
162  size_t firsthitindex = rechits->size();
163  for (auto hitit = seed.recHits().first; hitit != seed.recHits().second; ++hitit) {
164  rechits->push_back(*hitit);
165  }
166 
167  // create a trackextra, just to store the hit range
168  trackextras->push_back(TrackExtra());
169  trackextras->back().setHits(ref_rechits, firsthitindex, rechits->size() - firsthitindex);
170  trackextras->back().setSeedRef(edm::RefToBase<TrajectorySeed>(hseeds, iSeed));
171  // create link between track and trackextra
172  tracks->back().setExtra(TrackExtraRef(ref_trackextras, trackextras->size() - 1));
173  }
174 
175  if (nfailed > 0) {
176  edm::LogInfo("SeedValidator") << "failed to create tracks from " << nfailed << " out of " << seeds.size()
177  << " seeds ";
178  }
179  iEvent.put(std::move(tracks));
180  iEvent.put(std::move(rechits));
181  iEvent.put(std::move(trackextras));
182 }

References pwdgSkimBPark_cfi::beamSpot, beamSpotToken, TransientTrackingRecHitBuilder::build(), TrajectoryStateOnSurface::charge(), TrajectoryStateOnSurface::freeState(), PerigeeConversions::ftsToPerigeeError(), edm::EventSetup::get(), get, iEvent, eostools::move(), edm::ESHandle< T >::product(), TrackInfoProducer_cfi::rechits, SurveyInfoScenario_cff::seed, InitialStep_cff::seeds, seedsToken, PDWG_EXOHSCP_cff::tracks, trajectoryStateTransform::transientState(), and tTRHBuilderName.

Member Data Documentation

◆ beamSpotToken

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

Definition at line 60 of file TrackFromSeedProducer.cc.

Referenced by produce(), and TrackFromSeedProducer().

◆ seedsToken

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

Definition at line 59 of file TrackFromSeedProducer.cc.

Referenced by produce(), and TrackFromSeedProducer().

◆ tTRHBuilderName

std::string TrackFromSeedProducer::tTRHBuilderName
private

Definition at line 61 of file TrackFromSeedProducer.cc.

Referenced by produce(), and TrackFromSeedProducer().

edm::RefProd< TrackExtraCollection >
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TrajectoryStateClosestToBeamLine
Definition: TrajectoryStateClosestToBeamLine.h:15
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
edm::LogInfo
Definition: MessageLogger.h:254
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TransientRecHitRecord
Definition: TransientRecHitRecord.h:14
TrajectoryStateOnSurface::charge
TrackCharge charge() const
Definition: TrajectoryStateOnSurface.h:68
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
TrackingRecHit::RecHitPointer
std::shared_ptr< TrackingRecHit const > RecHitPointer
Definition: TrackingRecHit.h:24
TransientTrackingRecHitBuilder::build
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
edm::Handle
Definition: AssociativeIterator.h:50
PerigeeTrajectoryError
Definition: PerigeeTrajectoryError.h:14
uncleanedOnlyElectronSequence_cff.seedsTag
seedsTag
Definition: uncleanedOnlyElectronSequence_cff.py:148
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
reco::TrackExtra
Definition: TrackExtra.h:26
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
TrajectoryStateOnSurface::freeState
FreeTrajectoryState const * freeState(bool withErrors=true) const
Definition: TrajectoryStateOnSurface.h:58
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ESHandle< TransientTrackingRecHitBuilder >
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
AlignmentProducer_cff.beamSpotTag
beamSpotTag
Definition: AlignmentProducer_cff.py:50
TrackFromSeedProducer::seedsToken
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedsToken
Definition: TrackFromSeedProducer.cc:59
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:232
TrackFromSeedProducer::tTRHBuilderName
std::string tTRHBuilderName
Definition: TrackFromSeedProducer.cc:61
TrackInfoProducer_cfi.rechits
rechits
Definition: TrackInfoProducer_cfi.py:9
reco::TrackExtraRef
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:16
TrackFromSeedProducer::beamSpotToken
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken
Definition: TrackFromSeedProducer.cc:60
iEvent
int iEvent
Definition: GenABIO.cc:224
trajectoryStateTransform::transientState
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
Definition: TrajectoryStateTransform.cc:35
edm::LogVerbatim
Definition: MessageLogger.h:297
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
get
#define get
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
TSCBLBuilderNoMaterial
Definition: TSCBLBuilderNoMaterial.h:13
edm::RefToBase< TrajectorySeed >
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
PerigeeConversions::ftsToPerigeeError
PerigeeTrajectoryError ftsToPerigeeError(const FTS &originalFTS)
Definition: PerigeeConversions.cc:51
reco::TrackBase::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
edm::OwnVector< TrackingRecHit >
reco::TrackBase::Vector
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:77