CMS 3D CMS Logo

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

#include <hugues/SeedToTrackProducer/plugins/SeedToTrackProducer.cc>

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

Public Member Functions

 SeedToTrackProducer (const edm::ParameterSet &)
 
 ~SeedToTrackProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () 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
 
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)
 
 ~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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
virtual TrajectoryStateOnSurface seedTransientState (const TrajectorySeed &)
 

Private Attributes

edm::EDGetTokenT< edm::View< TrajectorySeed > > L2seedsTagS_
 
edm::EDGetTokenT< TrajectorySeedCollectionL2seedsTagT_
 
edm::ESHandle< MagneticFieldtheMGField
 
edm::ESHandle< GlobalTrackingGeometrytheTrackingGeometry
 

Additional Inherited Members

- Public Types inherited from edm::one::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::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Description:

Definition at line 49 of file SeedToTrackProducer.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file SeedToTrackProducer.cc.

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

29 {
30 
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
edm::EDGetTokenT< TrajectorySeedCollection > L2seedsTagT_
edm::EDGetTokenT< edm::View< TrajectorySeed > > L2seedsTagS_
SeedToTrackProducer::~SeedToTrackProducer ( )
override

Definition at line 39 of file SeedToTrackProducer.cc.

40 {
41 }

Member Function Documentation

void SeedToTrackProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 152 of file SeedToTrackProducer.cc.

153 {
154 }
void SeedToTrackProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 158 of file SeedToTrackProducer.cc.

References DEFINE_FWK_MODULE.

158  {
159 }
void SeedToTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 49 of file SeedToTrackProducer.cc.

References reco::TrackBase::appendHitPattern(), clone(), funct::cos(), TrajectoryStateOnSurface::curvilinearError(), PV3DBase< T, PVType, FrameType >::eta(), reco::TrackBase::eta(), edm::EventSetup::get(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), TrajectoryStateOnSurface::globalMomentum(), susybsm::HSCParticleType::globalMuon, mps_fire::i, training_settings::idx, edm::HandleBase::isValid(), 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(), edm::Handle< T >::product(), reco::TrackBase::pt(), reco::TrackBase::ptError(), edm::Event::put(), SurveyInfoScenario_cff::seed, seedTransientState(), trackingPlots::selectedTracks, reco::Track::setExtra(), funct::sin(), theMGField, and theTrackingGeometry.

50 {
51  using namespace edm;
52  using namespace std;
53 
54  std::unique_ptr<reco::TrackCollection> selectedTracks(new reco::TrackCollection);
55  std::unique_ptr<reco::TrackExtraCollection> selectedTrackExtras( new reco::TrackExtraCollection() );
56  std::unique_ptr<TrackingRecHitCollection> selectedTrackHits( new TrackingRecHitCollection() );
57 
61 
64 
65  // magnetic fied and detector geometry
68 
70  iSetup.get<TrackerTopologyRcd>().get(httopo);
71  const TrackerTopology& ttopo = *httopo;
72 
73  // now read the L2 seeds collection :
75  iEvent.getByToken(L2seedsTagT_,L2seedsCollection);
76  const std::vector<TrajectorySeed>* L2seeds = nullptr;
77  if (L2seedsCollection.isValid()) L2seeds = L2seedsCollection.product();
78  else edm::LogError("SeedToTrackProducer") << "L2 seeds collection not found !! " << endl;
79 
81  iEvent.getByToken(L2seedsTagS_, seedHandle);
82 
83 
84  int countRH = 0;
85 
86  // now loop on the seeds :
87  for (unsigned int i = 0; i < L2seeds->size() ; i++){
88 
89 
90  //get the kinematic extrapolation from the seed
91  TrajectoryStateOnSurface theTrajectory = seedTransientState(L2seeds->at(i));
92  float seedEta = theTrajectory.globalMomentum().eta();
93  float seedPhi = theTrajectory.globalMomentum().phi();
94  float seedPt = theTrajectory.globalMomentum().perp();
95  CovarianceMatrix matrixSeedErr = theTrajectory.curvilinearError().matrix();
96  edm::LogVerbatim("SeedToTrackProducer") << "seedPt=" << seedPt << " seedEta=" << seedEta << " seedPhi=" << seedPhi << endl;
97  /*AlgebraicSymMatrix66 errors = theTrajectory.cartesianError().matrix();
98  double partialPterror = errors(3,3)*pow(theTrajectory.globalMomentum().x(),2) + errors(4,4)*pow(theTrajectory.globalMomentum().y(),2);
99  edm::LogVerbatim("SeedToTrackProducer") << "seedPtError=" << sqrt(partialPterror)/theTrajectory.globalMomentum().perp() << "seedPhiError=" << theTrajectory.curvilinearError().matrix()(2,2) << endl;*/
100  //fill the track in a way that its pt, phi and eta will be the same as the seed
101  math::XYZPoint initPoint(0,0,0);
102  math::XYZVector initMom(seedPt*cos(seedPhi),seedPt*sin(seedPhi),seedPt*sinh(seedEta));
103  reco::Track theTrack(1, 1, //dummy Chi2 and ndof
104  initPoint, initMom,
105  1, matrixSeedErr,
106  reco::TrackBase::TrackAlgorithm::globalMuon, reco::TrackBase::TrackQuality::tight);
107 
108  //fill the extra track with dummy information
109  math::XYZPoint dummyFinalPoint(1,1,1);
110  math::XYZVector dummyFinalMom(0,0,10);
112  CovarianceMatrix matrixExtra = ROOT::Math::SMatrixIdentity();
113  reco::TrackExtra theTrackExtra(dummyFinalPoint, dummyFinalMom, true, initPoint, initMom, true,
114  matrixSeedErr, 1,
115  matrixExtra, 2,
116  (L2seeds->at(i)).direction(), seed);
117  theTrack.setExtra( reco::TrackExtraRef( rTrackExtras, idx++ ) );
118  edm::LogVerbatim("SeedToTrackProducer") << "trackPt=" << theTrack.pt() << " trackEta=" << theTrack.eta() << " trackPhi=" << theTrack.phi() << endl;
119  edm::LogVerbatim("SeedToTrackProducer") << "trackPtError=" << theTrack.ptError() << "trackPhiError=" << theTrack.phiError() << endl;
120 
121  //fill the seed segments in the track
122  unsigned int nHitsAdded = 0;
123  for(TrajectorySeed::recHitContainer::const_iterator itRecHits=(L2seeds->at(i)).recHits().first; itRecHits!=(L2seeds->at(i)).recHits().second; ++itRecHits, ++countRH) {
124  TrackingRecHit* hit = (itRecHits)->clone();
125  theTrack.appendHitPattern(*hit, ttopo);
126  selectedTrackHits->push_back(hit);
127  nHitsAdded++;
128  }
129  theTrackExtra.setHits( rHits, hidx, nHitsAdded );
130  hidx += nHitsAdded;
131  selectedTracks->push_back(theTrack);
132  selectedTrackExtras->push_back(theTrackExtra);
133 
134  }
135  iEvent.put(std::move(selectedTracks));
136  iEvent.put(std::move(selectedTrackExtras));
137  iEvent.put(std::move(selectedTrackHits));
138 
139 }
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:169
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
T perp() const
Definition: PV3DBase.h:72
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
const CurvilinearTrajectoryError & curvilinearError() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ESHandle< MagneticField > theMGField
virtual TrajectoryStateOnSurface seedTransientState(const TrajectorySeed &)
edm::EDGetTokenT< TrajectorySeedCollection > L2seedsTagT_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
bool isValid() const
Definition: HandleBase.h:74
RefProd< PROD > getRefBeforePut()
Definition: Event.h:167
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
T const * product() const
Definition: Handle.h:81
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
T eta() const
Definition: PV3DBase.h:76
edm::EDGetTokenT< edm::View< TrajectorySeed > > L2seedsTagS_
HLT enums.
const AlgebraicSymMatrix55 & matrix() const
GlobalVector globalMomentum() const
T get() const
Definition: EventSetup.h:63
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
def move(src, dest)
Definition: eostools.py:510
TrajectoryStateOnSurface SeedToTrackProducer::seedTransientState ( const TrajectorySeed tmpSeed)
privatevirtual

Definition at line 141 of file SeedToTrackProducer.cc.

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

Referenced by produce().

141  {
142 
143  PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState();
144  DetId tmpDetId(tmpTSOD.detId());
145  const GeomDet* tmpGeomDet = theTrackingGeometry->idToDet(tmpDetId);
146  TrajectoryStateOnSurface tmpTSOS = trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &(*theMGField));
147  return tmpTSOS;
148 }
edm::ESHandle< MagneticField > theMGField
unsigned int detId() const
Definition: DetId.h:18
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
const GeomDet * idToDet(DetId) const override
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry

Member Data Documentation

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

Definition at line 62 of file SeedToTrackProducer.h.

Referenced by produce(), and SeedToTrackProducer().

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

Definition at line 61 of file SeedToTrackProducer.h.

Referenced by produce(), and SeedToTrackProducer().

edm::ESHandle<MagneticField> SeedToTrackProducer::theMGField
private

Definition at line 64 of file SeedToTrackProducer.h.

Referenced by produce(), and seedTransientState().

edm::ESHandle<GlobalTrackingGeometry> SeedToTrackProducer::theTrackingGeometry
private

Definition at line 65 of file SeedToTrackProducer.h.

Referenced by produce(), and seedTransientState().