R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BTsplinePar.cxx
Go to the documentation of this file.
1
2
/******************************************************************************
3
* Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
4
* Copyright (C) 2019-2025 Members of R3B Collaboration *
5
* *
6
* This software is distributed under the terms of the *
7
* GNU General Public Licence (GPL) version 3, *
8
* copied verbatim in the file "LICENSE". *
9
* *
10
* In applying this license GSI does not waive the privileges and immunities *
11
* granted to it by virtue of its status as an Intergovernmental Organization *
12
* or submit itself to any jurisdiction. *
13
******************************************************************************/
14
15
// --------------------------------------------------------------
16
// ----- R3BTsplinePar -----
17
// ----- Created Jan 23th 2022 by J.L. Rodriguez-Sanchez -----
18
// --------------------------------------------------------------
19
20
#include "
R3BTsplinePar.h
"
21
#include "
R3BLogger.h
"
22
23
#include "FairLogger.h"
24
#include "FairParamList.h"
25
26
#include "TArrayF.h"
27
#include "TF1.h"
28
#include "TMath.h"
29
30
// ----- Default constructor -----------------------------------------------
31
R3BTsplinePar::R3BTsplinePar
(
const
TString& name)
32
: TNamed(name, name)
33
,
fSpline
(NULL)
34
,
fMaxPoints
(4000)
// 100
35
,
fxmin
(-100.50)
36
,
fxmax
(1030)
37
{
38
// fSpline = new TSpline3();
39
}
40
41
// ---- Method putParams ------------------------------------------------------
42
void
R3BTsplinePar::putParams
(FairParamList* list)
43
{
44
R3BLOG
(info,
"called for "
<<
fSpline
->GetNp() <<
" points"
);
45
46
TArrayF* p =
new
TArrayF(5);
47
// TArrayF* q = new TArrayF(3);
48
for
(
int
n = 0; n <
fSpline
->GetNp(); n++)
49
{
50
Double_t a[2];
51
Double_t b[6];
52
fSpline
->GetKnot(n, a[0], a[1]);
53
fSpline
->GetCoeff(n, b[0], b[1], b[2], b[3], b[4]);
54
TString name =
GetNameObj
() +
"Point"
+ n;
55
p->AddAt(a[0], 0);
56
p->AddAt(a[1], 1);
57
p->AddAt(b[2], 2);
58
p->AddAt(b[3], 3);
59
p->AddAt(b[4], 4);
60
list->add(name, *p);
61
/*TString namecoeff = GetNameObj() + "PointCoeff" + n;
62
q->AddAt(b[0], 0);
63
q->AddAt(b[1], 1);
64
q->AddAt(b[2], 2);
65
list->add(namecoeff, *q);*/
66
}
67
delete
p;
68
}
69
70
// ---- Method getParams ------------------------------------------------------
71
TSpline3*
R3BTsplinePar::getParams
(FairParamList* list)
72
{
73
R3BLOG
(info,
"called"
);
74
// if (fSpline == NULL)
75
fSpline
=
new
TSpline3(
"spline_func"
,
fxmin
,
fxmax
, (TF1*)0,
fMaxPoints
);
76
TArrayF* p =
new
TArrayF(5);
77
// TArrayF* q = new TArrayF(3);
78
for
(
int
n = 0; n <
fMaxPoints
; n++)
79
{
80
TString name =
GetNameObj
() +
"Point"
+ n;
81
// TString namecoeff = GetNameObj() + "PointCoeff" + n;
82
if
(list->fill(name, p))
83
{
84
fSpline
->SetPoint(n, p->GetAt(0), p->GetAt(1));
85
fSpline
->SetPointCoeff(n, p->GetAt(2), p->GetAt(3), p->GetAt(4));
86
}
87
else
88
{
89
break
;
90
}
91
}
92
delete
p;
93
// std::cout << "Np spline = " << fSpline->GetNp() << std::endl;
94
return
fSpline
;
95
}
96
97
// ---- Method print ----------------------------------------------------------
98
void
R3BTsplinePar::print
()
99
{
100
if
(
fSpline
)
101
{
102
R3BLOG
(info,
"for "
<<
fSpline
->GetName());
103
104
for
(
int
n = 0; n <
fSpline
->GetNp(); n++)
105
{
106
Double_t a[2];
107
Double_t b[6];
108
fSpline
->GetKnot(n, a[0], a[1]);
109
fSpline
->GetCoeff(n, b[0], b[1], b[2], b[3], b[4]);
110
LOG(info) <<
"CutPoint"
<< n <<
": "
<< a[0] <<
" ; "
<< a[1];
111
LOG(info) <<
"CutPoint"
<< n <<
": "
<< b[0] <<
" ; "
<< b[1] <<
" ; "
<< b[2];
112
}
113
}
114
else
115
{
116
R3BLOG
(warn,
"Spline parameters not found"
);
117
}
118
}
119
120
ClassImp
(
R3BTsplinePar
);
R3BLogger.h
R3BLOG
#define R3BLOG(severity, x)
Definition
R3BLogger.h:32
ClassImp
ClassImp(R3BTsplinePar)
R3BTsplinePar.h
R3BTsplinePar
Definition
R3BTsplinePar.h:24
R3BTsplinePar::getParams
TSpline3 * getParams(FairParamList *list)
Method to retrieve all parameters using FairRuntimeDB.
Definition
R3BTsplinePar.cxx:71
R3BTsplinePar::putParams
virtual void putParams(FairParamList *list)
Method to store all parameters using FairRuntimeDB.
Definition
R3BTsplinePar.cxx:42
R3BTsplinePar::R3BTsplinePar
R3BTsplinePar(const TString &name="Spline")
Default constructor.
Definition
R3BTsplinePar.cxx:31
R3BTsplinePar::fxmax
Double_t fxmax
Definition
R3BTsplinePar.h:52
R3BTsplinePar::GetNameObj
TString GetNameObj()
Accessor functions.
Definition
R3BTsplinePar.h:42
R3BTsplinePar::print
void print()
Method to print values of parameters.
Definition
R3BTsplinePar.cxx:98
R3BTsplinePar::fMaxPoints
UInt_t fMaxPoints
Definition
R3BTsplinePar.h:49
R3BTsplinePar::fxmin
Double_t fxmin
Definition
R3BTsplinePar.h:51
R3BTsplinePar::fSpline
TSpline3 * fSpline
Definition
R3BTsplinePar.h:50
r3bbase
R3BTsplinePar.cxx
Generated by
1.13.2