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<> edm::stream::EDProducerBase 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::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 41 of file FakeTrackProducers.cc.

Constructor & Destructor Documentation

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

Definition at line 62 of file FakeTrackProducers.cc.

62  :
63  src_(consumes<std::vector<T>>(iConfig.getParameter<edm::InputTag>("src")))
64  //,selector_(iConfig.existsAs<std::string>("cut") ? iConfig.getParameter<std::string>("cut") : "", true)
65 {
66  produces<std::vector<reco::Track> >();
67  produces<std::vector<reco::TrackExtra> >();
68  produces<edm::OwnVector<TrackingRecHit> >();
69 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< T > > src_
Labels for input collections.
template<class T>
virtual FakeTrackProducer< T >::~FakeTrackProducer ( )
inlinevirtual

Definition at line 44 of file FakeTrackProducers.cc.

References iEvent, and FakeTrackProducer< T >::produce().

44 { }

Member Function Documentation

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

Definition at line 56 of file FakeTrackProducers.cc.

References TrajectorySeed::recHits().

Referenced by FakeTrackProducer< T >::produce().

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

Definition at line 57 of file FakeTrackProducers.cc.

References TrackCandidate::recHits().

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

Muon selection.

Definition at line 54 of file FakeTrackProducers.cc.

References TrajectorySeed::startingState().

Referenced by FakeTrackProducer< T >::produce().

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

Definition at line 55 of file FakeTrackProducers.cc.

References TrackCandidate::trajectoryStateOnDet().

55 { return seed.trajectoryStateOnDet(); }
PTrajectoryStateOnDet const & trajectoryStateOnDet() const
template<typename T >
void FakeTrackProducer< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 73 of file FakeTrackProducers.cc.

References alongMomentum, MessageLogger_cfi::cerr, ALCARECOTkAlJpsiMuMu_cff::charge, LocalTrajectoryParameters::charge(), PTrajectoryStateOnDet::detId(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), edm::Event::getByToken(), FakeTrackProducer< T >::getHits(), edm::Event::getRefBeforePut(), FakeTrackProducer< T >::getState(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), runTauDisplay::gp, hfClusterShapes_cfi::hits, TrackerGeometry::idToDet(), TrajectoryStateOnSurface::localParameters(), TrackingRecHit::localPosition(), eostools::move(), RPCpg::mu, MillePedeFileConverter_cfg::out, AlCaHLTBitMon_ParallelJobs::p, edm::Event::put(), DetId::rawId(), reco::TrackExtraBase::setHits(), edm::OwnVector< T, P >::size(), TrackRefitter_38T_cff::src, FakeTrackProducer< T >::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().

Referenced by FakeTrackProducer< T >::~FakeTrackProducer().

73  {
74  using namespace edm;
75  using namespace std;
76 
77 
79  iSetup.get<TrackerDigiGeometryRecord>().get(theGeometry);
80  edm::ESHandle<MagneticField> theMagField;
81  iSetup.get<IdealMagneticFieldRecord>().get(theMagField);
83  iSetup.get<TrackerTopologyRcd>().get(httopo);
84  const TrackerTopology& ttopo = *httopo;
85 
87  iEvent.getByToken(src_, src);
88 
89  unique_ptr<vector<reco::Track> > out(new vector<reco::Track>());
90  out->reserve(src->size());
91  unique_ptr<vector<reco::TrackExtra> > outEx(new vector<reco::TrackExtra>());
92  outEx->reserve(src->size());
93  unique_ptr<OwnVector<TrackingRecHit> > outHits(new OwnVector<TrackingRecHit>());
94 
97  for (typename vector<T>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
98  const T &mu = *it;
99  //if (!selector_(mu)) continue;
100  const PTrajectoryStateOnDet & pstate = getState(mu);
101  const GeomDet *det = theGeometry->idToDet(DetId(pstate.detId()));
102  if (det == 0) { std::cerr << "ERROR: bogus detid " << pstate.detId() << std::endl; continue; }
103  TrajectoryStateOnSurface state = trajectoryStateTransform::transientState(pstate, & det->surface(), &*theMagField);
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()));
111  out->back().appendHits(hits.first, hits.second, ttopo);
112  // Now Track Extra
113  const TrackingRecHit *hit0 = &*hits.first;
114  const TrackingRecHit *hit1 = &*(hits.second-1);
115  const GeomDet *det0 = theGeometry->idToDet(hit0->geographicalId());
116  const GeomDet *det1 = theGeometry->idToDet(hit1->geographicalId());
117  if (det0 == 0 || det1 == 0) { std::cerr << "ERROR: bogus detids at beginning or end of range" << std::endl; continue; }
118  GlobalPoint gx0 = det0->toGlobal(hit0->localPosition());
119  GlobalPoint gx1 = det1->toGlobal(hit1->localPosition());
120  reco::Track::Point x0(gx0.x(), gx0.y(), gx0.z());
121  reco::Track::Point x1(gx1.x(), gx1.y(), gx1.z());
122  if (x0.R() > x1.R()) std::swap(x0,x1);
123  outEx->push_back( reco::TrackExtra(x1, p, true, x0, p, true,
126  alongMomentum) );
127  out->back().setExtra( reco::TrackExtraRef( rTrackExtras, outEx->size()-1 ) );
128  reco::TrackExtra &ex = outEx->back();
129  auto const firstHitIndex = outHits->size();
130  for (OwnVector<TrackingRecHit>::const_iterator it2 = hits.first; it2 != hits.second; ++it2) {
131  outHits->push_back(*it2);
132  }
133  ex.setHits( rHits, firstHitIndex, outHits->size()-firstHitIndex);
134  }
135 
136  iEvent.put(std::move(out));
137  iEvent.put(std::move(outEx));
138  iEvent.put(std::move(outHits));
139 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
const LocalTrajectoryParameters & localParameters() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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:54
size_type size() const
Definition: OwnVector.h:264
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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.
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
virtual LocalPoint localPosition() const =0
RefProd< PROD > getRefBeforePut()
Definition: Event.h:134
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)
HLT enums.
GlobalVector globalMomentum() const
const TrackerGeomDet * idToDet(DetId) const override
DetId geographicalId() const
long double T
T x() const
Definition: PV3DBase.h:62
math::XYZVector Vector
spatial vector
Definition: TrackBase.h:80
def move(src, dest)
Definition: eostools.py:510
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:77

Member Data Documentation

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

Labels for input collections.

Definition at line 49 of file FakeTrackProducers.cc.

Referenced by FakeTrackProducer< T >::produce().