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) : KVFAZIASignal(name, "Current")
43 {
44  init();
45 }
46 
47 
48 
49 
51 
53 {
54  SetChannelWidth(4);
56 }
57 
58 
59 
61 
63 {
64  Double_t val = GetPSAParameter("BaseLineLength");
65  SetBaseLineLength(val);
66 
67  val = GetPSAParameter("ChannelWidth");
68  SetChannelWidth(val);
69 
70  val = GetPSAParameter("InterpolatedChannelWidth");
72 
73  val = GetPSAParameter("Interpolation");
74  SetInterpolation((val == 1));
75 
76 }
77 
78 
83 
85 {
86  // special case for current signal
87  // in case the pulse start to early,
88  // base line is calculated at the end of the signal
90 
91  if (fBaseLine <= fEndLine) {
92  //do nothing baseline is kept as calculated by default KVSignal method
93  }
94  else {
95  //compute the base line at the end of the signal
96  //baseline length is taken as for the standard base line calculation
97  //
101  }
102 
103  return fBaseLine;
104 
105 }
106 
107 
108 
109 
111 
113 {
114  if (PSAHasBeenComputed()) return;
115 
116  if (!IsLongEnough()) return;
117  if (!TestWidth())
119 
120 // FIR_ApplyMovingAverage(4);
121 
122  Add(-1.*ComputeBaseLine());
123  if (fWithInterpolation) {
125  SetNSamples(GetNSamples() - 5 * (fChannelWidth / fInterpolatedChannelWidth)); // because we use a 3th order interpolation...
126  }
128  fPSAIsDone = kTRUE;
129 }
130 
131 
132 
134 
136 {
137  if (!fPSAIsDone) return;
138 
139  val.SetValue("BaseLine", fBaseLine);
140  val.SetValue("SigmaBaseLine", fSigmaBase);
141  val.SetValue("Amplitude", fAmplitude);
142  val.SetValue("RawAmplitude", GetRawAmplitude());
143 }
144 
145 
double Double_t
constexpr Bool_t kTRUE
char name[80]
Double_t GetPSAParameter(const Char_t *parname) override
routines to read/change PSA parameters from configuration file or database
Definition: KVI2.h:9
KVI2()
Definition: KVI2.cpp:32
void init()
Definition: KVI2.cpp:20
void LoadPSAParameters() override
Definition: KVI2.cpp:62
Double_t ComputeBaseLine() override
Definition: KVI2.cpp:84
void TreateSignal() override
Definition: KVI2.cpp:112
void GetPSAResults(KVNameValueList &) const override
Definition: KVI2.cpp:135
void SetDefaultValues() override
Definition: KVI2.cpp:52
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:31
void Add(Double_t fact)
Definition: KVSignal.cpp:1602
Bool_t IsLongEnough() const
Definition: KVSignal.cpp:109
void ChangeChannelWidth(Double_t newwidth)
Definition: KVSignal.cpp:286
void SetInterpolation(Bool_t with=kTRUE)
Definition: KVSignal.h:282
Double_t fEndLine
mean value of the signal line at the end
Definition: KVSignal.h:24
Double_t fAmplitude
results of signal treatement
Definition: KVSignal.h:17
virtual Double_t ComputeBaseLine()
Definition: KVSignal.cpp:303
Double_t fSigmaBase
base line rms
Definition: KVSignal.h:23
void SetInterpolatedChannelWidth(double width)
Definition: KVSignal.h:286
Int_t GetNSamples() const
Definition: KVSignal.h:158
Bool_t fWithInterpolation
use of interpolation or not
Definition: KVSignal.h:38
Double_t fChannelWidth
channel width in ns
Definition: KVSignal.h:30
Double_t GetRawAmplitude() const
Definition: KVSignal.h:299
Double_t fSigmaEnd
rms value of the signal line at the end
Definition: KVSignal.h:25
void SetNSamples(int nn)
Definition: KVSignal.h:154
Double_t fBaseLine
base line mean value
Definition: KVSignal.h:22
void SetBaseLineLength(Int_t length, Int_t first=0)
Definition: KVSignal.h:166
Double_t ComputeAmplitude()
Compute and return the absolute value of the signal amplitude.
Definition: KVSignal.cpp:431
virtual void BuildSmoothingSplineSignal()
Definition: KVSignal.cpp:1236
void SetChannelWidth(double width)
Definition: KVSignal.h:137
Bool_t PSAHasBeenComputed() const
Definition: KVSignal.h:129
Bool_t fPSAIsDone
indicate if PSA has been done
Definition: KVSignal.h:45
Bool_t TestWidth() const
Definition: KVSignal.cpp:270
virtual Double_t ComputeEndLine()
Definition: KVSignal.cpp:376
Double_t GetChannelWidth() const
Definition: KVSignal.h:142
ClassImp(TPyArg)