KaliVeda  1.12/06
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 "KVACQParam.h"
9 #include "KVCalibrator.h"
10 #include "KVChannelVolt.h"
11 
13 
14 
15 
19 {
20  // Default constructor
21 }
22 
23 
24 
27 
29 {
30  // Destructor
31 }
32 
33 
34 
35 
40 
42 {
43  //Set gains used during this run
44  //Read gains in database just print detectors for which gains have changed
45  //
46 
47  KVRList* gain_list = kvrun->GetLinks("Gains");
48  if (!gain_list) {
49  return;
50  Warning("SetGains", "No gains defined for this run in database");
51  }
52  Int_t ndets = gain_list->GetSize();
53  Info("SetGains", "Loop on %d detectors : ...", ndets);
54 
55  Int_t nchange = 0;
56  KVDetector* kvd = 0;
57  Double_t oldgain;
58  TString list;
59  for (Int_t i = 0; i < ndets; i++) {
60  KVDBParameterSet* dbps = (KVDBParameterSet*) gain_list->At(i);
61  kvd = gIndra->GetDetector(dbps->GetName());
62  if (!kvd) {
63  //Error("SetGains",
64  // "Detector %s is unknown or does not exist at the current time...???",
65  // dbps->GetName());
66  continue;
67  }
68  else {
69  oldgain = kvd->GetGain();
70  if (oldgain != dbps->GetParameter(0)) {
71  kvd->SetGain(dbps->GetParameter(0));
72  //cout << " " << kvd->GetName() << " set gain from " << oldgain << " to G=" << kvd->GetGain() << endl;
73  list += kvd->GetName();
74  list += ",";
75  nchange += 1;
76  }
77  }
78  }
79  if (nchange == 0)
80  Info("SetGains", "Gains of the %d detectors are the same than the run before ", ndets);
81  else
82  Info("SetGains", "Gains have been changed for %d detectors (total = %d)", nchange, ndets);
83 
84 }
85 
86 
87 
88 
91 
93 {
94  //Set pedestals for this run
95 
96  KVRList* ped_list = kvrun->GetLinks("Pedestals");
97  if (!ped_list) {
98  return;
99  Warning("SetPedestals", "No pedestals defined for this run in database");
100  }
101  Int_t ndets = ped_list->GetSize();
102  Info("SetPedestals", "Loop on %d acquisition parameter : ...", ndets);
103 
104  Int_t nchange = 0;
105  KVACQParam* acq = 0;
106  KVDBParameterSet* dbps = 0;
107  Float_t oldped;
108  TString list;
109  for (Int_t i = 0; i < ndets; i++) {
110  dbps = (KVDBParameterSet*) ped_list->At(i);
111  acq = gIndra->GetACQParam(dbps->GetName());
112  if (!acq) {
113  //Error("SetPedestals","ACQ Parameter not defined %s",dbps->GetName());
114  }
115  else {
116  oldped = acq->GetPedestal();
117  if (oldped != Float_t(dbps->GetParameter(0))) {
118  acq->SetPedestal(Float_t(dbps->GetParameter(0)));
119 
120  list += acq->GetName();
121  list += ",";
122  nchange += 1;
123  }
124  }
125  }
126  if (nchange == 0)
127  Info("SetGains", "Pedestals of the %d acquisition parameters are the same than the run before ", ndets);
128  else
129  Info("SetGains", "Pedestals have been changed for %d acquisition parameters (total = %d)", nchange, ndets);
130 
131 }
132 
133 
134 
136 
138 {
139 
140 
141  KVRList* param_list = kvrun->GetLinks("Channel-Volt");
142  if (!param_list)
143  return;
144  if (!param_list->GetSize())
145  return;
146 
147  KVDetector* kvd;
148  KVDBParameterSet* kvps;
149  KVCalibrator* kvc;
150  TIter next_ps(param_list);
151 
152 
153  TString str;
154 
155  // Setting Channel-Volts calibration parameters
156  while ((kvps = (KVDBParameterSet*) next_ps())) { // boucle sur les parametres
157  str = kvps->GetName();
158  str.Remove(str.Sizeof() - 4, 3); //Removing 3 last letters (ex : "_PG")
159  kvd = gIndra->GetDetector(str.Data());
160  if (!kvd) {
161  // Warning("SetChVoltParameters(UInt_t)", "Dectector %s not found !",
162  // str.Data());
163  }
164  else { // detector found
165  kvc = kvd->GetCalibrator(kvps->GetName(), kvps->GetTitle());
166  if (!kvc)
167  Warning("SetChVoltParameters(UInt_t)",
168  "Calibrator %s %s not found !", kvps->GetName(),
169  kvps->GetTitle());
170  else { //calibrator found
171  //Prise en compte du gain du detecteur quand la rampe gene a ete faite
172  //pour ponderation des coef dans KVChannelVolt
173  Double_t gain_ref = kvps->GetParameter(kvc->GetNumberParams());
174  ((KVChannelVolt*)kvc)->SetGainRef(gain_ref);
175  for (Int_t i = 0; i < kvc->GetNumberParams(); i++) {
176  kvc->SetParameter(i, kvps->GetParameter(i));
177  }
178  kvc->SetStatus((gain_ref != 0)); // calibrator ready
179  } //calibrator found
180  } //detector found
181  } //boucle sur les parameters
182 }
183 
184 
185 
193 
195 {
196  // Do some e613 run-dependent fixing and bodging
197  //
198  // - for runs < 559, the cables of CsI detectors 2.9 and 3.10 were interchanged
199  // for these runs, we change the names of the corresponding acquisition
200  // parameters so that correct data are associated to each detector
201 
202  // inversion cables CsI 2.9 & 3.10
203  if (run < 559) {
204  KVDetector* d = gIndra->GetDetector("CSI_0209");
205  d->GetACQParam("R")->SetName("CSI_0310_R");
206  d->GetACQParam("L")->SetName("CSI_0310_L");
207  d->GetACQParam("T")->SetName("CSI_0310_T");
208  d = gIndra->GetDetector("CSI_0310");
209  d->GetACQParam("R")->SetName("CSI_0209_R");
210  d->GetACQParam("L")->SetName("CSI_0209_L");
211  d->GetACQParam("T")->SetName("CSI_0209_T");
212  ((KVHashList*)gIndra->GetACQParams())->Rehash();
213  }
214  else {
215  KVDetector* d = gIndra->GetDetector("CSI_0209");
216  d->GetACQParam("R")->SetName("CSI_0209_R");
217  d->GetACQParam("L")->SetName("CSI_0209_L");
218  d->GetACQParam("T")->SetName("CSI_0209_T");
219  d = gIndra->GetDetector("CSI_0310");
220  d->GetACQParam("R")->SetName("CSI_0310_R");
221  d->GetACQParam("L")->SetName("CSI_0310_L");
222  d->GetACQParam("T")->SetName("CSI_0310_T");
223  ((KVHashList*)gIndra->GetACQParams())->Rehash();
224  }
226 }
227 
228 
229 
int Int_t
unsigned int UInt_t
#define str(s)
Definition: KVBase.cpp:57
KVINDRA * gIndra
Definition: KVINDRA.cpp:78
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
#define d(i)
double Double_t
float Float_t
GANIL VXI/VME acquisition parameter.
Definition: KVACQParam.h:15
void SetPedestal(Float_t ped)
Definition: KVACQParam.h:98
Float_t GetPedestal() const
Definition: KVACQParam.h:102
Base class for all detector calibrations.
Definition: KVCalibrator.h:75
Int_t GetNumberParams() const
Definition: KVCalibrator.h:129
void SetParameter(int i, Double_t par_val) const
Definition: KVCalibrator.h:134
void SetStatus(Bool_t ready)
Definition: KVCalibrator.h:142
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, interface to energy-loss calculations.
Definition: KVDetector.h:121
Double_t GetGain() const
Definition: KVDetector.h:789
KVCalibrator * GetCalibrator(const Char_t *name, const Char_t *type) const
Definition: KVDetector.h:757
void SetGain(Double_t gain)
Definition: KVDetector.h:784
KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
Extended version of ROOT THashList.
Definition: KVHashList.h:28
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 SetParameters(UInt_t run, Bool_t physics_parameters_only=kFALSE)
const KVSeqCollection * GetACQParams() const
KVACQParam * GetACQParam(const Char_t *name) const
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),...)