KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVINDRADetector.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Sat Oct 3 14:18:09 2009
2 //Author: John Frankland,,,
3 
4 #include "KVINDRADetector.h"
5 #include "KVGroup.h"
6 #include "KVDataSet.h"
7 
9 
10 
11 
18 const Char_t* KVINDRADetector::GetArrayName()
19 {
20  // Name of detector given in the form
21  // CI_0213, SI_0911, CSI_1705
22  // to be compatible with GANIL acquisition parameters
23  //
24  // The root of the name is the detector type
25 
26  fFName =
27  Form("%s_%02d%02d", GetType(), GetRingNumber(),
28  GetModuleNumber());
29  return fFName.Data();
30 }
31 
32 
33 
48 
50 {
51  // Add an acquisition parameter of given type to this detector
52  // The parameter will be named according to INDRA/GANIL acquisition
53  // convention, i.e. name_of_detector_type e.g.
54  // CI_0201_PG (type="PG")
55  // CSI_0913_R (type="R")
56  //
57  // If you want to use a different extension for a given type for certain
58  // detectors, you can define them in the .kvrootrc file, e.g.:
59  //
60  // e613.KVACQParam.SI_0101.T: TOF
61  //
62  // Then for the dataset 'e613', calling GetACQParam("T") for the detector
63  // SI_0101 will return the parameter with name "SI_0101_TOF"
64 
65  TString extension = gDataSet->GetDataSetEnv(Form("KVACQParam.%s.%s", GetName(), type), type);
66  TString name;
67  name = this->GetName();
68  name.Append("_");
69  name.Append(extension.Data());
70 
71  AddACQParam(new KVACQParam(name, type));
72 }
73 
74 
75 
97 
99 {
100  // Look for acquisition parameter with given type in list
101  // of parameters associated with this detector.
102  //
103  // *** WARNING ***
104  // This method overrides the KVDetector::GetACQParam(const Char_t* name)
105  // method, which interprets the argument as the FULL name of the parameter.
106  // In this version, only the 'type' needs to be given,
107  // e.g. GetACQParam("PG") to retrieve e.g. the "CI_0201_PG" parameter
108  // associated to detector "CI_0201".
109  // If using this method in a loop over a list of INDRA- and non-INDRA
110  // detectors, the behaviour of the method will be different for the two
111  // types of detectors, and results may not be what you wanted.
112  //
113  // If you want to use a different extension for a given type for certain
114  // detectors, you can define them in the .kvrootrc file, e.g.:
115  //
116  // e613.KVACQParam.SI_0101.T: TOF
117  //
118  // Then for the dataset 'e613', calling GetACQParam("T") for the detector
119  // SI_0101 will return the parameter with name "SI_0101_TOF"
120 
121  TString extension = gDataSet->GetDataSetEnv(Form("KVACQParam.%s.%s", GetName(), type), type);
122  extension.Prepend("_");
123  // search just using the extension
124  // (in case e.g. of a mismatch between detector & parameter names)
125  TIter next(GetACQParamList());
126  KVACQParam* p;
127  while ((p = (KVACQParam*)next())) {
128  TString name = p->GetName();
129  if (name.EndsWith(extension)) return p;
130  }
131  return 0;
132 }
133 
134 
135 
136 
143 
145 {
146  //Linear conversion from GG to PG coder values (silicon and ionisation chamber detectors)
147  //If GG is not given as argument, the current value of the detector's GG ACQParam is read
148  //The PG value returned includes the current pedestal:
149  // PG = pied_PG + fGGtoPG_0 + fGGtoPG_1 * (GG - pied_GG)
150  //alpha, beta coefficients are obtained by fitting (PG-pied) vs. (GG-pied) for data.
151  if (GG < 0)
152  GG = (Double_t) GetGG();
153  Double_t PG =
154  GetPedestal("PG") + fGGtoPG_0 + fGGtoPG_1 * (GG - GetPedestal("GG"));
155  return PG;
156 }
157 
158 
159 
160 
167 
169 {
170  //Linear conversion from PG to GG coder values (silicon and ionisation chamber detectors)
171  //If PG is not given as argument, the current value of the detector's PG ACQParam is read
172  //The GG value returned includes the current pedestal:
173  // GG = pied_GG - (fGGtoPG_0/fGGtoPG_1) + (PG - pied_PG)/fGGtoPG_1
174  //alpha, beta coefficients are obtained by fitting (PG-pied) vs. (GG-pied) for data.
175  if (PG < 0)
176  PG = (Double_t) GetPG();
177  Double_t GG =
178  GetPedestal("GG") - (fGGtoPG_0 / fGGtoPG_1) + (PG - GetPedestal("PG")) / fGGtoPG_1;
179  return GG;
180 }
181 
182 
183 
188 
190 {
191  //PRIVATE METHOD
192  //Used when GetChIo is called the first time to retrieve the
193  //pointer to the ChIo of the group associated to this detector
194  if (GetTelescope()) {
195  KVGroup* kvgr = GetTelescope()->GetGroup();
196  if (kvgr) {
197  const KVSeqCollection* dets = kvgr->GetDetectors();
198  TIter next_det(dets);
199  KVINDRADetector* dd;
200  while ((dd = (KVINDRADetector*) next_det())) {
201  if (dd->InheritsFrom("KVChIo"))
202  fChIo = dd;
203  }
204  }
205  }
206  else
207  fChIo = 0;
208  return fChIo;
209 }
210 
211 
212 
215 
217 {
218  //Set the number of the electronic module of type QDC
219  NumeroCodeur = numero;
220 }
221 
222 
223 
227 
229 {
230  //Get the number of the electronic module of type QDC
231  //this field are initialized in KVINDRA::Build()
232  return NumeroCodeur;
233 }
234 
235 
236 
242 
244 {
245  // Overrides KVDetector::SetThickness
246  // If using ROOT geometry, print warning that any change in detector thickness will not
247  // be taken into account in the geometry.
248  // All thicknesses have to be set before the ROOT geometry is generated.
249 
250  if (ROOTGeo()) {
251  Warning("SetThickness", "Using ROOT geometry. Changes to detector thickness will not be taken into account in geometry.");
252  }
254 }
255 
256 
int Int_t
KVDataSet * gDataSet
Definition: KVDataSet.cpp:30
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
double Double_t
int type
char * Form(const char *fmt,...)
const char * extension
GANIL VXI/VME acquisition parameter.
Definition: KVACQParam.h:15
const Char_t * GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
Definition: KVDataSet.cpp:757
void AddACQParam(KVACQParam *)
Add given acquisition parameter to this detector.
Definition: KVDetector.cpp:627
virtual Float_t GetPedestal(const Char_t *) const
Access pedestal value associated to parameter with given name.
Definition: KVDetector.cpp:683
KVList * GetACQParamList() const
Definition: KVDetector.h:342
const KVSeqCollection * GetDetectors() const
Group of detectors which can be treated independently of all others in array.
Definition: KVGroup.h:19
Base class for detectors of INDRA array.
void SetNumeroCodeur(Int_t numero)
Set the number of the electronic module of type QDC.
void AddACQParamType(const Char_t *type)
virtual KVACQParam * GetACQParam(const Char_t *) const
Double_t GetPGfromGG(Double_t GG=-1)
void SetThickness(Double_t thick)
Double_t fGGtoPG_1
GG-PGconversion factor: slope.
virtual Float_t GetGG() const
Double_t fGGtoPG_0
GG-PG conversion factor: offset.
Double_t GetGGfromPG(Double_t PG=-1)
KVINDRATelescope * GetTelescope() const
Int_t NumeroCodeur
Numero du codeur (QDC pour les ChIo/Si)
KVINDRADetector * FindChIo()
KVINDRADetector * fChIo
pointer to ionisation chamber in group associated to this detector
virtual Float_t GetPG() const
KVGroup * GetGroup() const
virtual void SetThickness(Double_t thick)
Definition: KVMaterial.cpp:354
Bool_t ROOTGeo() const
Returns kTRUE if ROOT geometry is used, kFALSE if not.
Definition: KVPosition.cpp:598
KaliVeda extensions to ROOT collection classes.
virtual const char * GetName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual Bool_t InheritsFrom(const char *classname) const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
TString & Append(char c, Ssiz_t rep=1)
Type GetType(const std::string &Name)