1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
3
* MAUS is free software: you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation, either version 3 of the License, or
6
* (at your option) any later version.
8
* MAUS is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with MAUS. If not, see <http://www.gnu.org/licenses/>.
20
#include "TVirtualPad.h"
23
#include "SciFiDisplayHelicalTracksPR.hh"
27
SciFiDisplayHelicalTracksPR::SciFiDisplayHelicalTracksPR() : mZMin(0.0),
32
SciFiDisplayHelicalTracksPR::~SciFiDisplayHelicalTracksPR() {
36
void SciFiDisplayHelicalTracksPR::Clear() {
47
void SciFiDisplayHelicalTracksPR::Fill() {
49
// Loop over the data for each track in the spill and form the tracks
50
for ( size_t i = 0; i < GetData()->mDataPR.size(); ++i ) {
51
mTrackData = GetData()->mDataPR[i];
52
double xc = mTrackData.CircleX0;
53
double yc = mTrackData.CircleY0;
54
double rad = mTrackData.Radius;
55
double dsdz = mTrackData.dsdz;
56
double csz = mTrackData.SZIntercept;
57
if (mTrackData.TrackerNumber == 0) {
58
mTracksXY1.push_back(MakeCircle(xc, yc, rad));
59
mTracksZX1.push_back(MakeTrackZX(-1, xc, rad, dsdz, csz, mZMin, mZMax));
60
mTracksZY1.push_back(MakeTrackZY(yc, rad, dsdz, csz, mZMin, mZMax));
61
} else if (mTrackData.TrackerNumber == 1) {
62
mTracksXY2.push_back(MakeCircle(xc, yc, rad));
63
mTracksZX2.push_back(MakeTrackZX(-1, xc, rad, dsdz, csz, mZMin, mZMax));
64
mTracksZY2.push_back(MakeTrackZY(yc, rad, dsdz, csz, mZMin, mZMax));
69
SciFiDataHelicalPR* SciFiDisplayHelicalTracksPR::GetData() {
70
return GetDataTemplate();
73
SciFiDataBase* SciFiDisplayHelicalTracksPR::MakeDataObject() {
74
return MakeDataObjectTemplate();
77
TArc SciFiDisplayHelicalTracksPR::MakeCircle(double x0, double y0, double rad) {
78
TArc arc = TArc(x0, y0, rad);
79
arc.SetFillStyle(0); // 0 - Transparent
80
arc.SetLineColor(kBlue);
84
TF1 SciFiDisplayHelicalTracksPR::MakeStraightTrack(double c, double m, double zmin, double zmax) {
85
// Note: in the function expression, x is just the independent variable, which
86
// in this case is the z coordinate in the tracker coordinate system
87
TF1 trk = TF1("FuncStraight", "[0]+([1]*x)", zmin, zmax);
88
trk.SetParameters(c, m);
89
trk.SetLineColor(kRed);
93
TF1 SciFiDisplayHelicalTracksPR::MakeTrackZX(int handness, double circle_x0, double rad,
94
double dsdz, double sz_c, double zmin, double zmax) {
95
// Note: in the function expression, x is just the independent variable, which
96
// in this case is the z coordinate in the tracker coordinate system
97
TF1 func = TF1("FuncZX", "[0]-[4]*([1]*cos((1/[1])*([2]*x+[3])))", zmin, zmax);
98
func.SetParameter(0, circle_x0);
99
func.SetParameter(1, rad);
100
func.SetParameter(2, dsdz);
101
func.SetParameter(3, sz_c);
102
func.SetParameter(4, handness);
103
func.SetLineColor(kBlue);
107
TF1 SciFiDisplayHelicalTracksPR::MakeTrackZY(double circle_y0, double rad, double dsdz,
108
double sz_c, double zmin, double zmax) {
109
// Note: in the function expression, x is just the independent variable, which
110
// in this case is the z coordinate in the tracker coordinate system
111
TF1 func = TF1("FuncZY", "[0]+([1]*sin((1/[1])*([2]*x+[3])))", zmin, zmax);
112
func.SetParameter(0, circle_y0);
113
func.SetParameter(1, rad);
114
func.SetParameter(2, dsdz);
115
func.SetParameter(3, sz_c);
116
func.SetLineColor(kBlue);
121
void SciFiDisplayHelicalTracksPR::Plot(TCanvas* aCanvas) {
122
// If canvas if passed in use it, otherwise initialise the member canvas
123
TCanvas* lCanvas(NULL);
126
if (mCanvas && (mCanvas != aCanvas)) delete mCanvas;
132
mCanvas = new TCanvas("cHelicalTracksXYZ", "Helical Tracks in XYZ", 200, 10, 700, 500);
133
mCanvas->Divide(3, 2);
141
for (size_t i = 0; i < mTracksXY1.size(); ++i) {
143
mTracksXY1[i].Draw("same");
146
for (size_t i = 0; i < mTracksZX1.size(); ++i) {
148
mTracksZX1[i].Draw("same");
151
for (size_t i = 0; i < mTracksZY1.size(); ++i) {
153
mTracksZY1[i].Draw("same");
156
for (size_t i = 0; i < mTracksXY2.size(); ++i) {
158
mTracksXY2[i].Draw("same");
161
for (size_t i = 0; i < mTracksZX2.size(); ++i) {
163
mTracksZX2[i].Draw("same");
166
for (size_t i = 0; i < mTracksZY2.size(); ++i) {
168
mTracksZY2[i].Draw("same");
176
void SciFiDisplayHelicalTracksPR::Save() {
177
std::cerr << "SciFiDisplayHelicalTracksPR::Save: This is just a placeholder function.\n";
180
SciFiDataBase* SciFiDisplayHelicalTracksPR::SetData(SciFiDataBase* data) {
181
return SetDataTemplate(data);
184
SciFiDataBase* SciFiDisplayHelicalTracksPR::SetUp() {
189
} // ~namespace Analysis