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"
12 class interval;
13 class interval_set;
14 
77 class KVIDZAFromZGrid : public KVIDZAGrid {
78 
79  void check_pidranges_and_massfits();
80 
81 public:
82  enum PIDType {
85  kIntType
86  };
87 
88 protected:
89  Bool_t fPIDRange;
90  KVNumberList fPIDRangeZList;
91  KVList fTables;
92  KVUniqueNameList fFits;
93 
94  Bool_t fIgnoreMassID;
95 
96  int is_inside(double pid) const;
97 
98 public:
100  ROOT_COPY_CTOR(KVIDZAFromZGrid, KVIDZAGrid)
101  ROOT_COPY_ASSIGN_OP(KVIDZAFromZGrid)
102 
103  void Copy(TObject& obj) const override;
104 
105  void ReadFromAsciiFile(std::ifstream& gridfile) override;
106  void WriteToAsciiFile(std::ofstream& gridfile) override;
107 
108  void Identify(Double_t x, Double_t y, KVIdentificationResult*) const override;
109  virtual double DeduceAfromPID(KVIdentificationResult* idr) const;
110  void LoadPIDRanges();
111  void ResetPIDRanges();
112  void ReloadPIDRanges();
113  interval_set* GetIntervalSet(int zint) const;
114  const KVList* GetIntervalSets() const
115  {
116  return &fTables;
117  }
119  void RemoveIntervalSet(int zint);
121 
122  void PrintPIDLimits();
123  void ClearPIDIntervals();
124  void ExportToGrid();
125 
126  void Initialize() override;
127 
128  Bool_t HasMassIDCapability() const override
129  {
137 
138  return (fPIDRange || fTables.GetEntries()) && !fIgnoreMassID;
139  }
140  void SetOnlyZId(Bool_t /*yes*/ = kTRUE) override
141  {
147 
149  }
150 
153  auto GetFits() const
154  {
156  return &fFits;
157  }
158  TH1* LinearizeHistoToPID(const TH2* hdata, int nbins = 100) const override;
159 
160  ClassDefOverride(KVIDZAFromZGrid, 3) //Compute Z and A only from Z lines...
161 };
162 
163 
164 
165 class interval: public TNamed {
166  int fType;
167  int fZ;
168  int fA;
169 
170  double fPID;
171  double fPIDMin;
172  double fPIDmax;
173 
174 public:
175  void Copy(TObject& o) const override
176  {
177  TNamed::Copy(o);
178  interval& i = dynamic_cast<interval&>(o);
179  i.fType = fType;
180  i.fZ = fZ;
181  i.fA = fA;
182  i.fPID = fPID;
183  i.fPIDMin = fPIDMin;
184  i.fPIDmax = fPIDmax;
185  }
186  ROOT_DEF_CTOR(interval, TNamed)
187  ROOT_COPY_CTOR(interval, TNamed)
188  ROOT_COPY_ASSIGN_OP(interval)
189  interval(int zz, int aa, double pid, double pidmin = -1., double pidmax = -1.)
190  {
191  fZ = zz;
192  fA = aa;
193  fPID = pid;
194  fPIDMin = pidmin;
195  fPIDmax = pidmax;
196  SetName(Form("%d_%d", zz, aa));
197  }
198  bool is_inside(double pid)
199  {
201  if (pid > fPIDMin && pid < fPIDmax) return kTRUE;
202  return kFALSE;
203  }
204  bool is_left_of(double pid)
205  {
207  return (fPIDmax < pid);
208  }
209  bool is_right_of(double pid)
210  {
212  return (fPIDMin > pid);
213  }
214 
215  int GetA()
216  {
217  return fA;
218  }
219  int GetZ()
220  {
221  return fZ;
222  }
223  double GetPID()
224  {
225  return fPID;
226  }
227  double GetPIDmin()
228  {
229  return fPIDMin;
230  }
231  double GetPIDmax()
232  {
233  return fPIDmax;
234  }
235 
236  void SetA(int aa)
237  {
238  fA = aa;
239  }
240  void SetZ(int zz)
241  {
242  fZ = zz;
243  }
244  bool SetPID(double pid)
245  {
247  fPID = pid;
248  if (fPIDMin > 0 && fPIDmax > 0) {
249  if (pid >= fPIDMin && pid <= fPIDmax) return true;
250  return false;
251  }
252  return true;
253  }
254  void SetPIDmin(double pidmin)
255  {
256  fPIDMin = pidmin;
257  }
258  void SetPIDmax(double pidmax)
259  {
260  fPIDmax = pidmax;
261  }
262 
263 
265 };
266 
267 class interval_set: public TNamed {
268 public:
269  int fType;
270  int fZ;
274 
275  void Copy(TObject& o) const override
276  {
277  TNamed::Copy(o);
278  interval_set& i = dynamic_cast<interval_set&>(o);
279  i.fType = fType;
280  i.fZ = fZ;
282  i.fNPIDs = fNPIDs;
283  i.fPIDs = fPIDs;
284  }
285  ROOT_DEF_CTOR(interval_set, TNamed)
286  ROOT_COPY_CTOR(interval_set, TNamed)
287  ROOT_COPY_ASSIGN_OP(interval_set)
288  int GetZ()
289  {
290  return fZ;
291  }
292  int GetNPID()
293  {
294  return fIntervals.GetSize();
295  }
297  {
298  return &fIntervals;
299  }
301 
302  interval_set(int zz, int type);
303  void add(int aa, double pid, double pidmin = -1., double pidmax = -1.);
304  double eval(KVIdentificationResult* idr);
305  bool is_inside(double pid);
306  bool is_above(double pid);
307 
309 };
310 
311 
312 
313 
314 
315 #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:1580
Hybrid charge & mass identification grid.
const KVList * GetIntervalSets() const
bool MassIdentificationFromMultiGaussFit(KVMultiGaussIsotopeFit *, KVIdentificationResult *) const
void Initialize() override
KVMultiGaussIsotopeFit * GetMultiGaussFit(int z) const
interval_set * GetIntervalSet(int zint) const
void WriteToAsciiFile(std::ofstream &gridfile) override
auto GetFits() const
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
TH1 * LinearizeHistoToPID(const TH2 *hdata, int nbins=100) const override
void SetOnlyZId(Bool_t=kTRUE) override
void RemoveIntervalSet(int zint)
Remove interval set for given Z from grid.
void ReadFromAsciiFile(std::ifstream &gridfile) override
void Copy(TObject &obj) const override
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:86
void Copy(TObject &obj) 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()
void SetZ(int zz)
void SetPIDmin(double pidmin)
void Copy(TObject &o) const override
void SetA(int aa)
double GetPIDmax()
void SetPIDmax(double pidmax)
bool is_inside(double pid)