CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VertexMaker.cc
Go to the documentation of this file.
3 
5 
7 
8  thePVCollection_ = iCollector.consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("primaryVertexInputTag"));
9 
10 }
11 
12 void VertexMaker::SetVars(HWW& hww, const edm::Event& iEvent, const edm::EventSetup& iSetup){
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
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
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:446
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
VertexMaker(const edm::ParameterSet &, edm::ConsumesCollector)
Definition: VertexMaker.cc:6
void Load_vtxs_isFake()
Definition: HWW.cc:809
int iEvent
Definition: GenABIO.cc:230
void SetVars(HWW &, const edm::Event &, const edm::EventSetup &)
Definition: VertexMaker.cc:12
std::vector< float > & vtxs_ndof()
Definition: HWW.cc:9
int j
Definition: DBlmapReader.cc:9
std::vector< LorentzVector > & vtxs_position()
Definition: HWW.cc:5
Definition: HWW.h:12
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
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > XYZTLorentzVectorF
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:22
std::vector< float > & vtxs_sumpt()
Definition: HWW.cc:13
math::PtEtaPhiELorentzVectorF LorentzVector