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++) {
36 Double_t value = is_top ? pz[ie] : px[ie] * py[ie] * pz[ie];
38 auto g =
dynamic_cast<TGraph *
>(list->At(bin));
40 g->SetPoint(
g->GetN(), py[ie], px[ie]);
48 auto histo =
dynamic_cast<TH1F *
>(obj);
59 TList *list =
nullptr;
60 if (!strcmp(histo->
GetName(),
"histo1"))
62 else if (!strcmp(histo->
GetName(),
"histo2"))
82void hist045_Graphics_highlight_ntuple()
84 auto dir =
gROOT->GetTutorialDir();
85 dir.Append(
"/hsimple.C");
86 dir.ReplaceAll(
"/./",
"/");
89 auto file = (
TFile *)
gROOT->ProcessLineFast(
"hsimple(1)");
94 file->GetObject(
"ntuple", ntuple);
97 const char *cut =
"pz > 3.0";
99 TCanvas *Canvas1 =
new TCanvas(
"Canvas1",
"Canvas1", 0, 0, 700, 500);
103 TCanvas *Canvas2 =
new TCanvas(
"Canvas2",
"Canvas2", 705, 0, 500, 500);
107 ntuple->Draw(
"pz>>histo1(100, 2.0, 12.0)", cut);
108 auto histo1 = (
TH1F *)
gPad->FindObject(
"histo1");
109 auto info1 =
new TText(7.0, histo1->GetMaximum() * 0.6,
"please move the mouse over the frame");
110 info1->SetTextColor(histo1->GetLineColor());
116 ntuple->Draw(
"(px*py*pz)>>histo2(100, -50.0, 50.0)", cut);
117 auto histo2 = (
TH1F *)
gPad->FindObject(
"histo2");
118 histo2->SetLineColor(
kGreen + 2);
119 auto info2 =
new TText(10.0, histo2->GetMaximum() * 0.6, info1->GetTitle());
120 info2->SetTextColor(histo2->GetLineColor());
126 histo1->SetHighlight();
127 histo2->SetHighlight();
131 ntuple->Draw(
"px:py", cut);
132 auto gcommon = (
TGraph *)
gPad->FindObject(
"Graph");
134 auto htemp = (
TH2F *)
gPad->FindObject(
"htemp");
135 gcommon->
SetTitle(htemp->GetTitle());
141 ntuple->Draw(
"px:py:pz", cut,
"goff");
142 list1 = InitGraphs(ntuple, histo1,
true);
143 list2 = InitGraphs(ntuple, histo2,
false);
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
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 file, usually with extension .root, that stores data and code in the form of serialized objects in ...
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
void SetTitle(const char *title="") override
Set the title of the TNamed.
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 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.
virtual Long64_t GetSelectedRows()
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