{ // Macro phgeom.C: This macro generates a display of the PHOBOS // geometry translated from UGCDATA via PMC Geant and g2root. // It requires macros phobos.C (the g2root output), and phcset.C, // which takes arguments "name" and "colno" where name is two // characters for a node classification, colno is a color number. // It also requires phtog.C which implements the small buttons, // and phghelp.C which routes help and provides a button panel. // Pushbuttons allow superposition of any number of // classifications in a 3-dim. view of PHOBOS. DMcL 1/Sep/97 #include #include // Set up the phobos geometry and load the phcset macro gROOT->Macro("phobos.C"); //Sets up TGeometry phobos gROOT->LoadMacro("phcset.C"); //For use by pushbutton calls gROOT->LoadMacro("phtog.C"); //Toggle pushbutton calls gROOT->LoadMacro("phghelp.C"); //Help canvas & buttons TNode *phNode; phNode = phobos->GetNode("OUTS1"); //Top node, reference frame phNode->SetVisibility(0); //This sets all invisible (default) // The canvas dimensions and location may be system dependent. // It should appear approximately square. c1 = new TCanvas("Phobos","Phobos geometry",300,10,850,850); c1->SetFillColor(132); // Dark green for least eyestrain Int_t bw = 0; Bool_t fv = 0; Bool_t x2 = 0; Float_t *min[3]; Float_t *max[3]; Float_t *mins[3]; Float_t *maxs[3]; // There is a problem with nested quotes in the button method // spec. which requires defining some character variables: char *same = "same"; char *sn = "SN"; char *sp = "SP"; char *ca = "CA"; char *mn = "MN"; char *mp = "MP"; char *mo = "MO"; char *vp = "VP"; char *vn = "VN"; char *rr = "RR"; char *ro = "RO"; char *tp = "TP"; char *tn = "TN"; char *yy = "YY"; char *yc = "YC"; char *uu = "U*"; char outs1[5] = "OUTS1"; bar = new TCanvas("PHOBOS","PHOBOS",-10,10,300,700); bar->SetEditable(0); bar->SetFillColor(38); bar->SetFillStyle(3014); bar->Draw(); // black <-> white <-> dark green screen toggle TButton *buta = new TButton("","{phtog(1);}", .85,.92,.90,.95); buta->SetFillColor(10); buta->Draw(); buta->cd(); box = new TBox(0.0,0.0,1.0,0.33); // Make 3 colors on button box->SetFillColor(1); box->Draw(); box2 = new TBox(0.0,0.33,1.0,0.66); box2->SetFillColor(32); box2->Draw(); bar->cd(); // Fill box <-> natural proportions toggle; uses phtog.C TButton *butb = new TButton("","{phtog(2);}", .90,.85,.95,.88); butb->SetFillColor(3); butb->Draw(); // 2x view size toggle TButton *butc = new TButton("","{phtog(3);}", .80,.85,.85,.88); butc->SetFillColor(6); butc->Draw(); // Try making sounds!! const char* noisy = "c:\\windows\\sndrec32.exe /play /close cat.wav"; TButton *butd = new TButton("", "{gSystem.Exec(noisy);}", .92,.92,.95,.95); butd->SetFillColor(2); butd->Draw(); // Help for this demo, and its WWW pages TButton *but1 = new TButton("Help","{phghelp(0);};", .05,.85,.75,.95); but1->SetFillColor(18); but1->SetTextColor(4); but1->SetTextSize(0.50); but1->Draw(); // The following ridiculous double repetition of Draw was // found to be necessary to scale properly; much browsing failed // to turn up a real understanding of the problem. TButton *but2 = new TButton("Spectrometer", "{phcset(sn,2); phcset(sp,2); phobos->Draw(same); c1->Draw();c1->Draw();c1->Update();}", .05,.72,.45,.80); but2->SetFillColor(2); but2->SetTextColor(10); but2->SetTextSize(0.33); but2->Draw(); TButton *but3 = new TButton("Spect. base", "{phcset(ca,9); phobos->Draw(same); c1->Draw();c1->Draw();c1->Update();}", .55,.72,.95,.80); but3->SetFillColor(9); but3->SetTextColor(10); but3->SetTextSize(0.33); but3->Draw(); TButton *but4 = new TButton("Multiplicity", "{phcset(mn,2); phcset(mp,2); phobos->Draw(same); c1->Draw();c1->Draw();c1->Update();}", .05,.59,.45,.67); but4->SetFillColor(2); but4->SetTextColor(10); but4->SetTextSize(0.33); but4->Draw(); TButton *but5 = new TButton("Mult. supports", "{phcset(rr,9); phobos->Draw(same); c1->Draw();c1->Draw();c1->Update();;}", .55,.59,.95,.67); but5->SetFillColor(9); but5->SetTextColor(10); but5->SetTextSize(0.33); but5->Draw(); TButton *but6 = new TButton("Octagon, vertex", "{phcset(mo,2); phcset(vp,2); phcset(vn,2); phobos->Draw(same); c1->Draw();c1->Draw();c1->Update();}", .05,.46,.45,.54); but6->SetFillColor(2); but6->SetTextColor(10); but6->SetTextSize(0.33); but6->Draw(); TButton *but7 = new TButton("Octagon support", "{phcset(ro,9); phobos->Draw(same); c1->Draw();c1->Draw();c1->Update();}", .55,.46,.95,.54); but7->SetFillColor(9); but7->SetTextColor(10); but7->SetTextSize(0.31); but7->Draw(); TButton *but8 = new TButton("TOF", "{phcset(tp,6); phcset(tn,6); phobos->Draw(same); c1->Draw();c1->Draw();c1->Update();}", .05,.31,.45,.39); but8->SetFillColor(6); but8->SetTextColor(10); but8->SetTextSize(0.50); but8->Draw(); TButton *but9 = new TButton("Magnet", "{phcset(yy,8); phcset(yc,5); phobos->Draw(same); c1->Draw();c1->Draw();c1->Update();}", .55,.31,.95,.39); but9->SetFillColor(8); but9->SetTextColor(10); but9->SetTextSize(0.40); but9->Draw(); TButton *but10 = new TButton("Spect. support", "{phcset(uu,7); phobos->Draw(same); c1->Draw();c1->Draw();c1->Update();}", .05,.18,.45,.26); but10->SetFillColor(7); but10->SetTextColor(1); but10->SetTextSize(0.33); but10->Draw(); TButton *but11 = new TButton("Clear", "{TNode *Outs; Outs = phobos->GetNode(outs1); Outs->SetVisibility(0); c1->Clear(); c1->Update();}", .55,.18,.95,.26); but11->SetFillColor(10); but11->SetTextColor(1); but11->SetTextSize(0.50); but11->Draw(); TButton *but12 = new TButton("ROOT Help","{phghelp(7);}", .05,.05,.45,.13); but12->SetFillColor(25); but12->SetTextColor(10); but12->SetTextSize(0.40); but12->Draw(); TButton *but13 = new TButton("Exit","gSystem->Exit(0)",.55,.05,.95,.13); but13->SetFillColor(40); but13->SetTextColor(10); but13->SetTextSize(0.50); but13->Draw(); bar->Update(); c1->cd(); c1->Update(); }