CMS 3D CMS Logo

List of all members | 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
 

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

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

42  : pfTransformer_(nullptr), magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()) {
43  produces<reco::PFV0Collection>();
44  produces<reco::PFRecTrackCollection>();
45 
46  std::vector<edm::InputTag> tags = iConfig.getParameter<vector<InputTag> >("V0List");
47 
48  for (unsigned int i = 0; i < tags.size(); ++i)
49  V0list_.push_back(consumes<reco::VertexCompositeCandidateCollection>(tags[i]));
50 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.cc:30
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: PFV0Producer.cc:32
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:29

◆ ~PFV0Producer()

PFV0Producer::~PFV0Producer ( )
override

Destructor.

Definition at line 52 of file PFV0Producer.cc.

References pfTransformer_.

52 { delete pfTransformer_; }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:29

Member Function Documentation

◆ beginRun()

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

Definition at line 96 of file PFV0Producer.cc.

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

96  {
97  auto const& magneticField = &iSetup.getData(magneticFieldToken_);
100 }
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: PFV0Producer.cc:32
bool getData(T &iHolder) const
Definition: EventSetup.h:122
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:29

◆ endRun()

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

Definition at line 103 of file PFV0Producer.cc.

References pfTransformer_.

103  {
104  delete pfTransformer_;
105  pfTransformer_ = nullptr;
106 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:29

◆ produce()

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

Produce the PFRecTrack collection.

Definition at line 54 of file PFV0Producer.cc.

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

54  {
55  LogDebug("PFV0Producer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run();
56  //create the empty collections
57  auto pfV0Coll = std::make_unique<PFV0Collection>();
58 
59  auto pfV0RecTrackColl = std::make_unique<reco::PFRecTrackCollection>();
60 
61  reco::PFRecTrackRefProd pfTrackRefProd = iEvent.getRefBeforePut<reco::PFRecTrackCollection>();
62  int idx = 0;
63 
64  for (unsigned int il = 0; il < V0list_.size(); il++) {
66  iEvent.getByToken(V0list_[il], V0coll);
67  LogDebug("PFV0Producer") << "V0list_[" << il << "] contains " << V0coll->size() << " V0 candidates ";
68  for (unsigned int iv = 0; iv < V0coll->size(); iv++) {
69  VertexCompositeCandidateRef V0(V0coll, iv);
70  vector<TrackRef> Tracks;
71  vector<PFRecTrackRef> PFTracks;
72  for (unsigned int ndx = 0; ndx < V0->numberOfDaughters(); ndx++) {
73  Tracks.push_back((dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track());
74  TrackRef trackRef = (dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track();
75 
76  reco::PFRecTrack pfRecTrack(trackRef->charge(), reco::PFRecTrack::KF, trackRef.key(), trackRef);
77 
78  Trajectory FakeTraj;
79  bool valid = pfTransformer_->addPoints(pfRecTrack, *trackRef, FakeTraj);
80  if (valid) {
81  PFTracks.push_back(reco::PFRecTrackRef(pfTrackRefProd, idx++));
82  pfV0RecTrackColl->push_back(pfRecTrack);
83  }
84  }
85  if ((PFTracks.size() == 2) && (Tracks.size() == 2)) {
86  pfV0Coll->push_back(PFV0(V0, PFTracks, Tracks));
87  }
88  }
89  }
90 
91  iEvent.put(std::move(pfV0Coll));
92  iEvent.put(std::move(pfV0RecTrackColl));
93 }
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:20
int32_t *__restrict__ iv
key_type key() const
Accessor for product key.
Definition: Ref.h:250
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.cc:30
int iEvent
Definition: GenABIO.cc:224
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:29
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 32 of file PFV0Producer.cc.

Referenced by beginRun().

◆ pfTransformer_

PFTrackTransformer* PFV0Producer::pfTransformer_
private

PFTrackTransformer.

Definition at line 29 of file PFV0Producer.cc.

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

◆ V0list_

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

Definition at line 30 of file PFV0Producer.cc.

Referenced by PFV0Producer(), and produce().