CMS 3D CMS Logo

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

#include <PFNuclearProducer.h>

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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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

double likelihoodCut_
 
std::vector< edm::EDGetTokenT< reco::NuclearInteractionCollection > > nuclearContainers_
 
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 PFNuclearProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 10 of file PFNuclearProducer.cc.

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

10  :
11  pfTransformer_(nullptr)
12 {
13  produces<reco::PFRecTrackCollection>();
14  produces<reco::PFNuclearInteractionCollection>();
15 
16  std::vector<edm::InputTag> tags=
17  iConfig.getParameter< vector < InputTag > >("nuclearColList");
18 
19  for (unsigned int i=0;i<tags.size();++i)
20  nuclearContainers_.push_back(consumes<reco::NuclearInteractionCollection>(tags[i]));
21 
23  = iConfig.getParameter<double>("likelihoodCut");
24 }
T getParameter(std::string const &) const
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
std::vector< edm::EDGetTokenT< reco::NuclearInteractionCollection > > nuclearContainers_
PFNuclearProducer::~PFNuclearProducer ( )
override

Destructor.

Definition at line 26 of file PFNuclearProducer.cc.

References pfTransformer_.

27 {
28  delete pfTransformer_;
29 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.

Member Function Documentation

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

Definition at line 79 of file PFNuclearProducer.cc.

References edm::EventSetup::get(), MagneticField::inTesla(), seedCreatorFromRegionConsecutiveHitsEDProducer_cff::magneticField, PFTrackTransformer::OnlyProp(), and pfTransformer_.

81 {
83  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
86 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
T get() const
Definition: EventSetup.h:63
void PFNuclearProducer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 90 of file PFNuclearProducer.cc.

References pfTransformer_.

91  {
92  delete pfTransformer_;
93  pfTransformer_=nullptr;
94 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
void PFNuclearProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Produce the PFRecTrack collection.

Definition at line 32 of file PFNuclearProducer.cc.

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

33 {
34  typedef reco::NuclearInteraction::trackRef_iterator trackRef_iterator;
35 
36  //create the empty collections
37  auto pfNuclearColl = std::make_unique<reco::PFNuclearInteractionCollection>();
38  auto pfNuclearRecTrackColl = std::make_unique<reco::PFRecTrackCollection>();
39 
41  int hid=0;
42 
43  // loop on the nuclear interaction collections
44  for (unsigned int istr=0; istr<nuclearContainers_.size();istr++){
45 
47  iEvent.getByToken(nuclearContainers_[istr], nuclCollH);
48  const reco::NuclearInteractionCollection& nuclColl = *(nuclCollH.product());
49 
50  // loop on all NuclearInteraction
51  for( unsigned int icoll=0; icoll < nuclColl.size(); icoll++) {
52 
53  if( nuclColl[icoll].likelihood() < likelihoodCut_) continue;
54 
55  reco::PFRecTrackRefVector pfRecTkcoll;
56 
57  // convert the secondary tracks
58  for(trackRef_iterator it = nuclColl[icoll].secondaryTracks_begin(); it!=nuclColl[icoll].secondaryTracks_end(); it++){
59  reco::PFRecTrack pftrack( (*it)->charge(),
61  it->key(), (reco::TrackRef)((*it).castTo<reco::TrackRef>()) );
62  Trajectory FakeTraj;
63  bool valid = pfTransformer_->addPoints( pftrack, **it, FakeTraj);
64  if(valid) {
65  pfRecTkcoll.push_back(reco::PFRecTrackRef( pfTrackRefProd, hid++ ));
66  pfNuclearRecTrackColl->push_back(pftrack);
67  }
68  }
69  reco::NuclearInteractionRef niRef(nuclCollH, icoll);
70  pfNuclearColl->push_back( reco::PFNuclearInteraction( niRef, pfRecTkcoll ));
71  }
72  }
73  iEvent.put(std::move(pfNuclearRecTrackColl));
74  iEvent.put(std::move(pfNuclearColl));
75 }
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
void likelihood(int &npar, double *grad, double &fval, double *xval, int flag)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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.
std::vector< edm::EDGetTokenT< reco::NuclearInteractionCollection > > nuclearContainers_
std::vector< NuclearInteraction > NuclearInteractionCollection
collection of NuclearInteractions
reco::Vertex::trackRef_iterator trackRef_iterator
RefProd< PROD > getRefBeforePut()
Definition: Event.h:167
T const * product() const
Definition: Handle.h:81
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:21
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:69
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
def move(src, dest)
Definition: eostools.py:510
int icoll
Definition: AMPTWrapper.h:136

Member Data Documentation

double PFNuclearProducer::likelihoodCut_
private

Definition at line 30 of file PFNuclearProducer.h.

Referenced by PFNuclearProducer(), and produce().

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

Definition at line 31 of file PFNuclearProducer.h.

Referenced by PFNuclearProducer(), and produce().

PFTrackTransformer* PFNuclearProducer::pfTransformer_
private

PFTrackTransformer.

Definition at line 29 of file PFNuclearProducer.h.

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