ATLAS Offline Software
Loading...
Searching...
No Matches
MuonVertexValidationMacroPlotAnnotations Namespace Reference

Functions

TLegend * makeLegend (double lower_x, double lower_y, double upper_x, double upper_y, double textsize)
void drawATLASlabel (const char *text, double x, double y, double textsize)
void drawDetectorRegionLabel (const char *name, const char *customlabel, double x, double y, double textsize)
void drawDetectorBoundaryLine (double x, double y_max, int line_style, const char *text)
void drawDetectorBoundaryLines (const char *bin_var, double y_max)
double getMaxy (const TGraphAsymmErrors *graph, double current_max)

Function Documentation

◆ drawATLASlabel()

void MuonVertexValidationMacroPlotAnnotations::drawATLASlabel ( const char * text,
double x,
double y,
double textsize )

Definition at line 23 of file PlotAnnotations.cxx.

23 {
24 // Draw the ATLAS label with some optional text. The textsize is a fraction of the pad dimensions.
25 TLatex l;
26 l.SetTextFont(42); // 42 for Helvetica and 72 for Helvetica italics
27 l.SetTextColor(1);
28 l.SetTextSize(textsize);
29 l.DrawLatexNDC(x, y, TString::Format("#it{#bf{ATLAS}} %s",text));
30
31 return;
32}
#define y
#define x

◆ drawDetectorBoundaryLine()

void MuonVertexValidationMacroPlotAnnotations::drawDetectorBoundaryLine ( double x,
double y_max,
int line_style,
const char * text )

Definition at line 65 of file PlotAnnotations.cxx.

65 {
66 // Draw a vertical line at the detector boundary location x between 0 and y_max in absolute coordinates.
67 TLine* l = new TLine(x, y_max, x, 0); // assures that dashed lines don't start with a gap
68 Int_t ashGrey = TColor::GetColor("#717581");
69 l->SetLineColor(ashGrey);
70 l->SetLineStyle(line_style);
71 l->Draw();
72
73 TText* t = new TText(x, y_max, text);
74 t->SetTextFont(42);
75 t->SetTextSize(0.03);
76 t->SetTextAlign(31); // text is bottom right aligned to the position of the text
77 t->SetTextAngle(90);
78 t->Draw();
79
80 return;
81}

◆ drawDetectorBoundaryLines()

void MuonVertexValidationMacroPlotAnnotations::drawDetectorBoundaryLines ( const char * bin_var,
double y_max )

Definition at line 84 of file PlotAnnotations.cxx.

84 {
85 // Draw annotated vertical lines at the detector boundary locations for plots binned in Lxy or z.
86 // Valid inputs for bin_var are "Lxy" or "z".
87 // y_max defines the upper end of the line in absolute coordinates.
88 double hcalEnd{0}, mdt1S{0}, mdt1L{0}, mdt2S{0}, mdt2L{0};
89 if ((std::string)bin_var == "Lxy") {hcalEnd = 3.9; mdt1S = 4.383; mdt1L = 4.718; mdt2S = 7.888; mdt2L = 6.861;}
90 else if ((std::string)bin_var == "z") {hcalEnd = 6.05; mdt1S = 7.023; mdt1L = 7.409; mdt2S = 13.265; mdt2L = 13.660;}
91 else printf("Invalid binning variable. Please use 'Lxy' or 'z'.\nReturning without drawing detector boundary lines.\n");
92
93 drawDetectorBoundaryLine(hcalEnd, y_max, 9, "HCal end");
94 drawDetectorBoundaryLine(mdt1S, y_max, 7, "MDT1S");
95 drawDetectorBoundaryLine(mdt1L, y_max, 2, "MDT1L");
96 drawDetectorBoundaryLine(mdt2S, y_max, 7, "MDT2S");
97 drawDetectorBoundaryLine(mdt2L, y_max, 2, "MDT2L");
98
99 return;
100}
void drawDetectorBoundaryLine(double x, double y_max, int line_style, const char *text)

◆ drawDetectorRegionLabel()

void MuonVertexValidationMacroPlotAnnotations::drawDetectorRegionLabel ( const char * name,
const char * customlabel,
double x,
double y,
double textsize )

Definition at line 35 of file PlotAnnotations.cxx.

35 {
36 // Returns an annotation for the detector region based on the name of the histogram:
37 // if the histogram name ends with "b" it is assumed to be in the barrel region
38 // if the histogram name ends with "e" it is assumed to be in the endcaps region
39 // if customlabel is provided, it is used instead of the default label.
40 // if non of the above applies, the function returns without drawing anything.
41 // The textsize is a fraction of the pad dimensions.
42
43 const char DecReg = name[std::strlen(name)-1];
44 TString DecReg_label{};
45 if (*customlabel != 0){
46 DecReg_label = TString(customlabel);
47 }
48 else if (DecReg == *"b"){
49 DecReg_label = TString::Format("Barrel: |#kern[0.2]{#eta}| < %.2f", fidVol_barrel_etaCut);
50 }
51 else if (DecReg == *"e"){
52 DecReg_label = TString::Format("Endcaps: %.2f < |#kern[0.1]{#eta}| < %.2f", fidVol_endcaps_etaCut_low, fidVol_endcaps_etaCut_up);
53 }
54 else return;
55
56 TLatex t;
57 t.SetTextFont(42);
58 t.SetTextSize(textsize);
59 t.DrawLatexNDC(x, y, DecReg_label);
60
61 return;
62}

◆ getMaxy()

double MuonVertexValidationMacroPlotAnnotations::getMaxy ( const TGraphAsymmErrors * graph,
double current_max )

Definition at line 103 of file PlotAnnotations.cxx.

103 {
104 // returns the maximum of the current_max and the maximum y value+error of the passed graph.
105 double max = current_max;
106 double max_graph;
107 for (int i=0; i<graph->GetN(); ++i){
108 max_graph = graph->GetPointY(i) + graph->GetErrorYhigh(i);
109 max = max_graph > max ? max_graph : max;
110 }
111
112 return max;
113}
#define max(a, b)
Definition cfImp.cxx:41

◆ makeLegend()

TLegend * MuonVertexValidationMacroPlotAnnotations::makeLegend ( double lower_x,
double lower_y,
double upper_x,
double upper_y,
double textsize )

Definition at line 13 of file PlotAnnotations.cxx.

13 {
14 // Takes NDC coordinates and the textsize as a faction of the pad dimensions to construct a TLegend object and return its pointer
15 TLegend* legend = new TLegend(lower_x,lower_y,upper_x,upper_y);
16 legend->SetBorderSize(0);
17 legend->SetTextFont(42);
18 legend->SetTextSize(textsize);
19 return legend;
20}