14 void MakeCrazy(TList *list, Int_t maxDepth, Int_t maxObjects, Float_t pList) {
16 const char *clnames[ncl] = {
"TH1F",
"TGraph",
"TGraphErrors",
"TF1",
"TPaveText",
17 "TAxis",
"TF2",
"TH2D",
"TLatex",
"TText",
"TCutG",
"THnSparseF"};
18 Int_t nobj = gRandom->Uniform(0,maxObjects);
19 for (Int_t i=0;i<nobj;i++) {
20 if (maxDepth && gRandom->Rndm() < pList) {
21 TList *slist =
new TList();
22 slist->SetName(Form(
"list_%d_%d",maxDepth,i));
24 MakeCrazy(slist,maxDepth-1,maxObjects,pList);
26 Int_t icl = (Int_t)gRandom->Uniform(0,ncl);
27 TNamed *named = (TNamed*)gROOT->ProcessLine(Form(
"new %s;",clnames[icl]));
28 named->SetName(Form(
"%s_%d_%d",clnames[icl],maxDepth,i));
35 TList *crazy(Int_t maxDepth=5, Int_t maxObjects=20, Float_t pList=0.2) {
36 TList *list =
new TList();
37 list->SetName(
"SuperList");
38 MakeCrazy(list,maxDepth,maxObjects,pList);
39 gROOT->GetListOfTasks()->Add(list);
43 void FillColorsMap(TStructViewer* sv)
47 const char *clnames[ncl] = {
"TH1F",
"TGraph",
"TGraphErrors",
"TF1",
"TPaveText",
48 "TAxis",
"TF2",
"TH2D",
"TLatex",
"TText",
"TCutG",
"THnSparseF"};
50 for (
int i = 0; i < ncl ; i++) {
51 sv->SetColor(clnames[i], (Int_t)gRandom->Integer(8)+2);
59 TList* pointer = crazy(2,10);
61 TStructViewer* sv =
new TStructViewer(pointer);