CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFV0Producer Class Reference

#include <PFV0Producer.h>

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 15 of file PFV0Producer.h.

Constructor & Destructor Documentation

◆ PFV0Producer()

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

Constructor.

Definition at line 13 of file PFV0Producer.cc.

14  : pfTransformer_(nullptr), magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()) {
15  produces<reco::PFV0Collection>();
16  produces<reco::PFRecTrackCollection>();
17 
18  std::vector<edm::InputTag> tags = iConfig.getParameter<vector<InputTag> >("V0List");
19 
20  for (unsigned int i = 0; i < tags.size(); ++i)
21  V0list_.push_back(consumes<reco::VertexCompositeCandidateCollection>(tags[i]));
22 }

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

◆ ~PFV0Producer()

PFV0Producer::~PFV0Producer ( )
override

Destructor.

Definition at line 24 of file PFV0Producer.cc.

24 { delete pfTransformer_; }

References pfTransformer_.

Member Function Documentation

◆ beginRun()

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

◆ endRun()

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

Definition at line 75 of file PFV0Producer.cc.

75  {
76  delete pfTransformer_;
77  pfTransformer_ = nullptr;
78 }

References pfTransformer_.

◆ produce()

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

Produce the PFRecTrack collection.

Definition at line 26 of file PFV0Producer.cc.

26  {
27  LogDebug("PFV0Producer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run();
28  //create the empty collections
29  auto pfV0Coll = std::make_unique<PFV0Collection>();
30 
31  auto pfV0RecTrackColl = std::make_unique<reco::PFRecTrackCollection>();
32 
33  reco::PFRecTrackRefProd pfTrackRefProd = iEvent.getRefBeforePut<reco::PFRecTrackCollection>();
34  int idx = 0;
35 
36  for (unsigned int il = 0; il < V0list_.size(); il++) {
38  iEvent.getByToken(V0list_[il], V0coll);
39  LogDebug("PFV0Producer") << "V0list_[" << il << "] contains " << V0coll->size() << " V0 candidates ";
40  for (unsigned int iv = 0; iv < V0coll->size(); iv++) {
41  VertexCompositeCandidateRef V0(V0coll, iv);
42  vector<TrackRef> Tracks;
43  vector<PFRecTrackRef> PFTracks;
44  for (unsigned int ndx = 0; ndx < V0->numberOfDaughters(); ndx++) {
45  Tracks.push_back((dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track());
46  TrackRef trackRef = (dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track();
47 
48  reco::PFRecTrack pfRecTrack(trackRef->charge(), reco::PFRecTrack::KF, trackRef.key(), trackRef);
49 
50  Trajectory FakeTraj;
51  bool valid = pfTransformer_->addPoints(pfRecTrack, *trackRef, FakeTraj);
52  if (valid) {
53  PFTracks.push_back(reco::PFRecTrackRef(pfTrackRefProd, idx++));
54  pfV0RecTrackColl->push_back(pfRecTrack);
55  }
56  }
57  if ((PFTracks.size() == 2) && (Tracks.size() == 2)) {
58  pfV0Coll->push_back(PFV0(V0, PFTracks, Tracks));
59  }
60  }
61  }
62 
63  iEvent.put(std::move(pfV0Coll));
64  iEvent.put(std::move(pfV0RecTrackColl));
65 }

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 RunInfoPI::valid.

Member Data Documentation

◆ magneticFieldToken_

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

Definition at line 34 of file PFV0Producer.h.

Referenced by beginRun().

◆ pfTransformer_

PFTrackTransformer* PFV0Producer::pfTransformer_
private

PFTrackTransformer.

Definition at line 31 of file PFV0Producer.h.

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

◆ V0list_

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

Definition at line 32 of file PFV0Producer.h.

Referenced by PFV0Producer(), and produce().

edm::RefProd
Definition: EDProductfwd.h:25
mps_fire.i
i
Definition: mps_fire.py:428
gpuVertexFinder::iv
int32_t *__restrict__ iv
Definition: gpuClusterTracksDBSCAN.h:42
reco::PFRecTrack::KF
Definition: PFRecTrack.h:25
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
edm::Handle
Definition: AssociativeIterator.h:50
edm::Ref< VertexCompositeCandidateCollection >
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
PFTrackTransformer::addPoints
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.
Definition: PFTrackTransformer.cc:40
Point3DBase< float, GlobalTag >
PFV0Producer::pfTransformer_
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:31
pfTrackElec_cfi.PFV0
PFV0
Definition: pfTrackElec_cfi.py:27
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
iEvent
int iEvent
Definition: GenABIO.cc:224
gather_cfg.Tracks
Tracks
Definition: gather_cfg.py:251
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::PFRecTrack
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:20
Trajectory
Definition: Trajectory.h:38
PFTrackTransformer::OnlyProp
void OnlyProp()
Definition: PFTrackTransformer.h:54
PFV0Producer::V0list_
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.h:32
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
reco::PFRecTrackCollection
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
PFTrackTransformer
Definition: PFTrackTransformer.h:34
PFV0Producer::magneticFieldToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: PFV0Producer.h:34