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

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< std::vector< T > > src_
 Labels for input collections. More...
 

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 38 of file FakeTrackProducers.cc.

Constructor & Destructor Documentation

◆ FakeTrackProducer()

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

Definition at line 59 of file FakeTrackProducers.cc.

60  : src_(consumes<std::vector<T>>(iConfig.getParameter<edm::InputTag>("src")))
61 //,selector_(iConfig.existsAs<std::string>("cut") ? iConfig.getParameter<std::string>("cut") : "", true)
62 {
63  produces<std::vector<reco::Track>>();
64  produces<std::vector<reco::TrackExtra>>();
65  produces<edm::OwnVector<TrackingRecHit>>();
66 }

◆ ~FakeTrackProducer()

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

Definition at line 41 of file FakeTrackProducers.cc.

41 {}

Member Function Documentation

◆ getHits() [1/2]

template<class T >
TrajectorySeed::range FakeTrackProducer< T >::getHits ( const TrackCandidate seed) const
inlineprivate

Definition at line 55 of file FakeTrackProducers.cc.

55 { return seed.recHits(); }

References SurveyInfoScenario_cff::seed.

◆ getHits() [2/2]

template<class T >
TrajectorySeed::range FakeTrackProducer< T >::getHits ( const TrajectorySeed seed) const
inlineprivate

Definition at line 54 of file FakeTrackProducers.cc.

54 { return seed.recHits(); }

References SurveyInfoScenario_cff::seed.

◆ getState() [1/2]

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

Definition at line 53 of file FakeTrackProducers.cc.

53 { return seed.trajectoryStateOnDet(); }

References SurveyInfoScenario_cff::seed.

◆ getState() [2/2]

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

Muon selection.

Definition at line 52 of file FakeTrackProducers.cc.

52 { return seed.startingState(); }

References SurveyInfoScenario_cff::seed.

◆ produce()

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

Definition at line 69 of file FakeTrackProducers.cc.

69  {
70  using namespace edm;
71  using namespace std;
72 
74  iSetup.get<TrackerDigiGeometryRecord>().get(theGeometry);
75  edm::ESHandle<MagneticField> theMagField;
76  iSetup.get<IdealMagneticFieldRecord>().get(theMagField);
78  iSetup.get<TrackerTopologyRcd>().get(httopo);
79  const TrackerTopology &ttopo = *httopo;
80 
82  iEvent.getByToken(src_, src);
83 
84  unique_ptr<vector<reco::Track>> out(new vector<reco::Track>());
85  out->reserve(src->size());
86  unique_ptr<vector<reco::TrackExtra>> outEx(new vector<reco::TrackExtra>());
87  outEx->reserve(src->size());
88  unique_ptr<OwnVector<TrackingRecHit>> outHits(new OwnVector<TrackingRecHit>());
89 
90  TrackingRecHitRefProd rHits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
91  reco::TrackExtraRefProd rTrackExtras = iEvent.getRefBeforePut<reco::TrackExtraCollection>();
92  for (typename vector<T>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
93  const T &mu = *it;
94  //if (!selector_(mu)) continue;
95  const PTrajectoryStateOnDet &pstate = getState(mu);
96  const GeomDet *det = theGeometry->idToDet(DetId(pstate.detId()));
97  if (det == nullptr) {
98  std::cerr << "ERROR: bogus detid " << pstate.detId() << std::endl;
99  continue;
100  }
101  TrajectoryStateOnSurface state = trajectoryStateTransform::transientState(pstate, &det->surface(), &*theMagField);
102  GlobalPoint gx = state.globalPosition();
103  GlobalVector gp = state.globalMomentum();
104  reco::Track::Point x(gx.x(), gx.y(), gx.z());
105  reco::Track::Vector p(gp.x(), gp.y(), gp.z());
106  int charge = state.localParameters().charge();
107  out->push_back(reco::Track(1.0, 1.0, x, p, charge, reco::Track::CovarianceMatrix()));
109  out->back().appendHits(hits.first, hits.second, ttopo);
110  // Now Track Extra
111  const TrackingRecHit *hit0 = &*hits.first;
112  const TrackingRecHit *hit1 = &*(hits.second - 1);
113  const GeomDet *det0 = theGeometry->idToDet(hit0->geographicalId());
114  const GeomDet *det1 = theGeometry->idToDet(hit1->geographicalId());
115  if (det0 == nullptr || det1 == nullptr) {
116  std::cerr << "ERROR: bogus detids at beginning or end of range" << std::endl;
117  continue;
118  }
119  GlobalPoint gx0 = det0->toGlobal(hit0->localPosition());
120  GlobalPoint gx1 = det1->toGlobal(hit1->localPosition());
121  reco::Track::Point x0(gx0.x(), gx0.y(), gx0.z());
122  reco::Track::Point x1(gx1.x(), gx1.y(), gx1.z());
123  if (x0.R() > x1.R())
124  std::swap(x0, x1);
125  outEx->push_back(reco::TrackExtra(x1,
126  p,
127  true,
128  x0,
129  p,
130  true,
132  hit0->geographicalId().rawId(),
134  hit1->geographicalId().rawId(),
135  alongMomentum));
136  out->back().setExtra(reco::TrackExtraRef(rTrackExtras, outEx->size() - 1));
137  reco::TrackExtra &ex = outEx->back();
138  auto const firstHitIndex = outHits->size();
139  for (OwnVector<TrackingRecHit>::const_iterator it2 = hits.first; it2 != hits.second; ++it2) {
140  outHits->push_back(*it2);
141  }
142  ex.setHits(rHits, firstHitIndex, outHits->size() - firstHitIndex);
143  }
144 
145  iEvent.put(std::move(out));
146  iEvent.put(std::move(outEx));
147  iEvent.put(std::move(outHits));
148 }

References alongMomentum, beam_dqm_sourceclient-live_cfg::cerr, ALCARECOTkAlJpsiMuMu_cff::charge, LocalTrajectoryParameters::charge(), PTrajectoryStateOnDet::detId(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), edm::get(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), runTauDisplay::gp, hfClusterShapes_cfi::hits, TrackerGeometry::idToDet(), iEvent, TrajectoryStateOnSurface::localParameters(), 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

◆ src_

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

Labels for input collections.

Definition at line 47 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
TrajectorySeed::range
std::pair< const_iterator, const_iterator > range
Definition: TrajectorySeed.h:21
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
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
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:47
edm::Ref< TrackExtraCollection >
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
reco::Track
Definition: Track.h:27
edm::ESHandle< TrackerGeometry >
reco::TrackExtraCollection
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
LocalTrajectoryParameters::charge
TrackCharge charge() const
Charge (-1, 0 or 1)
Definition: LocalTrajectoryParameters.h:110
Point3DBase< float, GlobalTag >
TrajectoryStateOnSurface::localParameters
const LocalTrajectoryParameters & localParameters() const
Definition: TrajectoryStateOnSurface.h:73
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
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
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
get
#define get
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
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
T
long double T
Definition: Basic3DVectorLD.h:48
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
FakeTrackProducer::getState
const PTrajectoryStateOnDet & getState(const TrajectorySeed &seed) const
Muon selection.
Definition: FakeTrackProducers.cc:52
reco::TrackBase::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74
FakeTrackProducer::getHits
TrajectorySeed::range getHits(const TrajectorySeed &seed) const
Definition: FakeTrackProducers.cc:54
edm::InputTag
Definition: InputTag.h:15
alongMomentum
Definition: PropagationDirection.h:4
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
edm::OwnVector< TrackingRecHit >
reco::TrackBase::Vector
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:77