KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVQ3.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 "KVQ3.h"
5 #include "KVDBParameterList.h"
6 
7 #include <KVDetector.h>
8 
10 
11 // BEGIN_HTML <!--
13 /* -->
14 <h2>KVQ3</h2>
15 <h4>digitized charge signal</h4>
16 <!-- */
17 // --> END_HTML
19 
21 
22 void KVQ3::init()
23 {
24  SetDefaultValues();
25  fChannel = kQ3;
26  SetType("Q3");
27  fFPGAOutputNumbers = 2;
28  LoadPSAParameters();
29 
30 }
31 
32 
33 
35 
37 {
38  init();
39 }
40 
41 
42 
43 
45 
46 KVQ3::KVQ3(const char* name) : KVSignal(name, "Charge")
47 {
48  init();
49 }
50 
51 
52 
53 
56 
58 {
59  // Destructor
60 }
61 
62 
63 
64 
72 
73 void KVQ3::Copy(TObject& obj) const
74 {
75  // This method copies the current state of 'this' object into 'obj'
76  // You should add here any member variables, for example:
77  // (supposing a member variable KVQ3::fToto)
78  // CastedObj.fToto = fToto;
79  // or
80  // CastedObj.SetToto( GetToto() );
81 
82  KVSignal::Copy(obj);
83  //KVQ3& CastedObj = (KVQ3&)obj;
84 }
85 
86 
87 
89 
91 {
92  SetChannelWidth(10);
93  SetBaseLineLength(250);
94 }
95 
96 
97 
99 
101 {
102 
103  Double_t val = GetPSAParameter("BaseLineLength");
104  SetBaseLineLength(val);
105 
106  val = GetPSAParameter("ChannelWidth");
107  SetChannelWidth(val);
108 
109  val = GetPSAParameter("TauRC");
110  SetTauRC(val);
111 
112  Double_t rise = GetPSAParameter("ShaperRiseTime");
113  val = GetPSAParameter("ShaperFlatTop");
114  SetTrapShaperParameters(rise, val);
115 
116  val = GetPSAParameter("PZCorrection");
117  SetPoleZeroCorrection((val == 1));
118 
119  rise = GetPSAParameter("FastShaperRiseTime");
120  val = GetPSAParameter("FastShaperFlatTop");
121  SetFastTrapShaperParameters(rise, val);
122 
123  val = GetPSAParameter("MinimumAmplitude");
125 
126 }
127 
128 
129 
131 
133 {
134  for (Int_t ii = 0; ii < par->GetParameters()->GetNpar(); ii += 1) {
135  TString nameat(par->GetParameters()->GetNameAt(ii));
136  if (nameat == "BaseLineLength") SetBaseLineLength(par->GetParameters()->GetDoubleValue(ii));
137  else if (nameat == "ChannelWidth") SetChannelWidth(par->GetParameters()->GetDoubleValue(ii));
138  else if (nameat == "ShaperRiseTime") SetShaperRiseTime(par->GetParameters()->GetDoubleValue(ii));
139  else if (nameat == "ShaperFlatTop") SetShaperFlatTop(par->GetParameters()->GetDoubleValue(ii));
140  else if (nameat == "FastShaperRiseTime") SetFastShaperRiseTime(par->GetParameters()->GetDoubleValue(ii));
141  else if (nameat == "FastShaperFlatTop") SetFastShaperFlatTop(par->GetParameters()->GetDoubleValue(ii));
142  else if (nameat == "TauRC") SetTauRC(par->GetParameters()->GetDoubleValue(ii));
143  else if (nameat == "MinimumAmplitude") SetAmplitudeTriggerValue(par->GetParameters()->GetDoubleValue(ii));
144  else if (nameat == "InterpolatedChannelWidth") SetInterpolatedChannelWidth(par->GetParameters()->GetDoubleValue(ii));
145  else if (nameat == "Interpolation") SetInterpolation((par->GetParameters()->GetDoubleValue(ii) == 1));
146  else if (nameat == "PZCorrection") SetPoleZeroCorrection((par->GetParameters()->GetDoubleValue(ii) == 1));
147  else {
148  if (nameat == "Detector" || nameat == "Signal" || nameat == "RunRange") {
149 
150  }
151  else {
152  Warning("UpdatePSAParameter", "Not supported PSA parameter : %d %s\n", ii, nameat.Data());
153  }
154  }
155  }
156 }
157 
158 
159 
160 
162 
164 {
165  if (PSAHasBeenComputed()) return;
166 
167  if (!IsLongEnough()) return;
168  if (!TestWidth())
170 
171  RemoveBaseLine();
172 
176 
177 
178 
179  SetADCData();
180 
183  fAmplitude = GetAmplitude();// - (sQ3fast[fMtot-1])*0.5;
184 
185  ComputeRiseTime();
186 
187  fPSAIsDone = kTRUE;
188 
189 }
190 
191 
192 
193 
195 
197 {
198  if (!fPSAIsDone) return;
199 
200 // d->SetDetectorSignalValue(Form("%s.TrapRiseTime", fType.Data()), fTrapRiseTime);
201 // d->SetDetectorSignalValue(Form("%s.TrapFlatTop", fType.Data()), fTrapFlatTop);
202 // d->SetDetectorSignalValue(Form("%s.FastTrapRiseTime", fType.Data()), fFastTrapRiseTime);
203 // d->SetDetectorSignalValue(Form("%s.FastTrapFlatTop", fType.Data()), fFastTrapFlatTop);
204  d->SetDetectorSignalValue(Form("%s.BaseLine", fType.Data()), fBaseLine);
205  d->SetDetectorSignalValue(Form("%s.SigmaBaseLine", fType.Data()), fSigmaBase);
206  d->SetDetectorSignalValue(Form("%s.Amplitude", fType.Data()), fAmplitude);
207  d->SetDetectorSignalValue(Form("%s.FastAmplitude", fType.Data()), fFastAmplitude);
208  d->SetDetectorSignalValue(Form("%s.RiseTime", fType.Data()), fRiseTime);
209  d->SetDetectorSignalValue(Form("%s.RawAmplitude", fType.Data()), GetRawAmplitude());
210 }
211 
212 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define d(i)
double Double_t
const Bool_t kTRUE
char * Form(const char *fmt,...)
To store calibration parameters in a database ,.
KVNameValueList * GetParameters()
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
Double_t GetDoubleValue(const Char_t *name) const
const Char_t * GetNameAt(Int_t idx) const
Definition: KVQ3.h:11
virtual ~KVQ3()
Destructor.
Definition: KVQ3.cpp:57
virtual void TreateSignal()
Definition: KVQ3.cpp:163
virtual void SetDefaultValues()
To be defined in child class.
Definition: KVQ3.cpp:90
virtual void GetPSAResult(KVDetector *) const
Definition: KVQ3.cpp:196
KVQ3()
Definition: KVQ3.cpp:36
void init()
Definition: KVQ3.cpp:22
virtual void UpdatePSAParameter(KVDBParameterList *par)
Definition: KVQ3.cpp:132
void Copy(TObject &obj) const
Definition: KVQ3.cpp:73
Double_t fFastAmplitude
fast amplitude for CsI
Definition: KVQ3.h:17
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
virtual void LoadPSAParameters()
Definition: KVQ3.cpp:100
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:300
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
virtual void RemoveBaseLine()
Definition: KVSignal.cpp:594
void SetShaperRiseTime(Double_t rise)
Definition: KVSignal.h:263
Double_t fAmplitude
results of signal treatement
Definition: KVSignal.h:38
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
Double_t GetAmplitude() const
Definition: KVSignal.h:250
void SetPoleZeroCorrection(Bool_t with=kTRUE)
Definition: KVSignal.h:296
Double_t GetRawAmplitude() const
Definition: KVSignal.h:329
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
void SetTrapShaperParameters(Double_t rise, Double_t flat)
Definition: KVSignal.h:258
void SetShaperFlatTop(Double_t flat)
Definition: KVSignal.h:267
void SetADCData()
Definition: KVSignal.cpp:229
void SetChannelWidth(double width)
Definition: KVSignal.h:167
Bool_t PSAHasBeenComputed() const
Definition: KVSignal.h:159
Double_t ComputeRiseTime()
Definition: KVSignal.cpp:636
void FIR_ApplyTrapezoidal(double trise, double tflat)
different shapers (modify only fAdc)
Definition: KVSignal.cpp:839
Double_t fTrapFlatTop
flat top of the trapezoidal shaper
Definition: KVSignal.h:56
Double_t fRiseTime
rise time of the signal
Definition: KVSignal.h:39
Bool_t fPSAIsDone
indicate if PSA has been done
Definition: KVSignal.h:64
Double_t fTrapRiseTime
rise time of the trapezoidal shaper
Definition: KVSignal.h:55
Bool_t TestWidth() const
Definition: KVSignal.cpp:458
Double_t GetChannelWidth() const
Definition: KVSignal.h:172
void SetAmplitudeTriggerValue(Double_t val)
Definition: KVSignal.h:347
virtual void Warning(const char *method, const char *msgfmt,...) const
const char * Data() const