CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PFV0Producer Class Reference
Inheritance diagram for PFV0Producer:
edm::stream::EDProducer<>

Public Member Functions

 PFV0Producer (const edm::ParameterSet &)
 Constructor. More...
 
 ~PFV0Producer () 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...
 
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
 

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 13 of file PFV0Producer.cc.

Constructor & Destructor Documentation

◆ PFV0Producer()

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

Constructor.

Definition at line 50 of file PFV0Producer.cc.

References edm::BeginRun, edm::ParameterSet::getParameter(), mps_fire::i, getPayloadData::tags, and V0list_.

51  : pfTransformer_(nullptr), magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()) {
52  produces<reco::PFV0Collection>();
53  produces<reco::PFRecTrackCollection>();
54 
55  std::vector<edm::InputTag> tags = iConfig.getParameter<vector<InputTag>>("V0List");
56 
57  for (unsigned int i = 0; i < tags.size(); ++i)
58  V0list_.push_back(consumes<reco::VertexCompositeCandidateCollection>(tags[i]));
59 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.cc:32
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: PFV0Producer.cc:34
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:31

◆ ~PFV0Producer()

PFV0Producer::~PFV0Producer ( )
override

Destructor.

Definition at line 61 of file PFV0Producer.cc.

References pfTransformer_.

61 { delete pfTransformer_; }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:31

Member Function Documentation

◆ beginRun()

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

Definition at line 105 of file PFV0Producer.cc.

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

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

◆ endRun()

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

Definition at line 112 of file PFV0Producer.cc.

References pfTransformer_.

112  {
113  delete pfTransformer_;
114  pfTransformer_ = nullptr;
115 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:31

◆ fillDescriptions()

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

Definition at line 40 of file PFV0Producer.cc.

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

40  {
42  desc.add<std::vector<edm::InputTag>>(
43  "V0List", {edm::InputTag("generalV0Candidates", "Kshort"), edm::InputTag("generalV0Candidates", "Lambda")});
44  descriptions.add("pfV0", desc);
45 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

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

Produce the PFRecTrack collection.

Definition at line 63 of file PFV0Producer.cc.

References PFTrackTransformer::addPoints(), heavyIonCSV_trainingSettings::idx, iEvent, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::iv, edm::Ref< C, T, F >::key(), reco::PFRecTrack::KF, LogDebug, eostools::move(), pfTransformer_, gather_cfg::Tracks, V0list_, and validateGeometry_cfg::valid.

63  {
64  LogDebug("PFV0Producer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run();
65  //create the empty collections
66  auto pfV0Coll = std::make_unique<PFV0Collection>();
67 
68  auto pfV0RecTrackColl = std::make_unique<reco::PFRecTrackCollection>();
69 
70  reco::PFRecTrackRefProd pfTrackRefProd = iEvent.getRefBeforePut<reco::PFRecTrackCollection>();
71  int idx = 0;
72 
73  for (unsigned int il = 0; il < V0list_.size(); il++) {
75  iEvent.getByToken(V0list_[il], V0coll);
76  LogDebug("PFV0Producer") << "V0list_[" << il << "] contains " << V0coll->size() << " V0 candidates ";
77  for (unsigned int iv = 0; iv < V0coll->size(); iv++) {
78  VertexCompositeCandidateRef V0(V0coll, iv);
79  vector<TrackRef> Tracks;
80  vector<PFRecTrackRef> PFTracks;
81  for (unsigned int ndx = 0; ndx < V0->numberOfDaughters(); ndx++) {
82  Tracks.push_back((dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track());
83  TrackRef trackRef = (dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track();
84 
85  reco::PFRecTrack pfRecTrack(trackRef->charge(), reco::PFRecTrack::KF, trackRef.key(), trackRef);
86 
87  Trajectory FakeTraj;
88  bool valid = pfTransformer_->addPoints(pfRecTrack, *trackRef, FakeTraj);
89  if (valid) {
90  PFTracks.push_back(reco::PFRecTrackRef(pfTrackRefProd, idx++));
91  pfV0RecTrackColl->push_back(pfRecTrack);
92  }
93  }
94  if ((PFTracks.size() == 2) && (Tracks.size() == 2)) {
95  pfV0Coll->push_back(PFV0(V0, PFTracks, Tracks));
96  }
97  }
98  }
99 
100  iEvent.put(std::move(pfV0Coll));
101  iEvent.put(std::move(pfV0RecTrackColl));
102 }
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:20
key_type key() const
Accessor for product key.
Definition: Ref.h:244
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.cc:32
int iEvent
Definition: GenABIO.cc:224
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:31
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< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
def move(src, dest)
Definition: eostools.py:511
#define LogDebug(id)

Member Data Documentation

◆ magneticFieldToken_

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

Definition at line 34 of file PFV0Producer.cc.

Referenced by beginRun().

◆ pfTransformer_

PFTrackTransformer* PFV0Producer::pfTransformer_
private

PFTrackTransformer.

Definition at line 31 of file PFV0Producer.cc.

Referenced by beginRun(), endRun(), produce(), and ~PFV0Producer().

◆ V0list_

std::vector<edm::EDGetTokenT<reco::VertexCompositeCandidateCollection> > PFV0Producer::V0list_
private

Definition at line 32 of file PFV0Producer.cc.

Referenced by PFV0Producer(), and produce().