KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVIDTelescope.h
Go to the documentation of this file.
1 /***************************************************************************
2 $Id: KVIDTelescope.h,v 1.33 2009/04/01 15:58:10 ebonnet Exp $
3  KVIDTelescope.h - description
4  -------------------
5  begin : Wed Jun 18 2003
6  copyright : (C) 2003 by J.D Frankland
7  email : frankland@ganil.fr
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef KVIDTELESCOPE_H
20 #define KVIDTELESCOPE_H
21 
22 #include "KVBase.h"
23 #include "KVDetector.h"
24 #include "KVRList.h"
25 #include "TGraph.h"
26 
28 class KVGroup;
29 class KVIDGraph;
30 class KVIDGrid;
31 class KVMultiDetArray;
33 class TH2;
35 
36 #ifdef WITH_CPP11
37 #include <unordered_map>
38 #else
39 #include <map>
40 #endif
41 
88 class KVIDTelescope: public KVBase {
89 
90 
93 
94 protected:
98  enum {
99  kMassID = BIT(15), //set if telescope is capable of mass identification i.e. isotopic resolution
100  kReadyForID = BIT(16) //set if telescope is ready and able for identification. set in Initialize()
101  };
103 
104  void SetLabelFromURI(const Char_t* uri);
106  KVDetectorSignal* GetSignalFromGridVar(const KVString& var, const KVString& axe);
107 #if defined(USING_ROOT5) && defined(__MAKECINT__)
110 #else
111  struct GraphCoords {
114  };
115 #ifdef WITH_CPP11
116  mutable std::unordered_map<KVIDGraph*, GraphCoords> fGraphCoords;
117 #else
118  mutable std::map<KVIDGraph*, GraphCoords> fGraphCoords;
119 #endif
120 #endif
121 
122 public:
123 
125  enum {
126  kCalibStatus_OK, // fine, OK, all detectors calculated and functioning properly
127  kCalibStatus_Calculated, // one or more detectors not calibrated/functioning, energy loss calculated
128  kCalibStatus_NoCalibrations, // no calibrations available for any detectors
129  kCalibStatus_Multihit, // one or more detectors hit by more than one particle, energy loss calculated for this detector
130  kCalibStatus_Coherency // comparison of calculated and measured energy loss in one or more detectors reveals presence of other particles
131  };
132 
133  KVIDTelescope();
134  virtual ~ KVIDTelescope();
135  void init();
136  virtual void AddDetector(KVDetector* d);
137  const KVList* GetDetectors() const
138  {
139  return &fDetectors;
140  }
142  {
144  if (n > GetSize() || n < 1) {
145  Error("GetDetector(UInt_t n)", "n must be between 1 and %u",
146  GetSize());
147  return 0;
148  }
149  KVDetector* d = (KVDetector*) GetDetectors()->At((n - 1));
150  return d;
151  };
152  KVDetector* GetDetector(const Char_t* name) const;
153  Bool_t HasDetector(const KVDetector* d) const
154  {
156  return GetDetectorRank(d) > 0;
157  }
159  {
162 
163  return GetDetectors()->IndexOf(kvd) + 1;
164  }
165  UInt_t GetSize() const
166  {
168  return GetDetectors()->GetSize();
169  }
170 
171  KVGroup* GetGroup() const;
172  void SetGroup(KVGroup* kvg);
174 
175  virtual TGraph* MakeIDLine(KVNucleus* nuc, Double_t Emin, Double_t Emax,
176  Double_t Estep = 0.0);
177 
178  virtual void Initialize(void);
179 
180  virtual Bool_t Identify(KVIdentificationResult*, Double_t x = -1., Double_t y = -1.);
181 
183  virtual Int_t GetCalibStatus() const
184  {
190  return fCalibStatus;
191  }
192 
193  virtual void Print(Option_t* opt = "") const;
194 
195  void SetIDGrid(KVIDGraph*);
196  KVIDGraph* GetIDGrid();
198  KVIDGraph* GetIDGrid(const Char_t*);
199  const KVList* GetListOfIDGrids() const
200  {
201  return &fIDGrids;
202  }
203 
204  virtual void RemoveGrids();
205 
206  virtual Double_t GetIDMapX(Option_t* opt = "");
207  virtual Double_t GetIDMapY(Option_t* opt = "");
208  virtual Double_t GetPedestalX(Option_t* opt = "");
209  virtual Double_t GetPedestalY(Option_t* opt = "");
210 
213  void GetIDGridCoords(Double_t& X, Double_t& Y, KVIDGraph* grid, Double_t x = -1, Double_t y = -1)
214  {
219 
220  Y = (y < 0. ? GetIDGridYCoord(grid) : y);
221  X = (x < 0. ? GetIDGridXCoord(grid) : x);
222  }
223  void SetHasMassID(Bool_t yes = kTRUE)
224  {
225  SetBit(kMassID, yes);
226  }
227 
231  {
232  return TestBit(kMassID);
233  }
234 
235  static KVIDTelescope* MakeIDTelescope(const Char_t* name);
236 
238  virtual void RemoveIdentificationParameters();
239 
240  void LoadIdentificationParameters(const Char_t* filename, const KVMultiDetArray* multidet);
241  void ReadIdentificationParameterFiles(const Char_t* filename, const KVMultiDetArray* multidet);
242 
246  {
247  return TestBit(kReadyForID);
248  };
249 
250  const Char_t* GetDefaultIDGridClass();
251  KVIDGrid* CalculateDeltaE_EGrid(const KVNumberList& Zrange, Int_t deltaMasse, Int_t npoints, Double_t lifetime = -10/*s*/, UChar_t massformula = 0, Double_t xfactor = 1.);
252  KVIDGrid* CalculateDeltaE_EGrid(TH2* haa_zz, Bool_t Zonly, Int_t npoints);
254  enum {
255  kMeanDE_OK, // all OK
256  kMeanDE_XtooSmall, // X-coordinate is smaller than smallest X-coordinate of ID line
257  kMeanDE_XtooLarge, // X-coordinate is larger than largest X-coordinate of ID line
258  kMeanDE_NoIdentifier // No identifier found for Z or (Z,A)
259  };
260  virtual Double_t GetMeanDEFromID(Int_t& status, Int_t Z, Int_t A = -1, Double_t Eres = -1.0);
261  virtual UShort_t GetIDCode()
262  {
265  return fIDCode;
266  }
267 
268  virtual void SetIDCode(UShort_t c)
269  {
271  fIDCode = c;
272  }
273 
274  virtual Bool_t CheckTheoreticalIdentificationThreshold(KVNucleus* /*ION*/, Double_t /*EINC*/ = 0.0);
275  virtual Bool_t CanIdentify(Int_t Z, Int_t /*A*/)
276  {
282  return (Z > 0);
283  }
286  {
292 
293  return (GetSize() == 1 || (GetSize() == 2 && GetDetector(1)->GetNode()->GetNTraj() == 1
294  && GetDetector(2)->GetNode()->GetNTraj() == 1));
295  }
296 
297  static void OpenIdentificationBilan(const TString& path);
298  void CheckIdentificationBilan(const TString& system);
299 
300  ClassDef(KVIDTelescope, 5) //A delta-E - E identification telescope
301 };
302 
303 #endif
int Int_t
unsigned int UInt_t
#define d(i)
#define c(i)
unsigned short UShort_t
unsigned char UChar_t
char Char_t
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
#define BIT(n)
Base class for KaliVeda framework.
Definition: KVBase.h:135
Output signal data produced by a detector.
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:121
Group of detectors which can be treated independently of all others in array.
Definition: KVGroup.h:19
Base class for particle identification in a 2D map.
Definition: KVIDGraph.h:31
Abstract base class for 2D identification grids in e.g. (dE,E) maps.
Definition: KVIDGrid.h:73
Base class for all detectors or associations of detectors in array which can identify charged particl...
Definition: KVIDTelescope.h:88
void LoadIdentificationParameters(const Char_t *filename, const KVMultiDetArray *multidet)
This method add to the gIDGridManager list the identification grids.
virtual Double_t GetIDMapY(Option_t *opt="")
virtual Bool_t IsReadyForID()
void init()
default init
KVList fIDGrids
identification grid(s)
Definition: KVIDTelescope.h:97
void SetGroup(KVGroup *kvg)
void SetLabelFromURI(const Char_t *uri)
@ kCalibStatus_NoCalibrations
Double_t GetIDGridYCoord(KVIDGraph *) const
virtual Bool_t Identify(KVIdentificationResult *, Double_t x=-1., Double_t y=-1.)
KVIDGrid * CalculateDeltaE_EGrid(const KVNumberList &Zrange, Int_t deltaMasse, Int_t npoints, Double_t lifetime=-10, UChar_t massformula=0, Double_t xfactor=1.)
virtual Double_t GetIDMapX(Option_t *opt="")
static KVIDTelescope * MakeIDTelescope(const Char_t *name)
virtual Double_t GetPedestalY(Option_t *opt="")
virtual Bool_t SetIdentificationParameters(const KVMultiDetArray *)
void SetIDGrid(KVIDGraph *)
Bool_t HasMassID() const
KVDetector * GetDetector(UInt_t n) const
void ReadIdentificationParameterFiles(const Char_t *filename, const KVMultiDetArray *multidet)
virtual Bool_t CheckTheoreticalIdentificationThreshold(KVNucleus *, Double_t=0.0)
UInt_t GetGroupNumber()
virtual void SetIDCode(UShort_t c)
KVGroup * GetGroup() const
virtual Bool_t CanIdentify(Int_t Z, Int_t)
Int_t fCalibStatus
temporary variable holding status code for last call to Calibrate(KVReconstructedNucleus*)
virtual Double_t GetPedestalX(Option_t *opt="")
virtual void CalculateParticleEnergy(KVReconstructedNucleus *nuc)
virtual ~ KVIDTelescope()
virtual void AddDetector(KVDetector *d)
virtual Double_t GetMeanDEFromID(Int_t &status, Int_t Z, Int_t A=-1, Double_t Eres=-1.0)
const KVList * GetDetectors() const
KVIDGraph * GetIDGrid()
virtual void Print(Option_t *opt="") const
std::unordered_map< KVIDGraph *, GraphCoords > fGraphCoords
X/Y coordinates from detector signals for ID maps.
UShort_t fIDCode
general id code corresponding to correct identification by this type of telescope
Definition: KVIDTelescope.h:92
virtual Int_t GetCalibStatus() const
virtual UShort_t GetIDCode()
KVDetectorSignal * GetSignalFromGridVar(const KVString &var, const KVString &axe)
void CheckIdentificationBilan(const TString &system)
Set status of ID Telescope for given system.
virtual void RemoveIdentificationParameters()
KVParticleCondition * fMassIDValidity
may be used to limit mass identification to certain Z and/or A range
static void OpenIdentificationBilan(const TString &path)
Open IdentificationBilan.dat file with given path.
void SetHasMassID(Bool_t yes=kTRUE)
virtual void Initialize(void)
KVList fDetectors
list of detectors in telescope
Definition: KVIDTelescope.h:95
Double_t GetIDGridXCoord(KVIDGraph *) const
const Char_t * GetDefaultIDGridClass()
virtual void SetIdentificationStatus(KVReconstructedNucleus *)
void GetIDGridCoords(Double_t &X, Double_t &Y, KVIDGraph *grid, Double_t x=-1, Double_t y=-1)
UInt_t GetSize() const
Bool_t HasDetector(const KVDetector *d) const
const KVList * GetListOfIDGrids() const
UInt_t GetDetectorRank(const KVDetector *kvd) const
KVGroup * fGroup
group to which telescope belongs
Definition: KVIDTelescope.h:96
Bool_t IsIndependent() const
static TEnv * fgIdentificationBilan
Definition: KVIDTelescope.h:91
virtual void RemoveGrids()
virtual TGraph * MakeIDLine(KVNucleus *nuc, Double_t Emin, Double_t Emax, Double_t Estep=0.0)
Full result of one attempted particle identification.
Extended TList class which owns its objects by default.
Definition: KVList.h:27
Base class for describing the geometry of a detector array.
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:125
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:83
Handles particle selection criteria for data analysis classes ,.
Nuclei reconstructed from data measured by a detector array ,.
virtual Int_t GetSize() const
virtual TObject * At(Int_t idx) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
void SetBit(UInt_t f)
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual Int_t IndexOf(const TObject *obj) const
Double_t y[n]
Double_t x[n]
const Int_t n
KVDetectorSignal * fVarY
KVDetectorSignal * fVarX