//example // open root and give //root [0] .L test.C //root [1] test() // // //............................................................................ void test() { TCanvas *c1 = new TCanvas("c1","The ... canvas",200,10,700,700); c1->cd(); BuildLayout()->Draw(); //ShowAxis(-15,-15,-20,4); ShowView(1.); TCanvas* c2 = new TCanvas("c2","The ... canvas",200,10,700,700); c2->cd(); BuildLayout()->Draw(); //ShowAxis(-15,-15,-20,4); ShowView(0.5); } //............................................................................ void ShowView(float zoomfactor) { gPad->GetView()->ZoomView(0,zoomfactor); gPad->SetFillColor(17);//light grey gPad->Modified(); gPad->Update(); } //............................................................................ //............................................................................ //............................................................................ //............................................................................ void ShowAxis(float x0=0, float y0=0, float z0=0, float length=4) { TPolyLine3D *axisX = new TPolyLine3D(); axisX->SetPoint(0,x0,y0,z0); axisX->SetPoint(1,x0+length,y0,z0); axisX->SetLineColor(4);//blue axisX->SetLineWidth(2); TPolyLine3D *axisY = new TPolyLine3D(); axisY->SetPoint(0,x0,y0,z0); axisY->SetPoint(1,x0,y0+length,z0); axisY->SetLineColor(5);//yellow axisY->SetLineWidth(2); TPolyLine3D *axisZ = new TPolyLine3D(); axisZ->SetPoint(0,x0,y0,z0); axisZ->SetPoint(1,x0,y0,z0+length); axisZ->SetLineColor(2);//red axisZ->SetLineWidth(2); axisX->Draw(); axisY->Draw(); axisZ->Draw(); } //............................................................................ TNode* BuildLayout() { TNode *mother,*tempNode; // int NofWafX = 3; int NofWafY = 3; int nCellsPerWaf = 6;//this means 6X6 float offsetX = 7; float offsetY = 7; float offsetZ = 3; float x,y,z; int NumOfLayers = 10; //these are dummy TMaterial *mat; TRotMatrix *rot; mat = new TMaterial("mat","mat",1.01,1,.0708); rot = new TRotMatrix("rot","rot",90,0,90,90,0,0); //rot = new TRotMatrix("rot","rot",90,0,180,0,90,90); //building blocks TBRIK *world = new TBRIK("world","world","mat",100,100,100); world->SetVisibility(0); TBRIK *cave = new TBRIK("cave","cave","mat",100,100,100); cave->SetVisibility(0); TBRIK *wafer = new TBRIK("wafer","wafer","mat",3,3,.1); wafer->SetLineColor(5);//yellow TBRIK *cell = new TBRIK("cell","cell","mat",.5,.5,.05); cell->SetLineColor(10);//white //cell->SetVisibility(0); TBRIK *layer = new TBRIK("layer","layer","mat",12,12,1.); layer->SetLineColor(15);//grey TBRIK *block = new TBRIK("block","block","mat",12,12,15); block->SetLineColor(1);//black TBRIK *chamber = new TBRIK("chamber","chamber","mat",18,18,5); chamber->SetLineColor(1);//black //not used TTUBE *hit = new TTUBE("hit","hit","mat",.2,.4,.2); hit->SetLineColor(1);//black //build geometry nodes = volumes for display TNode *test = new TNode("temp","temp","world"); test->cd(); mother = new TNode("temp","temp","cave",0,0,0,"rot"); mother->cd(); for(int iw=0;iwcd(); for(int i=0+12;i<18;i++) { for(int j=0+12;j<18;j++) { for(int k=0; k<10;k++) { //theCell[i][j][k] = new TNode("temp","temp","cell",(8)*(i/6) + i%6 -3 -8+.5,(8)*(j/6) +j%6-3-8+.5,10*k,""); x = offsetX*(i/nCellsPerWaf - 1) + i%nCellsPerWaf - wafer->GetDx() + cell->GetDx(); y = offsetY*(j/nCellsPerWaf - 1) + j%nCellsPerWaf - wafer->GetDy() + cell->GetDy(); z = offsetZ*k; tempNode = new TNode("temp","temp","cell",x,y,z,""); } } } mother->cd(); for(int k=0;kcd(); for(int k=0;k<3;k++) { x = 0.; y = 0.; z = 30*k+15; tempNode = new TNode("temp","temp","block",x,y,z,""); } mother->cd(); for(int k=0;k<2;k++) { x = 0.; y = 0.; z = 20*k-60; tempNode = new TNode("temp","temp","chamber",x,y,z,""); } //return mother; return test; }