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

Public Member Functions

 PATSecondaryVertexSlimmer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~PATSecondaryVertexSlimmer ()
 
- 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
< pat::PackedCandidateCollection > > 
map2_
 
edm::EDGetTokenT
< edm::Association
< pat::PackedCandidateCollection > > 
map_
 
edm::EDGetTokenT< std::vector
< reco::Vertex > > 
src_
 

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 18 of file PATSecondaryVertexSlimmer.cc.

Constructor & Destructor Documentation

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

Definition at line 31 of file PATSecondaryVertexSlimmer.cc.

31  :
32  src_(consumes<std::vector<reco::Vertex> >(iConfig.getParameter<edm::InputTag>("src"))),
35 {
36  produces< reco::VertexCompositePtrCandidateCollection >();
37 }
T getParameter(std::string const &) const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > map_
edm::EDGetTokenT< std::vector< reco::Vertex > > src_
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > map2_
pat::PATSecondaryVertexSlimmer::~PATSecondaryVertexSlimmer ( )

Definition at line 39 of file PATSecondaryVertexSlimmer.cc.

39 {}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 41 of file PATSecondaryVertexSlimmer.cc.

References reco::Vertex::chi2(), gather_cfg::cout, reco::Vertex::error(), edm::Event::getByToken(), i, n, reco::Vertex::ndof(), reco::Vertex::p4(), reco::Vertex::position(), edm::Event::put(), edm::refToPtr(), reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), reco::Vertex::trackWeight(), and findQualityFiles::v.

41  {
43  iEvent.getByToken(src_, vertices);
44  std::auto_ptr<reco::VertexCompositePtrCandidateCollection > outPtr(new reco::VertexCompositePtrCandidateCollection);
45 
47  iEvent.getByToken(map_,pf2pc);
49  iEvent.getByToken(map2_,pf2pc2);
50 
51 
52  outPtr->reserve(vertices->size());
53  for (unsigned int i = 0, n = vertices->size(); i < n; ++i) {
54  const reco::Vertex &v = (*vertices)[i];
55  outPtr->push_back(reco::VertexCompositePtrCandidate(0,v.p4(),v.position(), v.error(), v.chi2(), v.ndof()));
56 
57  for(reco::Vertex::trackRef_iterator it=v.tracks_begin(); it != v.tracks_end(); it++) {
58  if(v.trackWeight(*it)>0.5) {
59  if((*pf2pc)[*it].isNonnull() && (*pf2pc)[*it]->numberOfHits() > 0) {
60  outPtr->back().addDaughter(reco::CandidatePtr(edm::refToPtr((*pf2pc)[*it]) ));
61  }
62  else {
63  if((*pf2pc2)[*it].isNonnull()) {
64  outPtr->back().addDaughter(reco::CandidatePtr(edm::refToPtr((*pf2pc2)[*it]) ));
65  }
66  else { std::cout << "HELPME" << std::endl;}
67  }
68  }
69  }
70  }
71 
72  iEvent.put(outPtr);
73 }
int i
Definition: DBlmapReader.cc:9
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Definition: RefToPtr.h:18
trackRef_iterator tracks_end() const
last iterator over tracks
Definition: Vertex.cc:44
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
const Point & position() const
position
Definition: Vertex.h:106
std::vector< VertexCompositePtrCandidate > VertexCompositePtrCandidateCollection
collection of Candidate objects
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > map_
edm::EDGetTokenT< std::vector< reco::Vertex > > src_
double chi2() const
chi-squares
Definition: Vertex.h:95
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
Definition: Vertex.h:74
double ndof() const
Definition: Vertex.h:102
math::XYZTLorentzVectorD p4(float mass=0.13957018, float minWeight=0.5) const
Returns the four momentum of the sum of the tracks, assuming the given mass for the decay products...
Definition: Vertex.cc:113
Error error() const
return SMatrix
Definition: Vertex.h:129
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > map2_
tuple cout
Definition: gather_cfg.py:121
trackRef_iterator tracks_begin() const
first iterator over tracks
Definition: Vertex.cc:39

Member Data Documentation

edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection> > pat::PATSecondaryVertexSlimmer::map2_
private

Definition at line 27 of file PATSecondaryVertexSlimmer.cc.

edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection> > pat::PATSecondaryVertexSlimmer::map_
private

Definition at line 26 of file PATSecondaryVertexSlimmer.cc.

edm::EDGetTokenT<std::vector<reco::Vertex> > pat::PATSecondaryVertexSlimmer::src_
private

Definition at line 25 of file PATSecondaryVertexSlimmer.cc.