CMS 3D CMS Logo

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

#include <PFDisplacedTrackerVertexProducer.h>

Inheritance diagram for PFDisplacedTrackerVertexProducer:
edm::stream::EDProducer<>

Public Member Functions

 PFDisplacedTrackerVertexProducer (const edm::ParameterSet &)
 Constructor. More...
 
 ~PFDisplacedTrackerVertexProducer () 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

edm::EDGetTokenT< reco::PFDisplacedVertexCollectionpfDisplacedVertexContainer_
 
edm::EDGetTokenT< reco::TrackCollectionpfTrackContainer_
 
PFTrackTransformerpfTransformer_
 PFTrackTransformer. More...
 

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 12 of file PFDisplacedTrackerVertexProducer.h.

Constructor & Destructor Documentation

◆ PFDisplacedTrackerVertexProducer()

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

Constructor.

Definition at line 10 of file PFDisplacedTrackerVertexProducer.cc.

11  : pfTransformer_(nullptr) {
12  produces<reco::PFRecTrackCollection>();
13  produces<reco::PFDisplacedTrackerVertexCollection>();
14 
16  consumes<reco::PFDisplacedVertexCollection>(iConfig.getParameter<InputTag>("displacedTrackerVertexColl"));
17 
18  pfTrackContainer_ = consumes<reco::TrackCollection>(iConfig.getParameter<InputTag>("trackColl"));
19 }

References edm::ParameterSet::getParameter(), pfDisplacedVertexContainer_, and pfTrackContainer_.

◆ ~PFDisplacedTrackerVertexProducer()

PFDisplacedTrackerVertexProducer::~PFDisplacedTrackerVertexProducer ( )
override

Destructor.

Definition at line 21 of file PFDisplacedTrackerVertexProducer.cc.

21 { delete pfTransformer_; }

References pfTransformer_.

Member Function Documentation

◆ beginRun()

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

◆ endRun()

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

Definition at line 87 of file PFDisplacedTrackerVertexProducer.cc.

87  {
88  delete pfTransformer_;
89  pfTransformer_ = nullptr;
90 }

References pfTransformer_.

◆ produce()

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

Produce the PFRecTrack collection.

Definition at line 23 of file PFDisplacedTrackerVertexProducer.cc.

23  {
24  //create the empty collections
25  auto pfDisplacedTrackerVertexColl = std::make_unique<reco::PFDisplacedTrackerVertexCollection>();
26  auto pfRecTrackColl = std::make_unique<reco::PFRecTrackCollection>();
27 
28  reco::PFRecTrackRefProd pfTrackRefProd = iEvent.getRefBeforePut<reco::PFRecTrackCollection>();
29 
31  iEvent.getByToken(pfDisplacedVertexContainer_, nuclCollH);
32  const reco::PFDisplacedVertexCollection& nuclColl = *(nuclCollH.product());
33 
35  iEvent.getByToken(pfTrackContainer_, trackColl);
36 
37  int idx = 0;
38 
39  // cout << "Size of Displaced Vertices "
40  // << nuclColl.size() << endl;
41 
42  // loop on all NuclearInteraction
43  for (unsigned int icoll = 0; icoll < nuclColl.size(); icoll++) {
44  reco::PFRecTrackRefVector pfRecTkcoll;
45 
46  std::vector<reco::Track> refittedTracks = nuclColl[icoll].refittedTracks();
47 
48  // convert the secondary tracks
49  for (unsigned it = 0; it < refittedTracks.size(); it++) {
50  reco::TrackBaseRef trackBaseRef = nuclColl[icoll].originalTrack(refittedTracks[it]);
51 
52  // cout << "track base pt = " << trackBaseRef->pt() << endl;
53 
54  reco::TrackRef trackRef(trackColl, trackBaseRef.key());
55 
56  // cout << "track pt = " << trackRef->pt() << endl;
57 
58  reco::PFRecTrack pfRecTrack(trackBaseRef->charge(), reco::PFRecTrack::KF, trackBaseRef.key(), trackRef);
59 
60  // cout << pfRecTrack << endl;
61 
62  Trajectory FakeTraj;
63  bool valid = pfTransformer_->addPoints(pfRecTrack, *trackBaseRef, FakeTraj);
64  if (valid) {
65  pfRecTkcoll.push_back(reco::PFRecTrackRef(pfTrackRefProd, idx++));
66  pfRecTrackColl->push_back(pfRecTrack);
67  // cout << "after "<< pfRecTrack << endl;
68  }
69  }
70  reco::PFDisplacedVertexRef niRef(nuclCollH, icoll);
71  pfDisplacedTrackerVertexColl->push_back(reco::PFDisplacedTrackerVertex(niRef, pfRecTkcoll));
72  }
73 
74  iEvent.put(std::move(pfRecTrackColl));
75  iEvent.put(std::move(pfDisplacedTrackerVertexColl));
76 }

