CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
LightPFTrackProducer Class Reference
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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

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

const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldToken_
 
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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 12 of file LightPFTrackProducer.cc.

Constructor & Destructor Documentation

◆ LightPFTrackProducer()

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

Constructor.

Definition at line 53 of file LightPFTrackProducer.cc.

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

54  : pfTransformer_(nullptr), magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()) {
55  produces<reco::PFRecTrackCollection>();
56 
57  std::vector<InputTag> tags = iConfig.getParameter<vector<InputTag>>("TkColList");
58 
59  for (unsigned int i = 0; i < tags.size(); ++i)
60  tracksContainers_.push_back(consumes<reco::TrackCollection>(tags[i]));
61 
62  useQuality_ = iConfig.getParameter<bool>("UseQuality");
64 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
bool useQuality_
TRACK QUALITY.
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:126
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
std::vector< edm::EDGetTokenT< reco::TrackCollection > > tracksContainers_
reco::TrackBase::TrackQuality trackQuality_

◆ ~LightPFTrackProducer()

LightPFTrackProducer::~LightPFTrackProducer ( )
override

Destructor.

Definition at line 66 of file LightPFTrackProducer.cc.

References pfTransformer_.

66 { delete pfTransformer_; }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.

Member Function Documentation

◆ beginRun()

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

Definition at line 93 of file LightPFTrackProducer.cc.

References edm::EventSetup::getData(), HLT_2024v14_cff::magneticField, magneticFieldToken_, PFTrackTransformer::OnlyProp(), and pfTransformer_.

93  {
94  auto const& magneticField = &iSetup.getData(magneticFieldToken_);
97 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_

◆ endRun()

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

Definition at line 100 of file LightPFTrackProducer.cc.

References pfTransformer_.

100  {
101  delete pfTransformer_;
102  pfTransformer_ = nullptr;
103 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.

◆ fillDescriptions()

void LightPFTrackProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 42 of file LightPFTrackProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

42  {
44  desc.add<std::string>("TrackQuality", "highPurity");
45  desc.add<bool>("UseQuality", true);
46  desc.add<std::vector<edm::InputTag>>(
47  "TkColList", {edm::InputTag("generalTracks"), edm::InputTag("secStep"), edm::InputTag("thStep")});
48  descriptions.add("lightpftrack", desc);
49 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void LightPFTrackProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Produce the PFRecTrack collection.

Definition at line 68 of file LightPFTrackProducer.cc.

References PFTrackTransformer::addPoints(), mps_fire::i, iEvent, reco::PFRecTrack::KF, eostools::move(), pfTransformer_, edm::Handle< T >::product(), quality, trackQuality_, tracksContainers_, useQuality_, and validateGeometry_cfg::valid.

68  {
69  //create the empty collections
70  auto PfTrColl = std::make_unique<reco::PFRecTrackCollection>();
71 
72  for (unsigned int istr = 0; istr < tracksContainers_.size(); istr++) {
73  //Track collection
74  Handle<reco::TrackCollection> tkRefCollection;
75  iEvent.getByToken(tracksContainers_[istr], tkRefCollection);
76  reco::TrackCollection Tk = *(tkRefCollection.product());
77  for (unsigned int i = 0; i < Tk.size(); i++) {
78  if (useQuality_ && (!(Tk[i].quality(trackQuality_))))
79  continue;
80  reco::TrackRef trackRef(tkRefCollection, i);
81  reco::PFRecTrack pftrack(trackRef->charge(), reco::PFRecTrack::KF, i, trackRef);
82  Trajectory FakeTraj;
83  bool mymsgwarning = false;
84  bool valid = pfTransformer_->addPoints(pftrack, *trackRef, FakeTraj, mymsgwarning);
85  if (valid)
86  PfTrColl->push_back(pftrack);
87  }
88  }
89  iEvent.put(std::move(PfTrColl));
90 }
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:20
T const * product() const
Definition: Handle.h:70
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
string quality
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
int iEvent
Definition: GenABIO.cc:224
bool useQuality_
TRACK QUALITY.
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< edm::EDGetTokenT< reco::TrackCollection > > tracksContainers_
reco::TrackBase::TrackQuality trackQuality_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ magneticFieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> LightPFTrackProducer::magneticFieldToken_
private

Definition at line 33 of file LightPFTrackProducer.cc.

Referenced by beginRun().

◆ pfTransformer_

PFTrackTransformer* LightPFTrackProducer::pfTransformer_
private

◆ trackQuality_

reco::TrackBase::TrackQuality LightPFTrackProducer::trackQuality_
private

Definition at line 36 of file LightPFTrackProducer.cc.

Referenced by LightPFTrackProducer(), and produce().

◆ tracksContainers_

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

Definition at line 31 of file LightPFTrackProducer.cc.

Referenced by LightPFTrackProducer(), and produce().

◆ useQuality_

bool LightPFTrackProducer::useQuality_
private

TRACK QUALITY.

Definition at line 35 of file LightPFTrackProducer.cc.

Referenced by LightPFTrackProducer(), and produce().