CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFNuclearProducer Class Reference

#include <PFNuclearProducer.h>

Inheritance diagram for PFNuclearProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PFNuclearProducer (const edm::ParameterSet &)
 Constructor. More...
 
 ~PFNuclearProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void endRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 Produce the PFRecTrack collection. More...
 

Private Attributes

double likelihoodCut_
 
std::vector< edm::InputTagnuclearContainers_
 
PFTrackTransformerpfTransformer_
 PFTrackTransformer. More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 11 of file PFNuclearProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 11 of file PFNuclearProducer.cc.

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

11  :
13 {
14  produces<reco::PFRecTrackCollection>();
15  produces<reco::PFNuclearInteractionCollection>();
16 
18  iConfig.getParameter< vector < InputTag > >("nuclearColList");
20  = iConfig.getParameter<double>("likelihoodCut");
21 }
T getParameter(std::string const &) const
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
std::vector< edm::InputTag > nuclearContainers_
PFNuclearProducer::~PFNuclearProducer ( )

Destructor.

Definition at line 23 of file PFNuclearProducer.cc.

References pfTransformer_.

24 {
25  delete pfTransformer_;
26 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 78 of file PFNuclearProducer.cc.

References edm::EventSetup::get(), PFTrackTransformer::OnlyProp(), and pfTransformer_.

80 {
81  ESHandle<MagneticField> magneticField;
82  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
83  pfTransformer_= new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0,0,0))));
85 }
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const T & get() const
Definition: EventSetup.h:55
void PFNuclearProducer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 89 of file PFNuclearProducer.cc.

References pfTransformer_.

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

Produce the PFRecTrack collection.

Implements edm::EDProducer.

Definition at line 29 of file PFNuclearProducer.cc.

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

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

Member Data Documentation

double PFNuclearProducer::likelihoodCut_
private

Definition at line 29 of file PFNuclearProducer.h.

Referenced by PFNuclearProducer(), and produce().

std::vector<edm::InputTag> PFNuclearProducer::nuclearContainers_
private

Definition at line 30 of file PFNuclearProducer.h.

Referenced by PFNuclearProducer(), and produce().

PFTrackTransformer* PFNuclearProducer::pfTransformer_
private

PFTrackTransformer.

Definition at line 28 of file PFNuclearProducer.h.

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