hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Vertex.cxx
Go to the documentation of this file.
1
8#include "Vertex.h"
9#include <iostream>
10
12
14 : TObject() {
15 }
16
18 Clear();
19}
20
21void Vertex::Clear(Option_t *option) {
22 pos_.Clear();
23 p1_.Clear();
24 p2_.Clear();
25 //parts_->Delete();
26 TObject::Clear();
27}
28
29void Vertex::addParticle(TObject* part)
30{
31 n_parts_++;
32 parts_.Add(part);
33}
34
35void Vertex::setCovariance( const std::vector<float>& vec){
36 covariance_ = vec;
37}
38
39void Vertex::setPos(const float* pos, bool rotate) {
40 float svtAngle = 30.5e-3;
41 if (rotate) {
42 pos_.SetY(pos[2]);
43 pos_.SetZ(pos[1]*sin(svtAngle) + pos[0]*cos(svtAngle));
44 pos_.SetX(pos[1]*cos(svtAngle) - pos[0]*sin(svtAngle));
45 }
46 else {
47 // The vertex object should already by in HPS coordinates! (if not in the SVT already)
48 pos_.SetX(pos[0]);
49 pos_.SetY(pos[1]);
50 pos_.SetZ(pos[2]);
51 }
52}
53
54void Vertex::setVtxParameters(const TVector3& p1,
55 const TVector3& p2,
56 const double m) {
57
58 p1_.SetX(p1.X());
59 p1_.SetY(p1.Y());
60 p1_.SetZ(p1.Z());
61
62 p2_.SetX(p2.X());
63 p2_.SetY(p2.Y());
64 p2_.SetZ(p2.Z());
65
66 p_ = p1_ + p2_;
67
68 invM_ = m;
69
70}
71
72
73void Vertex::setVtxParameters(const TLorentzVector& p1,
74 const TLorentzVector& p2){
75
76 this->setVtxParameters(p1.Vect(),p2.Vect(),(p1+p2).M());
77}
78
79
80
81void Vertex::setVtxParameters(const std::vector<float>& parameters) {
82 parameters_ = parameters;
83
84 //std::cout << "There are " << parameters.size() << " parameters in this vertex" << std::endl;
85 //2016 invM,p1X, p2Y, p2X, p1Z, p2Z, p1Y,invMerr
86 if (parameters_.size() == 8 )
87 {
88 //First Track
89 p1_.SetX(parameters_[1]);
90 p1_.SetY(parameters_[6]);
91 p1_.SetZ(parameters_[4]);
92
93 //Second Track
94 p2_.SetX(parameters_[3]);
95 p2_.SetY(parameters_[2]);
96 p2_.SetZ(parameters_[5]);
97
98 //Invariant Mass
99 invM_ = parameters_[0];
101
102 //Vtx momentum
103 p_ = p1_ + p2_ ;
104 }
105 else if (parameters_.size() == 21 ) //0 V0PzErr, 1 invMass, 2 V0Pz, 3 V0Py, 4 V0Px, 5 V0PErr, 6 V0TargProjY, 7 V0TargProjXErr, 8 V0TargProjYErr, 9 invMassError, 10 p1X, 11 p2Y, 12 p2X, 13 V0P, 14 p1Z, 15 p1Y, 16 p2Z, 17 V0TargProjX, 18 layerCode, 19 V0PxErr, 20 V0PyErr
106 {
107 //First Track
108 p1_.SetX(parameters_[10]);
109 p1_.SetY(parameters_[15]);
110 p1_.SetZ(parameters_[14]);
111
112 //Second Track
113 p2_.SetX(parameters_[12]);
114 p2_.SetY(parameters_[11]);
115 p2_.SetZ(parameters_[16]);
116
117 //Invariant Mass
118 invM_ = parameters_[1];
120
121 //Vtx momentum
122 p_ = p1_ + p2_ ;
123 }
124 else if (parameters_.size() == 24 ) //0 V0PzErr, 1 invMass, 2 V0Pz, 3 vXErr, 4 V0Py, 5 V0Px, 6 V0PErr, 7 V0TargProjY, 8 vZErr, 9 V0TargProjXErr, 10 vYErr, 11 V0TargProjYErr, 12 invMassError, 13 p1X, 14 p2Y, 15 p2X, 16 V0P, 17 p1Z, 18 p1Y, 19 p2Z, 20 V0TargProjX, 21 layerCode, 22 V0PxErr, 23 V0PyErr
125 {
126 //First Track
127 p1_.SetX(parameters_[13]);
128 p1_.SetY(parameters_[18]);
129 p1_.SetZ(parameters_[17]);
130
131 //Second Track
132 p2_.SetX(parameters_[15]);
133 p2_.SetY(parameters_[14]);
134 p2_.SetZ(parameters_[19]);
135
136 p_ = p1_ + p2_;
137
138 invM_ = parameters_[1];
139 invMerr_ = parameters_[12];
140 }
141}
ClassImp(Vertex) Vertex
Definition Vertex.cxx:11
Class used to encapsulate Vertex information.
void setPos(const float *pos, bool rotate=false)
Definition Vertex.cxx:39
TVector3 pos_
Definition Vertex.h:164
void setVtxParameters(const std::vector< float > &parameters)
Definition Vertex.cxx:81
TVector3 p1_
Definition Vertex.h:164
float invMerr_
Definition Vertex.h:167
std::vector< float > parameters_
Definition Vertex.h:175
std::vector< float > covariance_
Definition Vertex.h:169
TRefArray parts_
Definition Vertex.h:173
float invM_
Definition Vertex.h:166
void Clear(Option_t *option="")
Definition Vertex.cxx:21
int n_parts_
Definition Vertex.h:174
void addParticle(TObject *part)
Definition Vertex.cxx:29
TVector3 p2_
Definition Vertex.h:164
TVector3 p_
Definition Vertex.h:164
void setCovariance(const std::vector< float > &vec)
Definition Vertex.cxx:35
~Vertex()
Definition Vertex.cxx:17