CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFNuclearProducer Class Reference
Inheritance diagram for PFNuclearProducer:
edm::stream::EDProducer<>

Public Member Functions

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

double likelihoodCut_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagneticFieldToken_
 
std::vector< edm::EDGetTokenT< reco::NuclearInteractionCollection > > nuclearContainers_
 
PFTrackTransformerpfTransformer_
 PFTrackTransformer. More...
 

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 11 of file PFNuclearProducer.cc.

Constructor & Destructor Documentation

◆ PFNuclearProducer()

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

Constructor.

Definition at line 39 of file PFNuclearProducer.cc.

40  : pfTransformer_(nullptr), magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()) {
41  produces<reco::PFRecTrackCollection>();
42  produces<reco::PFNuclearInteractionCollection>();
43 
44  std::vector<edm::InputTag> tags = iConfig.getParameter<vector<InputTag> >("nuclearColList");
45 
46  for (unsigned int i = 0; i < tags.size(); ++i)
47  nuclearContainers_.push_back(consumes<reco::NuclearInteractionCollection>(tags[i]));
48 
49  likelihoodCut_ = iConfig.getParameter<double>("likelihoodCut");
50 }

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

◆ ~PFNuclearProducer()

PFNuclearProducer::~PFNuclearProducer ( )
override

Destructor.

Definition at line 52 of file PFNuclearProducer.cc.

52 { delete pfTransformer_; }

References pfTransformer_.

Member Function Documentation

◆ beginRun()

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

◆ endRun()

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

Definition at line 105 of file PFNuclearProducer.cc.

105  {
106  delete pfTransformer_;
107  pfTransformer_ = nullptr;
108 }

References pfTransformer_.

◆ produce()

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

Produce the PFRecTrack collection.

Definition at line 54 of file PFNuclearProducer.cc.

54  {
55  typedef reco::NuclearInteraction::trackRef_iterator trackRef_iterator;
56 
57  //create the empty collections
58  auto pfNuclearColl = std::make_unique<reco::PFNuclearInteractionCollection>();
59  auto pfNuclearRecTrackColl = std::make_unique<reco::PFRecTrackCollection>();
60 
61  reco::PFRecTrackRefProd pfTrackRefProd = iEvent.getRefBeforePut<reco::PFRecTrackCollection>();
62  int hid = 0;
63 
64  // loop on the nuclear interaction collections
65  for (unsigned int istr = 0; istr < nuclearContainers_.size(); istr++) {
67  iEvent.getByToken(nuclearContainers_[istr], nuclCollH);
68  const reco::NuclearInteractionCollection& nuclColl = *(nuclCollH.product());
69 
70  // loop on all NuclearInteraction
71  for (unsigned int icoll = 0; icoll < nuclColl.size(); icoll++) {
72  if (nuclColl[icoll].likelihood() < likelihoodCut_)
73  continue;
74 
75  reco::PFRecTrackRefVector pfRecTkcoll;
76 
77  // convert the secondary tracks
78  for (trackRef_iterator it = nuclColl[icoll].secondaryTracks_begin(); it != nuclColl[icoll].secondaryTracks_end();
79  it++) {
80  reco::PFRecTrack pftrack(
81  (*it)->charge(), reco::PFRecTrack::KF, it->key(), (reco::TrackRef)((*it).castTo<reco::TrackRef>()));
82  Trajectory FakeTraj;
83  bool valid = pfTransformer_->addPoints(pftrack, **it, FakeTraj);
84  if (valid) {
85  pfRecTkcoll.push_back(reco::PFRecTrackRef(pfTrackRefProd, hid++));
86  pfNuclearRecTrackColl->push_back(pftrack);
87  }
88  }
89  reco::NuclearInteractionRef niRef(nuclCollH, icoll);
90  pfNuclearColl->push_back(reco::PFNuclearInteraction(niRef, pfRecTkcoll));
91  }
92  }
93  iEvent.put(std::move(pfNuclearRecTrackColl));
94  iEvent.put(std::move(pfNuclearColl));
95 }

References PFTrackTransformer::addPoints(), icoll, iEvent, reco::PFRecTrack::KF, likelihood(), likelihoodCut_, eostools::move(), nuclearContainers_, pfTransformer_, edm::Handle< T >::product(), edm::RefVector< C, T, F >::push_back(), and RunInfoPI::valid.

Member Data Documentation

◆ likelihoodCut_

double PFNuclearProducer::likelihoodCut_
private

Definition at line 28 of file PFNuclearProducer.cc.

Referenced by PFNuclearProducer(), and produce().

◆ magneticFieldToken_

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

Definition at line 31 of file PFNuclearProducer.cc.

Referenced by beginRun().

◆ nuclearContainers_

std::vector<edm::EDGetTokenT<reco::NuclearInteractionCollection> > PFNuclearProducer::nuclearContainers_
private

Definition at line 29 of file PFNuclearProducer.cc.

Referenced by PFNuclearProducer(), and produce().

◆ pfTransformer_

PFTrackTransformer* PFNuclearProducer::pfTransformer_
private

PFTrackTransformer.

Definition at line 27 of file PFNuclearProducer.cc.

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

edm::RefProd
Definition: EDProductfwd.h:25
mps_fire.i
i
Definition: mps_fire.py:428
edm::Handle::product
T const * product() const
Definition: Handle.h:70
PFNuclearProducer::magneticFieldToken_
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: PFNuclearProducer.cc:31
reco::PFNuclearInteraction
Definition: PFNuclearInteraction.h:15
reco::PFRecTrack::KF
Definition: PFRecTrack.h:25
edm::RefVector< PFRecTrackCollection >
HLT_FULL_cff.magneticField
magneticField
Definition: HLT_FULL_cff.py:348
edm::Handle
Definition: AssociativeIterator.h:50
likelihood
void likelihood(int &npar, double *grad, double &fval, double *xval, int flag)
Definition: MuScleFitUtils.cc:1784
edm::Ref< TrackCollection >
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::NuclearInteractionCollection
std::vector< NuclearInteraction > NuclearInteractionCollection
collection of NuclearInteractions
Definition: NuclearInteractionFwd.h:8
PFNuclearProducer::nuclearContainers_
std::vector< edm::EDGetTokenT< reco::NuclearInteractionCollection > > nuclearContainers_
Definition: PFNuclearProducer.cc:29
Point3DBase< float, GlobalTag >
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
reco::NuclearInteraction::trackRef_iterator
reco::Vertex::trackRef_iterator trackRef_iterator
Definition: NuclearInteraction.h:15
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
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
PFNuclearProducer::likelihoodCut_
double likelihoodCut_
Definition: PFNuclearProducer.cc:28
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
icoll
int icoll
Definition: AMPTWrapper.h:146
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
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
PFTrackTransformer
Definition: PFTrackTransformer.h:34
PFNuclearProducer::pfTransformer_
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFNuclearProducer.cc:27