00001 #include "TFile.h"
00002 #include "TCanvas.h"
00003 #include "TNtuple.h"
00004 #include "TSpider.h"
00005
00006
00007
00008 void spider() {
00009 TCanvas *c1 = new TCanvas("c1","TSpider example",200,10,700,700);
00010 TFile *f = new TFile("$ROOTSYS/tutorials/hsimple.root");
00011 if (!f || f->IsZombie()) {
00012 printf("Please run <ROOT location>/tutorials/hsimple.C before.");
00013 return;
00014 }
00015 TNtuple* ntuple = (TNtuple*)f->Get("ntuple");
00016 TString varexp = "px:py:pz:random:sin(px):log(px/py):log(pz)";
00017 TString select = "px>0 && py>0 && pz>0";
00018 TString options = "average";
00019 TSpider *spider = new TSpider(ntuple,varexp.Data(),select.Data(),options.Data());
00020 spider->Draw();
00021 c1->ToggleEditor();
00022 c1->Selected(c1,spider,1);
00023 }