KaliVeda
Toolkit for HIC analysis
KVIDZAFromZGrid.h
1 
4 #ifndef __KVIDZAFROMZGRID_H
5 #define __KVIDZAFROMZGRID_H
6 
7 #include "KVIDZAGrid.h"
8 #include "KVList.h"
9 #include "KVUniqueNameList.h"
10 #include "KVIdentificationResult.h"
11 #include "KVMultiGaussIsotopeFit.h"
12 
13 
14 class interval;
15 class interval_set;
16 
79 class KVIDZAFromZGrid : public KVIDZAGrid {
80 
82 
83 public:
84  enum PIDType {
87  kIntType
88  };
89 
90 protected:
95 
97 
98  int is_inside(double pid) const;
99 
100 public:
101  KVIDZAFromZGrid();
102  ROOT_COPY_CTOR(KVIDZAFromZGrid, KVIDZAGrid)
103  ROOT_COPY_ASSIGN_OP(KVIDZAFromZGrid)
104 
105  void Copy(TObject& obj) const override;
106 
107  void ReadFromAsciiFile(std::ifstream& gridfile) override;
108  void WriteToAsciiFile(std::ofstream& gridfile) override;
109 
110  void Identify(Double_t x, Double_t y, KVIdentificationResult*) const override;
111  virtual double DeduceAfromPID(KVIdentificationResult* idr) const;
112  void LoadPIDRanges();
113  void ResetPIDRanges();
114  void ReloadPIDRanges();
115  interval_set* GetIntervalSet(int zint) const;
116  const KVList* GetIntervalSets() const
117  {
118  return &fTables;
119  }
121  void RemoveIntervalSet(int zint);
123 
124  void PrintPIDLimits();
125  void ClearPIDIntervals();
126  void ExportToGrid();
127 
128  void Initialize() override;
129 
130  Bool_t HasMassIDCapability() const override
131  {
139 
140  return (fPIDRange || fTables.GetEntries()) && !fIgnoreMassID;
141  }
142  void SetOnlyZId(Bool_t /*yes*/ = kTRUE) override
143  {
149 
151  }
152 
155  {
156  return (KVMultiGaussIsotopeFit*)fFits.FindObject(Form("MultiGaussIsotopeFit_Z=%d", z));
157  }
158 
159  ClassDefOverride(KVIDZAFromZGrid, 3) //Compute Z and A only from Z lines...
160 };
161 
162 
163 
164 class interval: public TNamed {
165  int fType;
166  int fZ;
167  int fA;
168 
169  double fPID;
170  double fPIDMin;
171  double fPIDmax;
172 
173 public:
174  void Copy(TObject& o) const override
175  {
176  TNamed::Copy(o);
177  interval& i = dynamic_cast<interval&>(o);
178  i.fType = fType;
179  i.fZ = fZ;
180  i.fA = fA;
181  i.fPID = fPID;
182  i.fPIDMin = fPIDMin;
183  i.fPIDmax = fPIDmax;
184  }
185  ROOT_DEF_CTOR(interval, TNamed)
186  ROOT_COPY_CTOR(interval, TNamed)
187  ROOT_COPY_ASSIGN_OP(interval)
188  interval(int zz, int aa, double pid, double pidmin = -1., double pidmax = -1.)
189  {
190  fZ = zz;
191  fA = aa;
192  fPID = pid;
193  fPIDMin = pidmin;
194  fPIDmax = pidmax;
195  SetName(Form("%d_%d", zz, aa));
196  }
197  bool is_inside(double pid)
198  {
200  if (pid > fPIDMin && pid < fPIDmax) return kTRUE;
201  return kFALSE;
202  }
203  bool is_left_of(double pid)
204  {
206  return (fPIDmax < pid);
207  }
208  bool is_right_of(double pid)
209  {
211  return (fPIDMin > pid);
212  }
213 
214  int GetA()
215  {
216  return fA;
217  }
218  int GetZ()
219  {
220  return fZ;
221  }
222  double GetPID()
223  {
224  return fPID;
225  }
226  double GetPIDmin()
227  {
228  return fPIDMin;
229  }
230  double GetPIDmax()
231  {
232  return fPIDmax;
233  }
234 
235  void SetA(int aa)
236  {
237  fA = aa;
238  }
239  void SetZ(int zz)
240  {
241  fZ = zz;
242  }
243  bool SetPID(double pid)
244  {
246  fPID = pid;
247  if (fPIDMin > 0 && fPIDmax > 0) {
248  if (pid >= fPIDMin && pid <= fPIDmax) return true;
249  return false;
250  }
251  return true;
252  }
253  void SetPIDmin(double pidmin)
254  {
255  fPIDMin = pidmin;
256  }
257  void SetPIDmax(double pidmax)
258  {
259  fPIDmax = pidmax;
260  }
261 
262 
264 };
265 
266 class interval_set: public TNamed {
267 public:
268  int fType;
269  int fZ;
273 
274  void Copy(TObject& o) const override
275  {
276  TNamed::Copy(o);
277  interval_set& i = dynamic_cast<interval_set&>(o);
278  i.fType = fType;
279  i.fZ = fZ;
281  i.fNPIDs = fNPIDs;
282  i.fPIDs = fPIDs;
283  }
284  ROOT_DEF_CTOR(interval_set, TNamed)
285  ROOT_COPY_CTOR(interval_set, TNamed)
286  ROOT_COPY_ASSIGN_OP(interval_set)
287  int GetZ()
288  {
289  return fZ;
290  }
291  int GetNPID()
292  {
293  return fIntervals.GetSize();
294  }
296  {
297  return &fIntervals;
298  }
300 
301  interval_set(int zz, int type);
302  void add(int aa, double pid, double pidmin = -1., double pidmax = -1.);
303  double eval(KVIdentificationResult* idr);
304  bool is_inside(double pid);
305  bool is_above(double pid);
306 
308 };
309 
310 
311 
312 
313 
314 #endif
int Int_t
bool Bool_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
#define ClassDefOverride(name, id)
char * Form(const char *fmt,...)
virtual void SetOnlyZId(Bool_t yes=kTRUE)
Definition: KVIDGraph.cpp:1578
Hybrid charge & mass identification grid.
void check_pidranges_and_massfits()
Check for inconsistencies between 'PIDRANGE' and 'MASSFIT' parameters.
const KVList * GetIntervalSets() const
bool MassIdentificationFromMultiGaussFit(KVMultiGaussIsotopeFit *, KVIdentificationResult *) const
void Initialize() override
KVList fTables
intervals for mass id
interval_set * GetIntervalSet(int zint) const
void WriteToAsciiFile(std::ofstream &gridfile) override
void Identify(Double_t x, Double_t y, KVIdentificationResult *) const override
Bool_t HasMassIDCapability() const override
virtual double DeduceAfromPID(KVIdentificationResult *idr) const
void AddIntervalSet(interval_set *)
add an interval set to the grid, updating the corresponding parameters
KVUniqueNameList fFits
multi-gaussian fits for mass id
KVMultiGaussIsotopeFit * GetMultiGaussFit(int z) const
void SetOnlyZId(Bool_t=kTRUE) override
void RemoveIntervalSet(int zint)
Remove interval set for given Z from grid.
void ReadFromAsciiFile(std::ifstream &gridfile) override
KVNumberList fPIDRangeZList
void Copy(TObject &obj) const override
int is_inside(double pid) const
Identification grid with lines corresponding to different nuclear isotopes (KVIDZALine)
Definition: KVIDZAGrid.h:71
Full result of one attempted particle identification.
Extended TList class which owns its objects by default.
Definition: KVList.h:22
Function for fitting PID mass spectra.
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
void Copy(TObject &obj) const override
TObject * FindObject(const char *name) const override
Int_t GetSize() const override
Optimised list in which named objects can only be placed once.
virtual Int_t GetEntries() const
void Copy(TObject &named) const override
virtual void SetName(const char *name)
TString GetListOfMasses()
bool is_inside(double pid)
bool is_above(double pid)
void add(int aa, double pid, double pidmin=-1., double pidmax=-1.)
double eval(KVIdentificationResult *idr)
interval_set(int zz, int type)
void Copy(TObject &o) const override
KVList * GetIntervals()
bool SetPID(double pid)
bool is_right_of(double pid)
double GetPID()
bool is_left_of(double pid)
double GetPIDmin()
double fPIDmax
void SetZ(int zz)
void SetPIDmin(double pidmin)
double fPIDMin
void Copy(TObject &o) const override
void SetA(int aa)
double GetPIDmax()
void SetPIDmax(double pidmax)
bool is_inside(double pid)