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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () 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

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

Constructor & Destructor Documentation

◆ PFV0Producer()

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

Constructor.

Definition at line 15 of file PFV0Producer.cc.

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

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

◆ ~PFV0Producer()

PFV0Producer::~PFV0Producer ( )
override

Destructor.

Definition at line 25 of file PFV0Producer.cc.

25 { 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 77 of file PFV0Producer.cc.

77  {
78  delete pfTransformer_;
79  pfTransformer_ = nullptr;
80 }

References pfTransformer_.

◆ produce()

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

Produce the PFRecTrack collection.

Definition at line 27 of file PFV0Producer.cc.

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

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

Member Data Documentation

◆ pfTransformer_

PFTrackTransformer* PFV0Producer::pfTransformer_
private

PFTrackTransformer.

Definition at line 29 of file PFV0Producer.h.

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

◆ V0list_

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

Definition at line 30 of file PFV0Producer.h.

Referenced by PFV0Producer(), and produce().

edm::RefProd
Definition: EDProductfwd.h:25
mps_fire.i
i
Definition: mps_fire.py:355
HLT_2018_cff.magneticField
magneticField
Definition: HLT_2018_cff.py:348
reco::PFRecTrack::KF
Definition: PFRecTrack.h:27
edm::Handle
Definition: AssociativeIterator.h:50
training_settings.idx
idx
Definition: training_settings.py:16
validateGeometry_cfg.valid
valid
Definition: validateGeometry_cfg.py:21
edm::Ref< VertexCompositeCandidateCollection >
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::ESHandle< MagneticField >
Point3DBase< float, GlobalTag >
PFV0Producer::pfTransformer_
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:29
pfTrackElec_cfi.PFV0
PFV0
Definition: pfTrackElec_cfi.py:27
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
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
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
reco::PFRecTrack
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
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:30
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
PFTrackTransformer
Definition: PFTrackTransformer.h:34