18Int_t year, month, day;
20TProfile *hYear =
nullptr, *hMonth =
nullptr, *hDay =
nullptr;
27Int_t rMonth[3] = { 12, 1, 13 };
28Int_t rDay[3] = { 31, 1, 32 };
29Double_t rTemp[3] = { 55.0, -20.0, 35.0 };
31void HighlightDay(
Int_t xhb)
44 if (hDay->GetBinEntries(day) == 0)
56void HighlightMonth(
Int_t xhb)
59 hDay =
new TProfile(
"hDay",
"; day; temp, #circC", rDay[0], rDay[1], rDay[2]);
60 hDay->SetMinimum(rTemp[1]);
61 hDay->SetMaximum(rTemp[2]);
62 hDay->GetYaxis()->SetNdivisions(410);
63 hDay->SetFillColor(
kGray);
66 hDay->
Draw(
"HIST, CP");
74 hDay->SetTitle(
TString::Format(
"temperature by day (month = %02d, year = %d)", month, year));
77 HighlightDay(customhb);
80void HighlightYear(
Int_t xhb)
83 hMonth =
new TProfile(
"hMonth",
"; month; temp, #circC", rMonth[0], rMonth[1], rMonth[2]);
84 hMonth->SetMinimum(rTemp[1]);
85 hMonth->SetMaximum(rTemp[2]);
86 hMonth->GetXaxis()->SetNdivisions(112);
87 hMonth->GetXaxis()->CenterLabels();
88 hMonth->GetYaxis()->SetNdivisions(410);
89 hMonth->SetFillColor(
kGray+1);
92 hMonth->Draw(
"HIST, CP");
94 hMonth->SetHighlight();
97 year = xhb - 1 + rYear[1];
99 hMonth->SetTitle(
TString::Format(
"temperature by month (year = %d)", year));
102 HighlightMonth(customhb);
116void tree200_temperature()
119 tree =
new TTree(
"tree",
"GHCN-Daily");
123 auto dir =
gROOT->GetTutorialDir();
124 dir.Append(
"/io/tree/");
125 dir.ReplaceAll(
"/./",
"/");
126 if (tree->
ReadFile(
Form(
"%stemperature_Prague.dat", dir.Data())) == 0)
134 rYear[2] = rYear[2] + 1;
135 rYear[0] = rYear[2] - rYear[1];
138 hYear =
new TProfile(
"hYear",
"temperature (average) by year; year; temp, #circC", rYear[0], rYear[1], rYear[2]);
139 tree->
Draw(
"T:YEAR>>hYear",
"",
"goff");
150 Canvas =
new TCanvas(
"Canvas",
"Canvas", 0, 0, 700, 900);
151 Canvas->
HighlightConnect(
"HighlightTemp(TVirtualPad*,TObject*,Int_t,Int_t)");
152 Canvas->
Divide(1, 3, 0.001, 0.001);
154 hYear->
Draw(
"HIST, LP");
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
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 pixel.
virtual void HighlightConnect(const char *slot)
This is "simplification" for function TCanvas::Connect with Highlighted signal for specific slot.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
void Update() override
Update canvas pad buffers.
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.
virtual void SetMaximum(Double_t maximum=-1111)
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual void SetMinimum(Double_t minimum=-1111)
virtual void SetHighlight(Bool_t set=kTRUE)
Set highlight (enable/disable) mode for the histogram by default highlight mode is disable.
virtual Double_t GetValue(Int_t i=0) const
Mother of all ROOT objects.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
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
Automatic pad generation by division.
TVirtualPad * GetPad(Int_t subpadnumber) const override
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.
virtual void SetText(Double_t x, Double_t y, const char *text)
A TTree represents a columnar dataset.
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
void Draw(Option_t *opt) override
Default Draw method for all objects.
virtual Long64_t GetEntries() const
virtual TLeaf * GetLeaf(const char *branchname, const char *leafname)
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of fri...
virtual Long64_t ReadFile(const char *filename, const char *branchDescriptor="", char delimiter=' ')
Create or simply read branches from filename.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual void Modified(Bool_t flag=1)=0
void Draw(Option_t *option="") override=0
Default Draw method for all objects.
virtual void SetGridx(Int_t value=1)=0