CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFV0Producer Class Reference
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
 
 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

const edm::ESGetToken
< MagneticField,
IdealMagneticFieldRecord
magneticFieldToken_
 
PFTrackTransformerpfTransformer_
 PFTrackTransformer. More...
 
std::vector< edm::EDGetTokenT
< reco::VertexCompositeCandidateCollection > > 
V0list_
 

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 13 of file PFV0Producer.cc.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 41 of file PFV0Producer.cc.

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

42  : pfTransformer_(nullptr), magneticFieldToken_(esConsumes<edm::Transition::BeginRun>()) {
43  produces<reco::PFV0Collection>();
44  produces<reco::PFRecTrackCollection>();
45 
46  std::vector<edm::InputTag> tags = iConfig.getParameter<vector<InputTag> >("V0List");
47 
48  for (unsigned int i = 0; i < tags.size(); ++i)
49  V0list_.push_back(consumes<reco::VertexCompositeCandidateCollection>(tags[i]));
50 }
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.cc:30
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: PFV0Producer.cc:32
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:29
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PFV0Producer::~PFV0Producer ( )
override

Destructor.

Definition at line 52 of file PFV0Producer.cc.

References pfTransformer_.

52 { delete pfTransformer_; }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:29

Member Function Documentation

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

Definition at line 96 of file PFV0Producer.cc.

References edm::EventSetup::getData(), HLT_FULL_cff::magneticField, magneticFieldToken_, PFTrackTransformer::OnlyProp(), and pfTransformer_.

96  {
97  auto const& magneticField = &iSetup.getData(magneticFieldToken_);
100 }
tuple magneticField
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magneticFieldToken_
Definition: PFV0Producer.cc:32
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:29
void PFV0Producer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 103 of file PFV0Producer.cc.

References pfTransformer_.

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

Produce the PFRecTrack collection.

Definition at line 54 of file PFV0Producer.cc.

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

54  {
55  LogDebug("PFV0Producer") << "START event: " << iEvent.id().event() << " in run " << iEvent.id().run();
56  //create the empty collections
57  auto pfV0Coll = std::make_unique<PFV0Collection>();
58 
59  auto pfV0RecTrackColl = std::make_unique<reco::PFRecTrackCollection>();
60 
62  int idx = 0;
63 
64  for (unsigned int il = 0; il < V0list_.size(); il++) {
66  iEvent.getByToken(V0list_[il], V0coll);
67  LogDebug("PFV0Producer") << "V0list_[" << il << "] contains " << V0coll->size() << " V0 candidates ";
68  for (unsigned int iv = 0; iv < V0coll->size(); iv++) {
69  VertexCompositeCandidateRef V0(V0coll, iv);
70  vector<TrackRef> Tracks;
71  vector<PFRecTrackRef> PFTracks;
72  for (unsigned int ndx = 0; ndx < V0->numberOfDaughters(); ndx++) {
73  Tracks.push_back((dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track());
74  TrackRef trackRef = (dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track();
75 
76  reco::PFRecTrack pfRecTrack(trackRef->charge(), reco::PFRecTrack::KF, trackRef.key(), trackRef);
77 
78  Trajectory FakeTraj;
79  bool valid = pfTransformer_->addPoints(pfRecTrack, *trackRef, FakeTraj);
80  if (valid) {
81  PFTracks.push_back(reco::PFRecTrackRef(pfTrackRefProd, idx++));
82  pfV0RecTrackColl->push_back(pfRecTrack);
83  }
84  }
85  if ((PFTracks.size() == 2) && (Tracks.size() == 2)) {
86  pfV0Coll->push_back(PFV0(V0, PFTracks, Tracks));
87  }
88  }
89  }
90 
91  iEvent.put(std::move(pfV0Coll));
92  iEvent.put(std::move(pfV0RecTrackColl));
93 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:20
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
int32_t *__restrict__ iv
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
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.
key_type key() const
Accessor for product key.
Definition: Ref.h:250
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.cc:30
def move
Definition: eostools.py:511
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.cc:29
edm::EventID id() const
Definition: EventBase.h:59
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9
#define LogDebug(id)

Member Data Documentation

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

Definition at line 32 of file PFV0Producer.cc.

Referenced by beginRun().

PFTrackTransformer* PFV0Producer::pfTransformer_
private

PFTrackTransformer.

Definition at line 29 of file PFV0Producer.cc.

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

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

Definition at line 30 of file PFV0Producer.cc.

Referenced by PFV0Producer(), and produce().