Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
tree140_spider.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_tree
3/// \notebook
4/// TSpider example.
5///
6/// \macro_code
7///
8/// \author Bastien Dallapiazza
9
10#include "TFile.h"
11#include "TCanvas.h"
12#include "TNtuple.h"
13#include "TSpider.h"
14
15void tree140_spider()
16{
17 auto c1 = new TCanvas("c1", "TSpider example", 200, 10, 700, 700);
18 auto f = TFile::Open("hsimple.root");
19 if (!f || f->IsZombie()) {
20 printf("Please run <ROOT location>/tutorials/hsimple.C before.");
21 return;
22 }
23 auto ntuple = f->Get<TNtuple>("ntuple");
24 TString varexp = "px:py:pz:random:sin(px):log(px/py):log(pz)";
25 TString selection = "px>0 && py>0 && pz>0";
26 TString options = "average";
27 auto spider = new TSpider(ntuple, varexp.Data(), selection.Data(), options.Data());
28 spider->Draw();
29 c1->ToggleEditor();
30 c1->Selected(c1, spider, 1);
31}
#define f(i)
Definition RSha256.hxx:104
The Canvas class.
Definition TCanvas.h:23
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:4086
A simple TTree restricted to a list of float variables only.
Definition TNtuple.h:28
Spider class.
Definition TSpider.h:40
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
return c1
Definition legend1.C:41