KaliVeda
Toolkit for HIC analysis
KVI2.cpp
1 //Created by KVClassFactory on Tue Jan 13 15:11:11 2015
2 //Author: ,,,
3 
4 #include "KVI2.h"
5 #include "TMath.h"
6 
8 
9 // BEGIN_HTML <!--
11 /* -->
12 <h2>KVI2</h2>
13 <h4>digitized intensity signal</h4>
14 <!-- */
15 // --> END_HTML
17 
19 
20 void KVI2::init()
21 {
22  SetDefaultValues();
23  fChannel = kI2;
24  SetType("I2");
25  LoadPSAParameters();
26 }
27 
28 
29 
31 
33 {
34  init();
35 }
36 
37 
38 
39 
41 
42 KVI2::KVI2(const char* name) : KVSignal(name, "Current")
43 {
44  init();
45 }
46 
47 
48 
49 
52 
54 {
55  // Destructor
56 }
57 
58 
59 
60 
68 
69 void KVI2::Copy(TObject& obj) const
70 {
71  // This method copies the current state of 'this' object into 'obj'
72  // You should add here any member variables, for example:
73  // (supposing a member variable KVI2::fToto)
74  // CastedObj.fToto = fToto;
75  // or
76  // CastedObj.SetToto( GetToto() );
77 
78  KVSignal::Copy(obj);
79  //KVI2& CastedObj = (KVI2&)obj;
80 }
81 
82 
83 
85 
87 {
88  SetChannelWidth(4);
90 }
91 
92 
93 
95 
97 {
98  Double_t val = GetPSAParameter("BaseLineLength");
99  SetBaseLineLength(val);
100 
101  val = GetPSAParameter("ChannelWidth");
102  SetChannelWidth(val);
103 
104  val = GetPSAParameter("InterpolatedChannelWidth");
106 
107  val = GetPSAParameter("Interpolation");
108  SetInterpolation((val == 1));
109 
110 }
111 
112 
117 
119 {
120  // special case for current signal
121  // in case the pulse start to early,
122  // base line is calculated at the end of the signal
124 
125  if (fBaseLine <= fEndLine) {
126  //do nothing baseline is kept as calculated by default KVSignal method
127  }
128  else {
129  //compute the base line at the end of the signal
130  //baseline length is taken as for the standard base line calculation
131  //
132  ComputeEndLine();
135  }
136 
137  return fBaseLine;
138 
139 }
140 
141 
142 
143 
145 
147 {
148  if (PSAHasBeenComputed()) return;
149 
150  if (!IsLongEnough()) return;
151  if (!TestWidth())
153 
154 // FIR_ApplyMovingAverage(4);
155 
156  Add(-1.*ComputeBaseLine());
157  if (fWithInterpolation) {
159  SetNSamples(GetNSamples() - 5 * (fChannelWidth / fInterpolatedChannelWidth)); // because we use a 3th order interpolation...
160  }
162  fPSAIsDone = kTRUE;
163 }
164 
165 
166 
168 
170 {
171  if (!fPSAIsDone) return;
172 
173  val.SetValue("BaseLine", fBaseLine);
174  val.SetValue("SigmaBaseLine", fSigmaBase);
175  val.SetValue("Amplitude", fAmplitude);
176  val.SetValue("RawAmplitude", GetRawAmplitude());
177 }
178 
179 
double Double_t
constexpr Bool_t kTRUE
char name[80]
Definition: KVI2.h:9
KVI2()
Definition: KVI2.cpp:32
void Copy(TObject &obj) const override
Definition: KVI2.cpp:69
void init()
Definition: KVI2.cpp:20
void LoadPSAParameters() override
Definition: KVI2.cpp:96
Double_t ComputeBaseLine() override
Definition: KVI2.cpp:118
virtual ~KVI2()
Destructor.
Definition: KVI2.cpp:53
void TreateSignal() override
Definition: KVI2.cpp:146
void GetPSAResults(KVNameValueList &) const override
Definition: KVI2.cpp:169
void SetDefaultValues() override
Definition: KVI2.cpp:86
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
void SetValue(const Char_t *name, value_type value)
Double_t fInterpolatedChannelWidth
channel width used to produced the interpolated signal
Definition: KVSignal.h:51
void Add(Double_t fact)
Definition: KVSignal.cpp:1789
Bool_t IsLongEnough() const
Definition: KVSignal.cpp:185
void ChangeChannelWidth(Double_t newwidth)
Definition: KVSignal.cpp:473
void SetInterpolation(Bool_t with=kTRUE)
Definition: KVSignal.h:308
Double_t fEndLine
mean value of the signal line at the end
Definition: KVSignal.h:44
Double_t fAmplitude
results of signal treatement
Definition: KVSignal.h:37
virtual Double_t ComputeBaseLine()
Definition: KVSignal.cpp:490
Double_t GetPSAParameter(const Char_t *parname)
DeduceFromName has to be called before.
Definition: KVSignal.cpp:340
Double_t fSigmaBase
base line rms
Definition: KVSignal.h:43
void SetInterpolatedChannelWidth(double width)
Definition: KVSignal.h:312
Int_t GetNSamples() const
Definition: KVSignal.h:184
Bool_t fWithInterpolation
use of interpolation or not
Definition: KVSignal.h:58
Double_t fChannelWidth
channel width in ns
Definition: KVSignal.h:50
Double_t GetRawAmplitude() const
Definition: KVSignal.h:325
Double_t fSigmaEnd
rms value of the signal line at the end
Definition: KVSignal.h:45
void SetNSamples(int nn)
Definition: KVSignal.h:180
Double_t fBaseLine
base line mean value
Definition: KVSignal.h:42
void SetBaseLineLength(Int_t length, Int_t first=0)
Definition: KVSignal.h:192
Double_t ComputeAmplitude()
Compute and return the absolute value of the signal amplitude.
Definition: KVSignal.cpp:618
virtual void BuildSmoothingSplineSignal()
Definition: KVSignal.cpp:1423
void Copy(TObject &obj) const override
Definition: KVSignal.cpp:168
void SetChannelWidth(double width)
Definition: KVSignal.h:163
Bool_t PSAHasBeenComputed() const
Definition: KVSignal.h:155
Bool_t fPSAIsDone
indicate if PSA has been done
Definition: KVSignal.h:63
Bool_t TestWidth() const
Definition: KVSignal.cpp:457
virtual Double_t ComputeEndLine()
Definition: KVSignal.cpp:563
Double_t GetChannelWidth() const
Definition: KVSignal.h:168
ClassImp(TPyArg)