KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
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
16
18{
19 // Default constructor
20}
21
22
23
26
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
float Float_t
double Double_t
Base class for all detector calibrations.
Int_t GetNumberParams() const
void SetParameter(int i, Double_t par_val) const
void SetStatus(Bool_t ready)
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".
Description of an experimental run in database ,,.
Definition KVDBRun.h:36
Base class for detector geometry description.
Definition KVDetector.h:160
Double_t GetGain() const
Definition KVDetector.h:847
KVCalibrator * GetCalibrator(const Char_t *name, const Char_t *type) const
Definition KVDetector.h:815
void SetGain(Double_t gain)
Definition KVDetector.h:842
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 SetParameters(UInt_t run, Bool_t physics_parameters_only=kFALSE)
Wrapper for TRefArray adding some functionality.
Definition KVRList.h:37
virtual Int_t GetSize() const
Definition KVRList.h:77
const char * GetName() const override
const char * GetTitle() const override
TObject * At(Int_t idx) const override
void Info(const char *location, const char *fmt,...)
void Warning(const char *location, const char *fmt,...)
ClassImp(TPyArg)