KaliVeda
Toolkit for HIC analysis
KVIDTelescope.h
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 "TGraph.h"
25 #include "KVParticleCondition.h"
27 class KVGroup;
28 class KVIDGraph;
29 class KVIDGrid;
30 class KVMultiDetArray;
32 class TH2;
33 
34 #include <KVUnownedList.h>
35 #include <unordered_map>
36 
84 class KVIDTelescope: public KVBase {
85 
86 
89 
90 protected:
94  enum {
95  kMassID = BIT(15), //set if telescope is capable of mass identification i.e. isotopic resolution
96  kReadyForID = BIT(16) //set if telescope is ready and able for identification. set in Initialize()
97  };
99 
100  void SetLabelFromURI(const Char_t* uri);
101  std::unique_ptr<KVParticleCondition> fMassIDValidity;
102  KVDetectorSignal* GetSignalFromGridVar(const KVString& var, const KVString& axe, KVString& det_labels);
103  struct GraphCoords {
108  };
109  mutable std::unordered_map<KVIDGraph*, GraphCoords> fGraphCoords;
111 
112  KVIDGrid* newGrid(bool onlyZ);
113  void addLineToGrid(KVIDGrid* gg, int zz, int aa, int npoints);
114 
115 public:
116 
118 
120  enum {
121  kCalibStatus_OK, // fine, OK, all detectors calculated and functioning properly
122  kCalibStatus_Calculated, // one or more detectors not calibrated/functioning, energy loss calculated
123  kCalibStatus_NoCalibrations, // no calibrations available for any detectors
124  kCalibStatus_Multihit, // one or more detectors hit by more than one particle, energy loss calculated for this detector
125  kCalibStatus_Coherency // comparison of calculated and measured energy loss in one or more detectors reveals presence of other particles
126  };
127 
128  KVIDTelescope();
129  void init();
130  virtual void AddDetector(KVDetector* d);
131  const KVList* GetDetectors() const
132  {
133  return &fDetectors;
134  }
135  KVDetector* GetDetector(UInt_t n) const
136  {
138  if (n > GetSize() || n < 1) {
139  Error("GetDetector(UInt_t n)", "n must be between 1 and %u",
140  GetSize());
141  return 0;
142  }
143  KVDetector* d = (KVDetector*) GetDetectors()->At((n - 1));
144  return d;
145  };
146  KVDetector* GetDetector(const Char_t* name) const;
147  Bool_t HasDetector(const KVDetector* d) const
148  {
150  return GetDetectorRank(d) > 0;
151  }
152  UInt_t GetDetectorRank(const KVDetector* kvd) const
153  {
156 
157  return GetDetectors()->IndexOf(kvd) + 1;
158  }
159  UInt_t GetSize() const
160  {
162  return GetDetectors()->GetSize();
163  }
164 
165  KVGroup* GetGroup() const;
166  void SetGroup(KVGroup* kvg);
168 
169  virtual void Initialize(void);
170 
171  virtual Bool_t Identify(KVIdentificationResult*, Double_t x = -1., Double_t y = -1.);
172 
174  virtual Int_t GetCalibStatus() const
175  {
181  return fCalibStatus;
182  }
183 
184  void Print(Option_t* opt = "") const override;
185 
186  void SetIDGrid(KVIDGraph*);
187  KVIDGraph* GetIDGrid();
189  KVIDGraph* GetIDGrid(const Char_t*);
190  const KVList* GetListOfIDGrids() const
191  {
192  return &fIDGrids;
193  }
194 
195  virtual void RemoveGrids();
196 
197  virtual Double_t GetIDMapX(Option_t* opt = "");
198  virtual Double_t GetIDMapY(Option_t* opt = "");
199  virtual Double_t GetPedestalX(Option_t* opt = "");
200  virtual Double_t GetPedestalY(Option_t* opt = "");
201 
204  void GetIDGridCoords(Double_t& X, Double_t& Y, KVIDGraph* grid, Double_t x = -1, Double_t y = -1)
205  {
210 
211  Y = (y < 0. ? GetIDGridYCoord(grid) : y);
212  X = (x < 0. ? GetIDGridXCoord(grid) : x);
213  }
214  void SetHasMassID(Bool_t yes = kTRUE)
215  {
216  SetBit(kMassID, yes);
217  }
218 
222  {
223  return TestBit(kMassID);
224  }
225 
226  static KVIDTelescope* MakeIDTelescope(const Char_t* name);
227 
229  virtual void RemoveIdentificationParameters();
230 
231  void LoadIdentificationParameters(const Char_t* filename, const KVMultiDetArray* multidet);
232  void ReadIdentificationParameterFiles(const Char_t* filename, const KVMultiDetArray* multidet);
233 
237  {
238  return TestBit(kReadyForID);
239  };
240 
241  const Char_t* GetDefaultIDGridClass();
242  KVIDGrid* CalculateDeltaE_EGrid(const KVNameValueList& AperZ, Int_t npoints = 30, Double_t xfactor = 1.);
243  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.);
244  KVIDGrid* CalculateDeltaE_EGrid(TH2* haa_zz, Bool_t Zonly, Int_t npoints);
246  enum {
247  kMeanDE_OK, // all OK
248  kMeanDE_XtooSmall, // X-coordinate is smaller than smallest X-coordinate of ID line
249  kMeanDE_XtooLarge, // X-coordinate is larger than largest X-coordinate of ID line
250  kMeanDE_NoIdentifier // No identifier found for Z or (Z,A)
251  };
252  virtual Double_t GetMeanDEFromID(Int_t& status, Int_t Z, Int_t A = -1, Double_t Eres = -1.0);
253  virtual UShort_t GetIDCode()
254  {
257  return fIDCode;
258  }
259 
260  virtual void SetIDCode(UShort_t c)
261  {
263  fIDCode = c;
264  }
265 
266  virtual Bool_t CheckTheoreticalIdentificationThreshold(KVNucleus* /*ION*/, Double_t /*EINC*/ = 0.0);
267  virtual Bool_t CanIdentify(Int_t Z, Int_t /*A*/)
268  {
274  return (Z > 0);
275  }
276  virtual void SetIdentificationStatus(KVIdentificationResult* IDR, const KVNucleus*);
278  {
284 
285  return (GetSize() == 1 || (GetSize() == 2 && GetDetector(1)->GetNode()->GetNTraj() == 1
286  && GetDetector(2)->GetNode()->GetNTraj() == 1));
287  }
288 
289  static void OpenIdentificationBilan(const TString& path);
290  void CheckIdentificationBilan(const TString& system);
291 
292  ClassDefOverride(KVIDTelescope, 5) //A delta-E - E identification telescope
293 };
294 
295 #endif
int Int_t
unsigned int UInt_t
#define d(i)
#define c(i)
bool Bool_t
unsigned short UShort_t
unsigned char UChar_t
char Char_t
double Double_t
const char Option_t
#define BIT(n)
#define ClassDefOverride(name, id)
#define X(type, name)
Base class for KaliVeda framework.
Definition: KVBase.h:139
Base class for output signal data produced by a detector.
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:32
Abstract base class for 2D identification grids in e.g. (dE,E) maps.
Definition: KVIDGrid.h:74
Base class for all detectors or associations of detectors in array which can identify charged particl...
Definition: KVIDTelescope.h:84
KVIDGrid * newGrid(bool onlyZ)
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
KVIDGrid * CalculateDeltaE_EGrid(const KVNameValueList &AperZ, Int_t npoints=30, Double_t xfactor=1.)
void SetGroup(KVGroup *kvg)
KVList fMultiDetExpressions
used to clean up any multi-detector signal expressions generated to calculate X/Y coordinates
void SetLabelFromURI(const Char_t *uri)
Double_t GetIDGridYCoord(KVIDGraph *) const
virtual Bool_t Identify(KVIdentificationResult *, Double_t x=-1., Double_t y=-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()
void addLineToGrid(KVIDGrid *gg, int zz, int aa, int npoints)
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*)
Definition: KVIDTelescope.h:98
virtual Double_t GetPedestalX(Option_t *opt="")
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
KVDetectorSignal * GetSignalFromGridVar(const KVString &var, const KVString &axe, KVString &det_labels)
KVIDGraph * GetIDGrid()
void Print(Option_t *opt="") const override
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:88
virtual Int_t GetCalibStatus() const
virtual void CalculateParticleEnergy(KVReconstructedNucleus* nuc);
virtual UShort_t GetIDCode()
void CheckIdentificationBilan(const TString &system)
Set status of ID Telescope for given system.
virtual void RemoveIdentificationParameters()
@ kCalibStatus_NoCalibrations
static void OpenIdentificationBilan(const TString &path)
Open IdentificationBilan.dat file with given path.
void SetHasMassID(Bool_t yes=kTRUE)
virtual void Initialize(void)
Double_t GetIDGridXCoord(KVIDGraph *) const
const Char_t * GetDefaultIDGridClass()
void GetIDGridCoords(Double_t &X, Double_t &Y, KVIDGraph *grid, Double_t x=-1, Double_t y=-1)
UInt_t GetSize() const
KVUnownedList fIDGrids
identification grid(s)
Definition: KVIDTelescope.h:93
Bool_t HasDetector(const KVDetector *d) const
KVUnownedList fDetectors
list of detectors in telescope
Definition: KVIDTelescope.h:91
KVString GetDetectorLabelsForGridCoord(const KVString &axis) const
const KVList * GetListOfIDGrids() const
std::unique_ptr< KVParticleCondition > fMassIDValidity
may be used to limit mass identification to certain Z and/or A range
UInt_t GetDetectorRank(const KVDetector *kvd) const
KVGroup * fGroup
group to which telescope belongs
Definition: KVIDTelescope.h:92
Bool_t IsIndependent() const
static TEnv * fgIdentificationBilan
Definition: KVIDTelescope.h:87
virtual void SetIdentificationStatus(KVIdentificationResult *IDR, const KVNucleus *)
virtual void RemoveGrids()
Full result of one attempted particle identification.
Extended TList class which owns its objects by default.
Definition: KVList.h:28
Base class for describing the geometry of a detector array.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:123
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
Nuclei reconstructed from data measured by a detector array .
Int_t GetSize() const override
TObject * At(Int_t idx) const override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
Extended TList class which does not own its objects by default.
Definition: KVUnownedList.h:17
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