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 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

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

Constructor & Destructor Documentation

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

Constructor.

Definition at line 15 of file PFV0Producer.cc.

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

15  :
16  pfTransformer_(nullptr)
17 {
18 
19  produces<reco::PFV0Collection>();
20  produces<reco::PFRecTrackCollection>();
21 
22  std::vector<edm::InputTag> tags = iConfig.getParameter< vector < InputTag > >("V0List");
23 
24  for (unsigned int i=0;i<tags.size();++i)
25  V0list_.push_back(consumes<reco::VertexCompositeCandidateCollection>(tags[i]));
26 }
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.h:32
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:31
PFV0Producer::~PFV0Producer ( )
override

Destructor.

Definition at line 28 of file PFV0Producer.cc.

References pfTransformer_.

29 {
30  delete pfTransformer_;
31 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:31

Member Function Documentation

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

Definition at line 90 of file PFV0Producer.cc.

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

92 {
94  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
97 }
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
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:31
T get() const
Definition: EventSetup.h:68
void PFV0Producer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 102 of file PFV0Producer.cc.

References pfTransformer_.

103  {
104  delete pfTransformer_;
105  pfTransformer_=nullptr;
106 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:31
void PFV0Producer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Produce the PFRecTrack collection.

Definition at line 34 of file PFV0Producer.cc.

References PFTrackTransformer::addPoints(), edm::EventID::event(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), edm::EventBase::id(), training_settings::idx, edm::Ref< C, T, F >::key(), reco::PFRecTrack::KF, LogDebug, eostools::move(), pfTransformer_, pfTrackElec_cfi::PFV0, edm::Event::put(), edm::EventID::run(), gather_cfg::Tracks, and V0list_.

35 {
36  LogDebug("PFV0Producer")<<"START event: "<<iEvent.id().event()
37  <<" in run "<<iEvent.id().run();
38  //create the empty collections
39  auto pfV0Coll = std::make_unique<PFV0Collection>();
40 
41  auto pfV0RecTrackColl = std::make_unique<reco::PFRecTrackCollection>();
42 
43 
45  int idx = 0;
46 
47  for (unsigned int il=0; il<V0list_.size(); il++){
49  iEvent.getByToken(V0list_[il],V0coll);
50  LogDebug("PFV0Producer")<< "V0list_[" << il <<"] contains "<<V0coll->size()<<" V0 candidates ";
51  for (unsigned int iv=0;iv<V0coll->size();iv++){
52  VertexCompositeCandidateRef V0(V0coll, iv);
53  vector<TrackRef> Tracks;
54  vector<PFRecTrackRef> PFTracks;
55  for( unsigned int ndx = 0; ndx < V0->numberOfDaughters(); ndx++ ) {
56 
57  Tracks.push_back( (dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track() );
58  TrackRef trackRef = (dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track();
59 
60  reco::PFRecTrack pfRecTrack( trackRef->charge(),
62  trackRef.key(),
63  trackRef );
64 
65 
66  Trajectory FakeTraj;
67  bool valid = pfTransformer_->addPoints( pfRecTrack, *trackRef, FakeTraj);
68  if(valid) {
69  PFTracks.push_back(reco::PFRecTrackRef( pfTrackRefProd, idx++));
70  pfV0RecTrackColl->push_back(pfRecTrack);
71 
72  }
73  }
74  if ((PFTracks.size()==2)&&(Tracks.size()==2)){
75  pfV0Coll->push_back(PFV0(V0,PFTracks,Tracks));
76  }
77 
78 
79 
80  }
81  }
82 
83 
84  iEvent.put(std::move(pfV0Coll));
85  iEvent.put(std::move(pfV0RecTrackColl));
86 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
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
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::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.h:32
key_type key() const
Accessor for product key.
Definition: Ref.h:265
RefProd< PROD > getRefBeforePut()
Definition: Event.h:167
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:31
edm::EventID id() const
Definition: EventBase.h:60
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

PFTrackTransformer* PFV0Producer::pfTransformer_
private

PFTrackTransformer.

Definition at line 31 of file PFV0Producer.h.

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

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

Definition at line 32 of file PFV0Producer.h.

Referenced by PFV0Producer(), and produce().