KaliVeda
Toolkit for HIC analysis
KVINDRAUpDater_e613.cpp
1 //Created by KVClassFactory on Wed Nov 16 14:10:43 2011
2 //Author: bonnet
3 
4 #include "KVINDRAUpDater_e613.h"
5 #include "KVDBParameterSet.h"
6 #include "KVINDRA.h"
7 #include "KVDetector.h"
8 #include "KVCalibrator.h"
9 //#include "KVChannelVolt.h"
10 
12 
13 
14 
18 {
19  // Default constructor
20 }
21 
22 
23 
26 
28 {
29  // Destructor
30 }
31 
32 
33 
34 //void KVINDRAUpDater_e613::SetGains(KVDBRun* kvrun)
35 //{
36 // //Set gains used during this run
37 // //Read gains in database just print detectors for which gains have changed
38 // //
39 
40 // KVRList* gain_list = kvrun->GetLinks("Gains");
41 // if (!gain_list) {
42 // return;
43 // Warning("SetGains", "No gains defined for this run in database");
44 // }
45 // Int_t ndets = gain_list->GetSize();
46 // Info("SetGains", "Loop on %d detectors : ...", ndets);
47 
48 // Int_t nchange = 0;
49 // KVDetector* kvd = 0;
50 // Double_t oldgain;
51 // TString list;
52 // for (Int_t i = 0; i < ndets; i++) {
53 // KVDBParameterSet* dbps = (KVDBParameterSet*) gain_list->At(i);
54 // kvd = gIndra->GetDetector(dbps->GetName());
55 // if (!kvd) {
56 // //Error("SetGains",
57 // // "Detector %s is unknown or does not exist at the current time...???",
58 // // dbps->GetName());
59 // continue;
60 // }
61 // else {
62 // oldgain = kvd->GetGain();
63 // if (oldgain != dbps->GetParameter(0)) {
64 // kvd->SetGain(dbps->GetParameter(0));
65 // //cout << " " << kvd->GetName() << " set gain from " << oldgain << " to G=" << kvd->GetGain() << endl;
66 // list += kvd->GetName();
67 // list += ",";
68 // nchange += 1;
69 // }
70 // }
71 // }
72 // if (nchange == 0)
73 // Info("SetGains", "Gains of the %d detectors are the same than the run before ", ndets);
74 // else
75 // Info("SetGains", "Gains have been changed for %d detectors (total = %d)", nchange, ndets);
76 
77 //}
78 
79 
80 
83 
85 {
86  //Set pedestals for this run
87 
88  KVRList* ped_list = kvrun->GetLinks("Pedestals");
89  if (!ped_list) {
90  return;
91  Warning("SetPedestals", "No pedestals defined for this run in database");
92  }
93  Int_t ndets = ped_list->GetSize();
94  Info("SetPedestals", "Loop on %d acquisition parameter : ...", ndets);
95 
96  Int_t nchange = 0;
97  KVEBYEDAT_ACQParam* acq = 0;
98  KVDBParameterSet* dbps = 0;
99  Float_t oldped;
100  TString list;
101  for (Int_t i = 0; i < ndets; i++) {
102  dbps = (KVDBParameterSet*) ped_list->At(i);
103  acq = nullptr; // gIndra->GetACQParam(dbps->GetName());
104  if (!acq) {
105  //Error("SetPedestals","ACQ Parameter not defined %s",dbps->GetName());
106  }
107  else {
108 // oldped = acq->GetPedestal();
109 // if (oldped != Float_t(dbps->GetParameter(0))) {
110 // acq->SetPedestal(Float_t(dbps->GetParameter(0)));
111 
112 // list += acq->GetName();
113 // list += ",";
114 // nchange += 1;
115 // }
116  }
117  }
118  if (nchange == 0)
119  Info("SetGains", "Pedestals of the %d acquisition parameters are the same than the run before ", ndets);
120  else
121  Info("SetGains", "Pedestals have been changed for %d acquisition parameters (total = %d)", nchange, ndets);
122 
123 }
124 
125 
126 
128 
130 {
131 
132 
133  KVRList* param_list = kvrun->GetLinks("Channel-Volt");
134  if (!param_list)
135  return;
136  if (!param_list->GetSize())
137  return;
138 
139  KVDetector* kvd;
140  KVDBParameterSet* kvps;
141  KVCalibrator* kvc;
142  TIter next_ps(param_list);
143 
144 
145  TString str;
146 
147  // Setting Channel-Volts calibration parameters
148  while ((kvps = (KVDBParameterSet*) next_ps())) { // boucle sur les parametres
149  str = kvps->GetName();
150  str.Remove(str.Sizeof() - 4, 3); //Removing 3 last letters (ex : "_PG")
151  kvd = gIndra->GetDetector(str.Data());
152  if (!kvd) {
153  // Warning("SetChVoltParameters(UInt_t)", "Dectector %s not found !",
154  // str.Data());
155  }
156  else { // detector found
157  kvc = kvd->GetCalibrator(kvps->GetName(), kvps->GetTitle());
158  if (!kvc)
159  Warning("SetChVoltParameters(UInt_t)",
160  "Calibrator %s %s not found !", kvps->GetName(),
161  kvps->GetTitle());
162  else { //calibrator found
163  //Prise en compte du gain du detecteur quand la rampe gene a ete faite
164  //pour ponderation des coef dans KVChannelVolt
165  Double_t gain_ref = kvps->GetParameter(kvc->GetNumberParams());
166  //((KVChannelVolt*)kvc)->SetGainRef(gain_ref);
167  for (Int_t i = 0; i < kvc->GetNumberParams(); i++) {
168  kvc->SetParameter(i, kvps->GetParameter(i));
169  }
170  kvc->SetStatus((gain_ref != 0)); // calibrator ready
171  } //calibrator found
172  } //detector found
173  } //boucle sur les parameters
174 }
175 
176 
177 
207 
208 void KVINDRAUpDater_e613::SetParameters(UInt_t run, Bool_t physics_parameters_only)
209 {
210  // Do some e613 run-dependent fixing and bodging
211  //
212  // - for runs < 559, the cables of CsI detectors 2.9 and 3.10 were interchanged
213  // for these runs, we change the names of the corresponding acquisition
214  // parameters so that correct data are associated to each detector
215 
216  // inversion cables CsI 2.9 & 3.10
217 // if (run < 559) {
218 // KVDetector* d = gIndra->GetDetector("CSI_0209");
219 // d->GetACQParam("R")->SetName("CSI_0310_R");
220 // d->GetACQParam("L")->SetName("CSI_0310_L");
221 // d->GetACQParam("T")->SetName("CSI_0310_T");
222 // d = gIndra->GetDetector("CSI_0310");
223 // d->GetACQParam("R")->SetName("CSI_0209_R");
224 // d->GetACQParam("L")->SetName("CSI_0209_L");
225 // d->GetACQParam("T")->SetName("CSI_0209_T");
226 // ((KVHashList*)gIndra->GetACQParams())->Rehash();
227 // }
228 // else {
229 // KVDetector* d = gIndra->GetDetector("CSI_0209");
230 // d->GetACQParam("R")->SetName("CSI_0209_R");
231 // d->GetACQParam("L")->SetName("CSI_0209_L");
232 // d->GetACQParam("T")->SetName("CSI_0209_T");
233 // d = gIndra->GetDetector("CSI_0310");
234 // d->GetACQParam("R")->SetName("CSI_0310_R");
235 // d->GetACQParam("L")->SetName("CSI_0310_L");
236 // d->GetACQParam("T")->SetName("CSI_0310_T");
237 // ((KVHashList*)gIndra->GetACQParams())->Rehash();
238 // }
240 }
241 
242 
243 
int Int_t
unsigned int UInt_t
bool Bool_t
float Float_t
double Double_t
Base class for all detector calibrations.
Definition: KVCalibrator.h:99
Int_t GetNumberParams() const
Definition: KVCalibrator.h:153
void SetParameter(int i, Double_t par_val) const
Definition: KVCalibrator.h:158
void SetStatus(Bool_t ready)
Definition: KVCalibrator.h:166
To store calibration parameters in a database ,.
Double_t GetParameter(UShort_t i=0) const
virtual KVRList * GetLinks(const Char_t *key) const
Returns the list of records linked to this record in table "key".
Definition: KVDBRecord.cpp:206
Description of an experimental run in database ,,.
Definition: KVDBRun.h:40
GANIL VXI/VME 16 bit (maximum) EBYEDAT acquisition parameter.
Sets run parameters for INDRA_e613 dataset.
void SetChVoltParameters(KVDBRun *) override
void SetPedestals(KVDBRun *)
virtual void SetGains(KVDBRun*);
void SetParameters(UInt_t run, Bool_t physics_parameters_only=kFALSE) override
virtual ~KVINDRAUpDater_e613()
Destructor.
void SetParameters(UInt_t run, Bool_t physics_parameters_only=kFALSE) override
KVINDRADetector * GetDetector(const Char_t *name) const override
Definition: KVINDRA.h:277
Wrapper for TRefArray adding some functionality.
Definition: KVRList.h:37
Int_t GetSize() const override
Definition: KVRList.h:76
const char * GetName() const override
const char * GetTitle() const override
TObject * At(Int_t idx) const override
const char * Data() const
virtual Int_t Sizeof() const
TString & Remove(EStripType s, char c)
void Info(const char *location, const char *fmt,...)
void Warning(const char *location, const char *fmt,...)
ClassImp(TPyArg)