Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
gr107_exclusiongraph2.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_graphs
3/// \notebook
4/// \preview Draw several graphs with exclusion zones.
5/// The shaded areas are obtained with a fill for the graph and controlled with `SetLineWidth`.
6/// `SetLineWidth` for exclusion graphs is explained in the [TGraphPainter documentation](https://root.cern/doc/master/classTGraphPainter.html#GrP2)
7///
8/// The graphs are drawn superposed, with help of an empty histogram that defines the axes, so we must make sure that the axis limits are adequate for all graphs. Notice that only the first drawn graph needs the "A" (draw axes) option. Alternatively, one could add the graphs to a TMultiGraph, which automatically defines the appropriate limits; see the gr106_exclusiongraph.C tutorial.
9///
10/// We add some text to the plot with [TLatex](https://root.cern/doc/master/classTLatex.html). Notice that the TLatex text is drawn on the current pad/canvas and does not need, nor have, a "same" option.
11///
12/// \macro_image
13/// \macro_code
14/// \author Olivier Couet
15
17{
18 TCanvas *c = new TCanvas("c","Charged Higgs L300 Contour",0,0,700,700);
19 c->SetTickx();
20 c->SetTicky();
21 c->SetGridx();
22 c->SetGridy();
23
24 // Frame to define the axis limits (50 to 500 and 1 to 50)
25 TH1 *frame = new TH1F("frame","",1000,50,500);
26 frame->SetMinimum(1);
27 frame->SetMaximum(50);
28 frame->SetDirectory(0);
29 frame->SetStats(0);
30 frame->GetXaxis()->SetTitle("m_{A} (GeV)");
31 frame->GetXaxis()->SetTickLength(0.02);
32 frame->GetXaxis()->SetLabelSize(0.03);
33 frame->GetYaxis()->SetTitle("tan#beta");
34 frame->GetYaxis()->SetMoreLogLabels();
35 frame->GetYaxis()->SetLabelSize(0.03);
36 frame->Draw(" ");
37 c->SetLogy();
38
39 TGraph *gr1 = new TGraph(10);
40 gr1->SetFillColor(6);
41 gr1->SetFillStyle(3005);
42 gr1->SetLineColor(6);
43 gr1->SetLineWidth(603);
44 gr1->SetPoint(0,140,0.5);
45 gr1->SetPoint(1,130,2.9);
46 gr1->SetPoint(2,124.677,3.83726);
47 gr1->SetPoint(3,113.362,6.06903);
48 gr1->SetPoint(4,108.513,8.00221);
49 gr1->SetPoint(5,111.746,10.0272);
50 gr1->SetPoint(6,119.828,12.8419);
51 gr1->SetPoint(7,135.991,30.0872);
52 gr1->SetPoint(8,140,40);
53 gr1->SetPoint(9,135,60);
54 gr1->Draw("C");
55 TLatex *tex = new TLatex(140.841,37.9762,
56 "#leftarrow t #rightarrow bH^{+}, H^{+} #rightarrow #tau#nu");
57 tex->SetTextColor(6);
58 tex->Draw();
59
60 TGraph *gr2 = new TGraph(15);
61 gr2->SetName("Graph");
62 gr2->SetTitle("Graph");
63 gr2->SetFillColor(1);
64 gr2->SetFillStyle(3005);
65 gr2->SetLineWidth(3);
66 gr2->SetPoint(0,499.192,3.02622);
67 gr2->SetPoint(1,427.748,3.06233);
68 gr2->SetPoint(2,358.244,3.10722);
69 gr2->SetPoint(3,305.711,3.24589);
70 gr2->SetPoint(4,244.289,3.36617);
71 gr2->SetPoint(5,206.304,3.7544);
72 gr2->SetPoint(6,178.017,4.50347);
73 gr2->SetPoint(7,148.114,6.20297);
74 gr2->SetPoint(8,131.142,8.00221);
75 gr2->SetPoint(9,111.746,8.48188);
76 gr2->SetPoint(10,102.047,9.52921);
77 gr2->SetPoint(11,96.3901,13.2212);
78 gr2->SetPoint(12,92.3491,19.0232);
79 gr2->SetPoint(13,90.7328,26.3935);
80 gr2->SetPoint(14,93.1573,50.4385);
81 gr2->Draw("L");
82 tex = new TLatex(346.929,6.62281,"ATLAS");
83 tex->SetLineWidth(2);
84 tex->Draw();
85 tex = new TLatex(328.341,5.24703,"#intLdt = 300 fb^{-1}");
86 tex->SetTextSize(0.0297619);
87 tex->SetLineWidth(2);
88 tex->Draw();
89 tex = new TLatex(340.463,4.1874,"Maximal mixing");
90 tex->SetTextSize(0.0297619);
91 tex->SetLineWidth(2);
92 tex->Draw();
93 tex = new TLatex(413.2,2.51608,"LEP 2000");
94 tex->SetTextSize(0.0297619);
95 tex->SetLineWidth(2);
96 tex->Draw();
97
98 TGraph *gr3 = new TGraph(10);
99 gr3->SetName("Graph");
100 gr3->SetTitle("Graph");
101 gr3->SetFillColor(2);
102 gr3->SetFillStyle(3004);
103 gr3->SetLineColor(2);
104 gr3->SetLineWidth(603);
105 gr3->SetPoint(0,176.84,10.7499);
106 gr3->SetPoint(1,190.575,11.9912);
107 gr3->SetPoint(2,211.58,12.7108);
108 gr3->SetPoint(3,243.088,12.3457);
109 gr3->SetPoint(4,279.443,12.6185);
110 gr3->SetPoint(5,302.065,12.9916);
111 gr3->SetPoint(6,331.957,13.7713);
112 gr3->SetPoint(7,369.928,14.2821);
113 gr3->SetPoint(8,425.673,16.1651);
114 gr3->SetPoint(9,499.192,18.1635);
115 gr3->Draw("C");
116 tex = new TLatex(188.151,9.36035,
117 "gb #rightarrow tH^{+}, H^{+} #rightarrow #tau#nu");
118 tex->SetTextColor(2);
119 tex->Draw();
120
121 TGraph *gr4 = new TGraph(10);
122 gr4->SetName("Graph");
123 gr4->SetTitle("Graph");
124 gr4->SetFillColor(4);
125 gr4->SetFillStyle(3004);
126 gr4->SetLineColor(4);
127 gr4->SetLineWidth(-603);
128 gr4->SetPoint(0,178.456,2.91797);
129 gr4->SetPoint(1,200.269,3.40033);
130 gr4->SetPoint(2,229.354,3.96243);
131 gr4->SetPoint(3,249.551,4.07959);
132 gr4->SetPoint(4,269.749,3.71097);
133 gr4->SetPoint(5,298.025,3.09308);
134 gr4->SetPoint(6,341.652,2.89679);
135 gr4->SetPoint(7,378.007,2.57808);
136 gr4->SetPoint(8,441.023,2.16454);
137 gr4->SetPoint(9,499.677,1.76145);
138 gr4->Draw("C");
139 tex = new TLatex(165.,1.15498,
140 "gb #rightarrow tH^{+}, H^{+} #rightarrow tb");
141 tex->SetTextColor(4);
142 tex->Draw();
143
144 TGraph *gr5 = new TGraph(10);
145 gr5->SetName("Graph");
146 gr5->SetTitle("Graph");
147 gr5->SetFillColor(4);
148 gr5->SetFillStyle(3004);
149 gr5->SetLineColor(4);
150 gr5->SetLineWidth(603);
151 gr5->SetPoint(0,152.603,23.0996);
152 gr5->SetPoint(1,188.151,18.8373);
153 gr5->SetPoint(2,239.048,15.2499);
154 gr5->SetPoint(3,264.901,15.8156);
155 gr5->SetPoint(4,299.641,18.8373);
156 gr5->SetPoint(5,334.381,20.7085);
157 gr5->SetPoint(6,360.233,22.4362);
158 gr5->SetPoint(7,396.589,24.4859);
159 gr5->SetPoint(8,433.752,25.7669);
160 gr5->SetPoint(9,499.192,27.3132);
161 gr5->Draw("C");
162}
#define c(i)
Definition RSha256.hxx:101
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
virtual void SetLabelSize(Float_t size=0.04)
Set size of axis labels.
Definition TAttAxis.cxx:203
virtual void SetTickLength(Float_t length=0.03)
Set tick mark length.
Definition TAttAxis.cxx:284
void SetMoreLogLabels(Bool_t more=kTRUE)
Set the kMoreLogLabels bit flag When this option is selected more labels are drawn when in log scale ...
Definition TAxis.h:225
The Canvas class.
Definition TCanvas.h:23
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:645
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
Definition TH1.cxx:8939
TAxis * GetXaxis()
Definition TH1.h:340
virtual void SetMaximum(Double_t maximum=-1111)
Definition TH1.h:420
TAxis * GetYaxis()
Definition TH1.h:341
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3037
virtual void SetMinimum(Double_t minimum=-1111)
Definition TH1.h:421
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition TH1.cxx:8992
To draw Mathematical Formula.
Definition TLatex.h:18
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164