1 #include "KVDataQualityAuditReporting_INDRAFAZIA.h"
2 #include "KVDataSetManager.h"
5 #include <KVFAZIADetector.h>
6 #include <KVGeoDNTrajectory.h>
19 void KVDataQualityAuditReporting_INDRAFAZIA::make_canvas(canvas_t style)
24 if (style == canvas_t::kPortrait)
std::swap(w, h);
25 myCanvas = ::new
TCanvas(
"c",
"c", w, h);
34 void KVDataQualityAuditReporting_INDRAFAZIA::make_fazia_map(
double theta_bin)
40 std::map<double, std::vector<KVDetector*>> tmp_map;
45 tmp_map[bin].push_back(det);
50 for (
auto& p : tmp_map) {
51 auto grp_theta =
p.first;
53 return a->GetTheta() < b->GetTheta();
55 if(
p.second.size()>10)
57 auto new_size =
p.second.size() -
p.second.size()/2;
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};
65 fazia_map[grp_theta] = {
p.second.begin()+new_size,
p.second.begin()+2*new_size};
67 fazia_map[grp_theta] = {
p.second.begin()+2*new_size,
p.second.end()};
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};
74 fazia_map[grp_theta] = {
p.second.begin()+new_size,
p.second.end()};
78 fazia_map[grp_theta] =
p.second;
99 auto first_page = pdf_file +
"(";
100 auto last_page = pdf_file +
")";
101 current_page = first_page;
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;
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;
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;
138 for (
int ring = 6; ring <= 17; ++ring) {
139 if ((
id ==
"SI_CSI" ||
id ==
"SI")) {
146 myCanvas->
Print(current_page,
Form(
"Title:INDRA <A> vs Z %s by Ring",
id.Data()));
151 for (
int ring = 6; ring <= 17; ++ring) {
155 myCanvas->
Print(current_page,
Form(
"Title:INDRA Z thresh. vs Z %s by Ring",
id.Data()));
163 std::vector<TString> fazia_id_types = {
"SI1",
"SI1_SI2", fazia_si_csi_idtype,
"CSI"};
166 for (
auto&
id : fazia_id_types) {
171 for (
auto&
p : fazia_map) {
179 draw_sidebar_legend_fazia();
180 myCanvas->
Print(pdf_file,
Form(
"Title:FAZIA Z %s ID Quality by Group",
id.Data()));
188 draw_sidebar_legend_fazia();
189 myCanvas->
Print(pdf_file,
Form(
"Title:FAZIA Z %s ID Quality by Group",
id.Data()));
196 for (
auto&
p : fazia_map) {
204 myCanvas->
Print(pdf_file,
Form(
"Title:FAZIA <A> vs Z %s by Group",
id.Data()));
211 if (pad != 1) myCanvas->
Print(pdf_file,
Form(
"Title:FAZIA <A> vs Z %s by Group",
id.Data()));
217 for (
auto&
p : fazia_map) {
225 myCanvas->
Print(pdf_file,
Form(
"Title:FAZIA Z thresh. vs Z %s by Group",
id.Data()));
232 if (pad != 1) myCanvas->
Print(pdf_file,
Form(
"Title:FAZIA Z thresh. vs Z %s by Group",
id.Data()));
238 for (
auto&
p : fazia_map) {
246 myCanvas->
Print(pdf_file,
Form(
"Title:FAZIA A thresh. vs Z %s by Group",
id.Data()));
253 if (pad != 1) myCanvas->
Print(pdf_file,
Form(
"Title:FAZIA A thresh. vs Z %s by Group",
id.Data()));
256 myCanvas->
Print(last_page,
"Title:Last page");
263 std::optional<KVUnownedList> KVDataQualityAuditReporting_INDRAFAZIA::get_indra_telescopes(
int ring,
const TString& idtype)
267 for (
int mod = 1; mod <= 24; ++mod) {
287 auto tels = get_indra_telescopes(ring, idtype);
293 return (
int)
dynamic_cast<KVINDRADetector*
>(idt->GetDetector(1))->GetModuleNumber();
301 mg->SetTitle(
Form(
"Ring %d %s Min/Mean/Max Z vs. Module", ring, idtype.
Data()));
316 auto tels = get_indra_telescopes(ring,idtype);
322 int mod_set = (nmods > 16 ? 6 : 8);
329 while (i <= mod_set) {
332 auto gr = fReport[idt->
GetName()].get_mean_isotopic_mass_by_Z();
344 mg->SetTitle(
Form(
"INDRA <A> vs. Z %s Ring %d [%d-%d]", idtype.
Data(), ring, nmods - mod_set + 1, nmods));
348 leg =
gPad->BuildLegend(.11, .89, .61, .69);
352 leg =
gPad->BuildLegend(.11, .89, .61, .69);
356 leg =
gPad->BuildLegend(.11, .89, .61, .69);
358 leg->SetBorderSize(0);
361 myCanvas->
Print(current_page,
Form(
"Title:INDRA <A> vs Z %s by Ring", idtype.
Data()));
375 auto tels = get_indra_telescopes(ring,idtype);
382 int mod_set = (nmods > 16 ? 6 : 8);
389 while (i <= mod_set) {
398 std::cout << idt->
GetName() <<
" : particles are UNCALIBRATED";
408 if (nuncal == traj->
GetN()) std::cout <<
" ... just like ALL DETECTORS";
410 std::cout <<
" ... just like ";
415 std::cout << dn->
GetName() <<
" ";
420 std::cout << std::endl;
429 mg->SetTitle(
Form(
"INDRA Z thresh. [MeV/u] vs. Z %s Ring %d [%d-%d]", idtype.
Data(), ring, nmods - mod_set + 1, nmods));
447 else if (mod_set > 6) {
454 leg->SetBorderSize(0);
457 myCanvas->
Print(current_page,
Form(
"Title:INDRA Z thresh. vs Z %s by Ring", idtype.
Data()));
470 bool KVDataQualityAuditReporting_INDRAFAZIA::fill_telescopes_of_group(
TList& tels, std::vector<KVDetector*>& dets,
const TString& idtype,
double& theta_min,
double& theta_max)
474 for (
auto d : dets) {
484 if (tel->IsReadyForID()) std::cout << tel->GetName() <<
" is absent from audit - BUT IS READY TO IDENTIFY!" << std::endl;
487 theta_min = std::min(theta_min,
d->GetTheta());
488 theta_max = std::max(theta_min,
d->GetTheta());
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))
507 Info(
"FAZIA_group_reporting_Z",
"id=%s Group %d: NO TELESCOPES IN AUDIT", idtype.
Data(), group_num);
524 mg->SetTitle(
Form(
"Group %d [%.2f#leq#theta#leq%.2f] %s Min/Mean/Max Z", group_num, theta_min, theta_max, idtype.
Data()));
541 double theta_min{360}, theta_max{0};
542 if(!fill_telescopes_of_group(tels, dets, idtype, theta_min, theta_max))
551 auto gr = fReport[idt->
GetName()].get_mean_isotopic_mass_by_Z();
559 mg->SetTitle(
Form(
"FAZIA <A> vs. Z %s Group %d [%.2f#leq#theta#leq%.2f]", idtype.
Data(), group_num, theta_min, theta_max));
563 leg =
gPad->BuildLegend(.11, .89, .61, .69);
567 leg =
gPad->BuildLegend(.11, .89, .61, .69);
571 leg =
gPad->BuildLegend(.11, .89, .61, .69);
573 leg->SetBorderSize(0);
585 double theta_min{360}, theta_max{0};
586 if(!fill_telescopes_of_group(tels, dets, idtype, theta_min, theta_max))
601 std::cout << idt->
GetName() <<
" : particles are UNCALIBRATED";
618 if (nuncal == traj->
GetN()) std::cout <<
" ... just like ALL DETECTORS";
620 std::cout <<
" ... just like ";
625 std::cout << dn->
GetName() <<
" ";
630 std::cout << std::endl;
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));
638 if (idtype ==
"CSI") {
658 leg->SetBorderSize(0);
670 double theta_min{360}, theta_max{0};
671 if(!fill_telescopes_of_group(tels, dets, idtype, theta_min, theta_max))
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));
690 if (idtype ==
"CSI") {
710 leg->SetBorderSize(0);
722 for (
int i = 0; i <
N; ++i) {
735 void KVDataQualityAuditReporting_INDRAFAZIA::draw_sidebar_legend()
744 while ((obj = it())) {
749 TLatex* tex = ::new
TLatex(0.02336825, 0.86604,
"Max. Z");
763 marker = ::new
TMarker(0.01772764, 0.4453584, 30);
770 tex = ::new
TLatex(0.02497985, 0.4629847,
"Max. Z with identified A");
775 tex = ::new
TLatex(0.02659146, 0.2632197,
"Mean Z");
780 tex = ::new
TLatex(0.02820306, 0.1045828,
"Min. Z");
785 marker = ::new
TMarker(0.01853344, 0.2479436, 20);
792 marker = ::new
TMarker(0.02095085, 0.08578143, 25);
807 void KVDataQualityAuditReporting_INDRAFAZIA::draw_sidebar_legend_fazia()
815 while ((obj = it())) {
820 TLatex* tex =
new TLatex(0.9813084, 0.9470954,
"Max. Z");
834 marker =
new TMarker(0.984229, 0.8309129, 30);
841 tex =
new TLatex(0.9807243, 0.8143154,
"Max. Z with identified A");
846 tex =
new TLatex(0.9813084, 0.4419087,
"Mean Z");
851 tex =
new TLatex(0.978972, 0.2479253,
"Min. Z");
856 marker =
new TMarker(0.9853972, 0.4564315, 20);
863 marker =
new TMarker(0.9830607, 0.2645228, 25);
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 * Form(const char *fmt,...)
Bool_t IsLabelled(const Char_t *l) const
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.
Bool_t IsCalibrated(const KVNameValueList ¶ms={}) const
KVGeoDetectorNode * GetNode()
Double_t GetTheta() const override
Base class for FAZIA detectors.
TString GetSiCsIIDType() const
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...
KVDetector * GetDetector(UInt_t n) const
Base class for detectors of INDRA array.
TString GetCsIIDType() const
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.
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
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)
void Info(UserClass p, const char *location, const char *va_(fmt),...)