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
LightPFTrackProducer Class Reference

#include <LightPFTrackProducer.h>

Inheritance diagram for LightPFTrackProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 LightPFTrackProducer (const edm::ParameterSet &)
 Constructor. More...
 
 ~LightPFTrackProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

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

Private Attributes

PFTrackTransformerpfTransformer_
 PFTrackTransformer. More...
 
reco::TrackBase::TrackQuality trackQuality_
 
std::vector< edm::InputTagtracksContainers_
 
bool useQuality_
 TRACK QUALITY. More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 11 of file LightPFTrackProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 15 of file LightPFTrackProducer.cc.

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

15  :
17 {
18  produces<reco::PFRecTrackCollection>();
19 
21  iConfig.getParameter< vector < InputTag > >("TkColList");
22 
23 
24  useQuality_ = iConfig.getParameter<bool>("UseQuality");
25  trackQuality_=reco::TrackBase::qualityByName(iConfig.getParameter<std::string>("TrackQuality"));
26 
27 }
T getParameter(std::string const &) const
std::vector< edm::InputTag > tracksContainers_
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
bool useQuality_
TRACK QUALITY.
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:46
reco::TrackBase::TrackQuality trackQuality_
LightPFTrackProducer::~LightPFTrackProducer ( )

Destructor.

Definition at line 29 of file LightPFTrackProducer.cc.

References pfTransformer_.

30 {
31  delete pfTransformer_;
32 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 67 of file LightPFTrackProducer.cc.

References edm::EventSetup::get(), PFTrackTransformer::OnlyProp(), and pfTransformer_.

69 {
70  ESHandle<MagneticField> magneticField;
71  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
72  pfTransformer_= new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0,0,0))));
74 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const T & get() const
Definition: EventSetup.h:55
void LightPFTrackProducer::endRun ( void  )
privatevirtual

Definition at line 78 of file LightPFTrackProducer.cc.

References pfTransformer_.

78  {
79  delete pfTransformer_;
80 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
void LightPFTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Produce the PFRecTrack collection.

Implements edm::EDProducer.

Definition at line 35 of file LightPFTrackProducer.cc.

References PFTrackTransformer::addPoints(), edm::Event::getByLabel(), i, reco::PFRecTrack::KF, pfTransformer_, edm::Handle< T >::product(), edm::Event::put(), trackQuality_, tracksContainers_, useQuality_, and TrackValidation_HighPurity_cff::valid.

36 {
37 
38  //create the empty collections
39  auto_ptr< reco::PFRecTrackCollection >
40  PfTrColl (new reco::PFRecTrackCollection);
41 
42  for (unsigned int istr=0; istr<tracksContainers_.size();istr++){
43 
44  //Track collection
45  Handle<reco::TrackCollection> tkRefCollection;
46  iEvent.getByLabel(tracksContainers_[istr], tkRefCollection);
47  reco::TrackCollection Tk=*(tkRefCollection.product());
48  for(unsigned int i=0;i<Tk.size();i++){
49  if (useQuality_ &&
50  (!(Tk[i].quality(trackQuality_)))) continue;
51  reco::TrackRef trackRef(tkRefCollection, i);
52  reco::PFRecTrack pftrack( trackRef->charge(),
54  i, trackRef );
55  Trajectory FakeTraj;
56  bool valid = pfTransformer_->addPoints( pftrack, *trackRef, FakeTraj);
57  if(valid)
58  PfTrColl->push_back(pftrack);
59 
60  }
61  }
62  iEvent.put(PfTrColl);
63 }
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
int i
Definition: DBlmapReader.cc:9
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
std::vector< edm::InputTag > tracksContainers_
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
bool useQuality_
TRACK QUALITY.
bool addPoints(reco::PFRecTrack &pftrack, const reco::Track &track, const Trajectory &traj) const
Add points to a PFTrack. return false if a TSOS is invalid.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
T const * product() const
Definition: Handle.h:74
reco::TrackBase::TrackQuality trackQuality_
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9

Member Data Documentation

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

Definition at line 32 of file LightPFTrackProducer.h.

Referenced by LightPFTrackProducer(), and produce().

std::vector<edm::InputTag> LightPFTrackProducer::tracksContainers_
private

Definition at line 29 of file LightPFTrackProducer.h.

Referenced by LightPFTrackProducer(), and produce().

bool LightPFTrackProducer::useQuality_
private

TRACK QUALITY.

Definition at line 31 of file LightPFTrackProducer.h.

Referenced by LightPFTrackProducer(), and produce().