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::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PFV0Producer (const edm::ParameterSet &)
 Constructor. More...
 
 ~PFV0Producer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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::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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 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(), i, o2o::tags, and V0list_.

15  :
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
int i
Definition: DBlmapReader.cc:9
std::vector< edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > > V0list_
Definition: PFV0Producer.h:32
tuple tags
Definition: o2o.py:248
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:31
PFV0Producer::~PFV0Producer ( )

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 90 of file PFV0Producer.cc.

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

92 {
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:31
const T & get() const
Definition: EventSetup.h:56
void PFV0Producer::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::stream::EDProducerBase.

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

Produce the PFRecTrack collection.

Implements edm::stream::EDProducerBase.

Definition at line 34 of file PFV0Producer.cc.

References PFTrackTransformer::addPoints(), edm::EventID::event(), edm::Event::getByToken(), 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(), and V0list_.

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.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(pfV0Coll);
85  iEvent.put(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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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:264
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
std::vector< PFV0 > PFV0Collection
collection of PFV0 objects
Definition: PFV0Fwd.h:9
RefProd< PROD > getRefBeforePut()
Definition: Event.h:141
PFTrackTransformer * pfTransformer_
PFTrackTransformer.
Definition: PFV0Producer.h:31
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
edm::EventID id() const
Definition: EventBase.h:59
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
Definition: PFRecTrackFwd.h:9

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().