ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
spider.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_tree
3 /// TSpider example
4 /// \macro_code
5 ///
6 /// \author Bastien Dallapiazza
7 #include "TFile.h"
8 #include "TCanvas.h"
9 #include "TNtuple.h"
10 #include "TSpider.h"
11 
12 void spider() {
13  TCanvas *c1 = new TCanvas("c1","TSpider example",200,10,700,700);
14  TFile *f = new TFile("hsimple.root");
15  if (!f || f->IsZombie()) {
16  printf("Please run <ROOT location>/tutorials/hsimple.C before.");
17  return;
18  }
19  TNtuple* ntuple = (TNtuple*)f->Get("ntuple");
20  TString varexp = "px:py:pz:random:sin(px):log(px/py):log(pz)";
21  TString select = "px>0 && py>0 && pz>0";
22  TString options = "average";
23  TSpider *spider = new TSpider(ntuple,varexp.Data(),select.Data(),options.Data());
24  spider->Draw();
25  c1->ToggleEditor();
26  c1->Selected(c1,spider,1);
27 }
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
Definition: TCanvas.cxx:1503
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
Bool_t IsZombie() const
Definition: TObject.h:141
Basic string class.
Definition: TString.h:137
const char * Data() const
Definition: TString.h:349
A simple TTree restricted to a list of float variables only.
Definition: TNtuple.h:30
virtual void ToggleEditor()
Toggle editor.
Definition: TCanvas.cxx:2146
The Canvas class.
Definition: TCanvas.h:48
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual void Draw(Option_t *options="")
Draw the spider.
Definition: TSpider.cxx:453
Spider class.
Definition: TSpider.h:52