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 Attributes
pat::PATPackedGenParticleProducer Class Reference
Inheritance diagram for pat::PATPackedGenParticleProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATPackedGenParticleProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~PATPackedGenParticleProducer ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT
< edm::Association
< reco::GenParticleCollection > > 
Asso_
 
edm::EDGetTokenT
< reco::GenParticleCollection
Cands_
 
double maxEta_
 
edm::EDGetTokenT
< reco::VertexCollection
PVs_
 

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 40 of file PATPackedGenParticleProducer.cc.

Constructor & Destructor Documentation

pat::PATPackedGenParticleProducer::PATPackedGenParticleProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 55 of file PATPackedGenParticleProducer.cc.

55  :
56  Cands_(consumes<reco::GenParticleCollection>(iConfig.getParameter<edm::InputTag>("inputCollection"))),
58  PVs_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("inputVertices"))),
59  maxEta_(iConfig.getParameter<double>("maxEta"))
60 {
61  produces< std::vector<pat::PackedGenParticle> > ();
62 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::VertexCollection > PVs_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< reco::GenParticleCollection > Cands_
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > Asso_
pat::PATPackedGenParticleProducer::~PATPackedGenParticleProducer ( )

Definition at line 64 of file PATPackedGenParticleProducer.cc.

64 {}

Member Function Documentation

void pat::PATPackedGenParticleProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 66 of file PATPackedGenParticleProducer.cc.

References funct::abs(), reco::LeafCandidate::eta(), edm::Event::getByToken(), edm::HandleBase::id(), reco::CompositeRefCandidateT< D >::motherRef(), reco::CompositeRefCandidateT< D >::numberOfMothers(), edm::Event::put(), and reco::LeafCandidate::status().

66  {
67 
68 
70  iEvent.getByToken( Cands_, cands );
71  std::vector<reco::Candidate>::const_iterator cand;
72 
74  iEvent.getByToken( Asso_, asso );
75 
76 
78  iEvent.getByToken( PVs_, PVs );
79  reco::VertexRef PV(PVs.id());
80  math::XYZPoint PVpos;
81  if (!PVs->empty()) {
82  PV = reco::VertexRef(PVs, 0);
83  PVpos = PV->position();
84  }
85 
86  std::auto_ptr< std::vector<pat::PackedGenParticle> > outPtrP( new std::vector<pat::PackedGenParticle> );
87 
88 
89  for(unsigned int ic=0, nc = cands->size(); ic < nc; ++ic) {
90  const reco::GenParticle &cand=(*cands)[ic];
91  if(cand.status() ==1 && std::abs(cand.eta() < maxEta_))
92  {
93  if(cand.numberOfMothers() > 0) {
94  edm::Ref<reco::GenParticleCollection> newRef=(*asso)[cand.motherRef(0)];
95  outPtrP->push_back( pat::PackedGenParticle(cand,newRef));
96  } else {
98 
99  }
100 
101  }
102  }
103 
104 
105  iEvent.put( outPtrP );
106 
107 
108 }
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< reco::VertexCollection > PVs_
virtual int status() const
status word
edm::EDGetTokenT< reco::GenParticleCollection > Cands_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual size_t numberOfMothers() const
number of mothers
virtual float eta() const
momentum pseudorapidity
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
Definition: VertexFwd.h:13
daughters::value_type motherRef(size_type i=0) const
reference to mother at given position
edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > Asso_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12

Member Data Documentation

edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > pat::PATPackedGenParticleProducer::Asso_
private

Definition at line 49 of file PATPackedGenParticleProducer.cc.

edm::EDGetTokenT<reco::GenParticleCollection> pat::PATPackedGenParticleProducer::Cands_
private

Definition at line 48 of file PATPackedGenParticleProducer.cc.

double pat::PATPackedGenParticleProducer::maxEta_
private

Definition at line 51 of file PATPackedGenParticleProducer.cc.

edm::EDGetTokenT<reco::VertexCollection> pat::PATPackedGenParticleProducer::PVs_
private

Definition at line 50 of file PATPackedGenParticleProducer.cc.