StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AtlasFromWeb.C
1 //*-- Author : Valery Fine 26/03/99 (E-mail: fine@bnl.gov)
2 // $Id: AtlasFromWeb.C,v 1.2 2000/04/07 17:07:08 fine Exp $
3 // $Log: AtlasFromWeb.C,v $
4 // Revision 1.2 2000/04/07 17:07:08 fine
5 // adjusted to the ROOT 2.24
6 //
7 // Revision 1.1 1999/10/11 21:46:40 fine
8 // Macro to draw the ATLAS detector geometry
9 //
10 // Revision 1.2 1999/03/29 19:17:54 fine
11 // x3d view has been activated. Some improvement as well
12 //
13 {
14  // To run this example one needs the access to Internet
15  // To start this example launch ROOT as follows:
16  //
17  //*-* root.exe StarFromWeb.C
18  //
19 
20  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/WebStar.gif"> </P> End_Html //
21 
22  gROOT->Reset();
23  cout << " Loading share library" << endl;
24  gROOT->Reset();
25  printf( " Loading share library\n");
26  gSystem->Load("libSTAR");
27  if (!gGeometry) new TGeometry;
28 
29  // Create canvas
30 
31  cout << " Creating an empty TCanvas object to draw in" << endl;
32  TCanvas starCanvas("STAR","Star",400,600);
33  Int_t PadColumns = 2;
34  Int_t PadRows = 2;
35  starCanvas.Divide(PadColumns,PadRows);
36 
37  // Open remote Webfile
38  cout << " Open the remote Web file with STAR geometry database in ROOT format" << endl;
39  // TWebFile f("http://www.star.bnl.gov/~fine/atlas.root");
40  TFile f("~fine/WWW/atlas.root");
41  // read STAR geometry database remotely
42  cout << " Reading STAR geometry database (the full size of this database 3Mb bytes - ROOT-object" << endl;
43  TDataSetIter volume(HALL);
44  volume.Cd("ATLS");
45 
46  const Char_t *parts[] = {"INNE"
47  ,"PIPE"
48  ,"OUTE"
49  ,"CENT"
50  };
51  const Int_t numParts = sizeof(parts)/sizeof(void *);
52  cout << numParts << " different parts of the ATALS detector will be built" << endl;
53 
54  for (Int_t i =0; i< numParts; i++) {
55  const Char_t *part = parts[i];
56  cout << "Drawing \"" << part << "\"" << endl;
57  TVolume *vol = volume(part);
58  starCanvas.cd(i+1);
59  if (vol) vol->Draw();
60  gPad->Update();
61  }
62 
63  Int_t ThreeDPart = 2;
64  cout << " Plot 3D view of the " << ThreeDPart << " part: " << parts[ThreeDPart-1] << endl <<
65  " Note: Under Windows NT OpenGL will be used by default instead x3d for UNIX" << endl <<
66  " ================================================================" << endl <<
67  " Select x3d windows and type \"m\" in there to get x3d HELP windows" << endl <<
68  " ================================================================" << endl <<
69  " DON NOT FORGET to type \"q\" letter to terminate x3d widget and" << endl <<
70  " to continue this session" << endl <<
71  " ================================================================" << endl;
72  starCanvas.cd(ThreeDPart);
73  gPad->x3d();
74 
75  cout << "Drawing ROOT TBrowser" << endl;
76  TBrowser b("STAR",HALL);
77  cout << "Now. Try yourself:" << endl <<
78  " 1. Select any STAR geometry TVolume object with \"double-left-mouse click\" on the TVolumePosition" << endl <<
79  " TVolume object has no \";<n>\" in its name." << endl <<
80  " The objects with trail \";<n>\" are TVolumePosition ones" << endl <<
81  " 2. Pop the context menu up with \"right-mouse click\" on the ROOT browser" << endl <<
82  " 3. Select \"Draw\" position" << endl <<
83  " 4. Click OK" << endl;
84  cout << " Get this macro form $(STAR)/StRoot/macro/StarFromWeb.C and customize it for fun" << endl;
85 }
virtual TDataSet * Cd(const Char_t *dirname)
virtual void Draw(Option_t *depth="3")
Definition: TVolume.cxx:433