CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
FakeTrackProducer< T > Class Template Reference
Inheritance diagram for FakeTrackProducer< T >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 FakeTrackProducer (const edm::ParameterSet &iConfig)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
virtual ~FakeTrackProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

TrajectorySeed::range getHits (const TrajectorySeed &seed) const
 
TrajectorySeed::range getHits (const TrackCandidate &seed) const
 
const PTrajectoryStateOnDetgetState (const TrajectorySeed &seed) const
 
const PTrajectoryStateOnDetgetState (const TrackCandidate &seed) const
 

Private Attributes

edm::InputTag src_
 Labels for input collections. More...
 
edm::ESHandle< TrackerGeometrytheGeometry
 Muon selection. More...
 
edm::ESHandle< MagneticFieldtheMagField
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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

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

64  :
65  src_(iConfig.getParameter<edm::InputTag>("src"))
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
edm::InputTag src_
Labels for input collections.
template<class T >
virtual FakeTrackProducer< T >::~FakeTrackProducer ( )
inlinevirtual

Definition at line 42 of file FakeTrackProducers.cc.

42 { }

Member Function Documentation

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

Definition at line 58 of file FakeTrackProducers.cc.

References TrajectorySeed::recHits().

58 { return seed.recHits(); }
range recHits() const
template<class T >
TrajectorySeed::range FakeTrackProducer< T >::getHits ( const TrackCandidate seed) const
inlineprivate

Definition at line 59 of file FakeTrackProducers.cc.

References TrackCandidate::recHits().

59 { return seed.recHits(); }
range recHits() const
template<class T >
const PTrajectoryStateOnDet& FakeTrackProducer< T >::getState ( const TrajectorySeed seed) const
inlineprivate

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 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 75 of file FakeTrackProducers.cc.

References alongMomentum, ecal_dqm_sourceclient-live_cfg::cerr, RecoTauCleanerPlugins::charge, LocalTrajectoryParameters::charge(), PTrajectoryStateOnDet::detId(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::getRefBeforePut(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::localParameters(), TrackingRecHit::localPosition(), RPCpg::mu, dbtoconf::out, AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), DetId::rawId(), reco::TrackExtraBase::setHits(), alcazmumu_cfi::src, GeomDet::surface(), std::swap(), GeomDet::toGlobal(), trajectoryStateTransform::transientState(), x, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

75  {
76  using namespace edm;
77  using namespace std;
78 
79 
82 
84  iEvent.getByLabel(src_, src);
85 
86  auto_ptr<vector<reco::Track> > out(new vector<reco::Track>());
87  out->reserve(src->size());
88  auto_ptr<vector<reco::TrackExtra> > outEx(new vector<reco::TrackExtra>());
89  outEx->reserve(src->size());
90  auto_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 == 0) { std::cerr << "ERROR: bogus detid " << pstate.detId() << std::endl; continue; }
101  GlobalPoint gx = state.globalPosition();
102  GlobalVector gp = state.globalMomentum();
103  reco::Track::Point x(gx.x(), gx.y(), gx.z());
104  reco::Track::Vector p(gp.x(), gp.y(), gp.z());
105  int charge = state.localParameters().charge();
106  out->push_back(reco::Track(1.0,1.0,x,p,charge,reco::Track::CovarianceMatrix()));
107  TrajectorySeed::range hits = getHits(mu);
108  out->back().appendHits(hits.first, hits.second);
109  // Now Track Extra
110  const TrackingRecHit *hit0 = &*hits.first;
111  const TrackingRecHit *hit1 = &*(hits.second-1);
112  const GeomDet *det0 = theGeometry->idToDet(hit0->geographicalId());
113  const GeomDet *det1 = theGeometry->idToDet(hit1->geographicalId());
114  if (det0 == 0 || det1 == 0) { std::cerr << "ERROR: bogus detids at beginning or end of range" << std::endl; continue; }
115  GlobalPoint gx0 = det0->toGlobal(hit0->localPosition());
116  GlobalPoint gx1 = det1->toGlobal(hit1->localPosition());
117  reco::Track::Point x0(gx0.x(), gx0.y(), gx0.z());
118  reco::Track::Point x1(gx1.x(), gx1.y(), gx1.z());
119  if (x0.R() > x1.R()) std::swap(x0,x1);
120  outEx->push_back( reco::TrackExtra(x1, p, true, x0, p, true,
123  alongMomentum) );
124  out->back().setExtra( reco::TrackExtraRef( rTrackExtras, outEx->size()-1 ) );
125  reco::TrackExtra &ex = outEx->back();
126  auto const firstHitIndex = outHits->size();
127  for (OwnVector<TrackingRecHit>::const_iterator it2 = hits.first; it2 != hits.second; ++it2) {
128  outHits->push_back(*it2);
129  }
130  ex.setHits( rHits, firstHitIndex, outHits->size()-firstHitIndex);
131  }
132 
133  iEvent.put(out);
134  iEvent.put(outEx);
135  iEvent.put(outHits);
136 }
const LocalTrajectoryParameters & localParameters() const
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
edm::ESHandle< MagneticField > theMagField
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
const PTrajectoryStateOnDet & getState(const TrajectorySeed &seed) const
TrajectorySeed::range getHits(const TrajectorySeed &seed) const
T z() const
Definition: PV3DBase.h:64
std::pair< const_iterator, const_iterator > range
unsigned int detId() const
const int mu
Definition: Constants.h:22
math::XYZPoint Point
point in the space
Definition: TrackBase.h:83
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
RefProd< PROD > getRefBeforePut()
Definition: Event.h:133
tuple out
Definition: dbtoconf.py:99
Definition: DetId.h:18
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
const T & get() const
Definition: EventSetup.h:55
TrackCharge charge() const
Charge (-1, 0 or 1)
edm::InputTag src_
Labels for input collections.
edm::ESHandle< TrackerGeometry > theGeometry
Muon selection.
GlobalVector globalMomentum() const
DetId geographicalId() const
Definition: DDAxes.h:10
long double T
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const =0
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:80
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:77

Member Data Documentation

template<class T >
edm::InputTag FakeTrackProducer< T >::src_
private

Labels for input collections.

Definition at line 47 of file FakeTrackProducers.cc.

template<class T >
edm::ESHandle<TrackerGeometry> FakeTrackProducer< T >::theGeometry
private

Muon selection.

Definition at line 53 of file FakeTrackProducers.cc.

template<class T >
edm::ESHandle<MagneticField> FakeTrackProducer< T >::theMagField
private

Definition at line 54 of file FakeTrackProducers.cc.