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::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 LightPFTrackProducer (const edm::ParameterSet &)
 Constructor. More...
 
 ~LightPFTrackProducer ()
 Destructor. More...
 
- 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

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void endRun (const edm::Run &, const edm::EventSetup &) override
 
virtual 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::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

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(), i, reco::TrackBase::qualityByName(), AlCaHLTBitMon_QueryRunRegistry::string, o2o::tags, trackQuality_, tracksContainers_, and useQuality_.

14  :
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
int i
Definition: DBlmapReader.cc:9
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
bool useQuality_
TRACK QUALITY.
tuple tags
Definition: o2o.py:248
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:108
std::vector< edm::EDGetTokenT< reco::TrackCollection > > tracksContainers_
reco::TrackBase::TrackQuality trackQuality_
LightPFTrackProducer::~LightPFTrackProducer ( )

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

Reimplemented from edm::EDProducer.

Definition at line 71 of file LightPFTrackProducer.cc.

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

73 {
75  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
76  pfTransformer_= new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0,0,0))));
78 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const T & get() const
Definition: EventSetup.h:55
void LightPFTrackProducer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 82 of file LightPFTrackProducer.cc.

References pfTransformer_.

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

Produce the PFRecTrack collection.

Implements edm::EDProducer.

Definition at line 38 of file LightPFTrackProducer.cc.

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

39 {
40 
41  //create the empty collections
42  auto_ptr< reco::PFRecTrackCollection >
43  PfTrColl (new reco::PFRecTrackCollection);
44 
45  for (unsigned int istr=0; istr<tracksContainers_.size();istr++){
46 
47  //Track collection
48  Handle<reco::TrackCollection> tkRefCollection;
49  iEvent.getByToken(tracksContainers_[istr], tkRefCollection);
50  reco::TrackCollection Tk=*(tkRefCollection.product());
51  for(unsigned int i=0;i<Tk.size();i++){
52  if (useQuality_ &&
53  (!(Tk[i].quality(trackQuality_)))) continue;
54  reco::TrackRef trackRef(tkRefCollection, i);
55  reco::PFRecTrack pftrack( trackRef->charge(),
57  i, trackRef );
58  Trajectory FakeTraj;
59  bool mymsgwarning = false;
60  bool valid = pfTransformer_->addPoints( pftrack, *trackRef, FakeTraj, mymsgwarning);
61  if(valid)
62  PfTrColl->push_back(pftrack);
63 
64  }
65  }
66  iEvent.put(PfTrColl);
67 }
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
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:13
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
bool useQuality_
TRACK QUALITY.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
T const * product() const
Definition: Handle.h:81
std::vector< edm::EDGetTokenT< reco::TrackCollection > > tracksContainers_
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 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().