14TList *list1 =
nullptr, *list2 =
nullptr;
23 auto list =
new TList();
26 for (
Int_t bin = 0; bin < nbins; bin++) {
30 g->SetMarkerStyle(25);
35 for (
Long64_t ie = 0; ie < nev; ie++) {
38 auto g =
dynamic_cast<TGraph *
>(list->At(bin));
47 auto histo =
dynamic_cast<TH1F *
>(obj);
55 TList *list =
nullptr;
56 if (!strcmp(histo->
GetName(),
"histo1"))
58 else if (!strcmp(histo->
GetName(),
"histo2"))
72 if (savepad) savepad->
cd();
77 auto dir =
gROOT->GetTutorialDir();
78 dir.Append(
"/hsimple.C");
79 dir.ReplaceAll(
"/./",
"/");
81 auto file = (
TFile*)
gROOT->ProcessLineFast(
"hsimple(1)");
85 file->GetObject(
"ntuple", ntuple);
87 const char *cut =
"pz > 3.0";
89 TCanvas *Canvas1 =
new TCanvas(
"Canvas1",
"Canvas1", 0, 0, 700, 500);
93 TCanvas *Canvas2 =
new TCanvas(
"Canvas2",
"Canvas2", 705, 0, 500, 500);
97 ntuple->
Draw(
"pz>>histo1(100, 2.0, 12.0)", cut);
98 auto histo1 = (
TH1F *)
gPad->FindObject(
"histo1");
99 auto info1 =
new TText(7.0, histo1->GetMaximum()*0.6,
100 "please move the mouse over the frame");
101 info1->SetTextColor(histo1->GetLineColor());
107 ntuple->
Draw(
"(px*py*pz)>>histo2(100, -50.0, 50.0)", cut);
108 auto histo2 = (
TH1F *)
gPad->FindObject(
"histo2");
109 histo2->SetLineColor(
kGreen+2);
110 auto info2 =
new TText(10.0, histo2->GetMaximum()*0.6, info1->GetTitle());
111 info2->SetTextColor(histo2->GetLineColor());
117 histo1->SetHighlight();
118 histo2->SetHighlight();
122 ntuple->
Draw(
"px:py", cut);
125 auto htemp = (
TH2F *)
gPad->FindObject(
"htemp");
126 gcommon->
SetTitle(htemp->GetTitle());
132 ntuple->
Draw(
"px:py:pz", cut,
"goff");
133 list1 = InitGraphs(ntuple, histo1,
true);
134 list2 = InitGraphs(ntuple, histo2,
false);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
virtual Color_t GetLineColor() const
Return the line color.
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.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
void Draw(Option_t *chopt="") override
Draw this graph with its current attributes.
TAxis * GetXaxis() const
Get x axis of the graph.
TAxis * GetYaxis() const
Get y axis of the graph.
TObject * FindObject(const char *name) const override
Search object named name in the list of functions.
void SetTitle(const char *title="") override
Change (i.e.
1-D histogram with a float per channel (see TH1 documentation)
virtual Int_t GetNbinsX() const
virtual Bool_t IsHighlight() const
virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0)
Return Global bin number corresponding to x,y,z.
2-D histogram with a float per channel (see TH1 documentation)
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
A simple TTree restricted to a list of float variables only.
Mother of all ROOT objects.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
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.
TObject * FindObject(const char *name) const override
Search if object named name is inside this pad or in pads inside this pad.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Base class for several text objects.
virtual Long64_t GetSelectedRows()
void Draw(Option_t *opt) override
Default Draw method for all objects.
virtual Double_t * GetV3()
virtual Double_t * GetV1()
virtual Double_t * GetV2()
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0