KaliVeda
Toolkit for HIC analysis
KVDataQualityAudit.h
1 #ifndef __KVDATAQUALITYAUDIT_H
2 #define __KVDATAQUALITYAUDIT_H
3 
4 #include "KVBase.h"
5 
6 #include <KVNumberList.h>
7 #include <KVReconstructedNucleus.h>
8 #include <KVUniqueNameList.h>
9 
40 class KVDataQualityAudit : public KVBase {
41 private:
43 
45 
46 public:
48  KVDataQualityAudit(const Char_t* name, const Char_t* title = "")
49  : KVBase(name, title)
50  {
52  }
53  virtual ~KVDataQualityAudit() {}
54  void Add(const KVReconstructedNucleus& N);
55  void Print(Option_t* opt = "") const override;
57  {
58  return &telescopes;
59  }
60  Bool_t HasTelescope(const TString& tel_name) const
61  {
62  return telescopes.FindObject(tel_name) != nullptr;
63  }
65 
66  struct isotope {
69  Float_t emin{-1.0};
70  UShort_t A{0};
71  void add(const KVReconstructedNucleus& N);
72  void print() const;
73  void merge(const isotope& isoto)
74  {
77  if (emin > 0) {
78  if (isoto.emin > 0) emin = std::min(emin, isoto.emin);
79  }
80  else if (isoto.emin > 0) emin = isoto.emin;
81  counts += isoto.counts;
82  }
84  {
85  return emin;
86  }
87 
88  ClassDef(isotope, 1)
89  };
90  struct element {
93  Float_t emin{-1.0};
94  UShort_t A{0};// default (calculated) mass given when no isotopic identification available
95  UChar_t Z{0};
96  std::map<int, isotope> isotopes;
97  void add(const KVReconstructedNucleus& N);
98  void print() const;
99  void merge(const element&);
101  {
102  return !isotopes.empty();
103  }
104  Bool_t HasIsotope(int A) const
105  {
106  return isotopes.find(A) != std::end(isotopes);
107  }
108  const isotope& GetIsotope(int A) const
109  {
110  return isotopes.at(A);
111  }
113  {
115  KVNumberList l;
116  for (auto& p : isotopes) l.Add(p.first);
117  return l;
118  }
119  double get_mean_isotopic_mass() const;
120  int get_max_isotopic_mass() const;
121  std::map<int, double> get_isotopic_distribution() const;
122  int get_min_isotopic_mass() const;
124  double get_minimum_isotopic_threshold(int&) const;
125  int get_default_mass() const
126  {
127  return A;
128  }
130  {
131  return emin;
132  }
133  std::map<double, int> get_isotopes_sorted_by_threshold() const;
134 
135  ClassDef(element, 1)
136  };
137  class idtelescope : public TNamed {
138  std::map<int, element> elements;
139  public:
140  idtelescope(const TString& name = "") : TNamed(name, name) {}
141  ROOT_COPY_CTOR(idtelescope, TNamed)
142  ROOT_COPY_ASSIGN_OP(idtelescope)
143  void Copy(TObject& o) const override
144  {
146  TNamed::Copy(o);
147  idtelescope& other = (idtelescope&)o;
148  other.elements = elements;
149  }
150  void add(const KVReconstructedNucleus& N);
151  void Print(Option_t* opt = "") const override;
152  void merge(const idtelescope*);
153  Bool_t HasElement(int Z) const
154  {
155  return elements.find(Z) != std::end(elements);
156  }
157  const element& GetElement(int Z) const
158  {
159  return elements.at(Z);
160  }
162  {
164 
165  KVNumberList l;
166  for (auto& p : elements) l.Add(p.first);
167  return l;
168  }
169  std::map<int, double> get_element_distribution() const;
170  double get_mean_Z() const;
171  int get_max_Z() const;
172  double get_mean_A() const;
173  int get_max_A() const;
174  int get_min_A() const;
175  int get_min_Z() const;
176  int get_max_Z_with_isotopes() const;
177 
179  };
180 
181  Bool_t HasTelescope(const idtelescope* idt) const
182  {
183  return HasTelescope(idt->GetName());
184  }
185  idtelescope* GetTelescope(const TString& tel_name) const
186  {
187  return (idtelescope*)telescopes.FindObject(tel_name);
188  }
190  {
191  return GetTelescope(idt->GetName());
192  }
193 
197  class IDStatus {
198  public:
199  enum class EStatus {
213  };
215  operator bool() const
216  {
221  }
222  bool operator==(EStatus s) const
223  {
224  return status == s;
225  }
226  private:
228  public:
229  friend std::ostream& operator<<(std::ostream& os, const IDStatus& st_ob)
230  {
231  os << "ID Status: ";
232  switch (st_ob.status) {
234  os << "telescope not functioning";
235  break;
237  os << "below threshold for Z identification";
238  break;
240  os << "identification not possible for this Z";
241  break;
243  os << "Z identified but not A";
244  break;
246  os << "partial isotopic identification";
247  break;
249  os << "A greater than measured Amax";
250  break;
252  os << "A less than measured Amin";
253  break;
255  os << "A_never_measured_but_between_Amin_and_Amax";
256  break;
258  os << "full isotopic identification";
259  break;
261  os << "weird result 1";
262  break;
264  os << "weird result 2";
265  break;
267  os << "weird result 3";
268  break;
270  os << "weird result 4";
271  break;
272  }
273  return os;
274  }
275  };
276 
277  IDStatus CanIdentify(const TString& tel_name, int Z, int& A, double E) const;
278 
279 private:
280  void add(const idtelescope*);
281 
282  ClassDefOverride(KVDataQualityAudit, 1) //Audit of experimental data identification and calibrations
283 };
284 
285 #endif
bool Bool_t
unsigned short UShort_t
unsigned char UChar_t
char Char_t
float Float_t
double Double_t
const char Option_t
#define ClassDef(name, id)
#define ClassDefOverride(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
char name[80]
Base class for KaliVeda framework.
Definition: KVBase.h:139
Helper class used by CanIdentify() to test whether particles can be identified.
friend std::ostream & operator<<(std::ostream &os, const IDStatus &st_ob)
bool operator==(EStatus s) const
void Print(Option_t *opt="") const override
void add(const KVReconstructedNucleus &N)
std::map< int, element > elements
void Copy(TObject &o) const override
void merge(const idtelescope *)
const element & GetElement(int Z) const
std::map< int, double > get_element_distribution() const
idtelescope(const TString &name="")
Audit of experimental data identification and calibrations.
Long64_t merge(KVDataQualityAudit *)
void Print(Option_t *opt="") const override
Long64_t Merge(TCollection *)
Bool_t HasTelescope(const TString &tel_name) const
IDStatus CanIdentify(const TString &tel_name, int Z, int &A, double E) const
KVDataQualityAudit(const Char_t *name, const Char_t *title="")
idtelescope * GetTelescope(const TString &tel_name) const
KVUniqueNameList telescopes
const KVSeqCollection * GetTelescopeList() const
Bool_t HasTelescope(const idtelescope *idt) const
void Add(const KVReconstructedNucleus &N)
Add this reconstructed nucleus to the audit.
void add(const idtelescope *)
Add copy of idtelescope data to this audit.
idtelescope * GetTelescope(const idtelescope *idt) const
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
Nuclei reconstructed from data measured by a detector array .
KaliVeda extensions to ROOT collection classes.
TObject * FindObject(const char *name) const override
void SetOwner(Bool_t enable=kTRUE) override
Optimised list in which named objects can only be placed once.
void Copy(TObject &named) const override
const char * GetName() const override
long long Long64_t
double get_mean_isotopic_mass() const
calculate and return mean mass of isotopes measured for this element
std::map< double, int > get_isotopes_sorted_by_threshold() const
double get_minimum_isotopic_threshold(int &) const
KVNumberList GetIsotopeList() const
const isotope & GetIsotope(int A) const
std::map< int, double > get_isotopic_distribution() const
std::map< int, isotope > isotopes
Double_t counts
watch the alignment !
Bool_t HasIsotope(int A) const
int get_min_isotopic_mass() const
return min A of isotopes measured for this element
double get_minimum_isotopic_threshold_mev_per_nuc(int &) const
void add(const KVReconstructedNucleus &N)
int get_max_isotopic_mass() const
return max A of isotopes measured for this element
void add(const KVReconstructedNucleus &N)
Double_t counts
watch the alignment !
void merge(const isotope &isoto)
TLine l