References PFTrackTransformer::addPoints(), reco::TrackBase::charge(), icoll, charmTagsComputerCvsB_cfi::idx, iEvent, edm::RefToBase< T >::key(), reco::PFRecTrack::KF, eostools::move(), pfDisplacedVertexContainer_, pfTrackContainer_, pfTransformer_, edm::RefVector< C, T, F >::push_back(), tkAlTrackRefitSequence_cff::refittedTracks, pfDisplacedTrackerVertex_cfi::trackColl, and validateGeometry_cfg::valid.

Member Data Documentation

◆ pfDisplacedVertexContainer_

edm::EDGetTokenT<reco::PFDisplacedVertexCollection> PFDisplacedTrackerVertexProducer::pfDisplacedVertexContainer_
private

Definition at line 29 of file PFDisplacedTrackerVertexProducer.h.

Referenced by PFDisplacedTrackerVertexProducer(), and produce().

◆ pfTrackContainer_

edm::EDGetTokenT<reco::TrackCollection> PFDisplacedTrackerVertexProducer::pfTrackContainer_
private

Definition at line 30 of file PFDisplacedTrackerVertexProducer.h.

Referenced by PFDisplacedTrackerVertexProducer(), and produce().

◆ pfTransformer_

PFTrackTransformer* PFDisplacedTrackerVertexProducer::pfTransformer_
private
edm::RefProd
Definition: EDProductfwd.h:25
pfDisplacedTrackerVertex_cfi.trackColl
trackColl
Definition: pfDisplacedTrackerVertex_cfi.py:6
edm::RefToBase::key
size_t key() const
Definition: RefToBase.h:219
HLT_2018_cff.magneticField
magneticField
Definition: HLT_2018_cff.py:348
PFDisplacedTrackerVertexProducer::pfDisplacedVertexContainer_
edm::EDGetTokenT< reco::PFDisplacedVertexCollection > pfDisplacedVertexContainer_
Definition: PFDisplacedTrackerVertexProducer.h:29
charmTagsComputerCvsB_cfi.idx
idx
Definition: charmTagsComputerCvsB_cfi.py:108
reco::PFRecTrack::KF
Definition: PFRecTrack.h:27
edm::RefVector< PFRecTrackCollection >
edm::Handle< reco::PFDisplacedVertexCollection >
reco::PFDisplacedVertexCollection
std::vector< PFDisplacedVertex > PFDisplacedVertexCollection
collection of PFDisplacedVertex objects
Definition: PFDisplacedVertexFwd.h:10
validateGeometry_cfg.valid
valid
Definition: validateGeometry_cfg.py:21
edm::Ref< TrackCollection >
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 >
reco::TrackBase::charge
int charge() const
track electric charge
Definition: TrackBase.h:581
Point3DBase< float, GlobalTag >
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
iEvent
int iEvent
Definition: GenABIO.cc:224
get
#define get
edm::RefVector::push_back
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:67
PFDisplacedTrackerVertexProducer::pfTrackContainer_
edm::EDGetTokenT< reco::TrackCollection > pfTrackContainer_
Definition: PFDisplacedTrackerVertexProducer.h:30
reco::PFDisplacedTrackerVertex
Definition: PFDisplacedTrackerVertex.h:15
tkAlTrackRefitSequence_cff.refittedTracks
refittedTracks
Definition: tkAlTrackRefitSequence_cff.py:6
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
PFDisplacedTrackerVertexProducer::pfTransformer_
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFDisplacedTrackerVertexProducer.h:28
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
icoll
int icoll
Definition: AMPTWrapper.h:146
edm::RefToBase< reco::Track >
reco::PFRecTrackCollection
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
PFTrackTransformer
Definition: PFTrackTransformer.h:34
edm::InputTag
Definition: InputTag.h:15