KaliVeda
Toolkit for HIC analysis
KVDataQualityAuditReporting_INDRAFAZIA.cpp
1 #include "KVDataQualityAuditReporting_INDRAFAZIA.h"
2 #include "KVDataSetManager.h"
3 #include "KVINDRA.h"
4 #include "KVFAZIA.h"
5 #include <KVFAZIADetector.h>
6 #include <KVGeoDNTrajectory.h>
7 #include <TColor.h>
8 #include <TLatex.h>
9 #include <TLegend.h>
10 #include <TMarker.h>
11 #include "TLegend.h"
12 
14 
15 
16 
19  void KVDataQualityAuditReporting_INDRAFAZIA::make_canvas(canvas_t style)
20 {
21  // Make an A4-size canvas
22  Double_t w = 297 * 6;
23  Double_t h = 210 * 6;
24  if (style == canvas_t::kPortrait) std::swap(w, h);
25  myCanvas = ::new TCanvas("c", "c", w, h);
26  myCanvas->SetWindowSize(w + (w - myCanvas->GetWw()), h + (h - myCanvas->GetWh()));
27 }
28 
29 
30 
33 
34 void KVDataQualityAuditReporting_INDRAFAZIA::make_fazia_map(double theta_bin)
35 {
36  // sort fazia telescopes into bins of theta
37 
38  TIter itdet(gFazia->GetDetectors());
39  KVDetector* det;
40  std::map<double, std::vector<KVDetector*>> tmp_map;
41 
42  while ((det = (KVDetector*)itdet())) {
43  if (det->IsLabelled("SI1")) {
44  int bin = TMath::Nint(det->GetTheta() * (1 / theta_bin));
45  tmp_map[bin].push_back(det);
46  }
47  }
48  //sort detectors in vectors in order of increasing theta
49  //split any group with > 10 detectors in to 2
50  for (auto& p : tmp_map) {
51  auto grp_theta = p.first;
52  std::sort(std::begin(p.second), std::end(p.second), [](KVDetector * a, KVDetector * b) {
53  return a->GetTheta() < b->GetTheta();
54  });
55  if(p.second.size()>10)
56  {
57  auto new_size = p.second.size() - p.second.size()/2;
58  if(new_size > 10)
59  {
60  // split in 3
61  KVError::Info(this, "make_fazia_map", "group %f has %d members: split in 3", p.first, p.second.size());
62  new_size = p.second.size() - 2*p.second.size()/3;
63  fazia_map[grp_theta] = {p.second.begin(),p.second.begin()+new_size};
64  grp_theta+=1./3.;
65  fazia_map[grp_theta] = {p.second.begin()+new_size, p.second.begin()+2*new_size};
66  grp_theta+=1./3.;
67  fazia_map[grp_theta] = {p.second.begin()+2*new_size, p.second.end()};
68  }
69  else
70  {
71  KVError::Info(this, "make_fazia_map", "group %f has %d members: split in 2", p.first, p.second.size());
72  fazia_map[grp_theta] = {p.second.begin(),p.second.begin()+new_size};
73  grp_theta+=0.5;
74  fazia_map[grp_theta] = {p.second.begin()+new_size, p.second.end()};
75  }
76  }
77  else
78  fazia_map[grp_theta] = p.second;
79  }
80 }
81 
82 
83 
85 
87 {
88  if (!gMultiDetArray)
90 
91  indra_csi_idtype = gIndra->GetCsIIDType();
92  fazia_si_csi_idtype = gFazia->GetSiCsIIDType();
93 
94  make_fazia_map(0.4);
95 
96  make_canvas();
97 
98  TString pdf_file = Form("%s_DataQualityAudit_%s.pdf", dataset_name.Data(), fAudit->GetName());
99  auto first_page = pdf_file + "(";
100  auto last_page = pdf_file + ")";
101  current_page = first_page;
102  // INDRA Z identification bilan
103  int nx(2), ny(3);
104  myCanvas->Divide(nx, ny);
105  int pad = 1;
106  std::vector<TString> indra_id_types = {"SI", "SI_CSI", indra_csi_idtype};
107  for (auto& id : indra_id_types) {
108  for (int ring = 6; ring <= 17; ++ring) {
109  if ((id == "SI_CSI" || id == "SI") && ring > 9) break;
110 
111  myCanvas->cd(pad)->SetFillStyle(4000);//transparent pad
112  if(INDRA_ring_reporting_Z(ring, id))
113  {
114  ++pad;
115  if (pad > nx * ny) {
116  draw_sidebar_legend();
117  myCanvas->Print(current_page, Form("Title:INDRA Z %s ID Quality by Ring", id.Data()));
118  if (current_page == first_page) current_page = pdf_file;
119  myCanvas->Clear();
120  myCanvas->Divide(nx, ny);
121  pad = 1;
122  }
123  }
124  }
125  if (pad != 1) {
126  draw_sidebar_legend();
127  myCanvas->Print(current_page, Form("Title:INDRA Z %s ID Quality by Ring", id.Data()));
128  if (current_page == first_page) current_page = pdf_file;
129  myCanvas->Clear();
130  myCanvas->Divide(nx, ny);
131  pad = 1;
132  }
133  nx = 4;
134  ny = 3;
135  myCanvas->Clear();
136  myCanvas->Divide(nx, ny);
137  pad = 1;
138  for (int ring = 6; ring <= 17; ++ring) {
139  if ((id == "SI_CSI" || id == "SI")) {
140  if (ring > 9) break; // no si after ring 9
141  }
142 
143  INDRA_ring_mean_A_vs_Z(ring, id, pad, nx, ny);
144  }
145  if (pad != 1) {
146  myCanvas->Print(current_page, Form("Title:INDRA <A> vs Z %s by Ring", id.Data()));
147  myCanvas->Clear();
148  myCanvas->Divide(nx, ny);
149  pad = 1;
150  }
151  for (int ring = 6; ring <= 17; ++ring) {
152  INDRA_ring_Z_threshold_vs_Z(ring, id, pad, nx, ny);
153  }
154  if (pad != 1) {
155  myCanvas->Print(current_page, Form("Title:INDRA Z thresh. vs Z %s by Ring", id.Data()));
156  myCanvas->Clear();
157  myCanvas->Divide(nx, ny);
158  pad = 1;
159  }
160  }
161 
162  // FAZIA Z identification bilan
163  std::vector<TString> fazia_id_types = {"SI1", "SI1_SI2", fazia_si_csi_idtype, "CSI"};
164  nx = 4;
165  ny = 3;
166  for (auto& id : fazia_id_types) {
167  myCanvas->Clear();
168  myCanvas->Divide(nx, ny);
169  pad = 1;
170  int group_num = 1;
171  for (auto& p : fazia_map) {
172  myCanvas->cd(pad);
173 
174  if(FAZIA_group_reporting_Z(group_num, p.second, id))
175  {
176  ++group_num;
177  ++pad;
178  if (pad > nx * ny) {
179  draw_sidebar_legend_fazia();
180  myCanvas->Print(pdf_file, Form("Title:FAZIA Z %s ID Quality by Group", id.Data()));
181  myCanvas->Clear();
182  myCanvas->Divide(nx, ny);
183  pad = 1;
184  }
185  }
186  }
187  if (pad != 1) {
188  draw_sidebar_legend_fazia();
189  myCanvas->Print(pdf_file, Form("Title:FAZIA Z %s ID Quality by Group", id.Data()));
190  }
191 
192  myCanvas->Clear();
193  myCanvas->Divide(nx, ny);
194  pad = 1;
195  group_num = 1;
196  for (auto& p : fazia_map) {
197  myCanvas->cd(pad);
198 
199  if(FAZIA_group_mean_A_vs_Z(group_num, p.second, id))
200  {
201  ++group_num;
202  ++pad;
203  if (pad > nx * ny) {
204  myCanvas->Print(pdf_file, Form("Title:FAZIA <A> vs Z %s by Group", id.Data()));
205  myCanvas->Clear();
206  myCanvas->Divide(nx, ny);
207  pad = 1;
208  }
209  }
210  }
211  if (pad != 1) myCanvas->Print(pdf_file, Form("Title:FAZIA <A> vs Z %s by Group", id.Data()));
212 
213  myCanvas->Clear();
214  myCanvas->Divide(nx, ny);
215  pad = 1;
216  group_num = 1;
217  for (auto& p : fazia_map) {
218  myCanvas->cd(pad);
219 
220  if(FAZIA_group_Z_threshold_vs_Z(group_num, p.second, id))
221  {
222  ++group_num;
223  ++pad;
224  if (pad > nx * ny) {
225  myCanvas->Print(pdf_file, Form("Title:FAZIA Z thresh. vs Z %s by Group", id.Data()));
226  myCanvas->Clear();
227  myCanvas->Divide(nx, ny);
228  pad = 1;
229  }
230  }
231  }
232  if (pad != 1) myCanvas->Print(pdf_file, Form("Title:FAZIA Z thresh. vs Z %s by Group", id.Data()));
233 
234  myCanvas->Clear();
235  myCanvas->Divide(nx, ny);
236  pad = 1;
237  group_num = 1;
238  for (auto& p : fazia_map) {
239  myCanvas->cd(pad);
240 
241  if(FAZIA_group_A_threshold_vs_Z(group_num, p.second, id))
242  {
243  ++group_num;
244  ++pad;
245  if (pad > nx * ny) {
246  myCanvas->Print(pdf_file, Form("Title:FAZIA A thresh. vs Z %s by Group", id.Data()));
247  myCanvas->Clear();
248  myCanvas->Divide(nx, ny);
249  pad = 1;
250  }
251  }
252  }
253  if (pad != 1) myCanvas->Print(pdf_file, Form("Title:FAZIA A thresh. vs Z %s by Group", id.Data()));
254  }
255  myCanvas->Clear();
256  myCanvas->Print(last_page, "Title:Last page");
257 }
258 
259 
260 
262 
263 std::optional<KVUnownedList> KVDataQualityAuditReporting_INDRAFAZIA::get_indra_telescopes(int ring, const TString& idtype)
264 {
265  bool ok = false;
266  KVUnownedList tels;
267  for (int mod = 1; mod <= 24; ++mod) {
268  TString name = Form("%s_%02d%02d", idtype.Data(), ring, mod);
269  auto tel = gIndra->GetIDTelescope(name);
270  if (tel) {
271  tels.Add(tel);
272  if(fAudit->HasTelescope(name))
273  ok = true;
274  }
275  }
276  if(ok)
277  return tels;
278  return {};
279 }
280 
281 
282 
284 
286 {
287  auto tels = get_indra_telescopes(ring, idtype);
288 
289  if(!tels)
290  return false;
291 
292  auto get_module_number = [](const KVIDTelescope * idt) {
293  return (int)dynamic_cast<KVINDRADetector*>(idt->GetDetector(1))->GetModuleNumber();
294  };
295  auto zmean = fReport.get_mean_Z_for_telescopes(&(*tels), get_module_number);
296  auto zmax = fReport.get_max_Z_for_telescopes(&(*tels), get_module_number, 24);
297  auto zmax_iso = fReport.get_max_Z_with_isotopes_for_telescopes(&(*tels), get_module_number, 30);
298  zmax_iso->SetMarkerColor(kOrange - 2);
299  auto zmin = fReport.get_min_Z_for_telescopes(&(*tels), get_module_number, 25);
300  TMultiGraph* mg = ::new TMultiGraph;
301  mg->SetTitle(Form("Ring %d %s Min/Mean/Max Z vs. Module", ring, idtype.Data()));
302  mg->Add(zmin);
303  mg->Add(zmean);
304  mg->Add(zmax);
305  mg->Add(zmax_iso);
306  mg->Draw("ap");
307 
308  return true;
309 }
310 
311 
313 
314 void KVDataQualityAuditReporting_INDRAFAZIA::INDRA_ring_mean_A_vs_Z(int ring, const TString& idtype, int& pad, int nx, int ny)
315 {
316  auto tels = get_indra_telescopes(ring,idtype);
317  if(!tels)
318  return;
319 
320  int nmods = tels->GetEntries();
321  // 24 => 4 sets of 6, 16 => 2 sets of 8, 8 => 1 set of 8
322  int mod_set = (nmods > 16 ? 6 : 8);
323  int color_step = TColor::GetPalette().GetSize() / (mod_set + 1);
324  KVIDTelescope* idt;
325  nmods = 0;
326  while (tels->GetEntries()) {
327  TMultiGraph* mg = ::new TMultiGraph;
328  int i = 1;
329  while (i <= mod_set) {
330  idt = (KVIDTelescope*)tels->Remove(tels->First()); // "pop" the first one in the list
331  if (fAudit->HasTelescope(idt->GetName())) {
332  auto gr = fReport[idt->GetName()].get_mean_isotopic_mass_by_Z();
333  gr->SetMarkerColor(TColor::GetPalette()[color_step * i]);
334  gr->SetMarkerStyle(markers[(i-1)%max_marker]);
335  gr->SetLineWidth(0);
336  mg->Add(gr);
337  }
338  ++i;
339  ++nmods;
340  }
341  myCanvas->cd(pad);
342  ++pad;
343  // change title of graph => title of pad
344  mg->SetTitle(Form("INDRA <A> vs. Z %s Ring %d [%d-%d]", idtype.Data(), ring, nmods - mod_set + 1, nmods));
345  mg->Draw("ap");
346  TLegend* leg;
347  if (i > 12) {
348  leg = gPad->BuildLegend(.11, .89, .61, .69);
349  leg->SetNColumns(3);
350  }
351  else if (i > 6) {
352  leg = gPad->BuildLegend(.11, .89, .61, .69);
353  leg->SetNColumns(2);
354  }
355  else {
356  leg = gPad->BuildLegend(.11, .89, .61, .69);
357  }
358  leg->SetBorderSize(0);
359  leg->SetFillColorAlpha(kWhite, 1.00);
360  if (pad > nx * ny) {
361  myCanvas->Print(current_page, Form("Title:INDRA <A> vs Z %s by Ring", idtype.Data()));
362  myCanvas->Clear();
363  myCanvas->Divide(nx, ny);
364  pad = 1;
365  }
366  }
367 }
368 
369 
370 
372 
373 void KVDataQualityAuditReporting_INDRAFAZIA::INDRA_ring_Z_threshold_vs_Z(int ring, const TString& idtype, int& pad, int nx, int ny)
374 {
375  auto tels = get_indra_telescopes(ring,idtype);
376 
377  if(!tels)
378  return;
379 
380  int nmods = tels->GetEntries();
381  // 24 => 4 sets of 6, 16 => 2 sets of 8, 8 => 1 set of 8
382  int mod_set = (nmods > 16 ? 6 : 8);
383  int color_step = TColor::GetPalette().GetSize() / (mod_set + 1);
384  KVIDTelescope* idt;
385  nmods = 0;
386  while (tels->GetEntries()) {
387  TMultiGraph* mg = ::new TMultiGraph;
388  int i = 1;
389  while (i <= mod_set) {
390  idt = (KVIDTelescope*)tels->Remove(tels->First()); // "pop" the first one in the list
391  if (fAudit->HasTelescope(idt->GetName())) {
392  auto gr = fReport[idt->GetName()].get_element_thresholds_by_Z_mev_per_nuc(TColor::GetPalette()[color_step * i]);
393  gr->SetMarkerStyle(markers[(i-1)%max_marker]);
394  gr->SetLineWidth(0);
395  mg->Add(gr);
396  if (gr->GetMean(2) < 0) {
397  // threshold = -1 => uncalibrated particles
398  std::cout << idt->GetName() << " : particles are UNCALIBRATED";
399  // check detector calibrations
400  KVGeoDNTrajectory* traj;
401  if (idt->GetSize() > 1) traj = (KVGeoDNTrajectory*)idt->GetDetector(2)->GetNode()->GetForwardTrajectories()->First();
402  else traj = (KVGeoDNTrajectory*)(idt->GetDetector(1)->GetNode()->GetForwardTrajectories() ? idt->GetDetector(1)->GetNode()->GetForwardTrajectories()->First() : nullptr);
403  if(traj){
404  int nuncal = 0;
405  traj->IterateFrom();
406  KVGeoDetectorNode* dn;
407  while ((dn = traj->GetNextNode())) nuncal += (!dn->GetDetector()->IsCalibrated());
408  if (nuncal == traj->GetN()) std::cout << " ... just like ALL DETECTORS";
409  else {
410  std::cout << " ... just like ";
411  traj->IterateFrom();
412  KVGeoDetectorNode* dn;
413  while ((dn = traj->GetNextNode())) {
414  if (!dn->GetDetector()->IsCalibrated()) {
415  std::cout << dn->GetName() << " ";
416  }
417  }
418  }
419  }
420  std::cout << std::endl;
421  }
422  }
423  ++i;
424  ++nmods;
425  }
426  myCanvas->cd(pad);
427  ++pad;
428  // change title of graph => title of pad
429  mg->SetTitle(Form("INDRA Z thresh. [MeV/u] vs. Z %s Ring %d [%d-%d]", idtype.Data(), ring, nmods - mod_set + 1, nmods));
430  mg->Draw("ap");
431  double x1, x2;
432  // if(idtype == "CSI")
433  // {
434  // return;// no legend - doesn't fit
435  // //x1 = .39; x2 = .89;
436  // }
437  // else
438  // {
439  x1 = .11;
440  x2 = .61;
441  // }
442  TLegend* leg;
443  if (mod_set > 12) {
444  leg = gPad->BuildLegend(x1, .89, x2, .69);
445  leg->SetNColumns(3);
446  }
447  else if (mod_set > 6) {
448  leg = gPad->BuildLegend(x1, .89, x2, .69);
449  leg->SetNColumns(2);
450  }
451  else {
452  leg = gPad->BuildLegend(x1, .89, x2, .69);
453  }
454  leg->SetBorderSize(0);
455  leg->SetFillColorAlpha(kWhite, 1.00);
456  if (pad > nx * ny) {
457  myCanvas->Print(current_page, Form("Title:INDRA Z thresh. vs Z %s by Ring", idtype.Data()));
458  myCanvas->Clear();
459  myCanvas->Divide(nx, ny);
460  pad = 1;
461  }
462  }
463 }
464 
465 
466 
469 
470 bool KVDataQualityAuditReporting_INDRAFAZIA::fill_telescopes_of_group(TList& tels, std::vector<KVDetector*>& dets, const TString& idtype, double& theta_min, double& theta_max)
471 {
472  // \returns true if telescopes added to list, false if not a single telescope appears in the audit
473  bool ok = false;
474  for (auto d : dets) {
475  int index = dynamic_cast<KVFAZIADetector*>(d)->GetIndex();
476  TString name = Form("ID_%s_%d", idtype.Data(), index);
477  auto tel = gFazia->GetIDTelescope(name);
478  if (tel) {
479  if (fAudit->HasTelescope(tel->GetName())) {
480  tels.Add(tel);
481  ok = true;
482  }
483  else {
484  if (tel->IsReadyForID()) std::cout << tel->GetName() << " is absent from audit - BUT IS READY TO IDENTIFY!" << std::endl;
485  }
486  }
487  theta_min = std::min(theta_min, d->GetTheta());
488  theta_max = std::max(theta_min, d->GetTheta());
489  }
490  return ok;
491 }
492 
493 
494 
497 
498 bool KVDataQualityAuditReporting_INDRAFAZIA::FAZIA_group_reporting_Z(int group_num, std::vector<KVDetector*>& dets, const TString& idtype)
499 {
500  // \returns false if nothing was displayed
501 
502  TList tels;
503  double theta_min{360}, theta_max{0};
504  Info("FAZIA_group_reporting_Z", "id=%s Group %d", idtype.Data(), group_num);
505  if(!fill_telescopes_of_group(tels, dets, idtype, theta_min, theta_max))
506  {
507  Info("FAZIA_group_reporting_Z", "id=%s Group %d: NO TELESCOPES IN AUDIT", idtype.Data(), group_num);
508  return false;
509  }
510 
511  int index = 0;
512  auto get_index = [&](const KVIDTelescope*) {
513  return index++;
514  };
515  auto zmean = fReport.get_mean_Z_for_telescopes(&tels, get_index);
516  index = 0;
517  auto zmax = fReport.get_max_Z_for_telescopes(&tels, get_index, 24);
518  index = 0;
519  auto zmax_iso = fReport.get_max_Z_with_isotopes_for_telescopes(&tels, get_index, 30);
520  zmax_iso->SetMarkerColor(kOrange - 2);
521  index = 0;
522  auto zmin = fReport.get_min_Z_for_telescopes(&tels, get_index, 25);
523  TMultiGraph* mg = ::new TMultiGraph;
524  mg->SetTitle(Form("Group %d [%.2f#leq#theta#leq%.2f] %s Min/Mean/Max Z", group_num, theta_min, theta_max, idtype.Data()));
525  mg->Add(zmin);
526  mg->Add(zmean);
527  mg->Add(zmax);
528  mg->Add(zmax_iso);
529  relabel_FAZIA_telescope_axis(mg, &tels);
530  mg->Draw("ap");
531  return true;
532 }
533 
534 
535 
537 
538 bool KVDataQualityAuditReporting_INDRAFAZIA::FAZIA_group_mean_A_vs_Z(int group_num, std::vector<KVDetector*>& dets, const TString& idtype)
539 {
540  TList tels;
541  double theta_min{360}, theta_max{0};
542  if(!fill_telescopes_of_group(tels, dets, idtype, theta_min, theta_max))
543  return false;
544 
545  int color_step = TColor::GetPalette().GetSize() / (dets.size() + 1);
546  int i = 1;
547  TIter next(&tels);
548  KVIDTelescope* idt;
549  TMultiGraph* mg = ::new TMultiGraph;
550  while ((idt = (KVIDTelescope*)next())) {
551  auto gr = fReport[idt->GetName()].get_mean_isotopic_mass_by_Z();
552  gr->SetMarkerColor(TColor::GetPalette()[color_step * i]);
553  gr->SetMarkerStyle(markers[(i-1)%max_marker]);
554  gr->SetLineWidth(0);
555  mg->Add(gr);
556  ++i;
557  }
558  // change title of graph => title of pad
559  mg->SetTitle(Form("FAZIA <A> vs. Z %s Group %d [%.2f#leq#theta#leq%.2f]", idtype.Data(), group_num, theta_min, theta_max));
560  mg->Draw("ap");
561  TLegend* leg;
562  if (i > 12) {
563  leg = gPad->BuildLegend(.11, .89, .61, .69);
564  leg->SetNColumns(3);
565  }
566  else if (i > 6) {
567  leg = gPad->BuildLegend(.11, .89, .61, .69);
568  leg->SetNColumns(2);
569  }
570  else {
571  leg = gPad->BuildLegend(.11, .89, .61, .69);
572  }
573  leg->SetBorderSize(0);
574  leg->SetFillColorAlpha(kWhite, 1.00);
575  return true;
576 }
577 
578 
579 
581 
582 bool KVDataQualityAuditReporting_INDRAFAZIA::FAZIA_group_Z_threshold_vs_Z(int group_num, std::vector<KVDetector*>& dets, const TString& idtype)
583 {
584  TList tels;
585  double theta_min{360}, theta_max{0};
586  if(!fill_telescopes_of_group(tels, dets, idtype, theta_min, theta_max))
587  return false;
588 
589  int color_step = TColor::GetPalette().GetSize() / (dets.size() + 1);
590  int i = 1;
591  TIter next(&tels);
592  KVIDTelescope* idt;
593  TMultiGraph* mg = ::new TMultiGraph;
594  while ((idt = (KVIDTelescope*)next())) {
595  auto gr = fReport[idt->GetName()].get_element_thresholds_by_Z_mev_per_nuc(TColor::GetPalette()[color_step * i]);
596  gr->SetMarkerStyle(markers[(i-1)%max_marker]);
597  gr->SetLineWidth(0);
598  mg->Add(gr);
599  if (gr->GetMean(2) < 0) {
600  // threshold = -1 => uncalibrated particles
601  std::cout << idt->GetName() << " : particles are UNCALIBRATED";
602  // check detector calibrations
603  KVGeoDNTrajectory* traj = nullptr;
604  if (idt->GetSize() > 1) traj = (KVGeoDNTrajectory*)idt->GetDetector(2)->GetNode()->GetForwardTrajectories()->First();
605  else {
606  if (idt->GetDetector(1)->GetNode()->GetForwardTrajectories())
608  else {
609  if (idt->GetDetector(1)->IsCalibrated()) std::cout << " ... but " << idt->GetDetector(1)->GetName() << " is calibrated...";
610  else std::cout << " ... just like " << idt->GetDetector(1)->GetName();
611  }
612  }
613  if (traj) {
614  int nuncal = 0;
615  traj->IterateFrom();
616  KVGeoDetectorNode* dn;
617  while ((dn = traj->GetNextNode())) nuncal += (!dn->GetDetector()->IsCalibrated());
618  if (nuncal == traj->GetN()) std::cout << " ... just like ALL DETECTORS";
619  else {
620  std::cout << " ... just like ";
621  traj->IterateFrom();
622  KVGeoDetectorNode* dn;
623  while ((dn = traj->GetNextNode())) {
624  if (!dn->GetDetector()->IsCalibrated()) {
625  std::cout << dn->GetName() << " ";
626  }
627  }
628  }
629  }
630  std::cout << std::endl;
631  }
632  ++i;
633  }
634  // change title of graph => title of pad
635  mg->SetTitle(Form("FAZIA Z thresh. [MeV/u] vs. Z %s Group %d [%.2f#leq#theta#leq%.2f]", idtype.Data(), group_num, theta_min, theta_max));
636  mg->Draw("ap");
637  double x1, x2;
638  if (idtype == "CSI") {
639  return true;// no legend - doesn't fit
640  //x1 = .39; x2 = .89;
641  }
642  else {
643  x1 = .11;
644  x2 = .61;
645  }
646  TLegend* leg;
647  if (i > 12) {
648  leg = gPad->BuildLegend(x1, .89, x2, .69);
649  leg->SetNColumns(3);
650  }
651  else if (i > 6) {
652  leg = gPad->BuildLegend(x1, .89, x2, .69);
653  leg->SetNColumns(2);
654  }
655  else {
656  leg = gPad->BuildLegend(x1, .89, x2, .69);
657  }
658  leg->SetBorderSize(0);
659  leg->SetFillColorAlpha(kWhite, 1.00);
660  return true;
661 }
662 
663 
664 
666 
667 bool KVDataQualityAuditReporting_INDRAFAZIA::FAZIA_group_A_threshold_vs_Z(int group_num, std::vector<KVDetector*>& dets, const TString& idtype)
668 {
669  TList tels;
670  double theta_min{360}, theta_max{0};
671  if(!fill_telescopes_of_group(tels, dets, idtype, theta_min, theta_max))
672  return false;
673 
674  int color_step = TColor::GetPalette().GetSize() / (dets.size() + 1);
675  int i = 1;
676  TIter next(&tels);
677  KVIDTelescope* idt;
678  TMultiGraph* mg = ::new TMultiGraph;
679  while ((idt = (KVIDTelescope*)next())) {
680  auto gr = fReport[idt->GetName()].get_isotope_thresholds_by_Z_mev_per_nuc(TColor::GetPalette()[color_step * i]);
681  gr->SetMarkerStyle(markers[(i-1)%max_marker]);
682  gr->SetLineWidth(0);
683  mg->Add(gr);
684  ++i;
685  }
686  // change title of graph => title of pad
687  mg->SetTitle(Form("FAZIA A thresh. [MeV/u] vs. Z %s Group %d [%.2f#leq#theta#leq%.2f]", idtype.Data(), group_num, theta_min, theta_max));
688  mg->Draw("ap");
689  double x1, x2;
690  if (idtype == "CSI") {
691  return true;// no legend - doesn't fit
692  //x1 = .39; x2 = .89;
693  }
694  else {
695  x1 = .11;
696  x2 = .61;
697  }
698  TLegend* leg;
699  if (i > 12) {
700  leg = gPad->BuildLegend(x1, .89, x2, .69);
701  leg->SetNColumns(3);
702  }
703  else if (i > 6) {
704  leg = gPad->BuildLegend(x1, .89, x2, .69);
705  leg->SetNColumns(2);
706  }
707  else {
708  leg = gPad->BuildLegend(x1, .89, x2, .69);
709  }
710  leg->SetBorderSize(0);
711  leg->SetFillColorAlpha(kWhite, 1.00);
712  return true;
713 }
714 
715 
716 
718 
720 {
721  auto N = dynamic_cast<TGraph*>(graf->GetListOfGraphs()->First())->GetN();
722  for (int i = 0; i < N; ++i) {
723  auto bin = graf->GetXaxis()->FindBin(i);
724  graf->GetXaxis()->SetBinLabel(bin, tels->At(i)->GetName());
725  }
726  graf->GetXaxis()->LabelsOption("u");// automatic rotation of labels to fit
727 }
728 
729 
730 
734 
735 void KVDataQualityAuditReporting_INDRAFAZIA::draw_sidebar_legend()
736 {
737  //=========Macro generated from canvas: c1/c1
738  //========= (Tue Jul 27 11:21:28 2021) by ROOT version 6.24/02
739 
740  myCanvas->cd();
741  // make sure all pads are transparent
742  TIter it(myCanvas->GetListOfPrimitives());
743  TObject* obj;
744  while ((obj = it())) {
745  if (obj->InheritsFrom("TPad")) {
746  dynamic_cast<TPad*>(obj)->SetFillStyle(4000);
747  }
748  }
749  TLatex* tex = ::new TLatex(0.02336825, 0.86604, "Max. Z");
750  tex->SetTextSize(0.028);
751  tex->SetTextAngle(90);
752  tex->SetLineWidth(2);
753  tex->Draw();
754  TMarker* marker = ::new TMarker(0.01611604, 0.8519389, 4);
755 
756  Int_t ci; // for color index setting
757  TColor* color; // for color definition with alpha
758  ci = TColor::GetColor("#333399");
759  marker->SetMarkerColor(ci);
760  marker->SetMarkerStyle(4);
761  marker->SetMarkerSize(1.7);
762  marker->Draw();
763  marker = ::new TMarker(0.01772764, 0.4453584, 30);
764 
765  ci = TColor::GetColor("#ffcc33");
766  marker->SetMarkerColor(ci);
767  marker->SetMarkerStyle(30);
768  marker->SetMarkerSize(1.7);
769  marker->Draw();
770  tex = ::new TLatex(0.02497985, 0.4629847, "Max. Z with identified A");
771  tex->SetTextSize(0.028);
772  tex->SetTextAngle(90);
773  tex->SetLineWidth(2);
774  tex->Draw();
775  tex = ::new TLatex(0.02659146, 0.2632197, "Mean Z");
776  tex->SetTextSize(0.028);
777  tex->SetTextAngle(90);
778  tex->SetLineWidth(2);
779  tex->Draw();
780  tex = ::new TLatex(0.02820306, 0.1045828, "Min. Z");
781  tex->SetTextSize(0.028);
782  tex->SetTextAngle(90);
783  tex->SetLineWidth(2);
784  tex->Draw();
785  marker = ::new TMarker(0.01853344, 0.2479436, 20);
786 
787  ci = TColor::GetColor("#333399");
788  marker->SetMarkerColor(ci);
789  marker->SetMarkerStyle(20);
790  marker->SetMarkerSize(1.7);
791  marker->Draw();
792  marker = ::new TMarker(0.02095085, 0.08578143, 25);
793 
794  ci = TColor::GetColor("#333399");
795  marker->SetMarkerColor(ci);
796  marker->SetMarkerStyle(25);
797  marker->SetMarkerSize(1.7);
798  marker->Draw();
799 }
800 
801 
802 
806 
807 void KVDataQualityAuditReporting_INDRAFAZIA::draw_sidebar_legend_fazia()
808 {
809  //=========Macro generated from canvas: c1/c1
810  //========= (Tue Jul 27 12:21:27 2021) by ROOT version 6.24/02
811  myCanvas->cd();
812  // make sure all pads are transparent
813  TIter it(myCanvas->GetListOfPrimitives());
814  TObject* obj;
815  while ((obj = it())) {
816  if (obj->InheritsFrom("TPad")) {
817  dynamic_cast<TPad*>(obj)->SetFillStyle(4000);
818  }
819  }
820  TLatex* tex = new TLatex(0.9813084, 0.9470954, "Max. Z");
821  tex->SetTextSize(0.028);
822  tex->SetTextAngle(270);
823  tex->SetLineWidth(2);
824  tex->Draw();
825  TMarker* marker = new TMarker(0.9853972, 0.9688797, 4);
826 
827  Int_t ci; // for color index setting
828  TColor* color; // for color definition with alpha
829  ci = TColor::GetColor("#333399");
830  marker->SetMarkerColor(ci);
831  marker->SetMarkerStyle(4);
832  marker->SetMarkerSize(1.7);
833  marker->Draw();
834  marker = new TMarker(0.984229, 0.8309129, 30);
835 
836  ci = TColor::GetColor("#ffcc33");
837  marker->SetMarkerColor(ci);
838  marker->SetMarkerStyle(30);
839  marker->SetMarkerSize(1.7);
840  marker->Draw();
841  tex = new TLatex(0.9807243, 0.8143154, "Max. Z with identified A");
842  tex->SetTextSize(0.028);
843  tex->SetTextAngle(270);
844  tex->SetLineWidth(2);
845  tex->Draw();
846  tex = new TLatex(0.9813084, 0.4419087, "Mean Z");
847  tex->SetTextSize(0.028);
848  tex->SetTextAngle(270);
849  tex->SetLineWidth(2);
850  tex->Draw();
851  tex = new TLatex(0.978972, 0.2479253, "Min. Z");
852  tex->SetTextSize(0.028);
853  tex->SetTextAngle(270);
854  tex->SetLineWidth(2);
855  tex->Draw();
856  marker = new TMarker(0.9853972, 0.4564315, 20);
857 
858  ci = TColor::GetColor("#333399");
859  marker->SetMarkerColor(ci);
860  marker->SetMarkerStyle(20);
861  marker->SetMarkerSize(1.7);
862  marker->Draw();
863  marker = new TMarker(0.9830607, 0.2645228, 25);
864 
865  ci = TColor::GetColor("#333399");
866  marker->SetMarkerColor(ci);
867  marker->SetMarkerStyle(25);
868  marker->SetMarkerSize(1.7);
869  marker->Draw();
870 
871 }
872 
873 
int Int_t
#define d(i)
double Double_t
kOrange
kWhite
#define N
winID w
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t SetFillStyle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
char name[80]
char * Form(const char *fmt,...)
#define gPad
Bool_t IsLabelled(const Char_t *l) const
Definition: KVBase.h:207
TGraph * get_max_Z_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
TGraph * get_mean_Z_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
TGraph * get_max_Z_with_isotopes_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
TGraph * get_min_Z_for_telescopes(TSeqCollection *idtels, TelescopeIndexFunction F, Marker_t marker_style=20) const
Prepare PDF report on data quality audits for INDRA-FAZIA experiments.
void relabel_FAZIA_telescope_axis(TMultiGraph *graf, const TList *tels) const
bool FAZIA_group_reporting_Z(int group_num, std::vector< KVDetector * > &, const TString &idtype)
bool FAZIA_group_Z_threshold_vs_Z(int group_num, std::vector< KVDetector * > &dets, const TString &idtype)
bool INDRA_ring_reporting_Z(int ring, const TString &idtype)
void INDRA_ring_Z_threshold_vs_Z(int ring, const TString &idtype, int &pad, int nx, int ny)
bool FAZIA_group_mean_A_vs_Z(int group_num, std::vector< KVDetector * > &, const TString &idtype)
void INDRA_ring_mean_A_vs_Z(int ring, const TString &idtype, int &pad, int nx, int ny)
bool FAZIA_group_A_threshold_vs_Z(int group_num, std::vector< KVDetector * > &dets, const TString &idtype)
Bool_t HasTelescope(const TString &tel_name) const
Base class for detector geometry description, interface to energy-loss calculations.
Definition: KVDetector.h:173
Bool_t IsCalibrated(const KVNameValueList &params={}) const
Definition: KVDetector.cpp:527
KVGeoDetectorNode * GetNode()
Definition: KVDetector.h:354
Double_t GetTheta() const override
Definition: KVDetector.h:736
Base class for FAZIA detectors.
TString GetSiCsIIDType() const
Definition: KVFAZIA.h:314
Path taken by particles through multidetector geometry.
KVGeoDetectorNode * GetNextNode() const
void IterateFrom(const KVGeoDetectorNode *node0=nullptr) const
Information on relative positions of detectors & particle trajectories.
KVDetector * GetDetector() const
const KVSeqCollection * GetForwardTrajectories() const
const Char_t * GetName() const override
Name of node is same as name of associated detector.
const KVSeqCollection * GetDetectors() const
Base class for all detectors or associations of detectors in array which can identify charged particl...
Definition: KVIDTelescope.h:85
KVDetector * GetDetector(UInt_t n) const
UInt_t GetSize() const
Base class for detectors of INDRA array.
TString GetCsIIDType() const
Definition: KVINDRA.cpp:775
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray", KVExpDB *db=nullptr)
KVIDTelescope * GetIDTelescope(const Char_t *name) const
Return pointer to DeltaE-E ID Telescope with "name".
TObject * First() const override
TObject * Remove(TObject *obj) override
Remove object from list.
void Add(TObject *obj) override
Extended TList class which does not own its objects by default.
Definition: KVUnownedList.h:20
Int_t GetSize() const
virtual void SetFillStyle(Style_t fstyle)
virtual void SetLineWidth(Width_t lwidth)
virtual void SetMarkerColor(Color_t mcolor=1)
virtual void SetMarkerStyle(Style_t mstyle=1)
virtual void SetMarkerSize(Size_t msize=1)
virtual void SetTextAngle(Float_t tangle=0)
virtual void SetTextSize(Float_t tsize=1)
virtual Int_t FindBin(const char *label)
virtual void LabelsOption(Option_t *option="h")
virtual void SetBinLabel(Int_t bin, const char *label)
void SetWindowSize(UInt_t ww, UInt_t wh)
void Clear(Option_t *option="") override
TVirtualPad * cd(Int_t subpadnumber=0) override
UInt_t GetWw() const override
UInt_t GetWh() const override
virtual Int_t GetEntries() const
static const TArrayI & GetPalette()
static Int_t GetColor(const char *hexcolor)
virtual Double_t GetMean(Int_t axis=1) const
void Add(TObject *obj) override
TObject * First() const override
TObject * At(Int_t idx) const override
void Draw(Option_t *option="") override
TList * GetListOfGraphs() const
TAxis * GetXaxis()
const char * GetName() const override
virtual const char * GetName() const
virtual Bool_t InheritsFrom(const char *classname) const
virtual void Draw(Option_t *option="")
virtual void Info(const char *method, const char *msgfmt,...) const
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
TList * GetListOfPrimitives() const override
void Print(const char *filename, Option_t *option) override
const char * Data() const
void swap(RVec< T > &lhs, RVec< T > &rhs)
TGraphErrors * gr
leg
TH1 * h
void Info(UserClass p, const char *location, const char *va_(fmt),...)
Definition: KVError.h:134
Int_t Nint(T x)
ClassImp(TPyArg)