KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVINDRAUpDater_e475s.cpp
Go to the documentation of this file.
1 /*
2 $Id: KVINDRAUpDater_e475s.cpp,v 1.7 2009/04/15 09:52:45 ebonnet Exp $
3 $Revision: 1.7 $
4 $Date: 2009/04/15 09:52:45 $
5 */
6 
7 //Created by KVClassFactory on Tue Sep 18 12:14:51 2007
8 //Author: Eric Bonnet
9 
10 #include "KVINDRAUpDater_e475s.h"
11 #include "KVDBRun.h"
12 #include "KVDetector.h"
13 #include "KVCalibrator.h"
14 #include "KVDBParameterSet.h"
15 #include "KVINDRA.h"
16 #include "KVSilicon_e475s.h"
17 #include "KVChIo_e475s.h"
18 #include "KVCsI_e475s.h"
19 #include "KVEBYEDAT_ACQParam.h"
20 #include "KVINDRADB.h"
21 
22 #include "TList.h"
23 #include "TString.h"
24 
25 using namespace std;
26 
28 
29 
30 
31 
35 {
36  //Default constructor
37 }
38 
39 
40 
43 
45 {
46  //Destructor
47 }
48 
49 
50 
57 
59 {
60 
61 
62  //Set calibration parameters for this run.
63  //This will:
64  // remove all the calibrators of all the detectors ready to receive the calibrators for the run (handled by child classes),
65  // set calibration parameters for the run
66  // set pedestals for the run
67 
68  cout << "Setting calibration parameters of INDRA array for run " << run << ":" <<
69  endl;
70  KVDBRun* kvrun = gIndraDB->GetRun(run);
71  if (!kvrun) {
72  Error("SetParameters(UInt_t)", "Run %u not found in database!", run);
73  return;
74  }
75  //Reset all calibrators of all detectors first
76  TIter next(fArray->GetDetectors());
77  KVDetector* kvd;
78  while ((kvd = (KVDetector*) next())) {
79  if (kvd->InheritsFrom("KVSiLi") || kvd->InheritsFrom("KVSi75")) {
80  if (kvd->GetListOfCalibrators())
81  kvd->RemoveCalibrators();
82  kvd->SetCalibrators();
83  }
84  else {
85  if (kvd->GetListOfCalibrators()) {
86  kvd->RemoveCalibrators();
87  TIter lacq(kvd->GetACQParamList());
88  KVEBYEDAT_ACQParam* acq = 0;
89  while ((acq = (KVEBYEDAT_ACQParam*)lacq())) {
90  acq->SetPedestal(0);
91  }
92  }
93  }
94  }
95  SetCalibParameters(kvrun);
96  SetPedestals(kvrun);
97 
98 }
99 
100 
101 
102 
103 
105 
107 {
108 
109  KVRList* param_list = kvrun->GetLinks("Calibrations");
110 
111  if (!param_list)
112  return;
113  if (!param_list->GetSize())
114  return;
115 
116  //KVDetector *kvd;
117  KVDBParameterSet* kvps;
118  TIter next_ps(param_list);
119  TString str;
120 
121  // Setting all calibration parameters available
122  while ((kvps = (KVDBParameterSet*) next_ps())) { // boucle sur les parametres
123  str = kvps->GetName();
124  if (gIndra->GetDetector(str.Data())) {
125 
126  if (gIndra->GetDetector(str.Data())->InheritsFrom("KVSilicon_e475s")) {
127  ((KVSilicon_e475s*)gIndra->GetDetector(str.Data()))->SetCalibrator(kvps);
128  }
129  else if (gIndra->GetDetector(str.Data())->InheritsFrom("KVChIo_e475s")) {
130  ((KVChIo_e475s*)gIndra->GetDetector(str.Data()))->SetCalibrator(kvps);
131  }
132  else if (gIndra->GetDetector(str.Data())->InheritsFrom("KVCsI_e475s")) {
133  ((KVCsI_e475s*)gIndra->GetDetector(str.Data()))->SetCalibrator(kvps);
134  }
135  else {
136  Warning("SetCalibParameters(KVDBRun*)",
137  "Calibrator %s %s not found ! ",
138  kvps->GetName(), kvps->GetTitle());
139  }
140  } //detector found
141  } //boucle sur les parameters
142 
143 }
144 
145 
146 
147 
148 
150 
152 {
153 
154  KVRList* param_list = kvrun->GetLinks("Pedestals");
155 
156  if (!param_list)
157  return;
158  if (!param_list->GetSize())
159  return;
160 
161  KVDetector* det;
162  KVDBParameterSet* kvps;
163  TIter next_ps(param_list);
164  KVString str;
165  Double_t pied_value;
166 
167  // Setting all pedestal values available
168  while ((kvps = (KVDBParameterSet*) next_ps())) { // boucle sur les parametres
169  str = kvps->GetName();
170  if ((det = gIndra->GetDetector(str.Data()))) {
171  pied_value = kvps->GetParameter(1);
172  det->SetPedestal(kvps->GetTitle(), pied_value);
173  } //detector found
174  } //boucle sur les parameters
175 
176 }
177 
178 
unsigned int UInt_t
#define str(s)
Definition: KVBase.cpp:57
KVINDRADB * gIndraDB
Definition: KVINDRADB.cpp:38
KVINDRA * gIndra
Definition: KVINDRA.cpp:88
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
double Double_t
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
KVList * GetListOfCalibrators() const
Definition: KVDetector.h:385
virtual void RemoveCalibrators()
Definition: KVDetector.cpp:699
GANIL VXI/VME 16 bit (maximum) EBYEDAT acquisition parameter.
KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
KVINDRADBRun * GetRun(Int_t run) const
Definition: KVINDRADB.h:132
Sets run parameters for INDRA_e475s dataset.
void SetCalibrationParameters(UInt_t)
virtual ~KVINDRAUpDater_e475s()
Destructor.
void SetCalibParameters(KVDBRun *run)
Override in child classes to set specific calibrations.
Wrapper for TRefArray adding some functionality.
Definition: KVRList.h:36
virtual Int_t GetSize() const
Definition: KVRList.h:76
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
virtual const char * GetName() const
virtual const char * GetTitle() const
virtual Bool_t InheritsFrom(const char *classname) const
void Error(const char *location, const char *va_(fmt),...)
void Warning(const char *location, const char *va_(fmt),...)