KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVINDRAUpDater_e613.cpp
Go to the documentation of this file.
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 
39 
41 {
42  //Set gains used during this run
43  //Read gains in database just print detectors for which gains have changed
44  //
45 
46  KVRList* gain_list = kvrun->GetLinks("Gains");
47  if (!gain_list) {
48  return;
49  Warning("SetGains", "No gains defined for this run in database");
50  }
51  Int_t ndets = gain_list->GetSize();
52  Info("SetGains", "Loop on %d detectors : ...", ndets);
53 
54  Int_t nchange = 0;
55  KVDetector* kvd = 0;
56  Double_t oldgain;
57  TString list;
58  for (Int_t i = 0; i < ndets; i++) {
59  KVDBParameterSet* dbps = (KVDBParameterSet*) gain_list->At(i);
60  kvd = gIndra->GetDetector(dbps->GetName());
61  if (!kvd) {
62  //Error("SetGains",
63  // "Detector %s is unknown or does not exist at the current time...???",
64  // dbps->GetName());
65  continue;
66  }
67  else {
68  oldgain = kvd->GetGain();
69  if (oldgain != dbps->GetParameter(0)) {
70  kvd->SetGain(dbps->GetParameter(0));
71  //cout << " " << kvd->GetName() << " set gain from " << oldgain << " to G=" << kvd->GetGain() << endl;
72  list += kvd->GetName();
73  list += ",";
74  nchange += 1;
75  }
76  }
77  }
78  if (nchange == 0)
79  Info("SetGains", "Gains of the %d detectors are the same than the run before ", ndets);
80  else
81  Info("SetGains", "Gains have been changed for %d detectors (total = %d)", nchange, ndets);
82 
83 }
84 
85 
86 
87 
90 
92 {
93  //Set pedestals for this run
94 
95  KVRList* ped_list = kvrun->GetLinks("Pedestals");
96  if (!ped_list) {
97  return;
98  Warning("SetPedestals", "No pedestals defined for this run in database");
99  }
100  Int_t ndets = ped_list->GetSize();
101  Info("SetPedestals", "Loop on %d acquisition parameter : ...", ndets);
102 
103  Int_t nchange = 0;
104  KVEBYEDAT_ACQParam* acq = 0;
105  KVDBParameterSet* dbps = 0;
106  Float_t oldped;
107  TString list;
108  for (Int_t i = 0; i < ndets; i++) {
109  dbps = (KVDBParameterSet*) ped_list->At(i);
110  acq = nullptr; // gIndra->GetACQParam(dbps->GetName());
111  if (!acq) {
112  //Error("SetPedestals","ACQ Parameter not defined %s",dbps->GetName());
113  }
114  else {
115 // oldped = acq->GetPedestal();
116 // if (oldped != Float_t(dbps->GetParameter(0))) {
117 // acq->SetPedestal(Float_t(dbps->GetParameter(0)));
118 
119 // list += acq->GetName();
120 // list += ",";
121 // nchange += 1;
122 // }
123  }
124  }
125  if (nchange == 0)
126  Info("SetGains", "Pedestals of the %d acquisition parameters are the same than the run before ", ndets);
127  else
128  Info("SetGains", "Pedestals have been changed for %d acquisition parameters (total = %d)", nchange, ndets);
129 
130 }
131 
132 
133 
135 
137 {
138 
139 
140  KVRList* param_list = kvrun->GetLinks("Channel-Volt");
141  if (!param_list)
142  return;
143  if (!param_list->GetSize())
144  return;
145 
146  KVDetector* kvd;
147  KVDBParameterSet* kvps;
148  KVCalibrator* kvc;
149  TIter next_ps(param_list);
150 
151 
152  TString str;
153 
154  // Setting Channel-Volts calibration parameters
155  while ((kvps = (KVDBParameterSet*) next_ps())) { // boucle sur les parametres
156  str = kvps->GetName();
157  str.Remove(str.Sizeof() - 4, 3); //Removing 3 last letters (ex : "_PG")
158  kvd = gIndra->GetDetector(str.Data());
159  if (!kvd) {
160  // Warning("SetChVoltParameters(UInt_t)", "Dectector %s not found !",
161  // str.Data());
162  }
163  else { // detector found
164  kvc = kvd->GetCalibrator(kvps->GetName(), kvps->GetTitle());
165  if (!kvc)
166  Warning("SetChVoltParameters(UInt_t)",
167  "Calibrator %s %s not found !", kvps->GetName(),
168  kvps->GetTitle());
169  else { //calibrator found
170  //Prise en compte du gain du detecteur quand la rampe gene a ete faite
171  //pour ponderation des coef dans KVChannelVolt
172  Double_t gain_ref = kvps->GetParameter(kvc->GetNumberParams());
173  //((KVChannelVolt*)kvc)->SetGainRef(gain_ref);
174  for (Int_t i = 0; i < kvc->GetNumberParams(); i++) {
175  kvc->SetParameter(i, kvps->GetParameter(i));
176  }
177  kvc->SetStatus((gain_ref != 0)); // calibrator ready
178  } //calibrator found
179  } //detector found
180  } //boucle sur les parameters
181 }
182 
183 
184 
214 
216 {
217  // Do some e613 run-dependent fixing and bodging
218  //
219  // - for runs < 559, the cables of CsI detectors 2.9 and 3.10 were interchanged
220  // for these runs, we change the names of the corresponding acquisition
221  // parameters so that correct data are associated to each detector
222 
223  // inversion cables CsI 2.9 & 3.10
224 // if (run < 559) {
225 // KVDetector* d = gIndra->GetDetector("CSI_0209");
226 // d->GetACQParam("R")->SetName("CSI_0310_R");
227 // d->GetACQParam("L")->SetName("CSI_0310_L");
228 // d->GetACQParam("T")->SetName("CSI_0310_T");
229 // d = gIndra->GetDetector("CSI_0310");
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 // ((KVHashList*)gIndra->GetACQParams())->Rehash();
234 // }
235 // else {
236 // KVDetector* d = gIndra->GetDetector("CSI_0209");
237 // d->GetACQParam("R")->SetName("CSI_0209_R");
238 // d->GetACQParam("L")->SetName("CSI_0209_L");
239 // d->GetACQParam("T")->SetName("CSI_0209_T");
240 // d = gIndra->GetDetector("CSI_0310");
241 // d->GetACQParam("R")->SetName("CSI_0310_R");
242 // d->GetACQParam("L")->SetName("CSI_0310_L");
243 // d->GetACQParam("T")->SetName("CSI_0310_T");
244 // ((KVHashList*)gIndra->GetACQParams())->Rehash();
245 // }
247 }
248 
249 
250 
int Int_t
unsigned int UInt_t
#define str(s)
Definition: KVBase.cpp:57
KVINDRA * gIndra
Definition: KVINDRA.cpp:88
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
double Double_t
float Float_t
Base class for all detector calibrations.
Definition: KVCalibrator.h:98
Int_t GetNumberParams() const
Definition: KVCalibrator.h:152
void SetParameter(int i, Double_t par_val) const
Definition: KVCalibrator.h:157
void SetStatus(Bool_t ready)
Definition: KVCalibrator.h:165
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:35
Base class for detector geometry description.
Definition: KVDetector.h:159
Double_t GetGain() const
Definition: KVDetector.h:846
KVCalibrator * GetCalibrator(const Char_t *name, const Char_t *type) const
Definition: KVDetector.h:814
void SetGain(Double_t gain)
Definition: KVDetector.h:841
GANIL VXI/VME 16 bit (maximum) EBYEDAT acquisition parameter.
KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
Sets run parameters for INDRA_e613 dataset.
virtual void SetGains(KVDBRun *)
virtual void SetPedestals(KVDBRun *)
Set pedestals for this run.
virtual void SetParameters(UInt_t run)
virtual ~KVINDRAUpDater_e613()
Destructor.
virtual void SetChVoltParameters(KVDBRun *)
virtual void SetPedestals(KVDBRun*);
virtual void SetParameters(UInt_t run, Bool_t physics_parameters_only=kFALSE)
Wrapper for TRefArray adding some functionality.
Definition: KVRList.h:36
virtual Int_t GetSize() const
Definition: KVRList.h:76
virtual const char * GetName() const
virtual const char * GetTitle() const
TObject * At(Int_t idx) const
void Info(const char *location, const char *va_(fmt),...)
void Warning(const char *location, const char *va_(fmt),...)