This tutorial demonstrates how the highlight mechanism can be used on a ntuple.
void hlHisto3()
{
auto dir =
gROOT->GetTutorialDir();
dir.Append("/hsimple.C");
dir.ReplaceAll("/./","/");
file->GetObject(
"ntuple", ntuple);
if (!ntuple) return;
const char *cut = "pz > 3.0";
TCanvas *Canvas2 =
new TCanvas(
"Canvas2",
"Canvas2", 705, 0, 500, 500);
ntuple->
Draw(
"pz>>histo1(100, 2.0, 12.0)", cut);
auto histo1 = (
TH1F *)
gPad->FindObject(
"histo1");
auto info1 =
new TText(7.0, histo1->GetMaximum()*0.6,
"please move the mouse over the frame");
info1->SetTextColor(histo1->GetLineColor());
info1->Draw();
ntuple->
Draw(
"(px*py*pz)>>histo2(100, -50.0, 50.0)", cut);
auto histo2 = (
TH1F *)
gPad->FindObject(
"histo2");
histo2->SetLineColor(
kGreen+2);
auto info2 =
new TText(10.0, histo2->GetMaximum()*0.6, info1->GetTitle());
info2->SetTextColor(histo2->GetLineColor());
info2->Draw();
histo1->SetHighlight();
histo2->SetHighlight();
ntuple->
Draw(
"px:py", cut);
auto gcommon = (
TGraph *)
gPad->FindObject(
"Graph");
auto htemp = (
TH2F *)
gPad->FindObject(
"htemp");
gcommon->SetTitle(htemp->GetTitle());
gcommon->GetXaxis()->SetTitle(htemp->GetXaxis()->GetTitle());
gcommon->GetYaxis()->SetTitle(htemp->GetYaxis()->GetTitle());
gcommon->Draw("AP");
ntuple->
Draw(
"px:py:pz", cut,
"goff");
histo1->SetUniqueID(1);
histo2->SetUniqueID(2);
InitGraphs(ntuple, histo1);
InitGraphs(ntuple, histo2);
}
{
else return;
for (bin = 0; bin < nbins; bin++) {
}
if (histo->
GetUniqueID() == 2) value = px[ie]*py[ie]*pz[ie];
g->SetPoint(
g->GetN(), py[ie], px[ie]);
}
}
{
auto histo = (
TH1F *)obj;
if(!histo) return;
if (!Canvas2) return;
if (!gcommon) return;
if (!list) return;
if (
g->GetN() > 0)
g->Draw(
"P");
}
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 a suite of consecutive data records (TKey instances) with a well defined format.
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
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)}
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
virtual const char * GetName() const
Returns name of object.
A simple TTree restricted to a list of float variables only.
Mother of all ROOT objects.
virtual UInt_t GetUniqueID() const
Return the unique object id.
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()
virtual Double_t * GetV3()
virtual Double_t * GetV1()
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
virtual Double_t * GetV2()
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual TVirtualPad * cd(Int_t subpadnumber=0)=0