KaliVeda
Toolkit for HIC analysis
KVI1.cpp
1 //Created by KVClassFactory on Tue Jan 13 15:11:11 2015
2 //Author: ,,,
3 
4 #include "KVI1.h"
5 #include "TMath.h"
6 
8 
9 // BEGIN_HTML <!--
11 /* -->
12 <h2>KVI1</h2>
13 <h4>digitized current signal</h4>
14 <!-- */
15 // --> END_HTML
17 
19 
20 void KVI1::init()
21 {
22  SetDefaultValues();
23  fChannel = kI1;
24  SetType("I1");
25  LoadPSAParameters();
26 
27 }
28 
29 
30 
32 
34 {
35  init();
36 }
37 
38 
39 
40 
42 
43 KVI1::KVI1(const char* name) : KVSignal(name, "Current")
44 {
45  init();
46 }
47 
48 
49 
50 
53 
55 {
56  // Destructor
57 }
58 
59 
60 
61 
69 
70 void KVI1::Copy(TObject& obj) const
71 {
72  // This method copies the current state of 'this' object into 'obj'
73  // You should add here any member variables, for example:
74  // (supposing a member variable KVI1::fToto)
75  // CastedObj.fToto = fToto;
76  // or
77  // CastedObj.SetToto( GetToto() );
78 
79  KVSignal::Copy(obj);
80  //KVI1& CastedObj = (KVI1&)obj;
81 }
82 
83 
84 
86 
88 {
89  SetChannelWidth(4);
91 }
92 
93 
94 
96 
98 {
99 
100  Double_t val = GetPSAParameter("BaseLineLength");
101  SetBaseLineLength(val);
102 
103  val = GetPSAParameter("ChannelWidth");
104  SetChannelWidth(val);
105 
106  val = GetPSAParameter("InterpolatedChannelWidth");
108 
109  val = GetPSAParameter("Interpolation");
110  SetInterpolation((val == 1));
111 
112 }
113 
114 
115 
120 
122 {
123  // special case for current signal
124  // in case the pulse start to early,
125  // base line is calculated at the end of the signal
126 
129 
130  if (fBaseLine <= fEndLine) {
131  //do nothing baseline is kept as calculated by default KVSignal method
132  }
133  else {
134  //compute the base line at the end of the signal
135  //baseline length is taken as for the standard base line calculation
136  //
137  ComputeEndLine();
140  }
141 
142  return fBaseLine;
143 }
144 
145 
146 
147 
149 
151 {
152  if (PSAHasBeenComputed()) return;
153 
154  if (!IsLongEnough()) return;
155 
156  if (!TestWidth())
158 
159 // FIR_ApplyMovingAverage(4);
160  Add(-1.*ComputeBaseLine());
161 // ApplyModifications();
162 
163  if (fWithInterpolation) {
165  SetNSamples(GetNSamples() - 5 * (fChannelWidth / fInterpolatedChannelWidth)); // because we use a 3th order interpolation...
166  }
167 
169  fPSAIsDone = kTRUE;
170 
171 }
172 
173 
174 
176 
178 {
179  if (!fPSAIsDone) return;
180 
181  val.SetValue("BaseLine", fBaseLine);
182  val.SetValue("SigmaBaseLine", fSigmaBase);
183  val.SetValue("Amplitude", fAmplitude);
184  val.SetValue("RawAmplitude", GetRawAmplitude());
185 }
186 
187 
188 
double Double_t
constexpr Bool_t kTRUE
char name[80]
Definition: KVI1.h:9
KVI1()
Definition: KVI1.cpp:33
void SetDefaultValues() override
Definition: KVI1.cpp:87
void Copy(TObject &obj) const override
Definition: KVI1.cpp:70
virtual ~KVI1()
Destructor.
Definition: KVI1.cpp:54
void init()
Definition: KVI1.cpp:20
void TreateSignal() override
Definition: KVI1.cpp:150
void GetPSAResults(KVNameValueList &) const override
Definition: KVI1.cpp:177
void LoadPSAParameters() override
Definition: KVI1.cpp:97
Double_t ComputeBaseLine() override
Definition: KVI1.cpp:121
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)