CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FakeTrackProducer< T > Class Template Reference
Inheritance diagram for FakeTrackProducer< T >:
edm::stream::EDProducer<>

Public Member Functions

 FakeTrackProducer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~FakeTrackProducer () override
 
- Public Member Functions inherited from edm::stream::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
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

const PTrajectoryStateOnDetgetState (const TrajectorySeed &seed) const
 Muon selection. More...
 
const PTrajectoryStateOnDetgetState (const TrackCandidate &seed) const
 

Private Attributes

edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeometryToken_
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
edm::EDGetTokenT< std::vector< T > > src_
 Labels for input collections. More...
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopoToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<class T>
class FakeTrackProducer< T >

Definition at line 39 of file FakeTrackProducers.cc.

Constructor & Destructor Documentation

◆ FakeTrackProducer()

template<typename T >
FakeTrackProducer< T >::FakeTrackProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 61 of file FakeTrackProducers.cc.

62  : src_(consumes<std::vector<T>>(iConfig.getParameter<edm::InputTag>("src"))),
63  geometryToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()),
64  magFieldToken_(esConsumes<MagneticField, IdealMagneticFieldRecord>()),
65  trackerTopoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd>())
66 //,selector_(iConfig.existsAs<std::string>("cut") ? iConfig.getParameter<std::string>("cut") : "", true)
67 {
68  produces<std::vector<reco::Track>>();
69  produces<std::vector<reco::TrackExtra>>();
70  produces<edm::OwnVector<TrackingRecHit>>();
71 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
edm::EDGetTokenT< std::vector< T > > src_
Labels for input collections.
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geometryToken_

◆ ~FakeTrackProducer()

template<class T >
FakeTrackProducer< T >::~FakeTrackProducer ( )
inlineoverride

Definition at line 42 of file FakeTrackProducers.cc.

42 {}

Member Function Documentation

◆ getState() [1/2]

template<class T >
const PTrajectoryStateOnDet& FakeTrackProducer< T >::getState ( const TrajectorySeed seed) const
inlineprivate

Muon selection.

Definition at line 56 of file FakeTrackProducers.cc.

References fileCollector::seed.

56 { return seed.startingState(); }

◆ getState() [2/2]

template<class T >
const PTrajectoryStateOnDet& FakeTrackProducer< T >::getState ( const TrackCandidate seed) const
inlineprivate

Definition at line 57 of file FakeTrackProducers.cc.

References fileCollector::seed.

57 { return seed.trajectoryStateOnDet(); }

◆ produce()

template<typename T >
void FakeTrackProducer< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 74 of file FakeTrackProducers.cc.

References alongMomentum, DMR_cfg::cerr, ALCARECOTkAlJpsiMuMu_cff::charge, PTrajectoryStateOnDet::detId(), TrackingRecHit::geographicalId(), edm::EventSetup::getHandle(), hfClusterShapes_cfi::hits, TrackerGeometry::idToDet(), iEvent, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, TrackingRecHit::localPosition(), eostools::move(), amptDefaultParameters_cff::mu, MillePedeFileConverter_cfg::out, AlCaHLTBitMon_ParallelJobs::p, DetId::rawId(), reco::TrackExtraBase::setHits(), edm::OwnVector< T, P >::size(), TrackRefitter_38T_cff::src, GeomDet::surface(), edm::swap(), GeomDet::toGlobal(), trajectoryStateTransform::transientState(), x, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

74  {
75  using namespace edm;
76  using namespace std;
77 
81  const TrackerTopology &ttopo = *httopo;
82 
84  iEvent.getByToken(src_, src);
85 
86  unique_ptr<vector<reco::Track>> out(new vector<reco::Track>());
87  out->reserve(src->size());
88  unique_ptr<vector<reco::TrackExtra>> outEx(new vector<reco::TrackExtra>());
89  outEx->reserve(src->size());
90  unique_ptr<OwnVector<TrackingRecHit>> outHits(new OwnVector<TrackingRecHit>());
91 
92  TrackingRecHitRefProd rHits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
93  reco::TrackExtraRefProd rTrackExtras = iEvent.getRefBeforePut<reco::TrackExtraCollection>();
94  for (typename vector<T>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
95  const T &mu = *it;
96  //if (!selector_(mu)) continue;
97  const PTrajectoryStateOnDet &pstate = getState(mu);
98  const GeomDet *det = theGeometry->idToDet(DetId(pstate.detId()));
99  if (det == nullptr) {
100  std::cerr << "ERROR: bogus detid " << pstate.detId() << std::endl;
101  continue;
102  }
104  GlobalPoint gx = state.globalPosition();
105  GlobalVector gp = state.globalMomentum();
106  reco::Track::Point x(gx.x(), gx.y(), gx.z());
107  reco::Track::Vector p(gp.x(), gp.y(), gp.z());
108  int charge = state.localParameters().charge();
109  out->push_back(reco::Track(1.0, 1.0, x, p, charge, reco::Track::CovarianceMatrix()));
110  auto hits = mu.recHits();
111  out->back().appendHits(hits.begin(), hits.end(), ttopo);
112  // Now Track Extra
113  const TrackingRecHit *hit0 = &*hits.begin();
114  const TrackingRecHit *hit1 = &*(hits.end() - 1);
115  const GeomDet *det0 = theGeometry->idToDet(hit0->geographicalId());
116  const GeomDet *det1 = theGeometry->idToDet(hit1->geographicalId());
117  if (det0 == nullptr || det1 == nullptr) {
118  std::cerr << "ERROR: bogus detids at beginning or end of range" << std::endl;
119  continue;
120  }
121  GlobalPoint gx0 = det0->toGlobal(hit0->localPosition());
122  GlobalPoint gx1 = det1->toGlobal(hit1->localPosition());
123  reco::Track::Point x0(gx0.x(), gx0.y(), gx0.z());
124  reco::Track::Point x1(gx1.x(), gx1.y(), gx1.z());
125  if (x0.R() > x1.R())
126  std::swap(x0, x1);
127  outEx->push_back(reco::TrackExtra(x1,
128  p,
129  true,
130  x0,
131  p,
132  true,
134  hit0->geographicalId().rawId(),
136  hit1->geographicalId().rawId(),
137  alongMomentum));
138  out->back().setExtra(reco::TrackExtraRef(rTrackExtras, outEx->size() - 1));
139  reco::TrackExtra &ex = outEx->back();
140  auto const firstHitIndex = outHits->size();
141  for (auto const &it2 : hits) {
142  outHits->push_back(it2);
143  }
144  ex.setHits(rHits, firstHitIndex, outHits->size() - firstHitIndex);
145  }
146 
147  iEvent.put(std::move(out));
148  iEvent.put(std::move(outEx));
149  iEvent.put(std::move(outHits));
150 }
T z() const
Definition: PV3DBase.h:61
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
void swap(Association< C > &lhs, Association< C > &rhs)
Definition: Association.h:112
unsigned int detId() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< std::vector< T > > src_
Labels for input collections.
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
const TrackerGeomDet * idToDet(DetId) const override
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: DetId.h:17
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
DetId geographicalId() const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geometryToken_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const PTrajectoryStateOnDet & getState(const TrajectorySeed &seed) const
Muon selection.
HLT enums.
long double T
virtual LocalPoint localPosition() const =0
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

◆ geometryToken_

template<class T >
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> FakeTrackProducer< T >::geometryToken_
private

Definition at line 49 of file FakeTrackProducers.cc.

◆ magFieldToken_

template<class T >
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> FakeTrackProducer< T >::magFieldToken_
private

Definition at line 50 of file FakeTrackProducers.cc.

◆ src_

template<class T >
edm::EDGetTokenT<std::vector<T> > FakeTrackProducer< T >::src_
private

Labels for input collections.

Definition at line 48 of file FakeTrackProducers.cc.

◆ trackerTopoToken_

template<class T >
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> FakeTrackProducer< T >::trackerTopoToken_
private

Definition at line 51 of file FakeTrackProducers.cc.