00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 void StarFromWeb(const char *geomFile ="/afs/rhic.bnl.gov/star/users/fine/WWW/star_year_2a.root")
00024 {
00025
00026
00027
00028
00029
00030
00031
00032
00033 cout << " Loading share library" << endl;
00034 Bool_t NT=kFALSE;
00035 if (strcmp(gSystem->GetName(),"WinNT") == 0 ) NT=kTRUE;
00036 if (NT) gSystem->Load("Table");
00037 else gSystem->Load("libTable");
00038 if (!gGeometry) new TGeometry;
00039
00040
00041
00042 cout << " Creating an empty TCanvas object to draw in" << endl;
00043 TCanvas &starCanvas = *(new TCanvas("STAR","Star",400,600));
00044
00045 Int_t PadColumns = 2;
00046 Int_t PadRows = 2;
00047 starCanvas.Divide(PadColumns,PadRows);
00048
00049
00050 cout << " Open the remote Web file with STAR geometry database in ROOT format" << endl;
00051
00052 TFile f(geomFile);
00053
00054 cout << " Reading STAR geometry database (the full size of this database 28K bytes - ROOT-object" << endl;
00055 TDataSetIter volume(HALL);
00056 volume.Cd("HALL/CAVE");
00057
00058 const Char_t *parts[] = {"TPCE"
00059 ,"MAGP"
00060 ,"CALB/RICH/SRIC"
00061 ,"UPST" };
00062 const Int_t numParts = sizeof(parts)/sizeof(void *);
00063 cout << numParts << " different parts of the STAR detector will be built" << endl;
00064
00065 for (Int_t i =0; i< numParts; i++) {
00066 const Char_t *part = parts[i];
00067 cout << "Drawing \"" << part << "\"" << endl;
00068 TVolume *vol = (TVolume *)volume(part);
00069 starCanvas.cd(i+1);
00070 if (vol) vol->Draw();
00071 else printf(" Volume \"%s\" was not found\n", part);
00072 gPad->Update();
00073 }
00074
00075 Int_t ThreeDPart = 2;
00076 cout << " Plot 3D view of the " << ThreeDPart << " part: " << parts[ThreeDPart-1] << endl <<
00077 " Note: Under Windows NT OpenGL will be used by default instead x3d for UNIX" << endl <<
00078 " ================================================================" << endl <<
00079 " Select x3d windows and type \"m\" in there to get x3d HELP windows" << endl <<
00080 " ================================================================" << endl <<
00081 " DON NOT FORGET to type \"q\" letter to terminate x3d widget and" << endl <<
00082 " to continue this session" << endl <<
00083 " ================================================================" << endl;
00084 starCanvas.cd(ThreeDPart);
00085 gPad->x3d();
00086
00087 cout << "Drawing ROOT TBrowser" << endl;
00088 new TBrowser("STAR",HALL);
00089 cout << "Now. Try yourself:" << endl <<
00090 " 1. Select any STAR geometry TVolume object with \"double-left-mouse click\" on the TVolumePosition" << endl <<
00091 " TVolume object has no \";<n>\" in its name." << endl <<
00092 " The objects with trail \";<n>\" are TVolumePosition ones" << endl <<
00093 " 2. Pop the context menu up with \"right-mouse click\" on the ROOT browser" << endl <<
00094 " 3. Select \"Draw\" position" << endl <<
00095 " 4. Click OK" << endl;
00096 cout << " Get this macro form $(STAR)/StRoot/macro/StarFromWeb.C and customize it for fun" << endl;
00097
00098
00099
00100 }