CMS 3D CMS Logo

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

#include <SeedToTrackProducer.h>

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

Public Member Functions

 SeedToTrackProducer (const edm::ParameterSet &)
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const final
 
TrajectoryStateOnSurface seedTransientState (const TrajectorySeed &, const MagneticField &, const GlobalTrackingGeometry &) const
 

Private Attributes

edm::EDGetTokenT< edm::View< TrajectorySeed > > L2seedsTagS_
 
edm::EDGetTokenT< TrajectorySeedCollectionL2seedsTagT_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordtheMGFieldToken
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtheTopoToken
 
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecordtheTrackingGeometryToken
 

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
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 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)
 
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

hugues/SeedToTrackProducer/plugins/SeedToTrackProducer.cc

Description: [one line class summary]

Implementation: [Notes on implementation]

hugues/SeedToTrackProducer/plugins/SeedToTrackProducer.cc

Description:

Definition at line 50 of file SeedToTrackProducer.h.

Constructor & Destructor Documentation

◆ SeedToTrackProducer()

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

Definition at line 29 of file SeedToTrackProducer.cc.

References edm::ParameterSet::getParameter(), L2seedsTagS_, and L2seedsTagT_.

31  L2seedsTagT_ = consumes<TrajectorySeedCollection>(iConfig.getParameter<edm::InputTag>("L2seedsCollection"));
32  L2seedsTagS_ = consumes<edm::View<TrajectorySeed>>(iConfig.getParameter<edm::InputTag>("L2seedsCollection"));
33 
34  produces<reco::TrackCollection>();
35  produces<reco::TrackExtraCollection>();
36  produces<TrackingRecHitCollection>();
37 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTopoToken
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theMGFieldToken
edm::EDGetTokenT< TrajectorySeedCollection > L2seedsTagT_
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > theTrackingGeometryToken
edm::EDGetTokenT< edm::View< TrajectorySeed > > L2seedsTagS_

Member Function Documentation

◆ produce()

