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

Constructor & Destructor Documentation

◆ PFDisplacedTrackerVertexProducer()

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

Constructor.

Definition at line 9 of file PFDisplacedTrackerVertexProducer.cc.

10  : pfTransformer_(nullptr), magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()) {
11  produces<reco::PFRecTrackCollection>();
12  produces<reco::PFDisplacedTrackerVertexCollection>();
13 
15  consumes<reco::PFDisplacedVertexCollection>(iConfig.getParameter<InputTag>("displacedTrackerVertexColl"));
16 
17  pfTrackContainer_ = consumes<reco::TrackCollection>(iConfig.getParameter<InputTag>("trackColl"));
18 }

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

◆ ~PFDisplacedTrackerVertexProducer()

PFDisplacedTrackerVertexProducer::~PFDisplacedTrackerVertexProducer ( )
override

Destructor.

Definition at line 20 of file PFDisplacedTrackerVertexProducer.cc.

20 { 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 85 of file PFDisplacedTrackerVertexProducer.cc.

85  {
86  delete pfTransformer_;
87  pfTransformer_ = nullptr;
88 }

References pfTransformer_.

◆ produce()

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

Produce the PFRecTrack collection.

Definition at line 22 of file PFDisplacedTrackerVertexProducer.cc.

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

References PFTrackTransformer::addPoints(), reco::TrackBase::charge(), icoll, heavyIonCSV_trainingSettings::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 RunInfoPI::valid.

Member Data Documentation

◆ magneticFieldToken_

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

Definition at line 34 of file PFDisplacedTrackerVertexProducer.h.

Referenced by beginRun().

◆ pfDisplacedVertexContainer_

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

Definition at line 31 of file PFDisplacedTrackerVertexProducer.h.

Referenced by PFDisplacedTrackerVertexProducer(), and produce().

◆ pfTrackContainer_

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

Definition at line 32 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
PFDisplacedTrackerVertexProducer::pfDisplacedVertexContainer_
edm::EDGetTokenT< reco::PFDisplacedVertexCollection > pfDisplacedVertexContainer_
Definition: PFDisplacedTrackerVertexProducer.h:31
reco::PFRecTrack::KF
Definition: PFRecTrack.h:25
edm::RefVector< PFRecTrackCollection >
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
edm::Handle< reco::PFDisplacedVertexCollection >
reco::PFDisplacedVertexCollection
std::vector< PFDisplacedVertex > PFDisplacedVertexCollection
collection of PFDisplacedVertex objects
Definition: PFDisplacedVertexFwd.h:10
edm::Ref< TrackCollection >
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
reco::TrackBase::charge
int charge() const
track electric charge
Definition: TrackBase.h:596
Point3DBase< float, GlobalTag >
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
iEvent
int iEvent
Definition: GenABIO.cc:224
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:32
reco::PFDisplacedTrackerVertex
Definition: PFDisplacedTrackerVertex.h:15
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
tkAlTrackRefitSequence_cff.refittedTracks
refittedTracks
Definition: tkAlTrackRefitSequence_cff.py:6
eostools.move
def move(src, dest)
Definition: eostools.py:511
PFDisplacedTrackerVertexProducer::pfTransformer_
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFDisplacedTrackerVertexProducer.h:30
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
icoll
int icoll
Definition: AMPTWrapper.h:146
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::RefToBase< reco::Track >
PFDisplacedTrackerVertexProducer::magneticFieldToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: PFDisplacedTrackerVertexProducer.h:34
reco::PFRecTrackCollection
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
PFTrackTransformer
Definition: PFTrackTransformer.h:34
edm::InputTag
Definition: InputTag.h:15