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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Member Functions

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

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 }

◆ ~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 TrackCandidate seed) const
inlineprivate

Definition at line 57 of file FakeTrackProducers.cc.

57 { return seed.trajectoryStateOnDet(); }

References fileCollector::seed.

◆ getState() [2/2]

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

Muon selection.

Definition at line 56 of file FakeTrackProducers.cc.

56 { return seed.startingState(); }

References fileCollector::seed.

◆ produce()

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

Definition at line 74 of file FakeTrackProducers.cc.

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 }

References alongMomentum, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, ALCARECOTkAlJpsiMuMu_cff::charge, PTrajectoryStateOnDet::detId(), TrackingRecHit::geographicalId(), edm::EventSetup::getHandle(), runTauDisplay::gp, hfClusterShapes_cfi::hits, TrackerGeometry::idToDet(), iEvent, 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(), std::swap(), GeomDet::toGlobal(), trajectoryStateTransform::transientState(), PV3DBase< T, PVType, FrameType >::x(), testProducerWithPsetDescEmpty_cfi::x1, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

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.

Vector3DBase
Definition: Vector3DBase.h:8
edm::RefProd< TrackingRecHitCollection >
TrackerGeometry::idToDet
const TrackerGeomDet * idToDet(DetId) const override
Definition: TrackerGeometry.cc:193
GeomDet
Definition: GeomDet.h:27
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
amptDefaultParameters_cff.mu
mu
Definition: amptDefaultParameters_cff.py:16
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackerTopology
Definition: TrackerTopology.h:16
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
DDAxes::x
edm::Handle
Definition: AssociativeIterator.h:50
TrackingRecHit::localPosition
virtual LocalPoint localPosition() const =0
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
FakeTrackProducer::src_
edm::EDGetTokenT< std::vector< T > > src_
Labels for input collections.
Definition: FakeTrackProducers.cc:48
edm::Ref< TrackExtraCollection >
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
fileCollector.seed
seed
Definition: fileCollector.py:127
DetId
Definition: DetId.h:17
reco::TrackExtra
Definition: TrackExtra.h:26
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
PTrajectoryStateOnDet::detId
unsigned int detId() const
Definition: PTrajectoryStateOnDet.h:65
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
reco::Track
Definition: Track.h:27
edm::ESHandle< TrackerGeometry >
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
Point3DBase< float, GlobalTag >
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
runTauDisplay.gp
gp
Definition: runTauDisplay.py:431
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
TrackRefitter_38T_cff.src
src
Definition: TrackRefitter_38T_cff.py:24
FakeTrackProducer::trackerTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
Definition: FakeTrackProducers.cc:51
FakeTrackProducer::magFieldToken_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: FakeTrackProducers.cc:50
PV3DBase::y
T y() const
Definition: PV3DBase.h: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::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
reco::TrackExtraBase::setHits
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
Definition: TrackExtraBase.h:30
TrackingRecHit
Definition: TrackingRecHit.h:21
reco::TrackBase::Point
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
RunInfoPI::state
state
Definition: RunInfoPayloadInspectoHelper.h:16
T
long double T
Definition: Basic3DVectorLD.h:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
FakeTrackProducer::geometryToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geometryToken_
Definition: FakeTrackProducers.cc:49
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
FakeTrackProducer::getState
const PTrajectoryStateOnDet & getState(const TrajectorySeed &seed) const
Muon selection.
Definition: FakeTrackProducers.cc:56
reco::TrackBase::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
edm::InputTag
Definition: InputTag.h:15
alongMomentum
Definition: PropagationDirection.h:4
edm::OwnVector< TrackingRecHit >
reco::TrackBase::Vector
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:77