CMS 3D CMS Logo

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

#include <VertexMaker.h>

Public Member Functions

void SetVars (HWW &, const edm::Event &, const edm::EventSetup &)
 
 VertexMaker (const edm::ParameterSet &, edm::ConsumesCollector)
 

Public Attributes

edm::EDGetTokenT
< reco::VertexCollection
thePVCollection_
 

Detailed Description

Definition at line 9 of file VertexMaker.h.

Constructor & Destructor Documentation

VertexMaker::VertexMaker ( const edm::ParameterSet iConfig,
edm::ConsumesCollector  iCollector 
)

Definition at line 6 of file VertexMaker.cc.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), and thePVCollection_.

6  {
7 
8  thePVCollection_ = iCollector.consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("primaryVertexInputTag"));
9 
10 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< reco::VertexCollection > thePVCollection_
Definition: VertexMaker.h:16

Member Function Documentation

void VertexMaker::SetVars ( HWW hww,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 12 of file VertexMaker.cc.

References edm::Event::getByToken(), i, cmsHarvester::index, j, HWW::Load_vtxs_covMatrix(), HWW::Load_vtxs_isFake(), HWW::Load_vtxs_ndof(), HWW::Load_vtxs_position(), HWW::Load_vtxs_sumpt(), HWW::Load_vtxs_xError(), HWW::Load_vtxs_yError(), HWW::Load_vtxs_zError(), edm::Handle< T >::product(), thePVCollection_, GoodVertex_cfg::vertexCollection, HWW::vtxs_covMatrix(), HWW::vtxs_isFake(), HWW::vtxs_ndof(), HWW::vtxs_position(), HWW::vtxs_sumpt(), HWW::vtxs_xError(), HWW::vtxs_yError(), and HWW::vtxs_zError().

Referenced by HWWAnalyzer::analyze().

12  {
13 
14  hww.Load_vtxs_position();
15  hww.Load_vtxs_xError();
16  hww.Load_vtxs_yError();
17  hww.Load_vtxs_zError();
18  hww.Load_vtxs_ndof();
19  hww.Load_vtxs_isFake();
20  hww.Load_vtxs_sumpt();
21  hww.Load_vtxs_covMatrix();
22 
23  bool validToken;
24 
25  // get the primary vertices
27  validToken = iEvent.getByToken(thePVCollection_, vertexHandle);
28  if(!validToken) return;
29  const reco::VertexCollection *vertexCollection = vertexHandle.product();
30 
31  unsigned int index = 0;
32  const unsigned int covMatrix_dim = 3;
33 
34  for (reco::VertexCollection::const_iterator vtx = vertexCollection->begin(); vtx != vertexCollection->end(); ++vtx, ++index) {
35  hww.vtxs_position() .push_back( LorentzVector( vtx->position().x(), vtx->position().y(), vtx->position().z(), 0 ) );
36  hww.vtxs_xError() .push_back( vtx->xError() );
37  hww.vtxs_yError() .push_back( vtx->yError() );
38  hww.vtxs_zError() .push_back( vtx->zError() );
39  hww.vtxs_ndof() .push_back( vtx->ndof() );
40  hww.vtxs_isFake() .push_back( vtx->isFake() );
41  double sumpt = 0;
42  for (reco::Vertex::trackRef_iterator i = vtx->tracks_begin(); i != vtx->tracks_end(); ++i) sumpt += (*i)->pt();
43 
44  hww.vtxs_sumpt().push_back(sumpt);
45 
46  std::vector<float> temp_vec;
47  temp_vec.clear();
48 
49  for( unsigned int i = 0; i < covMatrix_dim; i++ ) {
50  for( unsigned int j = 0; j < covMatrix_dim; j++ ) {
51  temp_vec.push_back( vtx->covariance(i, j) );
52  }
53  }
54 
55  hww.vtxs_covMatrix().push_back( temp_vec );
56 
57  }
58 
59 }
void Load_vtxs_covMatrix()
Definition: HWW.cc:821
void Load_vtxs_position()
Definition: HWW.cc:800
int i
Definition: DBlmapReader.cc:9
void Load_vtxs_sumpt()
Definition: HWW.cc:806
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void Load_vtxs_yError()
Definition: HWW.cc:815
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
edm::EDGetTokenT< reco::VertexCollection > thePVCollection_
Definition: VertexMaker.h:16
std::vector< std::vector< float > > & vtxs_covMatrix()
Definition: HWW.cc:33
void Load_vtxs_zError()
Definition: HWW.cc:818
tuple vertexCollection
std::vector< float > & vtxs_zError()
Definition: HWW.cc:29
void Load_vtxs_isFake()
Definition: HWW.cc:809
std::vector< float > & vtxs_ndof()
Definition: HWW.cc:9
int j
Definition: DBlmapReader.cc:9
std::vector< LorentzVector > & vtxs_position()
Definition: HWW.cc:5
T const * product() const
Definition: Handle.h:81
void Load_vtxs_ndof()
Definition: HWW.cc:803
std::vector< float > & vtxs_xError()
Definition: HWW.cc:21
void Load_vtxs_xError()
Definition: HWW.cc:812
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector&lt;TrackRef&gt;
Definition: Vertex.h:37
std::vector< int > & vtxs_isFake()
Definition: HWW.cc:17
std::vector< float > & vtxs_yError()
Definition: HWW.cc:25
std::vector< float > & vtxs_sumpt()
Definition: HWW.cc:13
math::PtEtaPhiELorentzVectorF LorentzVector

Member Data Documentation

edm::EDGetTokenT<reco::VertexCollection> VertexMaker::thePVCollection_

Definition at line 16 of file VertexMaker.h.

Referenced by SetVars(), and VertexMaker().