KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVDataQualityAuditReportMaker.cpp
Go to the documentation of this file.
2 #include "KVMultiDetArray.h"
3 #include <TColor.h>
4 
5 
8 
10 {
11  // \returns histogram P(Z) probability distribution for elements
12 
14  // find largest Z
15  auto last = proba.rbegin();
16  auto Zmax = (*last).first;
17  auto histo = ::new TH1F(Form("Z_%s", this_telescope->GetName()), Form("P(Z) %s", this_telescope->GetName()),
18  Zmax + 1, .5, Zmax + 1.5);
19  for (auto& p : proba) {
20  histo->SetBinContent(p.first, p.second);
21  }
22  return KVDataQualityAuditReportMaker::FormatHisto(histo, color);
23 }
24 
25 
26 
29 
31 {
32  // \returns graph of energy threshold for each element identified by telescope
33 
34  auto gr = ::new TGraph;
35  gr->SetTitle(Form("%s Z thresholds [MeV]", this_telescope->GetName()));
36  gr->SetName(this_telescope->GetName());
37  auto Zlist = this_telescope->GetElementList();
38  Zlist.Begin();
39  while (!Zlist.End()) {
40  auto Z = Zlist.Next();
41  gr->SetPoint(gr->GetN(), Z, this_telescope->GetElement(Z).emin);
42  }
44 }
45 
46 
47 
51 
53 {
54  // \returns graph of energy threshold in MeV/nucleon for each element identified by telescope
55  // for uncalibrated particles, threshold is -1 for all
56 
57  auto gr = ::new TGraph;
58  gr->SetTitle(Form("%s Z thresholds [MeV/u]", this_telescope->GetName()));
59  gr->SetName(this_telescope->GetName());
60  auto Zlist = this_telescope->GetElementList();
61  Zlist.Begin();
62  KVNumberList abnormal;
63  while (!Zlist.End()) {
64  auto Z = Zlist.Next();
65  double thresh;
66  if (this_telescope->GetElement(Z).HasIsotopes())
67  thresh = this_telescope->GetElement(Z).emin / this_telescope->GetElement(Z).get_mean_isotopic_mass();
68  else
69  thresh = this_telescope->GetElement(Z).emin / this_telescope->GetElement(Z).get_default_mass();
70  if (thresh < 0) thresh = -1;
71  gr->SetPoint(gr->GetN(), Z, thresh);
72  if (TString(this_telescope->GetName()).BeginsWith("ID_CSI") && thresh > 0 && thresh < 10) {
73  abnormal.Add(Z);
74  }
75  }
76  if (abnormal.GetEntries()) {
77  std::cout << "abnormal Z threshold (<10MeV/u): " << this_telescope->GetName() << " Z=" << abnormal.AsString();
78  TString p(this_telescope->GetName());
79  p.Remove(0, 7);
80  p.Prepend("CSI-");
81  if (!gMultiDetArray->GetDetector(p)->IsCalibrated()) std::cout << " : Detector " << p << " NOT CALIBRATED";
82  std::cout << std::endl;
83  }
85 }
86 
87 
88 
93 
95 {
96  // \returns graph of energy threshold in MeV/nucleon for isotopic identification of each element identified by telescope.
97  //
98  // this is the lowest recorded threshold value (in MeV/u) for the element to be isotopically identified
99 
100  auto gr = ::new TGraph;
101  gr->SetTitle(Form("%s A thresholds [MeV/u]", this_telescope->GetName()));
102  gr->SetName(this_telescope->GetName());
103  auto Zlist = this_telescope->GetElementList();
104  Zlist.Begin();
105  while (!Zlist.End()) {
106  auto Z = Zlist.Next();
107  // only include elements with isotopic identification
108  if (this_telescope->GetElement(Z).HasIsotopes())
109  gr->SetPoint(gr->GetN(), Z, this_telescope->GetElement(Z).get_minimum_isotopic_threshold_mev_per_nuc());
110  }
112 }
113 
114 
115 
118 
120 {
121  // \returns graph of mean isotopic mass for each isotopically-identified Z
122  auto gr = ::new TGraph;
123  gr->SetTitle(Form("%s <A> vs. Z", this_telescope->GetName()));
124  gr->SetName(this_telescope->GetName());
125  auto Zlist = this_telescope->GetElementList();
126  Zlist.Begin();
127  while (!Zlist.End()) {
128  auto Z = Zlist.Next();
129  auto elem = this_telescope->GetElement(Z);
130  if (elem.HasIsotopes()) {
131  gr->SetPoint(gr->GetN(), Z, elem.get_mean_isotopic_mass());
132  }
133  }
135 }
136 
137 
138 
141 
143 {
144  // \returns multigraph of isotope distributions for all isotopically identified elements
145 
146  auto mg = ::new TMultiGraph;
147  auto Zlist = this_telescope->GetElementList();
148  int color_step = TColor::GetPalette().GetSize() / (Zlist.GetNValues() + 1);
149  Zlist.Begin();
150  int i = 1;
151  while (!Zlist.End()) {
152  auto Z = Zlist.Next();
153  auto elem = get_element(Z);
154  if (this_telescope->GetElement(Z).HasIsotopes()) {
155  auto gr = elem.get_isotope_distribution(TColor::GetPalette()[color_step * i]);
156  mg->Add(gr);
157  }
158  ++i;
159  }
160  return mg;
161 }
162 
163 
164 
167 
169 {
170  // \returns multigraph of isotope thresholds in [MeV] for all isotopically identified elements
171 
172  auto mg = ::new TMultiGraph;
173  auto Zlist = this_telescope->GetElementList();
174  int color_step = TColor::GetPalette().GetSize() / (Zlist.GetNValues() + 1);
175  Zlist.Begin();
176  int i = 1;
177  while (!Zlist.End()) {
178  auto Z = Zlist.Next();
179  auto elem = get_element(Z);
180  if (this_telescope->GetElement(Z).HasIsotopes()) {
181  mg->Add(elem.get_isotope_thresholds_by_A(TColor::GetPalette()[color_step * i]));
182  }
183  ++i;
184  }
185  return mg;
186 }
187 
188 
189 
192 
194 {
195  // \returns multigraph of isotope thresholds in [MeV/u] for all isotopically identified elements
196 
197  auto mg = ::new TMultiGraph;
198  auto Zlist = this_telescope->GetElementList();
199  int color_step = TColor::GetPalette().GetSize() / (Zlist.GetNValues() + 1);
200  Zlist.Begin();
201  int i = 1;
202  while (!Zlist.End()) {
203  auto Z = Zlist.Next();
204  auto elem = get_element(Z);
205  if (this_telescope->GetElement(Z).HasIsotopes()) {
206  mg->Add(elem.get_isotope_thresholds_by_A_mev_per_nuc(TColor::GetPalette()[color_step * i]));
207  }
208  ++i;
209  }
210  return mg;
211 }
212 
213 
214 
217 
219 {
220  // provide uniform style for all graphs
221 
222  if (!col) col = kBlue - 2;
223  if (!mark) mark = 20;
224  G->SetMarkerStyle(mark);
225  G->SetMarkerSize(1.7);
226  G->SetMarkerColor(col);
227  G->SetLineWidth(2);
228  G->SetLineColor(col);
229  return G;
230 }
231 
232 
233 
236 
238 {
239  // provide uniform style for all histos
240 
241  if (!col) col = kBlue - 2;
242  G->SetLineWidth(2);
243  G->SetLineColor(col);
244  return G;
245 }
246 
247 
248 
252 
254 {
255  // \returns graph of isotope distribution P(A) for element.
256  // The distribution is weighted by the number of elements Z observed.
257 
258  auto proba = this_element->get_isotopic_distribution();
259  auto gr = ::new TGraph;
260  gr->SetName(Form("Z=%d", (int)this_element->Z));
261  gr->SetTitle(Form("P(A) Z=%d %s", (int)this_element->Z, telescope_name.c_str()));
262  for (auto& p : proba) {
263  gr->SetPoint(gr->GetN(), p.first, this_element->counts * p.second);
264  }
266 }
267 
268 
269 
272 
274 {
275  // \returns thresholds in [MeV] for each isotope as a function of A
276  auto gr = ::new TGraph;
277  gr->SetTitle(Form("%s Z=%d A thresholds [MeV]", telescope_name.c_str(), this_element->Z));
278  gr->SetName(Form("Z=%d", this_element->Z));
279  auto Alist = this_element->GetIsotopeList();
280  Alist.Begin();
281  while (!Alist.End()) {
282  auto A = Alist.Next();
283  gr->SetPoint(gr->GetN(), A, this_element->GetIsotope(A).emin);
284  }
286 }
287 
288 
289 
292 
294 {
295  // \returns thresholds in [MeV/nucleon] for each isotope as a function of A
296  auto gr = ::new TGraph;
297  gr->SetTitle(Form("%s Z=%d A thresholds [MeV/u]", telescope_name.c_str(), this_element->Z));
298  gr->SetName(Form("Z=%d", this_element->Z));
299  auto Alist = this_element->GetIsotopeList();
300  Alist.Begin();
301  while (!Alist.End()) {
302  auto A = Alist.Next();
303  gr->SetPoint(gr->GetN(), A, this_element->GetIsotope(A).emin / A);
304  }
306 }
307 
308 
310 
311 
312 
315 {
316  Double_t Red[] = {0., 1.0, 0.0, 0.0, 1.0, 1.0};
317  Double_t Green[] = {0., 0.0, 0.0, 1.0, 0.0, 1.0};
318  Double_t Blue[] = {0., 1.0, 1.0, 0.0, 0.0, 0.0};
319  Double_t Length[] = {0., .2, .4, .6, .8, 1.0};
320  TColor::CreateGradientColorTable(6, Length, Red, Green, Blue, ncols);
321 }
322 
323 
KVMultiDetArray * gMultiDetArray
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
short Marker_t
double Double_t
short Color_t
kBlue
char * Form(const char *fmt,...)
Produce graphs and histograms from KVDataQualityAudit.
static TGraph * FormatGraph(TGraph *, Color_t=0, Marker_t=0)
provide uniform style for all graphs
static TH1F * FormatHisto(TH1F *, Color_t=0)
provide uniform style for all histos
std::map< int, double > get_element_distribution() const
Bool_t IsCalibrated() const
Definition: KVDetector.h:389
KVDetector * GetDetector(const Char_t *name) const
Return detector in this structure with given name.
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:83
const Char_t * AsString(Int_t maxchars=0) const
Int_t GetEntries() const
Definition: KVNumberList.h:169
void Add(Int_t)
Add value 'n' to the list.
Int_t Next(void) const
Int_t GetSize() const
static const TArrayI & GetPalette()
static Int_t CreateGradientColorTable(UInt_t Number, Double_t *Stops, Double_t *Red, Double_t *Green, Double_t *Blue, UInt_t NColors, Float_t alpha=1.)
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
virtual void SetName(const char *name="")
Int_t GetN() const
virtual void SetTitle(const char *title="")
virtual const char * GetName() const
TString & Prepend(char c, Ssiz_t rep=1)
TString & Remove(EStripType s, char c)
TGraphErrors * gr
const long double mg
Definition: KVUnits.h:74
constexpr Double_t G()
TGraph * get_isotope_thresholds_by_Z_mev_per_nuc(Color_t color=0) const
KVDataQualityAudit::idtelescope * this_telescope
#define mark(osub)