Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TSpider.cxx
Go to the documentation of this file.
1// @(#)root/treeviewer:$Id: 2bb6def14de16b049d4c979e73ad2b08d0936520 $
2// Author: Bastien Dalla Piazza 20/07/07
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TSpider.h"
13#include "TAttFill.h"
14#include "TAttText.h"
15#include "TAttLine.h"
16#include "TGraphPolargram.h"
17#include "TPolyLine.h"
18#include "TNtuple.h"
19#include "TBranch.h"
20#include "TTreeFormula.h"
21#include "TTreeFormulaManager.h"
22#include "TList.h"
23#include "TSelectorDraw.h"
24#include "TROOT.h"
25#include "TEntryList.h"
26#include "TLatex.h"
27#include "TVirtualPad.h"
28#include "TMath.h"
29#include "TCanvas.h"
30#include "TArc.h"
31#include <cfloat>
32#include "TEnv.h"
33
34
35/** \class TSpider
36Spider class.
37
38A spider view is a handy way to visualize a set of data stored in a TTree.
39It draws as many polar axes as selected data members. For each of them, it draws
40on the axis the position of the present event between the min and max of the
41data member. Two modes are available:
42
43 - The spider view: With each points on the axes is drawn a polyline.
44 - The segment view: For each data member is drawn an arc segment with the
45 radius corresponding to the event.
46
47The spider plot is available from the treeviewer called by
48"atree->StartViewer()", or simply by calling its constructor and defining the
49variables to display.
50
51Begin_Macro(source)
52{
53 TCanvas *c1 = new TCanvas("c1","TSpider example",200,10,700,700);
54 TFile *f = new TFile("$(ROOTSYS)/tutorials/hsimple.root");
55 if (!f || f->IsZombie()) {
56 printf("Please run <ROOT location>/tutorials/hsimple.C before.");
57 return;
58 }
59 TNtuple* ntuple = (TNtuple*)f->Get("ntuple");
60 TString varexp = "px:py:pz:random:sin(px):log(px/py):log(pz)";
61 TString selectStr = "px>0 && py>0 && pz>0";
62 TString options = "average";
63 TSpider *spider = new TSpider(ntuple,varexp.Data(),selectStr.Data(),options.Data());
64 spider->Draw();
65 c1->ToggleEditor();
66 c1->Selected(c1,spider,1);
67 return c1;
68}
69End_Macro
70*/
71
72////////////////////////////////////////////////////////////////////////////////
73/// Default constructor.
74
76{
77 fDisplayAverage=false;
78 fForceDim=false;
79 fPolargram=nullptr;
80 fInput=nullptr;
81 fManager=nullptr;
82 fNcols=0;
83 fNx=3;
84 fNy=4;
85 fPolyList=nullptr;
86 fSelect=nullptr;
87 fSelector=nullptr;
88 fTree=nullptr;
89 fMax=nullptr;
90 fMin=nullptr;
91 fAve=nullptr;
92 fCanvas=nullptr;
93 fAveragePoly=nullptr;
94 fEntry=0;
95 fSuperposed=nullptr;
96 fShowRange=false;
97 fAngularLabels=false;
98 fAverageSlices=nullptr;
99 fSegmentDisplay=false;
100 fNentries=0;
101 fFirstEntry=0;
102 fArraySize=0;
103 fCurrentEntries = nullptr;
104 fFormulas = nullptr;
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Normal constructor. Options are:
109/// - "average"
110/// - "showrange"
111/// - "segment"
112
113TSpider::TSpider(TTree* tree ,const char *varexp, const char *selection,
115 : TAttFill(2,3003), TAttLine(1,1,1)
116{
117 UInt_t ui=0;
118
119 fArraySize = 16;
120 fTree=tree;
122 fFormulas= new TList();
123 fInput= new TList();
124 fInput->Add(new TNamed("varexp",""));
125 fInput->Add(new TNamed("selection",""));
127 gROOT->GetListOfCleanups()->Add(this);
128 fNx=2;
129 fNy=2;
130 fDisplayAverage=false;
131 fSelect=nullptr;
132 fManager=nullptr;
133 fCanvas=nullptr;
134 fAveragePoly=nullptr;
136 fSuperposed=nullptr;
137 fShowRange=false;
138 fAngularLabels=true;
139 fForceDim=false;
140 fAverageSlices=nullptr;
141 fSegmentDisplay=false;
144 if (nentries>0) fNentries = nentries;
145 else fNentries = nentries = tree->GetEstimate()-firstentry;
146
148
149 fPolargram=nullptr;
150 fPolyList=nullptr;
151
154 for(ui=0;ui<fNx*fNy;++ui) fCurrentEntries[ui]=0;
155
156 TString opt = option;
157
158 if (opt.Contains("average")) fDisplayAverage=true;
159 if (opt.Contains("showrange")) fShowRange=true;
160 if (opt.Contains("segment")) fSegmentDisplay=true;
161
162 fNcols=8;
163
166 SyncFormulas();
168}
169
170////////////////////////////////////////////////////////////////////////////////
171/// Destructor.
172
174{
175 delete [] fCurrentEntries;
176 if(fPolyList){
177 fPolyList->Delete();
178 delete fPolyList;
179 }
181 delete [] fAverageSlices;
182 if(fFormulas){
183 fFormulas->Delete();
184 delete fFormulas;
185 }
186 if(fSelect) delete fSelect;
187 if(fSelector) delete fSelector;
188 if(fInput){
189 fInput->Delete();
190 delete fInput;
191 }
192 if(fMax) delete [] fMax;
193 if(fMin) delete [] fMin;
194 if(fAve) delete [] fAve;
195 if(fSuperposed){
197 delete fSuperposed;
198 }
199 if (fCanvas) fCanvas->cd(0);
200}
201
202////////////////////////////////////////////////////////////////////////////////
203/// Allow to superpose several spider views.
204
210
211////////////////////////////////////////////////////////////////////////////////
212/// Add a variable to the plot from its expression.
213
215{
216 if(!varexp[0]) return;
218 if(fvar->GetNdim() <= 0) return;
219
221
222 InitArrays(fNcols + 1);
223 ++fNcols;
224 SyncFormulas();
225
226 UInt_t ui=0;
228 Int_t tnumber=-1;
232 while(entriesToDisplay!=0){
234 if(entryNumber < 0) break;
236 if(localEntry < 0) break;
237 if(tnumber != fTree->GetTreeNumber()) {
240 else {
241 for(Int_t i=0;i<=fFormulas->LastIndex();++i)
242 ((TTreeFormula*)fFormulas->At(i))->UpdateFormulaLeaves();
243 }
244 }
245 Int_t ndata=1;
246 if(fForceDim){
247 if(fManager)
248 ndata = fManager->GetNdata(true);
249 else {
250 for(ui=0;ui<fNcols;++ui){
251 if(ndata<((TTreeFormula*)fFormulas->At(ui))->GetNdata())
252 ndata = ((TTreeFormula*)fFormulas->At(ui))->GetNdata();
253 }
254 if(fSelect && fSelect->GetNdata() == 0)
255 ndata = 0;
256 }
257 }
258
259 bool loaded = false;
260 bool skip = false;
261 // Loop over the instances of the selection condition
262 for(Int_t inst=0;inst<ndata;++inst){
263 if(fSelect){
264 if(fSelect->EvalInstance(inst) == 0){
265 skip = true;
266 ++entry;
267 }
268 }
269 if (!loaded) {
270 // EvalInstance(0) always needs to be called so that
271 // the proper branches are loaded.
272 ((TTreeFormula*)fFormulas->At(fNcols-1))->EvalInstance(0);
273 loaded = true;
274 } else if (inst == 0) {
275 loaded = true;
276 }
277 }
278 if(!skip){
281 if(var->EvalInstance()>fMax[fNcols-1]) fMax[fNcols-1]=var->EvalInstance();
282 if(var->EvalInstance()<fMin[fNcols-1]) fMin[fNcols-1]=var->EvalInstance();
283 fAve[fNcols-1]+=var->EvalInstance();
284 ++notSkipped;
286 ++entry;
287 }
288 }
290
291 Color_t lc;
292 Style_t lt;
293 Width_t lw;
294 Color_t fc;
295 Style_t fs;
296
297 if(fAverageSlices){
303 } else {
309 }
310
311 delete fPolargram;
312 fPolargram = nullptr;
313
314 if(fSegmentDisplay){
315 for(ui=0;ui<fNx*fNy;++ui) ((TList*)fPolyList->At(ui))->Delete();
316 if (fAverageSlices) for(ui=0;ui<fNcols-1;++ui) delete fAverageSlices[ui];
317 }
318 fPolyList->Delete();
319 delete fPolyList;
320 fPolyList = nullptr;
321 delete [] fAverageSlices;
322 fAverageSlices = nullptr;
323 delete fAveragePoly;
324 fAveragePoly = nullptr;
325
326 if (fCanvas) {
327 fCanvas->Clear();
329 }
330 Draw("");
331
332 if(fAverageSlices){
333 for(ui = 0;ui<fNcols;++ui){
339 }
340 } else {
346 }
347}
348
349////////////////////////////////////////////////////////////////////////////////
350/// Delete a variable from its expression.
351
353{
354 Int_t var=-1;
355 UInt_t ui=0;
356
357 if(fNcols == 2) return;
358 for(ui=0; ui<fNcols;++ui){
359 if(!strcmp(varexp,((TTreeFormula*)fFormulas->At(ui))->GetTitle())) var = ui;
360 }
361 if(var<0) return;
362
364 SyncFormulas();
365
366 for(ui=var+1;ui<fNcols;++ui){
367 fMin[ui-1] = fMin[ui];
368 fMax[ui-1] = fMax[ui];
369 fAve[ui-1] = fAve[ui];
370 }
371 fMin[fNcols-1] = DBL_MAX;
372 fMax[fNcols-1] = -DBL_MAX;
373 fAve[fNcols-1] = 0;
374 --fNcols;
375
376 Color_t lc;
377 Style_t lt;
378 Width_t lw;
379 Color_t fc;
380 Style_t fs;
381
382 if(fAverageSlices){
388 } else {
394 }
395
396 delete fPolargram;
397 fPolargram = nullptr;
398
399 if(fSegmentDisplay){
400 for(ui=0;ui<fNx*fNy;++ui) ((TList*)fPolyList->At(ui))->Delete();
401 if (fAverageSlices) for(ui=0;ui<=fNcols;++ui) delete fAverageSlices[ui];
402 }
403 fPolyList->Delete();
404 delete fPolyList;
405 fPolyList = nullptr;
406 delete [] fAverageSlices;
407 fAverageSlices = nullptr;
408 delete fAveragePoly;
409 fAveragePoly = nullptr;
410
411 if (fCanvas) {
412 fCanvas->Clear();
414 }
415 Draw("");
416 if(fNcols == 2) SetSegmentDisplay(true);
417
418 if(fAverageSlices){
419 for(ui = 0;ui<fNcols;++ui){
425 }
426 } else {
432 }
433}
434
435////////////////////////////////////////////////////////////////////////////////
436/// Compute the distance to the spider.
437
439{
440 if(!gPad) return 9999;
442 xx=gPad->AbsPixeltoX(px);
443 yy=gPad->AbsPixeltoY(py);
444 r2 = xx*xx + yy*yy;
445 if(r2>1 && r2<1.5)
446 return 0;
447 else return 9999;
448}
449
450////////////////////////////////////////////////////////////////////////////////
451/// Draw the spider.
452
454{
455 UInt_t ui=0;
456
457 gEnv->SetValue("Canvas.ShowEditor",1);
458 if(!gPad && !fCanvas){
459 fCanvas = new TCanvas("screen","Spider Plot",fNx*256,fNy*256);
461 } else if(!fCanvas){
462 fCanvas = (TCanvas*)gPad;
464 }
465 if(fPolargram) delete fPolargram;
466 fPolargram=new TGraphPolargram("fPolargram");
469 if (fCanvas) fCanvas->cd();
471 AppendPad(options);
472 for(ui=0;ui<fNx*fNy;++ui){
473 if (fCanvas) fCanvas->cd(ui+1);
474 fPolargram->Draw("pn");
476 if(fSegmentDisplay){
478 DrawSlices("");
479 } else {
481 DrawPoly("");
482 }
483 AppendPad();
484 }
485 if (fCanvas) fCanvas->Selected(fCanvas,this,1);
486}
487
488////////////////////////////////////////////////////////////////////////////////
489/// Paint the Polygon representing the average value of the variables.
490
492{
498
499 UInt_t ui=0;
500 Double_t slice = 2*TMath::Pi()/fNcols;
501 Double_t *x = new Double_t[fNcols+1];
502 Double_t *y = new Double_t[fNcols+1];
503
504 for(ui=0;ui<fNcols;++ui){
505 x[ui]=(fAve[ui]-fMin[ui])/(fMax[ui]-fMin[ui])*TMath::Cos(ui*slice);
506 y[ui]=(fAve[ui]-fMin[ui])/(fMax[ui]-fMin[ui])*TMath::Sin(ui*slice);
507 }
508 x[fNcols]=(fAve[0]-fMin[0])/(fMax[0]-fMin[0]);
509 y[fNcols]=0;
510
511 if(!fAveragePoly){
518 }
520 fAveragePoly->Draw("f");
521
522 delete [] x;
523 delete [] y;
524}
525
526////////////////////////////////////////////////////////////////////////////////
527/// Paint the polygon representing the current entry.
528
529void TSpider::DrawPoly(Option_t* /*options*/)
530{
531 if(!fPolyList) fPolyList = new TList();
532 Double_t *x = new Double_t[fNcols+1];
533 Double_t *y = new Double_t[fNcols+1];
534
535 Double_t slice = 2*TMath::Pi()/fNcols;
536 for(UInt_t i=0;i<fNcols;++i){
537 x[i]=(((TTreeFormula*)fFormulas->At(i))->EvalInstance()-fMin[i])/(fMax[i]-fMin[i])*TMath::Cos(i*slice);
538 y[i]=(((TTreeFormula*)fFormulas->At(i))->EvalInstance()-fMin[i])/(fMax[i]-fMin[i])*TMath::Sin(i*slice);
539 }
540 x[fNcols]=(((TTreeFormula*)fFormulas->At(0))->EvalInstance()-fMin[0])/(fMax[0]-fMin[0]);
541 y[fNcols]=0;
542
543 TPolyLine* poly= new TPolyLine(fNcols+1,x,y);
544 poly->SetFillColor(GetFillColor());
545 poly->SetFillStyle(GetFillStyle());
546 poly->SetLineWidth(GetLineWidth());
547 poly->SetLineColor(GetLineColor());
548 poly->SetLineStyle(GetLineStyle());
549 poly->Draw("f");
550 poly->Draw();
552 delete [] x;
553 delete [] y;
554}
555
556////////////////////////////////////////////////////////////////////////////////
557/// Draw the slices of the segment plot.
558
560{
561 UInt_t ui=0;
562
564 Double_t conv = 180.0/TMath::Pi();
565
566 if(!fPolyList) fPolyList = new TList;
567 TList* li = new TList();
568 for(ui=0;ui<fNcols;++ui){
569 Double_t r = (((TTreeFormula*)fFormulas->At(ui))->EvalInstance()-fMin[ui])/(fMax[ui]-fMin[ui]);
570 TArc* slice = new TArc(0,0,r,(ui-0.25)*angle*conv,(ui+0.25)*angle*conv);
571 slice->SetFillColor(GetFillColor());
572 slice->SetFillStyle(GetFillStyle());
573 slice->SetLineWidth(GetLineWidth());
574 slice->SetLineColor(GetLineColor());
575 slice->SetLineStyle(GetLineStyle());
576 li->Add(slice);
577 slice->Draw(options);
578 }
579 fPolyList->Add(li);
580}
581
582////////////////////////////////////////////////////////////////////////////////
583/// Draw the slices representing the average for the segment plot.
584
586{
587 UInt_t ui=0;
588
589 Int_t fillstyle=3002;
594
596 Double_t conv = 180.0/TMath::Pi();
597
598 if(!fAverageSlices){
599 fAverageSlices = new TArc*[fNcols];
600 for(ui=0;ui<fNcols;++ui){
601 Double_t r = (fAve[ui]-fMin[ui])/(fMax[ui]-fMin[ui]);
602 fAverageSlices[ui] = new TArc(0,0,r,(ui-0.5)*angle*conv,(ui+0.5)*angle*conv);
608 }
609 }
610 for(ui=0;ui<fNcols;++ui) fAverageSlices[ui]->Draw();
611}
612
613////////////////////////////////////////////////////////////////////////////////
614/// Get the LineStyle of the average.
615
617{
619 else if(fAveragePoly) return fAveragePoly->GetLineStyle();
620 else return 0;
621}
622
623////////////////////////////////////////////////////////////////////////////////
624/// Get the LineColor of the average.
625
627{
629 else if(fAveragePoly) return fAveragePoly->GetLineColor();
630 else return 0;
631}
632
633////////////////////////////////////////////////////////////////////////////////
634/// Get the LineWidth of the average.
635
637{
639 else if(fAveragePoly) return fAveragePoly->GetLineWidth();
640 else return 0;
641}
642
643////////////////////////////////////////////////////////////////////////////////
644/// Get the Fill Color of the average.
645
647{
649 else if(fAveragePoly) return fAveragePoly->GetFillColor();
650 else return 0;
651}
652
653////////////////////////////////////////////////////////////////////////////////
654/// Get the FillStyle of the average.
655
657{
659 else if(fAveragePoly) return fAveragePoly->GetFillStyle();
660 else return 0;
661}
662
663////////////////////////////////////////////////////////////////////////////////
664/// Execute the corresponding event.
665
666void TSpider::ExecuteEvent(Int_t /*event*/,Int_t /*px*/, Int_t /*py*/)
667{
668 if (!gPad) return;
669 gPad->SetCursor(kHand);
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// Find the alignement rule to apply for TText::SetTextAlign(Short_t).
674
676{
677 Double_t pi = TMath::Pi();
678
679 while(angle < 0 || angle > 2*pi){
680 if(angle < 0) angle+=2*pi;
681 if(angle > 2*pi) angle-=2*pi;
682 }
683 if(!fAngularLabels){
684 if(angle > 0 && angle < pi/2) return 11;
685 else if(angle > pi/2 && angle < pi) return 31;
686 else if(angle > pi && angle < 3*pi/2) return 33;
687 else if(angle > 3*pi/2 && angle < 2*pi) return 13;
688 else if(angle == 0 || angle == 2*pi) return 12;
689 else if(angle == pi/2) return 21;
690 else if(angle == pi) return 32;
691 else if(angle == 3*pi/2) return 23;
692 else return 0;
693 }
694 else{
695 if(angle >= 0 && angle < pi) return 21;
696 else if(angle >=pi && angle <= 2*pi) return 23;
697 else return 0;
698 }
699}
700
701////////////////////////////////////////////////////////////////////////////////
702/// Determine the orientation of the polar labels according to their angle.
703
705{
706 Double_t pi = TMath::Pi();
707 Double_t convraddeg = 180.0/pi;
708
709 while(angle < 0 || angle > 2*pi){
710 if(angle < 0) angle+=2*pi;
711 if(angle > 2*pi) angle-=2*pi;
712 }
713
714 if(angle >= 0 && angle <= pi/2) return angle*convraddeg - 90;
715 else if(angle > pi/2 && angle <= pi) return (angle + pi)*convraddeg + 90;
716 else if(angle > pi && angle <= 3*pi/2) return (angle - pi)*convraddeg - 90;
717 else if(angle > 3*pi/2 && angle <= 2*pi) return angle*convraddeg + 90;
718 else return 0;
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// return the number of entries to be processed
723/// this function checks that nentries is not bigger than the number
724/// of entries in the Tree or in the associated TEventlist
725
727{
729 if (lastentry > fTree->GetEntriesFriend()-1) {
732 }
733 TEntryList *elist = fTree->GetEntryList();
734 if (elist && elist->GetN() < nentries) nentries = elist->GetN();
735 return nentries;
736}
737
738////////////////////////////////////////////////////////////////////////////////
739/// Go to a specified entry.
740
742{
743 if(e<fFirstEntry || e+fTree->GetScanField()>=fFirstEntry + fNentries) return;
744 fEntry = e;
746}
747
748////////////////////////////////////////////////////////////////////////////////
749/// Go to the next entries.
750
757
758////////////////////////////////////////////////////////////////////////////////
759/// Go to the previous entries.
760
767
768////////////////////////////////////////////////////////////////////////////////
769/// Go to the next entry.
770
772{
773 if(fEntry + fTree->GetScanField() >= fFirstEntry + fNentries) return;
774 ++fEntry;
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// Go to the last entry.
780
782{
783 if(fEntry - 1 < fFirstEntry) return;
784 --fEntry;
786}
787
788////////////////////////////////////////////////////////////////////////////////
789/// Check if the arrays size is enough and reallocate them if not.
790
792{
794
795 Int_t i;
796 Int_t old = fArraySize;
797
798 while(fArraySize<newsize) fArraySize*=2;
799
803
804 for(i=0;i<fArraySize;++i){
805 if(i<old){
806 memmax[i] = fMax[i];
807 memmin[i] = fMin[i];
808 memave[i] = fAve[i];
809 } else {
810 memmax[i] = -DBL_MAX;
811 memmin[i] = DBL_MAX;
812 memave[i] = 0;
813 }
814 }
815
816 delete [] fMax;
817 delete [] fMin;
818 delete [] fAve;
819
820 fMax = memmax;
821 fMin = memmin;
822 fAve = memave;
823 }
824}
825
826////////////////////////////////////////////////////////////////////////////////
827/// Browse the tree to set the min, max and average value of each variable of fVar.
828
830{
831 UInt_t ui=0;
832 Int_t i;
833
834 fMax = new Double_t [fArraySize];
835 fMin= new Double_t [fArraySize];
836 fAve= new Double_t [fArraySize];
837
838 for(i=0;i<fArraySize;++i){
839 fMax[i]= -DBL_MAX;
840 fMin[i]= DBL_MAX;
841 fAve[i]=0;
842 }
843
845 Int_t tnumber=-1;
849 while(entriesToDisplay!=0){
851 if(entryNumber < 0) break;
853 if(localEntry < 0) break;
854 if(tnumber != fTree->GetTreeNumber()) {
857 else {
858 for(i=0;i<=fFormulas->LastIndex();++i)
859 ((TTreeFormula*)fFormulas->At(i))->UpdateFormulaLeaves();
860 }
861 }
862 Int_t ndata=1;
863 if(fForceDim){
864 if(fManager)
865 ndata = fManager->GetNdata(true);
866 else {
867 for(ui=0;ui<fNcols;++ui){
868 if(ndata<((TTreeFormula*)fFormulas->At(ui))->GetNdata())
869 ndata = ((TTreeFormula*)fFormulas->At(ui))->GetNdata();
870 }
871 if(fSelect && fSelect->GetNdata() == 0)
872 ndata = 0;
873 }
874 }
875 bool loaded = false;
876 bool skip = false;
877 // Loop over the instances of the selection condition
878 for(Int_t inst=0;inst<ndata;++inst){
879 if(fSelect){
880 if(fSelect->EvalInstance(inst) == 0){
881 skip = true;
882 ++entry;
883 }
884 }
885 if (!loaded) {
886 // EvalInstance(0) always needs to be called so that
887 // the proper branches are loaded.
888 for (ui=0;ui<fNcols;ui++) {
889 ((TTreeFormula*)fFormulas->At(ui))->EvalInstance(0);
890 }
891 loaded = true;
892 } else if (inst == 0) {
893 loaded = true;
894 }
895 }
896 if(!skip){
898 for(ui=0;ui<fNcols;++ui){
899 Double_t inst = ((TTreeFormula*)fFormulas->At(ui))->EvalInstance();
900 if(inst > fMax[ui]) fMax[ui] = inst;
901 if(inst < fMin[ui]) fMin[ui] = inst;
902 fAve[ui] += inst;
903 }
904 ++notSkipped;
906 ++entry;
907 }
908 }
909 if (notSkipped) {for(ui=0;ui<fNcols;++ui) fAve[ui]/=notSkipped;}
910}
911
912////////////////////////////////////////////////////////////////////////////////
913/// Paint the spider.
914
916{
917 UInt_t ui=0;
918 TString opt = options;
919
920 if(opt.Contains("n")) return;
921
922 Double_t slice = 2*TMath::Pi()/fNcols;
923 Double_t offset(1.0);
924 if (!fCanvas) {
925 if (gPad) fCanvas = gPad->GetCanvas();
926 else return;
927 }
928
929 TLatex *txt = new TLatex();
930 for(ui=0;ui<fNx*fNy;++ui){
931 txt->SetTextAlign(13);
932 if (fCanvas) fCanvas->cd(ui+1);
933 if (fCurrentEntries) {
934 txt->PaintLatex(-1.2,1.2,0,0.08,Form("#%d",(int)fCurrentEntries[ui]));
935 }
936 txt->SetTextSize(0.035);
937 for(UInt_t var=0;var<fNcols;++var){ // Print labels.
938 if(ui==0){
939 txt->SetTextAlign(FindTextAlign(var*slice));
940 offset = 1.09 + txt->GetTextSize();
941 txt->PaintLatex(offset*TMath::Cos(var*slice),offset*TMath::Sin(var*slice),
942 FindTextAngle(var*slice),0.035,fFormulas->At(var)->GetTitle());
943 offset= 1.03;
944 txt->PaintLatex(offset*TMath::Cos(var*slice),offset*TMath::Sin(var*slice),
945 FindTextAngle(var*slice),0.035,Form("[%5.3f,%5.3f]",fMin[var],fMax[var]));
946 }
947 else {
948 txt->SetTextAlign(FindTextAlign(var*slice));
949 if(var*slice >=0 && var*slice <= TMath::Pi()) offset =1.13 + txt->GetTextSize();
950 else offset = 1.09 + txt->GetTextSize();
951 txt->PaintLatex(offset*TMath::Cos(var*slice),offset*TMath::Sin(var*slice),
952 FindTextAngle(var*slice),0.035,fFormulas->At(var)->GetTitle());
953 }
954 }
955 }
956 delete txt;
957}
958
959////////////////////////////////////////////////////////////////////////////////
960/// Set the LineStyle of the average.
961
970
971////////////////////////////////////////////////////////////////////////////////
972/// Set the LineColor of the average.
973
975{
976 UInt_t ui=0;
977
978 if(fAverageSlices){
979 for(ui=0;ui<fNcols;++ui) fAverageSlices[ui]->SetLineColor(col);
980 } else if(fAveragePoly) fAveragePoly->SetLineColor(col);
981}
982
983////////////////////////////////////////////////////////////////////////////////
984/// Set the LineWidth of the average.
985
994
995////////////////////////////////////////////////////////////////////////////////
996/// Set the Fill Color of the average.
997
999{
1000 UInt_t ui=0;
1001
1002 if(fAverageSlices){
1003 for(ui=0;ui<fNcols;++ui) fAverageSlices[ui]->SetFillColor(col);
1004 } else if(fAveragePoly) fAveragePoly->SetFillColor(col);
1005}
1006
1007////////////////////////////////////////////////////////////////////////////////
1008/// Set the FillStyle of the average.
1009
1018
1019////////////////////////////////////////////////////////////////////////////////
1020/// Display or not the average.
1021
1023{
1024 if(disp == fDisplayAverage) return;
1025
1026 UInt_t ui=0;
1027
1029 delete fAveragePoly;
1030 fAveragePoly = nullptr;
1031 if(fAverageSlices){
1032 for(ui = 0;ui<fNcols;++ui) delete fAverageSlices[ui];
1033 }
1034 delete [] fAverageSlices;
1035 fAverageSlices = nullptr;
1036
1037 for(ui=0;ui<fNx*fNy;++ui){
1038 if (fCanvas) fCanvas->cd(ui+1);
1039 gPad->Clear();
1040 }
1041
1042 for(ui = 0; ui < fNx*fNy; ++ui){
1043 if (fCanvas) fCanvas->cd(ui+1);
1044 fPolargram->Draw("pn");
1046 if(fSegmentDisplay){
1047 if(disp) DrawSlicesAverage("");
1048 DrawSlices("");
1049 } else {
1050 if(disp) DrawPolyAverage("");
1051 DrawPoly("");
1052 }
1053 AppendPad();
1054 }
1055 if (fCanvas) {
1056 fCanvas->Modified();
1057 fCanvas->Update();
1058 }
1059}
1060
1061////////////////////////////////////////////////////////////////////////////////
1062/// Set the current selected entries.
1063
1065{
1066 Int_t i;
1067 UInt_t ui=0;
1068 Int_t tnumber=-1;
1072
1074
1075 while(entriesToDisplay!=0){
1077 if(entryNumber < 0) break;
1079 if(localEntry < 0) break;
1080 if(tnumber != fTree->GetTreeNumber()) {
1083 else {
1084 for(i=0;i<=fFormulas->LastIndex();++i)
1085 ((TTreeFormula*)fFormulas->At(i))->UpdateFormulaLeaves();
1086 }
1087 }
1088 Int_t ndata=1;
1089 if(fForceDim){
1090 if(fManager)
1091 ndata = fManager->GetNdata(true);
1092 else {
1093 for(ui=0;ui<fNcols;++ui){
1094 if(ndata < ((TTreeFormula*)fFormulas->At(ui))->GetNdata())
1095 ndata = ((TTreeFormula*)fFormulas->At(ui))->GetNdata();
1096 }
1097 if(fSelect && fSelect->GetNdata() == 0)
1098 ndata = 0;
1099 }
1100 }
1101 bool loaded = false;
1102 bool skip = false;
1103 // Loop over the instances of the selection condition
1104 for(Int_t inst=0;inst<ndata;++inst){
1105 if(fSelect){
1106 if(fSelect->EvalInstance(inst) == 0){
1107 skip = true;
1108 ++entry;
1109 }
1110 }
1111 if (!loaded) {
1112 // EvalInstance(0) always needs to be called so that
1113 // the proper branches are loaded.
1114 for (ui=0;ui<fNcols;ui++) {
1115 ((TTreeFormula*)fFormulas->At(ui))->EvalInstance(0);
1116 }
1117 loaded = true;
1118 } else if (inst == 0) {
1119 loaded = true;
1120 }
1121 }
1122 if(!skip){
1125 ++entry;
1126 }
1127 }
1128 if(fPolyList) UpdateView();
1129}
1130
1131////////////////////////////////////////////////////////////////////////////////
1132/// Set line style.
1133
1135{
1136 UInt_t ui=0;
1137
1139 for(ui=0; ui<fNx*fNy;++ui){
1140 if(fSegmentDisplay){
1141 TList *li = (TList*)fPolyList->At(ui);
1142 for(UInt_t var=0;var<fNcols;++var) ((TArc*)li->At(var))->SetLineStyle(sty);
1143 } else ((TPolyLine*)fPolyList->At(ui))->SetLineStyle(sty);
1144 }
1145}
1146
1147////////////////////////////////////////////////////////////////////////////////
1148/// Set lin color.
1149
1151{
1152 UInt_t ui=0;
1153
1155 for(ui=0; ui<fNx*fNy;++ui){
1156 if(fSegmentDisplay){
1157 TList *li = (TList*)fPolyList->At(ui);
1158 for(UInt_t var=0;var<fNcols;++var) ((TArc*)li->At(var))->SetLineColor(col);
1159 } else ((TPolyLine*)fPolyList->At(ui))->SetLineColor(col);
1160 }
1161}
1162
1163////////////////////////////////////////////////////////////////////////////////
1164///Set line width.
1165
1167{
1168 UInt_t ui=0;
1169
1171 for(ui=0; ui<fNx*fNy;++ui){
1172 if(fSegmentDisplay){
1173 TList *li = (TList*)fPolyList->At(ui);
1174 for(UInt_t var=0;var<fNcols;++var) ((TArc*)li->At(var))->SetLineWidth(wid);
1175 } else ((TPolyLine*)fPolyList->At(ui))->SetLineWidth(wid);
1176 }
1177}
1178
1179////////////////////////////////////////////////////////////////////////////////
1180/// Set fill color.
1181
1183{
1184 UInt_t ui=0;
1185
1187 for(ui=0; ui<fNx*fNy;++ui){
1188 if(fSegmentDisplay){
1189 TList *li = (TList*)fPolyList->At(ui);
1190 for(UInt_t var=0;var<fNcols;++var) ((TArc*)li->At(var))->SetFillColor(col);
1191 } else ((TPolyLine*)fPolyList->At(ui))->SetFillColor(col);
1192 }
1193}
1194
1195////////////////////////////////////////////////////////////////////////////////
1196/// Set fill style.
1197
1199{
1200 UInt_t ui=0;
1201
1203 for(ui=0; ui<fNx*fNy;++ui){
1204 if(fSegmentDisplay){
1205 TList *li = (TList*)fPolyList->At(ui);
1206 for(UInt_t var=0;var<fNcols;++var) ((TArc*)li->At(var))->SetFillStyle(sty);
1207 } else ((TPolyLine*)fPolyList->At(ui))->SetFillStyle(sty);
1208 }
1209}
1210
1211////////////////////////////////////////////////////////////////////////////////
1212/// Set number of radial divisions.
1213
1215{
1216 if(fPolargram->GetNdivRadial() == ndiv) return;
1218}
1219
1220////////////////////////////////////////////////////////////////////////////////
1221/// Set the X number of sub pads.
1222
1224{
1225 if(fNx == nx || nx <= 0) return;
1227
1228 UInt_t ui=0;
1229 Color_t lc;
1230 Style_t lt;
1231 Width_t lw;
1232 Color_t fc;
1233 Style_t fs;
1234 if(fAverageSlices){
1240 } else {
1246 }
1247
1248 if(fSegmentDisplay){
1249 for(ui=0; ui<fNx*fNy;++ui) ((TList*)fPolyList->At(ui))->Delete();
1250 }
1251 fPolyList->Delete();
1252 delete fPolyList;
1253 fPolyList = nullptr;
1254 delete [] fCurrentEntries;
1255 fCurrentEntries = nullptr;
1256
1257 fNx = nx;
1258
1261 if (fCanvas) {
1262 fCanvas->Clear();
1264 }
1265
1266 for(ui=0; ui < fNx*fNy;++ui){
1267 if (fCanvas) fCanvas->cd(ui+1);
1268 fPolargram->Draw("pn");
1270 if(fSegmentDisplay){
1272 DrawSlices("");
1273 } else {
1275 DrawPoly("");
1276 }
1277 AppendPad();
1278 }
1279
1280 if(fAverageSlices){
1281 for(ui = 0;ui<fNcols;++ui){
1287 }
1288 } else {
1294 }
1295}
1296
1297////////////////////////////////////////////////////////////////////////////////
1298/// Set the Y number of sub pads.
1299
1301{
1302 if(fNy == ny || ny <= 0) return;
1304
1305 UInt_t ui=0;
1306 Color_t lc;
1307 Style_t lt;
1308 Width_t lw;
1309 Color_t fc;
1310 Style_t fs;
1311 if(fAverageSlices){
1317 } else {
1323 }
1324
1325 if(fSegmentDisplay){
1326 for(ui=0; ui<fNx*fNy;++ui) ((TList*)fPolyList->At(ui))->Delete();
1327 }
1328 fPolyList->Delete();
1329 delete fPolyList;
1330 fPolyList = nullptr;
1331 delete [] fCurrentEntries;
1332 fCurrentEntries = nullptr;
1333
1334 fNy = ny;
1335
1338 if (fCanvas) {
1339 fCanvas->Clear();
1341 }
1342
1343 for(ui=0; ui < fNx*fNy;++ui){
1344 if (fCanvas) fCanvas->cd(ui+1);
1345 fPolargram->Draw("pn");
1347 if(fSegmentDisplay){
1349 DrawSlices("");
1350 } else {
1352 DrawPoly("");
1353 }
1354 AppendPad();
1355 }
1356
1357 if(fAverageSlices){
1358 for(ui = 0;ui<fNcols;++ui){
1364 }
1365 } else {
1371 }
1372}
1373
1374////////////////////////////////////////////////////////////////////////////////
1375/// Set the segment display or not.
1376
1378{
1379 if(seg == fSegmentDisplay) return;
1380
1381 UInt_t ui=0;
1382
1383 if(fSegmentDisplay){
1384 for(ui=0;ui<fNx*fNy;++ui){
1385 ((TList*)fPolyList->At(ui))->Delete();
1386 }
1387 }
1388 fPolyList->Delete();
1389
1390 Color_t lc = 1;
1391 Style_t lt = 1;
1392 Width_t lw = 1;
1393 Color_t fc = 1;
1394 Style_t fs = 0;
1395 if(fAverageSlices){
1401 } else {
1402 if (fAveragePoly) {
1408 }
1409 }
1410
1411 delete fPolyList;
1412 fPolyList = nullptr;
1413 if(fAverageSlices){
1414 for(ui=0;ui<fNcols;++ui) delete fAverageSlices[ui];
1415 }
1416 delete [] fAverageSlices;
1417 fAverageSlices = nullptr;
1418 delete fAveragePoly;
1419 fAveragePoly = nullptr;
1420
1421 for(ui=0;ui<fNx*fNy;++ui){
1422 if (fCanvas) fCanvas->cd(ui+1);
1423 gPad->Clear();
1424 }
1425
1427
1428 for(ui=0; ui < fNx*fNy;++ui){
1429 if (fCanvas) fCanvas->cd(ui+1);
1430 fPolargram->Draw("pn");
1432 if(fSegmentDisplay){
1434 DrawSlices("");
1435 } else {
1437 DrawPoly("");
1438 }
1439 AppendPad();
1440 }
1441
1442 if(fAverageSlices){
1443 for(ui=0;ui<fNcols;++ui){
1449 }
1450 } else {
1451 if (fAveragePoly) {
1457 }
1458 }
1459 if (fCanvas) {
1460 fCanvas->Modified();
1461 fCanvas->Update();
1462 }
1463}
1464
1465////////////////////////////////////////////////////////////////////////////////
1466/// Compile selection expression if there is one.
1467
1469{
1470 if (selection && strlen(selection)) {
1471 fSelect = new TTreeFormula("Selection",selection,fTree);
1472 // if (!fSelect) return -1;
1473 // if (!fSelect->GetNdim()) { delete fSelect; return -1; }
1475 }
1476}
1477
1478////////////////////////////////////////////////////////////////////////////////
1479/// Compile the variables expression from the given string varexp.
1480
1482{
1483 Int_t nch;
1484 fNcols=8;
1485
1486 if (!varexp) return;
1488 UInt_t nleaves = leaves->GetEntriesFast();
1489 if (nleaves < fNcols) fNcols = nleaves;
1490 nch = strlen(varexp);
1491
1492 // if varexp is empty, take first 8 columns by default
1493 Int_t allvar = 0;
1494 std::vector<TString> cnames;
1495 if (!strcmp(varexp, "*")) { fNcols = nleaves; allvar = 1; }
1496 if (nch == 0 || allvar) {
1497 UInt_t ncs = fNcols;
1498 fNcols = 0;
1499 for (UInt_t ui=0;ui<ncs;++ui) {
1500 TLeaf *lf = (TLeaf*)leaves->At(ui);
1501 if (lf->GetBranch()->GetListOfBranches()->GetEntries() > 0) continue;
1502 cnames.push_back(lf->GetName());
1503 fNcols++;
1504 }
1505 // otherwise select only the specified columns
1506 } else {
1508 }
1509
1510 // Create the TreeFormula objects corresponding to each column
1511 for (UInt_t ui=0;ui<fNcols;ui++) {
1512 fFormulas->Add(new TTreeFormula("Var1",cnames[ui].Data(),fTree));
1513 }
1514}
1515
1516////////////////////////////////////////////////////////////////////////////////
1517/// Create a TreeFormulaManager to coordinate the formulas.
1518
1520{
1521 Int_t i;
1522 if (fFormulas->LastIndex()>=0) {
1523 if (fSelect) {
1524 if (fSelect->GetManager()->GetMultiplicity() > 0 ) {
1526 for(i=0;i<=fFormulas->LastIndex();i++) {
1528 }
1529 fManager->Sync();
1530 }
1531 }
1532 for(i=0;i<=fFormulas->LastIndex();i++) {
1534 switch( form->GetManager()->GetMultiplicity() ) {
1535 case 1:
1536 case 2:
1537 case -1:
1538 fForceDim = true;
1539 break;
1540 case 0:
1541 break;
1542 }
1543
1544 }
1545 }
1546}
1547
1548////////////////////////////////////////////////////////////////////////////////
1549/// Update the polylines or the arcs for the current entries.
1550
1552{
1553 Double_t slice = 2*TMath::Pi()/fNcols;
1554
1555 Double_t x,y,r;
1556
1557 for(UInt_t pad=1;pad <= fNx*fNy;++pad){
1559 for(UInt_t i=0;i<fNcols;++i){
1560 r = (((TTreeFormula*)fFormulas->At(i))->EvalInstance()-fMin[i])/(fMax[i]-fMin[i]);
1561 x=r*TMath::Cos(i*slice);
1562 y=r*TMath::Sin(i*slice);
1563 if(!fSegmentDisplay) ((TPolyLine*)fPolyList->At(pad-1))->SetPoint(i,x,y);
1564 else {
1565 ((TArc*)((TList*)fPolyList->At(pad-1))->At(i))->SetR1(r);
1566 ((TArc*)((TList*)fPolyList->At(pad-1))->At(i))->SetR2(r);
1567 }
1568 }
1569 x=(((TTreeFormula*)fFormulas->At(0))->EvalInstance()-fMin[0])/(fMax[0]-fMin[0]);
1570 y=0;
1571 if(!fSegmentDisplay) ((TPolyLine*)fPolyList->At(pad-1))->SetPoint(fNcols,x,y);
1572 }
1573}
@ kHand
Definition GuiTypes.h:375
#define e(i)
Definition RSha256.hxx:103
short Style_t
Style number (short)
Definition RtypesCore.h:97
short Color_t
Color number (short)
Definition RtypesCore.h:100
short Width_t
Line width (short)
Definition RtypesCore.h:99
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:84
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TEnv * gEnv
Definition TEnv.h:126
Option_t Option_t option
Option_t Option_t SetLineWidth
Option_t Option_t SetFillStyle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t SetLineColor
Option_t Option_t TPoint TPoint angle
Option_t Option_t SetFillColor
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
int nentries
#define gROOT
Definition TROOT.h:417
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2570
#define gPad
Create an Arc.
Definition TArc.h:26
Fill Area Attributes class.
Definition TAttFill.h:21
virtual Color_t GetFillColor() const
Return the fill area color.
Definition TAttFill.h:32
virtual Style_t GetFillStyle() const
Return the fill area style.
Definition TAttFill.h:33
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:40
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition TAttFill.h:42
Line Attributes class.
Definition TAttLine.h:21
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:36
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition TAttLine.h:46
virtual Width_t GetLineWidth() const
Return the line width.
Definition TAttLine.h:38
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition TAttLine.h:47
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:44
virtual Style_t GetLineStyle() const
Return the line style.
Definition TAttLine.h:37
The Canvas class.
Definition TCanvas.h:23
void Clear(Option_t *option="") override
Remove all primitives from the canvas.
Definition TCanvas.cxx:746
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
Definition TCanvas.cxx:728
virtual void Selected(TVirtualPad *pad, TObject *obj, Int_t event)
Emit Selected() signal.
Definition TCanvas.cxx:1644
void Update() override
Update canvas pad buffers.
Definition TCanvas.cxx:2504
void Draw(Option_t *option="") override
Draw this ellipse with its current attributes.
Definition TEllipse.cxx:169
A List of entry numbers in a TTree or TChain.
Definition TEntryList.h:26
virtual Long64_t GetN() const
Definition TEntryList.h:78
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Set the value of a resource or create a new resource.
Definition TEnv.cxx:752
To draw polar axis.
void SetNdivPolar(Int_t Ndiv=508)
Set the number of Polar divisions: enter a number ij with 0<i<99 and 0<j<99.
void Draw(Option_t *options="") override
Draw Polargram.
void SetNdivRadial(Int_t Ndiv=508)
Set the number of radial divisions: enter a number ij with 0<i<99 and 0<j<99.
To draw Mathematical Formula.
Definition TLatex.h:20
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Definition TLeaf.h:57
A doubly linked list.
Definition TList.h:38
void AddAfter(const TObject *after, TObject *obj) override
Insert object after object after in the list.
Definition TList.cxx:247
void Add(TObject *obj) override
Definition TList.h:81
TObject * Remove(TObject *obj) override
Remove object from the list.
Definition TList.cxx:952
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:600
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:487
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
An array of TObjects.
Definition TObjArray.h:31
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition TObject.cxx:203
virtual void Delete(Option_t *option="")
Delete this object.
Definition TObject.cxx:267
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:506
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.
Definition TPad.cxx:1295
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
Definition TPad.cxx:7353
TCanvas * GetCanvas() const override
Definition TPad.h:264
Defined by an array on N points in a 2-D space.
Definition TPolyLine.h:23
void Draw(Option_t *option="") override
Draw this polyline with its current attributes.
A specialized TSelector for TTree::Draw.
virtual UInt_t SplitNames(const TString &varexp, std::vector< TString > &names)
Build Index array for names in varexp.
virtual void SetInputList(TList *input)
Definition TSelector.h:66
Int_t LastIndex() const
Spider class.
Definition TSpider.h:40
void SetAverageLineStyle(Style_t sty)
Set the LineStyle of the average.
Definition TSpider.cxx:962
TPolyLine * fAveragePoly
Polygon representing the average variables value.
Definition TSpider.h:55
void SetLineColor(Color_t col) override
Set lin color.
Definition TSpider.cxx:1150
void SetAverageFillColor(Color_t col)
Set the Fill Color of the average.
Definition TSpider.cxx:998
~TSpider() override
Destructor.
Definition TSpider.cxx:173
UInt_t fNy
Number of vertical spider plots.
Definition TSpider.h:43
void Draw(Option_t *options="") override
Draw the spider.
Definition TSpider.cxx:453
TList * fInput
Used for fSelector.
Definition TSpider.h:59
void SetNx(UInt_t nx)
Set the X number of sub pads.
Definition TSpider.cxx:1223
Double_t * fAve
[fNcols] Average value of each variable.
Definition TSpider.h:50
Style_t GetAverageLineStyle() const
Get the LineStyle of the average.
Definition TSpider.cxx:616
void GotoPrevious()
Go to the previous entries.
Definition TSpider.cxx:761
void SetFillStyle(Style_t sty) override
Set fill style.
Definition TSpider.cxx:1198
TList * fSuperposed
Superposed spider plots.
Definition TSpider.h:53
void DrawSlices(Option_t *options)
Draw the slices of the segment plot.
Definition TSpider.cxx:559
Long64_t fFirstEntry
First entry.
Definition TSpider.h:48
void SetDisplayAverage(bool disp)
Display or not the average.
Definition TSpider.cxx:1022
void UpdateView()
Update the polylines or the arcs for the current entries.
Definition TSpider.cxx:1551
TTree * fTree
Pointer to the TTree to represent.
Definition TSpider.h:54
bool fSegmentDisplay
True if displaying a segment plot.
Definition TSpider.h:68
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute the distance to the spider.
Definition TSpider.cxx:438
void SetSegmentDisplay(bool seg)
Set the segment display or not.
Definition TSpider.cxx:1377
void SetNdivRadial(Int_t div)
Set number of radial divisions.
Definition TSpider.cxx:1214
void SetCurrentEntries()
Set the current selected entries.
Definition TSpider.cxx:1064
void AddVariable(const char *varexp)
Add a variable to the plot from its expression.
Definition TSpider.cxx:214
UInt_t fNcols
Number of variables.
Definition TSpider.h:44
bool fShowRange
Show range of variables or not.
Definition TSpider.h:69
void DrawPoly(Option_t *options)
Paint the polygon representing the current entry.
Definition TSpider.cxx:529
bool fAngularLabels
True if the labels are oriented according to their axis.
Definition TSpider.h:65
void DrawSlicesAverage(Option_t *options)
Draw the slices representing the average for the segment plot.
Definition TSpider.cxx:585
void GotoEntry(Long64_t e)
Go to a specified entry.
Definition TSpider.cxx:741
TCanvas * fCanvas
! Pointer to the mother pad.
Definition TSpider.h:57
Int_t fArraySize
Actual size of the arrays.
Definition TSpider.h:45
void SetAverageLineColor(Color_t col)
Set the LineColor of the average.
Definition TSpider.cxx:974
TArc ** fAverageSlices
! Average slices.
Definition TSpider.h:56
void SetSelectionExpression(const char *selexp)
Compile selection expression if there is one.
Definition TSpider.cxx:1468
Long64_t fEntry
Present entry number in fTree.
Definition TSpider.h:46
void DeleteVariable(const char *varexp)
Delete a variable from its expression.
Definition TSpider.cxx:352
void SetAverageLineWidth(Width_t wid)
Set the LineWidth of the average.
Definition TSpider.cxx:986
TTreeFormulaManager * fManager
Coordinator for the formulas.
Definition TSpider.h:60
Width_t GetAverageLineWidth() const
Get the LineWidth of the average.
Definition TSpider.cxx:636
void SetLineWidth(Width_t wid) override
Set line width.
Definition TSpider.cxx:1166
TList * fFormulas
List of all formulas to represent.
Definition TSpider.h:58
void SetLineStyle(Style_t sty) override
Set line style.
Definition TSpider.cxx:1134
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute the corresponding event.
Definition TSpider.cxx:666
Color_t GetAverageLineColor() const
Get the LineColor of the average.
Definition TSpider.cxx:626
TTreeFormula * fSelect
Selection condition.
Definition TSpider.h:63
void InitVariables(Long64_t firstentry, Long64_t nentries)
Browse the tree to set the min, max and average value of each variable of fVar.
Definition TSpider.cxx:829
Int_t FindTextAlign(Double_t theta)
Find the alignement rule to apply for TText::SetTextAlign(Short_t).
Definition TSpider.cxx:675
void SetVariablesExpression(const char *varexp)
Compile the variables expression from the given string varexp.
Definition TSpider.cxx:1481
void SetAverageFillStyle(Style_t sty)
Set the FillStyle of the average.
Definition TSpider.cxx:1010
TSelectorDraw * fSelector
! Selector.
Definition TSpider.h:64
TSpider()
Default constructor.
Definition TSpider.cxx:75
Double_t FindTextAngle(Double_t theta)
Determine the orientation of the polar labels according to their angle.
Definition TSpider.cxx:704
Color_t GetAverageFillColor() const
Get the Fill Color of the average.
Definition TSpider.cxx:646
void SyncFormulas()
Create a TreeFormulaManager to coordinate the formulas.
Definition TSpider.cxx:1519
void AddSuperposed(TSpider *sp)
Allow to superpose several spider views.
Definition TSpider.cxx:205
void SetFillColor(Color_t col) override
Set fill color.
Definition TSpider.cxx:1182
Double_t * fMax
[fNcols] Maximum value of the variables.
Definition TSpider.h:51
Double_t * fMin
[fNcols] Minimum value of the variables.
Definition TSpider.h:52
UInt_t fNx
Number of horizontal spider plots.
Definition TSpider.h:42
void SetNy(UInt_t ny)
Set the Y number of sub pads.
Definition TSpider.cxx:1300
bool fForceDim
Force dimension.
Definition TSpider.h:67
void Paint(Option_t *options) override
Paint the spider.
Definition TSpider.cxx:915
void InitArrays(Int_t newsize)
Check if the arrays size is enough and reallocate them if not.
Definition TSpider.cxx:791
Long64_t fNentries
Number of entries.
Definition TSpider.h:47
Style_t GetAverageFillStyle() const
Get the FillStyle of the average.
Definition TSpider.cxx:656
TGraphPolargram * fPolargram
Polar graph.
Definition TSpider.h:61
void GotoNext()
Go to the next entries.
Definition TSpider.cxx:751
void DrawPolyAverage(Option_t *options)
Paint the Polygon representing the average value of the variables.
Definition TSpider.cxx:491
Long64_t * fCurrentEntries
![fNx*fNy] current selected entries;
Definition TSpider.h:49
TList * fPolyList
Polygons representing the variables.
Definition TSpider.h:62
void GotoPreceding()
Go to the last entry.
Definition TSpider.cxx:781
bool fDisplayAverage
Display or not the average.
Definition TSpider.h:66
Long64_t GetEntriesToProcess(Long64_t firstentry, Long64_t nentries) const
return the number of entries to be processed this function checks that nentries is not bigger than th...
Definition TSpider.cxx:726
void GotoFollowing()
Go to the next entry.
Definition TSpider.cxx:771
Basic string class.
Definition TString.h:138
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:643
Used to coordinate one or more TTreeFormula objects.
virtual void UpdateFormulaLeaves()
This function could be called TTreePlayer::UpdateFormulaLeaves, itself called by TChain::LoadTree whe...
virtual Int_t GetNdata(bool forceLoadDim=false)
Return number of available instances in the formulas.
virtual void Add(TTreeFormula *)
Add a new formula to the list of formulas managed The manager of the formula will be changed and the ...
virtual bool Sync()
Synchronize all the formulae.
virtual Int_t GetMultiplicity() const
Used to pass a selection expression to the Tree drawing routine.
TTreeFormulaManager * GetManager() const
T EvalInstance(Int_t i=0, const char *stringStack[]=nullptr)
Evaluate this treeformula.
virtual Int_t GetNdata()
Return number of available instances in the formula.
A TTree represents a columnar dataset.
Definition TTree.h:89
virtual Int_t GetScanField() const
Definition TTree.h:598
virtual Long64_t GetEstimate() const
Definition TTree.h:554
virtual TObjArray * GetListOfLeaves()
Definition TTree.h:576
virtual TEntryList * GetEntryList()
Returns the entry list assigned to this tree.
Definition TTree.cxx:5934
virtual Long64_t GetEntryNumber(Long64_t entry) const
Return entry number corresponding to entry.
Definition TTree.cxx:5945
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
Definition TTree.cxx:6584
virtual Long64_t GetEntriesFriend() const
Returns a number corresponding to:
Definition TTree.cxx:5590
virtual Int_t GetTreeNumber() const
Definition TTree.h:606
virtual void SetScanField(Int_t n=50)
Sets the default maximum number of lines to be shown before <CR> when calling Scan().
Definition TTree.h:743
void Clear(Option_t *option="") override=0
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:607
constexpr Double_t Pi()
Definition TMath.h:40
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:601
th1 Draw()