18Int_t year, month, day;
20TProfile *hYear = 0, *hMonth = 0, *hDay = 0;
27Int_t rMonth[3] = { 12, 1, 13 };
28Int_t rDay[3] = { 31, 1, 32 };
29Double_t rTemp[3] = { 55.0, -20.0, 35.0 };
32void HighlightYear(
Int_t xhb);
33void HighlightMonth(
Int_t xhb);
34void HighlightDay(
Int_t xhb);
44 auto dir =
gROOT->GetTutorialDir();
46 dir.ReplaceAll(
"/./",
"/");
47 if (
tree->ReadFile(
Form(
"%stemperature_Prague.dat",dir.Data())) == 0)
return;
51 rYear[1] = (
Int_t)
tree->GetLeaf(
"YEAR")->GetValue();
52 tree->GetEntry(
tree->GetEntries() - 1);
53 rYear[2] = (
Int_t)
tree->GetLeaf(
"YEAR")->GetValue();
54 rYear[2] = rYear[2] + 1;
55 rYear[0] = rYear[2] - rYear[1];
58 hYear =
new TProfile(
"hYear",
"temperature (average) by year; year; temp, #circC", rYear[0], rYear[1], rYear[2]);
59 tree->Draw(
"T:YEAR>>hYear",
"",
"goff");
70 Canvas =
new TCanvas(
"Canvas",
"Canvas", 0, 0, 700, 900);
71 Canvas->
Divide(1, 3, 0.001, 0.001);
73 hYear->
Draw(
"HIST, LP");
78 Canvas->
HighlightConnect(
"HighlightTemp(TVirtualPad*,TObject*,Int_t,Int_t)");
84 if (obj == hYear) HighlightYear(xhb);
85 if (obj == hMonth) HighlightMonth(xhb);
86 if (obj == hDay) HighlightDay(xhb);
91void HighlightYear(
Int_t xhb)
94 hMonth =
new TProfile(
"hMonth",
"; month; temp, #circC", rMonth[0], rMonth[1], rMonth[2]);
95 hMonth->SetMinimum(rTemp[1]);
96 hMonth->SetMaximum(rTemp[2]);
97 hMonth->GetXaxis()->SetNdivisions(112);
98 hMonth->GetXaxis()->CenterLabels();
99 hMonth->GetYaxis()->SetNdivisions(410);
100 hMonth->SetFillColor(
kGray+1);
103 hMonth->Draw(
"HIST, CP");
105 hMonth->SetHighlight();
108 year = xhb - 1 + rYear[1];
110 hMonth->SetTitle(
TString::Format(
"temperature by month (year = %d)", year));
113 HighlightMonth(customhb);
117void HighlightMonth(
Int_t xhb)
120 hDay =
new TProfile(
"hDay",
"; day; temp, #circC", rDay[0], rDay[1], rDay[2]);
121 hDay->SetMinimum(rTemp[1]);
122 hDay->SetMaximum(rTemp[2]);
123 hDay->GetYaxis()->SetNdivisions(410);
124 hDay->SetFillColor(
kGray);
127 hDay->
Draw(
"HIST, CP");
129 hDay->SetHighlight();
132 if (xhb != customhb) month = xhb;
134 hDay->SetTitle(
TString::Format(
"temperature by day (month = %02d, year = %d)", month, year));
137 HighlightDay(customhb);
141void HighlightDay(
Int_t xhb)
151 if (xhb != customhb) day = xhb;
153 if (hDay->GetBinEntries(day) == 0) temp =
" ";
char * Form(const char *fmt,...)
R__EXTERN TStyle * gStyle
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
virtual void SetTextSizePixels(Int_t npixels)
Set the text size in pixels.
virtual void HighlightConnect(const char *slot)
This is "simplification" for function TCanvas::Connect with Highlighted signal for specific slot.
virtual void Update()
Update canvas pad buffers.
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual void SetHighlight(Bool_t set=kTRUE)
Set highlight (enable/disable) mode for the histogram by default highlight mode is disable.
To draw Mathematical Formula.
Mother of all ROOT objects.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
virtual TVirtualPad * GetPad(Int_t subpadnumber) const
Get a pointer to subpadnumber of this pad.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
virtual void SetText(Double_t x, Double_t y, const char *text)
A TTree represents a columnar dataset.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual void Modified(Bool_t flag=1)=0
virtual void SetGridx(Int_t value=1)=0
virtual void Draw(Option_t *option="")=0
Default Draw method for all objects.