KaliVeda
Toolkit for HIC analysis
KVFAZIASignal.cpp
1 //Created by KVClassFactory on Mon Dec 22 15:46:46 2014
2 //Author: ,,,
3 
4 #include "KVFAZIASignal.h"
5 #include "KVString.h"
6 #include "TMath.h"
7 #include "KVDigitalFilter.h"
8 #include "KVEnv.h"
9 #include "KVDataSet.h"
10 #include "TMatrixD.h"
11 #include "TMatrixF.h"
12 #include "TClass.h"
13 
14 #define LOG2 (double)6.93147180559945286e-01
15 # define M_PI 3.14159265358979323846 /* pi */
16 
18 
19 // BEGIN_HTML <!--
21 /* -->
22 <h2>KVFAZIASignal</h2>
23 <h4>Base class for FAZIA signal processing</h4>
24 <!-- */
25 // --> END_HTML
26 //
27 // SIGNAL NAME
28 // ===========
29 // KVFAZIASignal::GetName() returns the name of the signal as defined in FAZIA
30 // raw data, e.g. "T1-Q3-B001-QH1"
31 //
32 // SIGNAL TYPE
33 // ===========
34 // KVFAZIASignal::GetType() returns one of: "QH1", "QL1", "Q2", "Q3", "I1", "I2"
36 
37 
38 
40 void KVFAZIASignal::init()
41 {
42  fChannel = kUNKDT;
43  ResetIndexes();
44  SetDefaultValues();
45 }
46 
47 
48 
50 
52 {
53  fIndex = 0;
54  fDetName = "";
56 }
57 
58 
59 
62 
64 {
65  // Default constructor
66  init();
67 }
68 
69 
70 
71 
73 
74 KVFAZIASignal::KVFAZIASignal(const char* name, const char* title) : KVSignal(name,title)
75 {
76  init();
77 }
78 
79 
80 
81 
83 
84 KVFAZIASignal::KVFAZIASignal(const TString& name, const TString& title) : KVSignal(name,title)
85 {
86  init();
87 }
88 
89 
90 
91 
92 
93 
95 
97 {
98  TString stit = GetTitle();
99  stit.ToUpper();
100 
101  KVString tmp = GetName();
102  KVString part = "";
103  if (tmp.BeginsWith("B")) {
104  tmp.Begin("-");
105  part = tmp.Next();
106  part.ReplaceAll("B", "");
107  Int_t bb = part.Atoi();
108  part = tmp.Next();
109  part.ReplaceAll("Q", "");
110  Int_t qq = part.Atoi();
111  part = tmp.Next();
112  part.ReplaceAll("T", "");
113  Int_t tt = part.Atoi();
114  fType = tmp.Next();
115 
116  fIndex = 100 * bb + 10 * qq + tt;
117  fDetName.Form("%s-%d", stit.Data(), fIndex);
118  }
119  else if (tmp.BeginsWith("RUTH")) {
120  //Old FAZIA telescope denomination
121  // Rutherford telescope case for FAZIASYM experiment
122  tmp.Begin("-");
123  part = tmp.Next();
124  fType = tmp.Next();
125 
126  TString stit = GetTitle();
127  stit.ToUpper();
128 
129  fDetName.Form("%s-RUTH", stit.Data());
130  }
131 }
132 
133 
134 
140 
142 {
143  //methods used to identify to from which detector/telescope/quartet/block
144  //the signal is associated
145  //it is assumed that the name of the signal is defined as it is in the raw data
146  //generated by fazia_reader which convert raw acquisition file in raw ROOT files
147 
148  ResetIndexes();
149  KVString tmp = GetName();
150  KVString part = "";
151  if (tmp.BeginsWith("B") || tmp.BeginsWith("RUTH")) {
152  //Old FAZIA telescope denomination
153  //Info("DeduceFromName","Old format %s",GetName());
155  }
156  else {
157 
158  if (tmp.GetNValues("-") == 2) {
159  //new general denomination
160  //in KaliVeda :
161  // signal name : [signal_type]-[index]
162  // if index is digit (number), it is the telescope number : 100*b+10*q+t
163  // if index is a string of character, we kept it as it is
164  // for example RUTH for the FAZIASYM dataset
165  TString stit = GetTitle();
166  stit.ToUpper();
167  //new format
168  //Info("DeduceFromName", "New format %s", GetName());
169  tmp.Begin("-");
170  fType = tmp.Next();
171  KVString ss = tmp.Next();
172 
173  if (ss.IsDigit()) {
174  fIndex = ss.Atoi();
175  fDetName.Form("%s-%d", stit.Data(), fIndex);
176  }
177  else {
178  fDetName.Form("%s-%s", stit.Data(), ss.Data());
179  }
180  }
181  else {
182  Warning("DeduceFromName", "Unkown format %s", GetName());
183  }
184  }
185 
186 
187 }
188 
189 
190 
193 
195 {
196  //DeduceFromName has to be called before
197 
198  Double_t lval = -1;
199  KVString spar;
200  spar.Form("%s.%s", GetType(), parname);
201  if (gDataSet) lval = gDataSet->GetDataSetEnv(spar.Data(), 0.0);
202  else lval = gEnv->GetValue(spar.Data(), 0.0);
203  return lval;
204 }
205 
206 
207 
209 
211 {
212  Info("Print", "\nName: %s - Title: %s", GetName(), GetTitle());
213  if (fDetName != "") {
214  printf("\tAssociated to the detector %s\n", fDetName.Data());
215  }
217 }
218 
219 
int Int_t
char Char_t
double Double_t
const char Option_t
R__EXTERN TEnv * gEnv
char name[80]
ValType GetDataSetEnv(const Char_t *type, const ValType &defval={}) const
Definition: KVDataSet.h:269
Int_t fIndex
index deduced from block, quartet and telescope numbering
Definition: KVFAZIASignal.h:20
TString fDetName
name of the detector, the signal is linked to, needed to find it in the KVMultiDetector
Definition: KVFAZIASignal.h:23
void TreateOldSignalName()
KVFAZIASignal()
Default constructor.
Double_t GetPSAParameter(const Char_t *parname) override
routines to read/change PSA parameters from configuration file or database
Int_t fFPGAOutputNumbers
ASsociated FPGA energy outputs.
Definition: KVFAZIASignal.h:25
void Print(Option_t *chopt="") const override
const Char_t * GetType() const
Definition: KVSignal.h:82
TString fType
string to identify the signal type
Definition: KVSignal.h:41
void print_psa_parameters() const
Definition: KVSignal.cpp:221
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
void Begin(TString delim) const
Definition: KVString.cpp:565
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:695
Int_t GetNValues(TString delim) const
Definition: KVString.cpp:886
virtual const char * GetValue(const char *name, const char *dflt) const
const char * GetName() const override
const char * GetTitle() const override
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
Int_t Atoi() const
const char * Data() const
Bool_t IsDigit() const
void ToUpper()
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
void Form(const char *fmt,...)
TString & ReplaceAll(const char *s1, const char *s2)
auto * tt
ClassImp(TPyArg)