CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
TrackerDigiGeometryRecord
geometryToken_
 
edm::ESGetToken< MagneticField,
IdealMagneticFieldRecord
magFieldToken_
 
edm::EDGetTokenT< std::vector
< T > > 
src_
 Labels for input collections. More...
 
edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
trackerTopoToken_
 

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

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 }
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_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
template<class T >
FakeTrackProducer< T >::~FakeTrackProducer ( )
inlineoverride

Definition at line 42 of file FakeTrackProducers.cc.

42 {}

Member Function Documentation

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

Muon selection.

Definition at line 56 of file FakeTrackProducers.cc.

References TrajectorySeed::startingState().

56 { return seed.startingState(); }
PTrajectoryStateOnDet const & startingState() const
template<class T >
const PTrajectoryStateOnDet& FakeTrackProducer< T >::getState ( const TrackCandidate seed) const
inlineprivate

Definition at line 57 of file FakeTrackProducers.cc.

References TrackCandidate::trajectoryStateOnDet().

57 { return seed.trajectoryStateOnDet(); }
PTrajectoryStateOnDet const & trajectoryStateOnDet() const
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, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, RecoTauCleanerPlugins::charge, LocalTrajectoryParameters::charge(), PTrajectoryStateOnDet::detId(), TrackingRecHit::geographicalId(), edm::Event::getByToken(), edm::EventSetup::getHandle(), edm::Event::getRefBeforePut(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), runTauDisplay::gp, TrajectoryStateOnSurface::localParameters(), TrackingRecHit::localPosition(), eostools::move(), RPCpg::mu, submitPVResolutionJobs::out, AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), DetId::rawId(), reco::TrackExtraBase::setHits(), alcazmumu_cfi::src, GeomDet::surface(), std::swap(), GeomDet::toGlobal(), trajectoryStateTransform::transientState(), 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 
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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const LocalTrajectoryParameters & localParameters() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
edm::EDGetTokenT< std::vector< T > > src_
Labels for input collections.
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const PTrajectoryStateOnDet & getState(const TrajectorySeed &seed) const
Muon selection.
T z() const
Definition: PV3DBase.h:61
def move
Definition: eostools.py:511
unsigned int detId() const
const int mu
Definition: Constants.h:22
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
Definition: DetId.h:17
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:10
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geometryToken_
TrackCharge charge() const
Charge (-1, 0 or 1)
GlobalVector globalMomentum() const
DetId geographicalId() const
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
long double T
T x() const
Definition: PV3DBase.h:59
virtual LocalPoint localPosition() const =0
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:77
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:74

Member Data Documentation

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

Definition at line 49 of file FakeTrackProducers.cc.

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

Definition at line 50 of file FakeTrackProducers.cc.

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

Labels for input collections.

Definition at line 48 of file FakeTrackProducers.cc.

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

Definition at line 51 of file FakeTrackProducers.cc.