KaliVeda
Toolkit for HIC analysis
KVQ3.cpp
1 //Created by KVClassFactory on Tue Jan 13 15:11:11 2015
2 //Author: ,,,
3 
4 #include "KVQ3.h"
5 #include "KVDBParameterList.h"
6 
8 
9 // BEGIN_HTML <!--
11 /* -->
12 <h2>KVQ3</h2>
13 <h4>digitized charge signal</h4>
14 <!-- */
15 // --> END_HTML
17 
19 
20 void KVQ3::init()
21 {
22  SetDefaultValues();
23  fChannel = kQ3;
24  SetType("Q3");
25  fFPGAOutputNumbers = 2;
26  LoadPSAParameters();
27 
28 }
29 
30 
31 
33 
35 {
36  init();
37 }
38 
39 
40 
41 
43 
44 KVQ3::KVQ3(const char* name) : KVSignal(name, "Charge")
45 {
46  init();
47 }
48 
49 
50 
51 
54 
56 {
57  // Destructor
58 }
59 
60 
61 
62 
70 
71 void KVQ3::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 KVQ3::fToto)
76  // CastedObj.fToto = fToto;
77  // or
78  // CastedObj.SetToto( GetToto() );
79 
80  KVSignal::Copy(obj);
81  //KVQ3& CastedObj = (KVQ3&)obj;
82 }
83 
84 
85 
87 
89 {
90  SetChannelWidth(10);
91  SetBaseLineLength(250);
92 }
93 
94 
95 
97 
99 {
100 
101  Double_t val = GetPSAParameter("BaseLineLength");
102  SetBaseLineLength(val);
103 
104  val = GetPSAParameter("ChannelWidth");
105  SetChannelWidth(val);
106 
107  val = GetPSAParameter("TauRC");
108  SetTauRC(val);
109 
110  Double_t rise = GetPSAParameter("ShaperRiseTime");
111  val = GetPSAParameter("ShaperFlatTop");
112  SetTrapShaperParameters(rise, val);
113 
114  val = GetPSAParameter("PZCorrection");
115  SetPoleZeroCorrection((val == 1));
116 
117  rise = GetPSAParameter("FastShaperRiseTime");
118  val = GetPSAParameter("FastShaperFlatTop");
119  SetFastTrapShaperParameters(rise, val);
120 
121  val = GetPSAParameter("MinimumAmplitude");
123 
124 }
125 
126 
127 
129 
131 {
132  for (Int_t ii = 0; ii < par->GetParameters()->GetNpar(); ii += 1) {
133  TString nameat(par->GetParameters()->GetNameAt(ii));
134  if (nameat == "BaseLineLength") SetBaseLineLength(par->GetParameters()->GetDoubleValue(ii));
135  else if (nameat == "ChannelWidth") SetChannelWidth(par->GetParameters()->GetDoubleValue(ii));
136  else if (nameat == "ShaperRiseTime") SetShaperRiseTime(par->GetParameters()->GetDoubleValue(ii));
137  else if (nameat == "ShaperFlatTop") SetShaperFlatTop(par->GetParameters()->GetDoubleValue(ii));
138  else if (nameat == "FastShaperRiseTime") SetFastShaperRiseTime(par->GetParameters()->GetDoubleValue(ii));
139  else if (nameat == "FastShaperFlatTop") SetFastShaperFlatTop(par->GetParameters()->GetDoubleValue(ii));
140  else if (nameat == "TauRC") SetTauRC(par->GetParameters()->GetDoubleValue(ii));
141  else if (nameat == "MinimumAmplitude") SetAmplitudeTriggerValue(par->GetParameters()->GetDoubleValue(ii));
142  else if (nameat == "InterpolatedChannelWidth") SetInterpolatedChannelWidth(par->GetParameters()->GetDoubleValue(ii));
143  else if (nameat == "Interpolation") SetInterpolation((par->GetParameters()->GetDoubleValue(ii) == 1));
144  else if (nameat == "PZCorrection") SetPoleZeroCorrection((par->GetParameters()->GetDoubleValue(ii) == 1));
145  else {
146  if (nameat == "Detector" || nameat == "Signal" || nameat == "RunRange") {
147 
148  }
149  else {
150  Warning("UpdatePSAParameter", "Not supported PSA parameter : %d %s\n", ii, nameat.Data());
151  }
152  }
153  }
154 }
155 
156 
157 
158 
160 
162 {
163  if (PSAHasBeenComputed()) return;
164 
165  if (!IsLongEnough()) return;
166  if (!TestWidth())
168 
169  RemoveBaseLine();
170 
174 
175 
176 
177  SetADCData();
178 
181  fAmplitude = GetAmplitude();// - (sQ3fast[fMtot-1])*0.5;
182 
183  ComputeRiseTime();
184 
185  fPSAIsDone = kTRUE;
186 
187 }
188 
189 
190 
192 
194 {
195  if (!fPSAIsDone) return;
196 
197  val.SetValue("BaseLine", fBaseLine);
198  val.SetValue("SigmaBaseLine", fSigmaBase);
199  val.SetValue("Amplitude", fAmplitude);
200  val.SetValue("FastAmplitude", fFastAmplitude);
201  val.SetValue("RiseTime", fRiseTime);
202  val.SetValue("RawAmplitude", GetRawAmplitude());
203 }
204 
205 
int Int_t
double Double_t
constexpr Bool_t kTRUE
char name[80]
To store calibration parameters in a database ,.
KVNameValueList * GetParameters()
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Double_t GetDoubleValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
const Char_t * GetNameAt(Int_t idx) const
Definition: KVQ3.h:11
virtual ~KVQ3()
Destructor.
Definition: KVQ3.cpp:55
void UpdatePSAParameter(KVDBParameterList *par) override
Definition: KVQ3.cpp:130
KVQ3()
Definition: KVQ3.cpp:34
void init()
Definition: KVQ3.cpp:20
void GetPSAResults(KVNameValueList &val) const override
Definition: KVQ3.cpp:193
void TreateSignal() override
Definition: KVQ3.cpp:161
Double_t fFastAmplitude
fast amplitude for CsI
Definition: KVQ3.h:17
void SetDefaultValues() override
Definition: KVQ3.cpp:88
void SetFastShaperRiseTime(Double_t rise)
Definition: KVQ3.h:41
Double_t fFastTrapRiseTime
rise time of the trapezoidal shaper for fast componment
Definition: KVQ3.h:15
void Copy(TObject &obj) const override
Definition: KVQ3.cpp:71
void LoadPSAParameters() override
Definition: KVQ3.cpp:98
void SetFastTrapShaperParameters(Double_t rise, Double_t flat)
Definition: KVQ3.h:36
void SetFastShaperFlatTop(Double_t flat)
Definition: KVQ3.h:45
Double_t fFastTrapFlatTop
flat top of the trapezoidal shaper for fast componment
Definition: KVQ3.h:16
void SetTauRC(Int_t taurc)
Definition: KVSignal.h:296
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
virtual void RemoveBaseLine()
Definition: KVSignal.cpp:593
void SetShaperRiseTime(Double_t rise)
Definition: KVSignal.h:259
Double_t fAmplitude
results of signal treatement
Definition: KVSignal.h:37
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
Double_t GetAmplitude() const
Definition: KVSignal.h:246
void SetPoleZeroCorrection(Bool_t with=kTRUE)
Definition: KVSignal.h:292
Double_t GetRawAmplitude() const
Definition: KVSignal.h:325
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
void SetTrapShaperParameters(Double_t rise, Double_t flat)
Definition: KVSignal.h:254
void Copy(TObject &obj) const override
Definition: KVSignal.cpp:168
void SetShaperFlatTop(Double_t flat)
Definition: KVSignal.h:263
void SetADCData()
Definition: KVSignal.cpp:228
void SetChannelWidth(double width)
Definition: KVSignal.h:163
Bool_t PSAHasBeenComputed() const
Definition: KVSignal.h:155
Double_t ComputeRiseTime()
Definition: KVSignal.cpp:635
void FIR_ApplyTrapezoidal(double trise, double tflat)
different shapers (modify only fAdc)
Definition: KVSignal.cpp:838
Double_t fTrapFlatTop
flat top of the trapezoidal shaper
Definition: KVSignal.h:55
Double_t fRiseTime
rise time of the signal
Definition: KVSignal.h:38
Bool_t fPSAIsDone
indicate if PSA has been done
Definition: KVSignal.h:63
Double_t fTrapRiseTime
rise time of the trapezoidal shaper
Definition: KVSignal.h:54
Bool_t TestWidth() const
Definition: KVSignal.cpp:457
Double_t GetChannelWidth() const
Definition: KVSignal.h:168
void SetAmplitudeTriggerValue(Double_t val)
Definition: KVSignal.h:343
virtual void Warning(const char *method, const char *msgfmt,...) const
const char * Data() const
ClassImp(TPyArg)