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.
Loading...
Searching...
No Matches
Track.cxx
Go to the documentation of this file.
1
6
7#include "Track.h"
8
10
12 : TObject() {
13 }
14
15//TODO Fix particle->track->tracker hits relation. If Track is object of Particle then tracker_hits in on the stack and delete make it crash?
17 Clear();
18 //delete tracker_hits_;
19}
20
21
22//TODO:: Why is tracker_hist->Delete() crashes.
23void Track::Clear(Option_t* /* option */) {
24 TObject::Clear();
25 //if (tracker_hits_)
26 // tracker_hits_->Delete();
27 memset(isolation_, 0, sizeof(isolation_));
28 n_hits_ = 0;
29}
30
31void Track::setTrackParameters(double d0, double phi0, double omega,
32 double tan_lambda, double z0) {
33 d0_ = d0;
34 phi0_ = phi0;
35 omega_ = omega;
36 tan_lambda_ = tan_lambda;
37 z0_ = z0;
38 if (omega_ < 0)
39 charge_ = 1;
40 else
41 charge_ = -1;
42
43}
44
45std::vector<double> Track::getTrackParameters() { return { d0_, phi0_, omega_, tan_lambda_, z0_ }; }
46
47void Track::setPositionAtEcal(const double* position) {
48 x_at_ecal_ = position[0];
49 y_at_ecal_ = position[1];
50 z_at_ecal_ = position[2];
51}
52
53std::vector<double> Track::getPositionAtEcal() { return { x_at_ecal_, y_at_ecal_, z_at_ecal_ }; }
54
55void Track::setPosition(const double* position) {
56 x_ = position[0];
57 y_ = position[1];
58 z_ = position[2];
59}
60
61std::vector<double> Track::getPosition() { return { x_, y_, z_ }; }
62
63void Track::setMomentum(double bfield) {
64
65 double mom_param = 2.99792458e-04;
66 double pt = fabs(1. / omega_) * bfield * mom_param;
67 py_ = pt*tan_lambda_;
68 px_ = pt*sin(phi0_);
69 pz_ = pt*cos(phi0_);
70 //pterr_ = pow(1./omega,2)*sqrt(cov_[5])*bfield*mom_param;
71}
72
73
74void Track::setMomentum(std::vector<double> momentum) {
75 px_ = momentum[0];
76 py_ = momentum[1];
77 pz_ = momentum[2];
78}
79
80void Track::setMomentum(double px, double py, double pz) {
81 px_ = px;
82 py_ = py;
83 pz_ = pz;
84}
85
86void Track::addHit(TObject* hit) {
87 ++n_hits_;
88 tracker_hits_.Add(hit);
89}
90
91void Track::applyCorrection(std::string var, double correction){
92 if(var == "z0"){
93 z0_ = z0_ - correction;
94 }
95 if(var == "track_time"){
96 track_time_ = track_time_ + correction;
97 }
98}
99
100void Track::Print (Option_t *option) const {
101 printf("d0 Phi Omega TanLambda Z0 time chi2\n");
102 printf("% 6.4f % 6.4f % 6.4f % 6.4f % 6.4f % 6.4f % 6.4f\n",d0_,phi0_,omega_,tan_lambda_,z0_,track_time_,chi2_);
103 printf("type: %d\n", type_);
104}
ClassImp(Track) Track
Definition Track.cxx:9
Class used to encapsulate track information.
Definition Track.h:32
int n_hits_
Definition Track.h:377
int type_
Definition Track.h:383
void setTrackParameters(const double d0, const double phi0, const double omega, const double tan_lambda, const double z0)
Definition Track.cxx:31
double px_
Definition Track.h:458
double phi0_
Definition Track.h:401
void setPosition(const double *position)
Definition Track.cxx:55
std::vector< double > getPosition()
Definition Track.cxx:61
double tan_lambda_
Definition Track.h:413
double d0_
Definition Track.h:395
double py_
Definition Track.h:459
void Print(Option_t *option="") const
Definition Track.cxx:100
void setPositionAtEcal(const double *position)
Definition Track.cxx:47
double chi2_
Definition Track.h:422
std::vector< double > getTrackParameters()
Definition Track.cxx:45
std::vector< double > getPositionAtEcal()
Definition Track.cxx:53
double isolation_[14]
Definition Track.h:374
~Track()
Definition Track.cxx:16
double x_at_ecal_
Definition Track.h:434
TRefArray tracker_hits_
Definition Track.h:368
void Clear(Option_t *option="")
Definition Track.cxx:23
double z_at_ecal_
Definition Track.h:440
int charge_
Definition Track.h:466
double pz_
Definition Track.h:460
double z_
Definition Track.h:449
double y_
Definition Track.h:446
void addHit(TObject *hit)
Definition Track.cxx:86
double x_
Definition Track.h:443
void setMomentum(double bfield=0.52)
Definition Track.cxx:63
double omega_
Definition Track.h:407
double y_at_ecal_
Definition Track.h:437
void applyCorrection(std::string var, double correction)
Definition Track.cxx:91
double z0_
Definition Track.h:419
double track_time_
Definition Track.h:431