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
PFV0Producer Class Reference

#include <PFV0Producer.h>

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

Public Member Functions

 PFV0Producer (const edm::ParameterSet &)
 Constructor. More...
 
 ~PFV0Producer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) 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

PFTrackTransformerpfTransformer_
 PFTrackTransformer. More...
 
std::vector< edm::InputTagV0list_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- 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::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 12 of file PFV0Producer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 17 of file PFV0Producer.cc.

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

17  :
19 {
20 
21  produces<reco::PFV0Collection>();
22  produces<reco::PFRecTrackCollection>();
23 
24  V0list_ =
25  iConfig.getParameter< vector < InputTag > >("V0List");
26 }
std::vector< edm::InputTag > V0list_
Definition: PFV0Producer.h:30
T getParameter(std::string const &) const
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:29
PFV0Producer::~PFV0Producer ( )

Destructor.

Definition at line 28 of file PFV0Producer.cc.

References pfTransformer_.

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

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 90 of file PFV0Producer.cc.

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

92 {
93  ESHandle<MagneticField> magneticField;
94  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
95  pfTransformer_= new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0,0,0))));
97 }
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:29
const T & get() const
Definition: EventSetup.h:55
void PFV0Producer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 102 of file PFV0Producer.cc.

References pfTransformer_.

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

Produce the PFRecTrack collection.

Implements edm::EDProducer.

Definition at line 34 of file PFV0Producer.cc.

References PFTrackTransformer::addPoints(), edm::EventID::event(), edm::Event::getByLabel(), edm::Event::getRefBeforePut(), edm::EventBase::id(), customizeTrackingMonitorSeedNumber::idx, edm::Ref< C, T, F >::key(), reco::PFRecTrack::KF, LogDebug, pfTransformer_, edm::Event::put(), edm::EventID::run(), V0list_, and TrackValidation_HighPurity_cff::valid.

35 {
36  LogDebug("PFV0Producer")<<"START event: "<<iEvent.id().event()
37  <<" in run "<<iEvent.id().run();
38  //create the empty collections
39  auto_ptr< PFV0Collection > pfV0Coll (new PFV0Collection);
40 
41  auto_ptr<reco::PFRecTrackCollection> pfV0RecTrackColl(new reco::PFRecTrackCollection);
42 
43 
45  int idx = 0;
46 
47  for (unsigned int il=0; il<V0list_.size(); il++){
49  iEvent.getByLabel(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(pfV0Coll);
85  iEvent.put(pfV0RecTrackColl);
86 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:42
std::vector< edm::InputTag > V0list_
Definition: PFV0Producer.h:30
EventNumber_t event() const
Definition: EventID.h:44
reconstructed track used as an input to particle flow
Definition: PFRecTrack.h:22
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:116
std::vector< PFV0 > PFV0Collection
collection of PFV0 objects
Definition: PFV0Fwd.h:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
RefProd< PROD > getRefBeforePut()
Definition: Event.h:128
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:29
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
key_type key() const
Accessor for product key.
Definition: Ref.h:266
edm::EventID id() const
Definition: EventBase.h:56
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9

Member Data Documentation

PFTrackTransformer* PFV0Producer::pfTransformer_
private

PFTrackTransformer.

Definition at line 29 of file PFV0Producer.h.

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

std::vector< edm::InputTag > PFV0Producer::V0list_
private

Definition at line 30 of file PFV0Producer.h.

Referenced by PFV0Producer(), and produce().