void SeedToTrackProducer::produce ( edm::StreamID  ,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
finalprivatevirtual

Implements edm::global::EDProducerBase.

Definition at line 44 of file SeedToTrackProducer.cc.

References reco::TrackBase::appendHitPattern(), funct::cos(), TrajectoryStateOnSurface::curvilinearError(), PV3DBase< T, PVType, FrameType >::eta(), reco::TrackBase::eta(), edm::EventSetup::getData(), TrajectoryStateOnSurface::globalMomentum(), susybsm::HSCParticleType::globalMuon, mps_fire::i, heavyIonCSV_trainingSettings::idx, iEvent, SeedToTrackProducer_cfi::L2seedsCollection, L2seedsTagS_, L2seedsTagT_, CurvilinearTrajectoryError::matrix(), eostools::move(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), reco::TrackBase::phi(), reco::TrackBase::phiError(), reco::TrackBase::pt(), reco::TrackBase::ptError(), rpcPointValidation_cfi::recHit, fileCollector::seed, seedTransientState(), TrackCollections2monitor_cff::selectedTracks, reco::Track::setExtra(), funct::sin(), theMGFieldToken, theTopoToken, and theTrackingGeometryToken.

44  {
45  using namespace edm;
46  using namespace std;
47 
48  std::unique_ptr<reco::TrackCollection> selectedTracks(new reco::TrackCollection);
49  std::unique_ptr<reco::TrackExtraCollection> selectedTrackExtras(new reco::TrackExtraCollection());
50  std::unique_ptr<TrackingRecHitCollection> selectedTrackHits(new TrackingRecHitCollection());
51 
52  reco::TrackRefProd rTracks = iEvent.getRefBeforePut<reco::TrackCollection>();
53  reco::TrackExtraRefProd rTrackExtras = iEvent.getRefBeforePut<reco::TrackExtraCollection>();
54  TrackingRecHitRefProd rHits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
55 
58 
59  // magnetic fied and detector geometry
60  auto const &mgField = iSetup.getData(theMGFieldToken);
61  auto const &trackingGeometry = iSetup.getData(theTrackingGeometryToken);
62 
63  const TrackerTopology &ttopo = iSetup.getData(theTopoToken);
64 
65  // now read the L2 seeds collection :
68  const std::vector<TrajectorySeed> *L2seeds = nullptr;
69  if (L2seedsCollection.isValid())
70  L2seeds = L2seedsCollection.product();
71  else
72  edm::LogError("SeedToTrackProducer") << "L2 seeds collection not found !! " << endl;
73 
75  iEvent.getByToken(L2seedsTagS_, seedHandle);
76 
77  // now loop on the seeds :
78  for (unsigned int i = 0; i < L2seeds->size(); i++) {
79  // get the kinematic extrapolation from the seed
80  TrajectoryStateOnSurface theTrajectory = seedTransientState(L2seeds->at(i), mgField, trackingGeometry);
81  float seedEta = theTrajectory.globalMomentum().eta();
82  float seedPhi = theTrajectory.globalMomentum().phi();
83  float seedPt = theTrajectory.globalMomentum().perp();
84  CovarianceMatrix matrixSeedErr = theTrajectory.curvilinearError().matrix();
85  edm::LogVerbatim("SeedToTrackProducer")
86  << "seedPt=" << seedPt << " seedEta=" << seedEta << " seedPhi=" << seedPhi << endl;
87  /*AlgebraicSymMatrix66 errors = theTrajectory.cartesianError().matrix();
88  double partialPterror =
89  errors(3,3)*pow(theTrajectory.globalMomentum().x(),2) +
90  errors(4,4)*pow(theTrajectory.globalMomentum().y(),2);
91  edm::LogVerbatim("SeedToTrackProducer") << "seedPtError=" <<
92  sqrt(partialPterror)/theTrajectory.globalMomentum().perp() <<
93  "seedPhiError=" << theTrajectory.curvilinearError().matrix()(2,2) << endl;*/
94  // fill the track in a way that its pt, phi and eta will be the same as the
95  // seed
96  math::XYZPoint initPoint(0, 0, 0);
97  math::XYZVector initMom(seedPt * cos(seedPhi), seedPt * sin(seedPhi), seedPt * sinh(seedEta));
98  reco::Track theTrack(1,
99  1, // dummy Chi2 and ndof
100  initPoint,
101  initMom,
102  1,
103  matrixSeedErr,
105  reco::TrackBase::TrackQuality::tight);
106 
107  // fill the extra track with dummy information
108  math::XYZPoint dummyFinalPoint(1, 1, 1);
109  math::XYZVector dummyFinalMom(0, 0, 10);
111  CovarianceMatrix matrixExtra = ROOT::Math::SMatrixIdentity();
112  reco::TrackExtra theTrackExtra(dummyFinalPoint,
113  dummyFinalMom,
114  true,
115  initPoint,
116  initMom,
117  true,
118  matrixSeedErr,
119  1,
120  matrixExtra,
121  2,
122  (L2seeds->at(i)).direction(),
123  seed);
124  theTrack.setExtra(reco::TrackExtraRef(rTrackExtras, idx++));
125  edm::LogVerbatim("SeedToTrackProducer")
126  << "trackPt=" << theTrack.pt() << " trackEta=" << theTrack.eta() << " trackPhi=" << theTrack.phi() << endl;
127  edm::LogVerbatim("SeedToTrackProducer")
128  << "trackPtError=" << theTrack.ptError() << "trackPhiError=" << theTrack.phiError() << endl;
129 
130  // fill the seed segments in the track
131  unsigned int nHitsAdded = 0;
132  for (auto const &recHit : L2seeds->at(i).recHits()) {
133  TrackingRecHit *hit = recHit.clone();
134  theTrack.appendHitPattern(*hit, ttopo);
135  selectedTrackHits->push_back(hit);
136  nHitsAdded++;
137  }
138  theTrackExtra.setHits(rHits, hidx, nHitsAdded);
139  hidx += nHitsAdded;
140  selectedTracks->push_back(theTrack);
141  selectedTrackExtras->push_back(theTrackExtra);
142  }
144  iEvent.put(std::move(selectedTrackExtras));
145  iEvent.put(std::move(selectedTrackHits));
146 }
Log< level::Info, true > LogVerbatim
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > theTopoToken
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
T perp() const
Definition: PV3DBase.h:69
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T eta() const
Definition: PV3DBase.h:73
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > theMGFieldToken
TrajectoryStateOnSurface seedTransientState(const TrajectorySeed &, const MagneticField &, const GlobalTrackingGeometry &) const
edm::EDGetTokenT< TrajectorySeedCollection > L2seedsTagT_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool getData(T &iHolder) const
Definition: EventSetup.h:122
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
const CurvilinearTrajectoryError & curvilinearError() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const AlgebraicSymMatrix55 & matrix() const
GlobalVector globalMomentum() const
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > theTrackingGeometryToken
edm::EDGetTokenT< edm::View< TrajectorySeed > > L2seedsTagS_
HLT enums.
def move(src, dest)
Definition: eostools.py:511

◆ seedTransientState()

TrajectoryStateOnSurface SeedToTrackProducer::seedTransientState ( const TrajectorySeed tmpSeed,
const MagneticField mgField,
const GlobalTrackingGeometry trackingGeometry 
) const
private

Definition at line 148 of file SeedToTrackProducer.cc.

References PTrajectoryStateOnDet::detId(), GlobalTrackingGeometry::idToDet(), TrajectorySeed::startingState(), and trajectoryStateTransform::transientState().

Referenced by produce().

150  {
151  PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState();
152  DetId tmpDetId(tmpTSOD.detId());
153  const GeomDet *tmpGeomDet = trackingGeometry.idToDet(tmpDetId);
154  TrajectoryStateOnSurface tmpTSOS =
155  trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &mgField);
156  return tmpTSOS;
157 }
const GeomDet * idToDet(DetId) const override
unsigned int detId() const
PTrajectoryStateOnDet const & startingState() const
Definition: DetId.h:17
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)

Member Data Documentation

◆ L2seedsTagS_

edm::EDGetTokenT<edm::View<TrajectorySeed> > SeedToTrackProducer::L2seedsTagS_
private

Definition at line 62 of file SeedToTrackProducer.h.

Referenced by produce(), and SeedToTrackProducer().

◆ L2seedsTagT_

edm::EDGetTokenT<TrajectorySeedCollection> SeedToTrackProducer::L2seedsTagT_
private

Definition at line 61 of file SeedToTrackProducer.h.

Referenced by produce(), and SeedToTrackProducer().

◆ theMGFieldToken

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> SeedToTrackProducer::theMGFieldToken
private

Definition at line 64 of file SeedToTrackProducer.h.

Referenced by produce().

◆ theTopoToken

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SeedToTrackProducer::theTopoToken
private

Definition at line 66 of file SeedToTrackProducer.h.

Referenced by produce().

◆ theTrackingGeometryToken

const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> SeedToTrackProducer::theTrackingGeometryToken
private

Definition at line 65 of file SeedToTrackProducer.h.

Referenced by produce().