cms_calo.C: Demonstrates usage of EVE calorimetry classes. | Event Display | csgdemo.C: Combinatorial Solid Geometry example |
// @(#)root/eve:$Id$ // Author: Alja Mrak-Tadel // Demonstrates usage of 'cone' mode in TEveBoxSet class. TEveBoxSet* cone_test(Float_t x=0, Float_t y=0, Float_t z=0, Int_t num=100, Bool_t register=kTRUE) { TEveManager::Create(); using namespace TMath; TEveStraightLineSet* lines = new TEveStraightLineSet("StraightLines"); lines->SetLineColor(kYellow); lines->SetLineWidth(2); TRandom r(0); gStyle->SetPalette(1, 0); TEveRGBAPalette* pal = new TEveRGBAPalette(0, 500); TEveBoxSet* cones = new TEveBoxSet("ConeSet"); cones->SetPalette(pal); cones->Reset(TEveBoxSet::kBT_Cone, kFALSE, 64); Float_t a = 40; // max distance between cones TEveVector dir, pos; Float_t theta, phi, height, rad; for (Int_t i=0; i<num; ++i) { theta = r.Uniform(0,TMath::Pi()); phi = r.Uniform (-TMath::Pi(), TMath::Pi()); height = r.Uniform(5, 15); rad = r.Uniform(3, 5); dir.Set(Cos(phi)*Cos(theta), Sin(phi)*Cos(theta), Sin(theta)); dir *= height; pos.Set(r.Uniform(-a,a), r.Uniform(-a, a), r.Uniform(-a, a)); cones->AddCone(pos, dir, rad); cones->DigitValue(r.Uniform(0, 500)); // draw axis line 30% longer than cone height TEveVector end = pos + dir*1.3; lines->AddLine(pos.fX, pos.fY, pos.fZ, end.fX, end.fY, end.fZ); } // by default cone cap not drawn if (r.Integer(2)>0) cones->SetDrawConeCap(kTRUE); cones->RefitPlex(); TEveTrans& t = cones->RefMainTrans(); t.SetPos(x, y, z); gEve->AddElement(cones); gEve->AddElement(lines); gEve->Redraw3D(kTRUE); return cones; } TEveBoxSet* elliptic_cone_test(Float_t x=0, Float_t y=0, Float_t z=0, Int_t num=100, Bool_t register=kTRUE) { TEveManager::Create(); using namespace TMath; TEveManager::Create(); TEveStraightLineSet* lines = new TEveStraightLineSet("StraightLines"); lines->SetLineColor(kYellow); lines->SetLineWidth(2); TRandom r(0); TEveBoxSet* cones = new TEveBoxSet("EllipticConeSet"); cones->Reset(TEveBoxSet::kBT_EllipticCone, kTRUE, 64); cones->SetPickable(kTRUE); Float_t a = 40; // max distance between cones TEveVector dir, pos; Float_t theta, phi, height, rad; for (Int_t i=0; i<num; ++i) { theta = r.Uniform(0,TMath::Pi()); phi = r.Uniform (-TMath::Pi(), TMath::Pi()); height = r.Uniform(5, 15); rad = r.Uniform(3, 5); dir.Set(Cos(phi)*Cos(theta), Sin(phi)*Cos(theta), Sin(theta)); dir *= height; pos.Set(r.Uniform(-a,a), r.Uniform(-a, a), r.Uniform(-a, a)); cones->AddEllipticCone(pos, dir, rad, 0.5*rad, r.Uniform(0,360)); cones->DigitColor(r.Uniform(20, 255), r.Uniform(20, 255), r.Uniform(20, 255), r.Uniform(20, 255)); // draw axis line 30% longer than cone height TEveVector end = pos + dir*1.3; lines->AddLine(pos.fX, pos.fY, pos.fZ, end.fX, end.fY, end.fZ); } // by default cone cap not drawn if (r.Integer(2)>0) cones->SetDrawConeCap(kTRUE); cones->RefitPlex(); TEveTrans& t = cones->RefMainTrans(); t.SetPos(x, y, z); gEve->AddElement(cones); gEve->AddElement(lines); gEve->Redraw3D(kTRUE); return cones; } cone_test.C:1 cone_test.C:2 cone_test.C:3 cone_test.C:4 cone_test.C:5 cone_test.C:6 cone_test.C:7 cone_test.C:8 cone_test.C:9 cone_test.C:10 cone_test.C:11 cone_test.C:12 cone_test.C:13 cone_test.C:14 cone_test.C:15 cone_test.C:16 cone_test.C:17 cone_test.C:18 cone_test.C:19 cone_test.C:20 cone_test.C:21 cone_test.C:22 cone_test.C:23 cone_test.C:24 cone_test.C:25 cone_test.C:26 cone_test.C:27 cone_test.C:28 cone_test.C:29 cone_test.C:30 cone_test.C:31 cone_test.C:32 cone_test.C:33 cone_test.C:34 cone_test.C:35 cone_test.C:36 cone_test.C:37 cone_test.C:38 cone_test.C:39 cone_test.C:40 cone_test.C:41 cone_test.C:42 cone_test.C:43 cone_test.C:44 cone_test.C:45 cone_test.C:46 cone_test.C:47 cone_test.C:48 cone_test.C:49 cone_test.C:50 cone_test.C:51 cone_test.C:52 cone_test.C:53 cone_test.C:54 cone_test.C:55 cone_test.C:56 cone_test.C:57 cone_test.C:58 cone_test.C:59 cone_test.C:60 cone_test.C:61 cone_test.C:62 cone_test.C:63 cone_test.C:64 cone_test.C:65 cone_test.C:66 cone_test.C:67 cone_test.C:68 cone_test.C:69 cone_test.C:70 cone_test.C:71 cone_test.C:72 cone_test.C:73 cone_test.C:74 cone_test.C:75 cone_test.C:76 cone_test.C:77 cone_test.C:78 cone_test.C:79 cone_test.C:80 cone_test.C:81 cone_test.C:82 cone_test.C:83 cone_test.C:84 cone_test.C:85 cone_test.C:86 cone_test.C:87 cone_test.C:88 cone_test.C:89 cone_test.C:90 cone_test.C:91 cone_test.C:92 cone_test.C:93 cone_test.C:94 cone_test.C:95 cone_test.C:96 cone_test.C:97 cone_test.C:98 cone_test.C:99 cone_test.C:100 cone_test.C:101 cone_test.C:102 cone_test.C:103 cone_test.C:104 cone_test.C:105 cone_test.C:106 cone_test.C:107 cone_test.C:108 cone_test.C:109 cone_test.C:110 cone_test.C:111 cone_test.C:112 cone_test.C:113 cone_test.C:114 cone_test.C:115 cone_test.C:116 |
|