KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVI2.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Tue Jan 13 15:11:11 2015
2 //Author: ,,,
3 
4 #include "KVI2.h"
5 #include "TMath.h"
6 
7 #include <KVDetector.h>
8 
10 
11 // BEGIN_HTML <!--
13 /* -->
14 <h2>KVI2</h2>
15 <h4>digitized intensity signal</h4>
16 <!-- */
17 // --> END_HTML
19 
21 
22 void KVI2::init()
23 {
24  SetDefaultValues();
25  fChannel = kI2;
26  SetType("I2");
27  LoadPSAParameters();
28 }
29 
30 
31 
33 
35 {
36  init();
37 }
38 
39 
40 
41 
43 
44 KVI2::KVI2(const char* name) : KVSignal(name, "Current")
45 {
46  init();
47 }
48 
49 
50 
51 
54 
56 {
57  // Destructor
58 }
59 
60 
61 
62 
70 
71 void KVI2::Copy(TObject& obj) const
72 {
73  // This method copies the current state of 'this' object into 'obj'
74  // You should add here any member variables, for example:
75  // (supposing a member variable KVI2::fToto)
76  // CastedObj.fToto = fToto;
77  // or
78  // CastedObj.SetToto( GetToto() );
79 
80  KVSignal::Copy(obj);
81  //KVI2& CastedObj = (KVI2&)obj;
82 }
83 
84 
85 
87 
89 {
90  SetChannelWidth(4);
92 }
93 
94 
95 
97 
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 
119 
121 {
122  // special case for current signal
123  // in case the pulse start to early,
124  // base line is calculated at the end of the signal
126 
127  if (fBaseLine <= fEndLine) {
128  //do nothing baseline is kept as calculated by default KVSignal method
129  }
130  else {
131  //compute the base line at the end of the signal
132  //baseline length is taken as for the standard base line calculation
133  //
134  ComputeEndLine();
137  }
138 
139  return fBaseLine;
140 
141 }
142 
143 
144 
145 
147 
149 {
150  if (PSAHasBeenComputed()) return;
151 
152  if (!IsLongEnough()) return;
153  if (!TestWidth())
155 
156 // FIR_ApplyMovingAverage(4);
157 
158  Add(-1.*ComputeBaseLine());
159  if (fWithInterpolation) {
161  SetNSamples(GetNSamples() - 5 * (fChannelWidth / fInterpolatedChannelWidth)); // because we use a 3th order interpolation...
162  }
164  fPSAIsDone = kTRUE;
165 }
166 
167 
168 
170 
172 {
173  if (!fPSAIsDone) return;
174 
175  d->SetDetectorSignalValue(Form("%s.BaseLine", fType.Data()), fBaseLine);
176  d->SetDetectorSignalValue(Form("%s.SigmaBaseLine", fType.Data()), fSigmaBase);
177  d->SetDetectorSignalValue(Form("%s.Amplitude", fType.Data()), fAmplitude);
178  d->SetDetectorSignalValue(Form("%s.RawAmplitude", fType.Data()), GetRawAmplitude());
179 }
180 
181 
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define d(i)
double Double_t
const Bool_t kTRUE
char * Form(const char *fmt,...)
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
Definition: KVI2.h:9
virtual void TreateSignal()
Definition: KVI2.cpp:148
void Copy(TObject &obj) const
Definition: KVI2.cpp:71
KVI2()
Definition: KVI2.cpp:34
virtual void LoadPSAParameters()
Definition: KVI2.cpp:98
void init()
Definition: KVI2.cpp:22
virtual ~KVI2()
Destructor.
Definition: KVI2.cpp:55
virtual void SetDefaultValues()
To be defined in child class.
Definition: KVI2.cpp:88
virtual void GetPSAResult(KVDetector *) const
Definition: KVI2.cpp:171
virtual Double_t ComputeBaseLine()
Definition: KVI2.cpp:120
Double_t fInterpolatedChannelWidth
channel width used to produced the interpolated signal
Definition: KVSignal.h:52
void Add(Double_t fact)
Definition: KVSignal.cpp:1790
Bool_t IsLongEnough() const
Definition: KVSignal.cpp:186
TString fType
string to identify the signal type : "QH1", "I2" etc ...
Definition: KVSignal.h:32
void Copy(TObject &obj) const
Definition: KVSignal.cpp:169
void ChangeChannelWidth(Double_t newwidth)
Definition: KVSignal.cpp:474
void SetInterpolation(Bool_t with=kTRUE)
Definition: KVSignal.h:312
Double_t fEndLine
mean value of the signal line at the end
Definition: KVSignal.h:45
Double_t fAmplitude
results of signal treatement
Definition: KVSignal.h:38
virtual Double_t ComputeBaseLine()
Definition: KVSignal.cpp:491
Double_t GetPSAParameter(const Char_t *parname)
DeduceFromName has to be called before.
Definition: KVSignal.cpp:341
Double_t fSigmaBase
base line rms
Definition: KVSignal.h:44
void SetInterpolatedChannelWidth(double width)
Definition: KVSignal.h:316
Int_t GetNSamples() const
Definition: KVSignal.h:188
Bool_t fWithInterpolation
use of interpolation or not
Definition: KVSignal.h:59
Double_t fChannelWidth
channel width in ns
Definition: KVSignal.h:51
Double_t GetRawAmplitude() const
Definition: KVSignal.h:329
Double_t fSigmaEnd
rms value of the signal line at the end
Definition: KVSignal.h:46
void SetNSamples(int nn)
Definition: KVSignal.h:184
Double_t fBaseLine
base line mean value
Definition: KVSignal.h:43
void SetBaseLineLength(Int_t length, Int_t first=0)
Definition: KVSignal.h:196
Double_t ComputeAmplitude()
Compute and return the absolute value of the signal amplitude.
Definition: KVSignal.cpp:619
virtual void BuildSmoothingSplineSignal()
Definition: KVSignal.cpp:1424
void SetChannelWidth(double width)
Definition: KVSignal.h:167
Bool_t PSAHasBeenComputed() const
Definition: KVSignal.h:159
Bool_t fPSAIsDone
indicate if PSA has been done
Definition: KVSignal.h:64
Bool_t TestWidth() const
Definition: KVSignal.cpp:458
virtual Double_t ComputeEndLine()
Definition: KVSignal.cpp:564
Double_t GetChannelWidth() const
Definition: KVSignal.h:172
const char * Data() const