KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVTGIDManager.cpp
1/***************************************************************************
2 KVTGIDManager.cpp - description
3 -------------------
4 begin : 21 July 2005
5 copyright : (C) 2005 by J.D. Frankland
6 email : frankland@ganil.fr
7
8$Id: KVTGIDManager.cpp,v 1.12 2008/04/04 09:06:25 franklan Exp $
9***************************************************************************/
10
11#include "KVTGIDManager.h"
12#include "KVTGIDGrid.h"
13
15
16
17
19
21{
22 //Default constructor.
23 fID_max = 0.;
24 fStatus = -1;
25}
26
27
28
29
31
35
36
37
38
42
44{
45 //Add an identification object to the list.
46 //It will be deleted when the KVTGIDManager is deleted.
47 fIDList.Add(_tgid);
49}
50
51
52
53
56
58{
59 //Retrieve the identification object with name
60 return (KVTGID*) fIDList.FindObject(name);
61}
62
63
64
65
68
70{
71 //Delete the identification object with name
72 KVTGID* tgid = 0;
73 if ((tgid = (KVTGID*)fIDList.FindObject(name))) {
74 fIDList.Remove(tgid);
75 //recalculate fID_max if needed
76 if (tgid->GetIDmax() == fID_max) {
77 fID_max = 0.;
78 TIter n(&fIDList);
79 KVTGID* t;
80 while ((t = (KVTGID*)n())) fID_max = TMath::Max(fID_max, t->GetIDmax());
81 }
82 delete tgid;
83 }
84}
85
86
87
88
91
93{
94 //Delete all identification objects
96 fID_max = 0.;
97}
98
99
100
101
107
109 const Char_t* id_type,
110 const Char_t* grid_type)
111{
112 //Retrieve the identification object using:
113 // idt_name = name of ID telescope
114 // id_type = type of identification ("Z", "A", "A_for_Z=3", etc.)
115 // grid_type = type of identification grid ("GG", "PG1", etc.)
116 return (GetTGID(GetTGIDName(idt_name, id_type, grid_type)));
117}
118
119
120
121
127
129 const Char_t* id_type,
130 const Char_t* grid_type)
131{
132 //Return unique name for KVTGID object using:
133 // idt_name = name of ID telescope
134 // id_type = type of identification ("Z", "A", "A_for_Z=3", etc.)
135 // grid_type = type of identification grid ("GG", "PG1", etc.)
136 return (Form("%s_%s_%s", idt_name, id_type, grid_type));
137}
138
139
140
141
153
154Double_t KVTGIDManager::IdentZ(const Char_t* idtelescope_name, Double_t id_map_X, Double_t id_map_Y, Double_t& funLTG,
155 const Char_t* grid_type)
156{
157 //Identification in Z of particle for ID telescope idt using Tassan-Got functional corresponding
158 //to grid of type "grid_type". The "signal_type" argument is passed to GetIDMapX/Y(signal_type),
159 //in case "grid_type" and "signal_type" are not exactly the same.
160 //
161 //funLTG gives distance to identification line (absolute value of LTG function for the Z we find)
162 // funLTG = 0 -> identification parfaite
163 // funLTG = -1 -> no identification
164 //If the point to identify is outside of the range of the identification
165 //for this 'grid_type' (not between Zmin and Zmax) then we return -1 and funLTG=-1.
166 //if no identification of the required type exists, we return -1. and funLTG=-1.
167
168 funLTG = -1.;
170
171 //get Z identification object from KVTGIDManager
172 KVTGID* _tgid = GetTGID(idtelescope_name, "Z", grid_type);
173
174 //if no identification object exists, return -1
175 if (!_tgid) {
177 return (-1.0);
178 }
179 //Enter current point coordinates into Z identification function
180 _tgid->SetParameter("X", id_map_X);
181 _tgid->SetParameter("Y", id_map_Y);
182
183 Double_t Zfound = -1.;
184 Double_t Zmin = _tgid->GetIDmin();
185 Double_t Zmax = _tgid->GetIDmax();
186 if ((Int_t) Zmax == (Int_t) GetIDmax()) {
187 //If this functional corresponds to the grid with the highest ID lines,
188 //(i.e. for higher ID there are no more grids) then we need to be able to identify all
189 //particles with this grid, even above the last ID line drawn by hand.
190
191 Zmax = 100.;
192 }
193 //we need to lower and raise the limits in Z in order to pass the Eval(Zmin)*Eval(Zmax)<0
194 //condition. E.G. for GG, Zmin=1, which means that any points below the Z=1 line are not
195 //identified, whereas we should allow Zreal between 0.5 and 1.5
196 //also when several fits are used for different ranges of Z, often the ranges of validity
197 //of two successive fits do not overlap, i.e. Z=1-5 in GG, then Z=6-20 in PG etc.
198 //in this case somewhere in between Z=5 & Z=6 particles will be left unidentified
199 //as they will neither work in GG nor in PG.
200 Zmin -= 1.;
201 Zmax += 1.;
202
203 Zfound = _tgid->GetIdentification(Zmin, Zmax, funLTG);
204
207
208 return Zfound;
209}
210
211
212
213
224
225Double_t KVTGIDManager::IdentA(const Char_t* idtelescope_name, Double_t id_map_X, Double_t id_map_Y, Double_t& funLTG,
226 const Char_t* grid_type, Int_t Z)
227{
228 //Get A identification (we already know Z) for ID telescope idt using grid "grid_type".
229 //The "signal_type" argument is passed to GetIDMapX/Y(signal_type),
230 //in case "grid_type" and "signal_type" are not exactly the same.
231 //
232 //funLTG is the ABSOLUTE value of the Tassan-Got function for the Z and the calculated
233 //A i.e. in an ideal world it should equal zero. This gives an idea of the
234 //quality of the identification.
235 // funLTG = 0 -> identification parfaite
236 // funLTG = -1 -> no identification
237
238 funLTG = -1.;
240
241 if (Z < 1) {
243 return -1.;
244 }
245 //get A identification object from KVTGIDManager
246 KVTGID* _tgid = GetTGID(idtelescope_name, "A", grid_type);
247 //if no identification object exists, return -1
248 if (!_tgid) {
250 return (-1.0);
251 }
252 //check Z is not too big - no isotopic identification for Z > Zmax of grid
253 if (Z > _tgid->GetIDmax()) {
255 return -1.;
256 }
257 //Initialise parameters of A identification function
258 _tgid->SetParameter("X", id_map_X);
259 _tgid->SetParameter("Y", id_map_Y);
260 _tgid->SetParameter("Z", Z);
261
262 Double_t Afound = -1., Amin, Amax;
263 // reasonable limits for nuclear masses:
264 if (Z == 1) {
265 Amin = 1.;
266 Amax = 3.;
267 }
268 else if (Z == 2) {
269 Amin = 3;
270 Amax = 8;
271 }
272 else if (Z == 3) {
273 Amin = 6;
274 Amax = 11;
275 }
276 else if (Z == 4) {
277 Amin = 7;
278 Amax = 14;
279 }
280 else if (Z == 5) {
281 Amin = 8;
282 Amax = 17;
283 }
284 else {
285 //formula for Amin reasonable for 6<Z<20
286 Amin = TMath::Max((Z + 1.), (1.8 * (Z - 2.) + 1.));
287 Amax = 2.*Z + 8.;
288 }
289
290 // same limit trick as in IdentZ
291 Amin -= 0.5;
292 Amax += 0.5;
293
294 Afound = _tgid->GetIdentification(Amin, Amax, funLTG);
295
298
299 return Afound;
300}
301
302
303
304
310
312 Double_t xmax, Double_t xmin,
313 Int_t ID_min, Int_t ID_max,
314 Int_t npoints, Bool_t logscale)
315{
316 //Generates and returns a pointer to a KVIDGrid object permitting to visualise the effective
317 //identification lines represented by the Tassan-Got functional "tgid".
318 //The KVIDGrid object must be deleted by the user.
319 //See KVTGID::MakeIDGrid for meaning of other arguments.
320
321 if (!tgid)
322 return 0;
323 KVTGIDGrid* gr = new KVTGIDGrid(tgid);
324 gr->Generate(xmax, xmin, ID_min, ID_max, npoints, logscale);
325 return gr;
326}
327
328
329
335
337 Double_t xmax, Double_t xmin,
338 Int_t ID_min, Int_t ID_max,
339 Int_t npoints, Bool_t logscale)
340{
341 //Generates and returns a pointer to a KVIDGrid object permitting to visualise the effective
342 //identification lines represented by the Tassan-Got functional "tgid_name".
343 //The KVIDGrid object must be deleted by the user.
344 //See KVTGID::MakeIDGrid for meaning of other arguments.
345
346 return GetTGIDGrid(GetTGID(tgid_name), xmax, xmin, ID_min, ID_max, npoints, logscale);
347}
348
349
350
351
358
360 const Char_t* id_type,
361 const Char_t* grid_type,
362 Double_t xmax, Double_t xmin,
363 Int_t ID_min, Int_t ID_max,
364 Int_t npoints, Bool_t logscale)
365{
366 //Generates and returns a pointer to a KVIDGrid object permitting to visualise the effective
367 //identification lines represented by the Tassan-Got functional of ID telescope "idt_name", of
368 //identification type "id_type", and identification grid type "grid_type".
369 //The KVIDGrid object must be deleted by the user.
370 //See KVTGID::MakeIDGrid for meaning of other arguments.
371
372 return GetTGIDGrid(GetTGID(idt_name, id_type, grid_type), xmax,
373 xmin, ID_min, ID_max, npoints, logscale);
374}
375
376
377
378
383
385{
386 //Returns explanatory message for status code 's'
387 //If no code argument is given, the status string corresponds to the current value
388 //of GetStatus(), i.e. only valid if an identification has just been performed
389
390 static TString messages[] = {
391 "ok",
392 "no KVTGID for requested identification",
393 "point to identify outside of identification range of function",
394 "IdentA called with Z<1",
395 "IdentA called with Z larger than max Z defined for KVTGIDZA isotopic identification object"
396 };
397 Int_t status = (s != kCurrentStatus ? s + 1 : GetStatus() + 1);
398 if (status--)
399 return messages[status];
400 return Form("no call to IdentZ()/IdentA() performed yet");
401}
402
403
int Int_t
bool Bool_t
char Char_t
double Double_t
char name[80]
float xmin
float xmax
char * Form(const char *fmt,...)
virtual TObject * FindObject(const char *name) const
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from list.
virtual void Delete(Option_t *option="")
Grid representing result of fit.
Definition KVTGIDGrid.h:24
Handles a set of Tassan-Got functional-based identifications (KVTGID objects) for use by a KVIDTelesc...
virtual void RemoveTGID(const Char_t *name)
Delete the identification object with name.
virtual const Char_t * GetStatusString(ETGIDMStatus s=kCurrentStatus) const
virtual void RemoveAllTGID()
Delete all identification objects.
Double_t fID_max
maximum ID of all TGID objects
KVList fIDList
KVTGID objects for identifications.
virtual Double_t IdentA(const Char_t *, Double_t, Double_t, Double_t &funLTG, const Char_t *grid_type, Int_t Z)
virtual KVTGIDGrid * GetTGIDGrid(KVTGID *tgid, Double_t xmax, Double_t xmin=0., Int_t ID_min=0, Int_t ID_max=0, Int_t npoints=100, Bool_t logscale=kFALSE)
virtual void AddTGID(KVTGID *)
const Char_t * GetTGIDName(const Char_t *idt_name, const Char_t *id_type, const Char_t *grid_type)
ETGIDMStatus
status codes for IdentZ/IdentA
Int_t fStatus
transient member used to hold status of last call to IdentZ/IdentA
virtual ~KVTGIDManager()
Double_t GetIDmax() const
virtual Int_t GetStatus() const
virtual Double_t IdentZ(const Char_t *, Double_t, Double_t, Double_t &funLTG, const Char_t *grid_type)
KVTGID * GetTGID(const Char_t *name)
Retrieve the identification object with name.
Abstract base class for particle identfication using functionals developed by L. Tassan-Got (IPN Orsa...
Definition KVTGID.h:44
@ kStatus_NotBetween_IDMin_IDMax
Definition KVTGID.h:101
Double_t GetIDmin() const
Definition KVTGID.h:129
Double_t GetIDmax() const
Definition KVTGID.h:121
virtual Int_t GetStatus() const
Definition KVTGID.h:145
virtual Double_t GetIdentification(Double_t ID_min, Double_t ID_max, Double_t &ID_quality, Double_t *par=0)
Definition KVTGID.cpp:188
virtual void SetParameter(const TString &name, Double_t value)
const Int_t n
TGraphErrors * gr
Double_t Max(Double_t a, Double_t b)
ClassImp(TPyArg)