REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestAxionEvent.cxx
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5 * For more information see http://gifna.unizar.es/trex *
6 * *
7 * REST is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * REST is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have a copy of the GNU General Public License along with *
18 * REST in $REST_PATH/LICENSE. *
19 * If not, see http://www.gnu.org/licenses/. *
20 * For the list of contributors see $REST_PATH/CREDITS. *
21 *************************************************************************/
22
43#include "TRestAxionEvent.h"
44
45#include "TRestTools.h"
46
47using namespace std;
48using namespace TMath;
49
50ClassImp(TRestAxionEvent);
51
52TRestAxionEvent::TRestAxionEvent() {
53 Initialize();
54 fPad = NULL;
55}
56
57TRestAxionEvent::~TRestAxionEvent() {}
58
60
61TPad* TRestAxionEvent::DrawEvent(TString option) {
62 vector<string> optList = TRestTools::GetOptions((string)option);
63
64 for (unsigned int n = 0; n < optList.size(); n++) {
65 if (optList[n] == "print") this->PrintEvent();
66 }
67
68 optList.erase(std::remove(optList.begin(), optList.end(), "print"), optList.end());
69
70 if (optList.size() == 0) optList.push_back("TODO");
71
72 if (fPad != NULL) {
73 delete fPad;
74 fPad = NULL;
75 }
76
77 fPad = new TPad(this->GetName(), " ", 0, 0, 1, 1);
78 fPad->Divide(1, 1);
79 fPad->Draw();
80
81 // TOBE implemented if necessary
82
83 return fPad;
84}
85
91void TRestAxionEvent::RotateXZ(const TVector3& center, Double_t theta, Double_t phi) {
92 TVector3 ref = fPosition - center;
93
94 ref.RotateX(theta);
95 ref.RotateZ(phi);
96
97 fPosition = ref + center;
98
99 fDirection.RotateX(theta);
100 fDirection.RotateZ(phi);
101}
102
108void TRestAxionEvent::RotateZX(const TVector3& center, Double_t phi, Double_t theta) {
109 TVector3 ref = fPosition - center;
110
111 ref.RotateZ(phi);
112 ref.RotateX(theta);
113
114 fPosition = ref + center;
115
116 fDirection.RotateZ(phi);
117 fDirection.RotateX(theta);
118}
119
125void TRestAxionEvent::RotateXY(const TVector3& center, Double_t pitch, Double_t yaw) {
126 TVector3 ref = fPosition - center;
127
128 ref.RotateX(pitch);
129 ref.RotateY(yaw);
130
131 fPosition = ref + center;
132
133 fDirection.RotateX(pitch);
134 fDirection.RotateY(yaw);
135}
136
142void TRestAxionEvent::RotateYX(const TVector3& center, Double_t yaw, Double_t pitch) {
143 TVector3 ref = fPosition - center;
144
145 ref.RotateY(yaw);
146 ref.RotateX(pitch);
147
148 fPosition = ref + center;
149
150 fDirection.RotateY(yaw);
151 fDirection.RotateX(pitch);
152}
153
157void TRestAxionEvent::Translate(const TVector3& delta) { fPosition += delta; }
158
159void TRestAxionEvent::PrintEvent() {
161
162 cout << "Mass : " << GetMass() * units("eV") << " eV" << endl;
163 cout << "Energy : " << GetEnergy() << " keV" << endl;
164 cout << "Position : ( " << fPosition.X() << ", " << fPosition.Y() << ", " << fPosition.Z() << " ) mm"
165 << endl;
166 cout << "Direction : ( " << fDirection.X() << ", " << fDirection.Y() << ", " << fDirection.Z() << " )"
167 << endl;
168 cout << endl;
169}
An event data class to define the parameters related to an axion particle.
void RotateXY(const TVector3 &center, Double_t pitch, Double_t yaw)
This method will produce a rotation respect to a center given by argument. First we rotate the partic...
TVector3 fPosition
Particle position.
void RotateYX(const TVector3 &center, Double_t yaw, Double_t pitch)
This method will produce a rotation respect to a center given by argument. First we rotate the partic...
void RotateXZ(const TVector3 &center, Double_t theta, Double_t phi)
This method will produce a rotation respect to a center given by argument. First we rotate the partic...
virtual void Initialize()
void RotateZX(const TVector3 &center, Double_t phi, Double_t theta)
This method will produce a rotation respect to a center given by argument. First we rotate the partic...
TVector3 fDirection
Particle momentum. Unitary direction.
void Translate(const TVector3 &delta)
This method will produce a tranlation of the axion position by an amount delta.
virtual void PrintEvent() const
Definition: TRestEvent.cxx:187
virtual void Initialize()=0
Definition: TRestEvent.cxx:73
static std::vector< std::string > GetOptions(std::string optionsStr)
Returns all the options in an option string.
Definition: TRestTools.cxx:86