CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
LightPFTrackProducer Class Reference

#include <LightPFTrackProducer.h>

Inheritance diagram for LightPFTrackProducer:
edm::stream::EDProducer<>

Public Member Functions

 LightPFTrackProducer (const edm::ParameterSet &)
 Constructor. More...
 
 ~LightPFTrackProducer () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 Produce the PFRecTrack collection. More...
 

Private Attributes

PFTrackTransformerpfTransformer_
 PFTrackTransformer. More...
 
reco::TrackBase::TrackQuality trackQuality_
 
std::vector< edm::EDGetTokenT< reco::TrackCollection > > tracksContainers_
 
bool useQuality_
 TRACK QUALITY. 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

Definition at line 13 of file LightPFTrackProducer.h.

Constructor & Destructor Documentation

LightPFTrackProducer::LightPFTrackProducer ( const edm::ParameterSet iConfig)
explicit

Constructor.

Definition at line 14 of file LightPFTrackProducer.cc.

References edm::ParameterSet::getParameter(), mps_fire::i, reco::TrackBase::qualityByName(), AlCaHLTBitMon_QueryRunRegistry::string, trackQuality_, tracksContainers_, and useQuality_.

14  :
15  pfTransformer_(nullptr)
16 {
17  produces<reco::PFRecTrackCollection>();
18 
19 
20 
21  std::vector<InputTag> tags =
22  iConfig.getParameter< vector < InputTag > >("TkColList");
23 
24  for (unsigned int i=0;i<tags.size();++i)
25  tracksContainers_.push_back(consumes<reco::TrackCollection>(tags[i]));
26 
27  useQuality_ = iConfig.getParameter<bool>("UseQuality");
29 
30 }
T getParameter(std::string const &) const
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
bool useQuality_
TRACK QUALITY.
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:125
std::vector< edm::EDGetTokenT< reco::TrackCollection > > tracksContainers_
reco::TrackBase::TrackQuality trackQuality_
LightPFTrackProducer::~LightPFTrackProducer ( )
override

Destructor.

Definition at line 32 of file LightPFTrackProducer.cc.

References pfTransformer_.

33 {
34  delete pfTransformer_;
35 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.

Member Function Documentation

void LightPFTrackProducer::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 70 of file LightPFTrackProducer.cc.

References edm::EventSetup::get(), MagneticField::inTesla(), seedCreatorFromRegionConsecutiveHitsEDProducer_cff::magneticField, PFTrackTransformer::OnlyProp(), and pfTransformer_.

72 {
74  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
77 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const T & get() const
Definition: EventSetup.h:59
void LightPFTrackProducer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 81 of file LightPFTrackProducer.cc.

References pfTransformer_.

82  {
83  delete pfTransformer_;
84  pfTransformer_=nullptr;
85 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
void LightPFTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Produce the PFRecTrack collection.

Definition at line 38 of file LightPFTrackProducer.cc.

References PFTrackTransformer::addPoints(), edm::Event::getByToken(), mps_fire::i, reco::PFRecTrack::KF, eostools::move(), pfTransformer_, edm::Handle< T >::product(), edm::Event::put(), jets_cff::quality, trackQuality_, tracksContainers_, and useQuality_.

39 {
40 
41  //create the empty collections
42  auto PfTrColl = std::make_unique<reco::PFRecTrackCollection>();
43 
44  for (unsigned int istr=0; istr<tracksContainers_.size();istr++){
45 
46  //Track collection
47  Handle<reco::TrackCollection> tkRefCollection;
48  iEvent.getByToken(tracksContainers_[istr], tkRefCollection);
49  reco::TrackCollection Tk=*(tkRefCollection.product());
50  for(unsigned int i=0;i<Tk.size();i++){
51  if (useQuality_ &&
52  (!(Tk[i].quality(trackQuality_)))) continue;
53  reco::TrackRef trackRef(tkRefCollection, i);
54  reco::PFRecTrack pftrack( trackRef->charge(),
56  i, trackRef );
57  Trajectory FakeTraj;
58  bool mymsgwarning = false;
59  bool valid = pfTransformer_->addPoints( pftrack, *trackRef, FakeTraj, mymsgwarning);
60  if(valid)
61  PfTrColl->push_back(pftrack);
62 
63  }
64  }
65  iEvent.put(std::move(PfTrColl));
66 }
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
bool addPoints(reco::PFRecTrack &pftrack, const reco::Track &track, const Trajectory &traj, bool msgwarning=true) const
Add points to a PFTrack. return false if a TSOS is invalid.
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
bool useQuality_
TRACK QUALITY.
T const * product() const
Definition: Handle.h:81
std::vector< edm::EDGetTokenT< reco::TrackCollection > > tracksContainers_
reco::TrackBase::TrackQuality trackQuality_
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

PFTrackTransformer* LightPFTrackProducer::pfTransformer_
private
reco::TrackBase::TrackQuality LightPFTrackProducer::trackQuality_
private

Definition at line 34 of file LightPFTrackProducer.h.

Referenced by LightPFTrackProducer(), and produce().

std::vector<edm::EDGetTokenT<reco::TrackCollection> > LightPFTrackProducer::tracksContainers_
private

Definition at line 31 of file LightPFTrackProducer.h.

Referenced by LightPFTrackProducer(), and produce().

bool LightPFTrackProducer::useQuality_
private

TRACK QUALITY.

Definition at line 33 of file LightPFTrackProducer.h.

Referenced by LightPFTrackProducer(), and produce().