KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVDataQualityAudit.h
Go to the documentation of this file.
1 #ifndef __KVDATAQUALITYAUDIT_H
2 #define __KVDATAQUALITYAUDIT_H
3 
4 #include "KVBase.h"
5 
6 #include <KVNumberList.h>
8 #include <KVUniqueNameList.h>
9 
39 class KVDataQualityAudit : public KVBase {
40 private:
42 
44 
45 public:
47  KVDataQualityAudit(const Char_t* name, const Char_t* title = "")
48  : KVBase(name, title)
49  {
51  }
52  virtual ~KVDataQualityAudit() {}
53  void Add(const KVReconstructedNucleus& N);
54  void Print(Option_t* opt = "") const;
56  {
57  return &telescopes;
58  }
59  Bool_t HasTelescope(const TString& tel_name) const
60  {
61  return telescopes.FindObject(tel_name) != nullptr;
62  }
64 
65  struct isotope {
68  Float_t emin{-1.0};
69  UShort_t A{0};
70  void add(const KVReconstructedNucleus& N);
71  void print() const;
72  void merge(const isotope& isoto)
73  {
76  if (emin > 0) {
77  if (isoto.emin > 0) emin = std::min(emin, isoto.emin);
78  }
79  else if (isoto.emin > 0) emin = isoto.emin;
80  counts += isoto.counts;
81  }
82 
83  ClassDef(isotope, 1)
84  };
85  struct element {
88  Float_t emin{-1.0};
89  UShort_t A{0};// default (calculated) mass given when no isotopic identification available
90  UChar_t Z{0};
91  std::map<int, isotope> isotopes;
92  void add(const KVReconstructedNucleus& N);
93  void print() const;
94  void merge(const element&);
96  {
97  return !isotopes.empty();
98  }
99  Bool_t HasIsotope(int A) const
100  {
101  return isotopes.find(A) != std::end(isotopes);
102  }
103  const isotope& GetIsotope(int A) const
104  {
105  return isotopes.at(A);
106  }
108  {
110  KVNumberList l;
111  for (auto& p : isotopes) l.Add(p.first);
112  return l;
113  }
114  double get_mean_isotopic_mass() const;
115  int get_max_isotopic_mass() const;
116  std::map<int, double> get_isotopic_distribution() const;
117  int get_min_isotopic_mass() const;
119  int get_default_mass() const
120  {
121  return A;
122  }
123 
124  ClassDef(element, 1)
125  };
126  class idtelescope : public TNamed {
127  std::map<int, element> elements;
128  public:
129  idtelescope(const TString& name = "") : TNamed(name, name) {}
130  virtual ~idtelescope() {}
131  ROOT_COPY_CTOR(idtelescope, TNamed)
132  ROOT_COPY_ASSIGN_OP(idtelescope)
133  void Copy(TObject& o) const
134  {
136  TNamed::Copy(o);
137  idtelescope& other = (idtelescope&)o;
138  other.elements = elements;
139  }
140  void add(const KVReconstructedNucleus& N);
141  void Print(Option_t* opt = "") const;
142  void merge(const idtelescope*);
143  Bool_t HasElement(int Z) const
144  {
145  return elements.find(Z) != std::end(elements);
146  }
147  const element& GetElement(int Z) const
148  {
149  return elements.at(Z);
150  }
152  {
154 
155  KVNumberList l;
156  for (auto& p : elements) l.Add(p.first);
157  return l;
158  }
159  std::map<int, double> get_element_distribution() const;
160  double get_mean_Z() const;
161  int get_max_Z() const;
162  double get_mean_A() const;
163  int get_max_A() const;
164  int get_min_A() const;
165  int get_min_Z() const;
166  int get_max_Z_with_isotopes() const;
167 
169  };
170 
171  Bool_t HasTelescope(const idtelescope* idt) const
172  {
173  return HasTelescope(idt->GetName());
174  }
175  idtelescope* GetTelescope(const TString& tel_name) const
176  {
177  return (idtelescope*)telescopes.FindObject(tel_name);
178  }
180  {
181  return GetTelescope(idt->GetName());
182  }
183 
184 private:
185  void add(const idtelescope*);
186 
187  ClassDef(KVDataQualityAudit, 1) //Audit of experimental data identification and calibrations
188 };
189 
190 #endif
unsigned short UShort_t
unsigned char UChar_t
char Char_t
bool Bool_t
double Double_t
float Float_t
const char Option_t
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:141
void add(const KVReconstructedNucleus &N)
void Print(Option_t *opt="") const
std::map< int, element > elements
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
Long64_t Merge(TCollection *)
Bool_t HasTelescope(const TString &tel_name) 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:83
Nuclei reconstructed from data measured by a detector array .
KaliVeda extensions to ROOT collection classes.
virtual void SetOwner(Bool_t enable=kTRUE)
virtual TObject * FindObject(const char *name) const
Optimised list in which named objects can only be placed once.
virtual const char * GetName() const
virtual void Copy(TObject &named) const
long long Long64_t
double get_mean_isotopic_mass() const
calculate and return mean mass of isotopes measured for this element
KVNumberList GetIsotopeList() const
const isotope & GetIsotope(int A) const
double get_minimum_isotopic_threshold_mev_per_nuc() 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
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)
auto * l