StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MarkSensors.C
1 //*-- Author : Valery Fine 26/03/99 (E-mail: fine@bnl.gov)
2 // $Id: MarkSensors.C,v 1.4 2000/01/25 16:06:38 fisyak Exp $
3 // $Log: MarkSensors.C,v $
4 // Revision 1.4 2000/01/25 16:06:38 fisyak
5 // g2r -> g2t
6 //
7 // Revision 1.3 1999/05/21 15:33:52 kathy
8 // made sure Log & Id are in each file and also put in standard comment line with name of owner
9 //
10 // Revision 1.2 1999/05/06 03:21:24 fisyak
11 // synchronize FTPC and TPC slow/fast
12 //
13 // Revision 1.1 1999/04/15 20:37:49 fine
14 // new macro MarkSensors.C to generate St_Node and St_NodeView by St_geant_Maker
15 //
16 // Revision 1.2 1999/04/08 21:12:24 fine
17 // SubDetectorView macro has been introduced
18 //
19 // Revision 1.2 1999/03/29 19:17:54 fine
20 // x3d view has been activated. Some improvement as well
21 //
22 //=======================================================================
23 // owner: Valery Fine
24 // what it does:
25 //=======================================================================
26 {
27  // example to show how to generate the STAR/GEANT geometry sub-structure
28  // To run this example one needs the access to Internet
29  // To start this example launch ROOT as follows:
30  //
31  //*-* root.exe SubDetectorView.C
32  //
33 
34  // Begin_Html <P ALIGN=CENTER> <IMG SRC="gif/StarBMTC.gif"> </P> End_Html //
35 
36 // gROOT->Reset();
37 // printf( " Loading share libraries:\n");
38 // printf("St_base . . ."); gSystem->Load("St_base"); printf(" ..\n");
39 // printf("StChain . . ."); gSystem->Load("StChain"); printf(" ..\n");
40 // printf("St_Tables . . ."); gSystem->Load("St_Tables"); printf(" ..\n");
41 // printf("geometry . . ."); gSystem->Load("geometry"); printf(" ..\n");
42 // printf("St_g2t . . ."); gSystem->Load("St_g2t"); printf(" ..\n");
43 // printf("St_geant_Maker . . .");gSystem->Load("St_geant_Maker"); printf(" ..\n");
44 
45  if (!geant) return;
46  St_Node *hall = geant->Work();
47  // Remove hall from the list of ROOT nodes to make it free of ROOT control
48  St_DataSetIter volume(hall,0);
49 
50  // Get TGeant3 pointer:
51  TGeant3 *gGeant3 = TGeant3::Geant3();
52  if (!gGeant3) {
53  printf(" No TGeant was loaded yet !\n");
54  return;
55  }
56  // Mark the pieces of the whole detector to create sub-structure
57 
58  St_Node *node =0;
59  Int_t iAcceptedCounter = 0;
60  Int_t iRefusedCounter = 0;
61  while( node = (St_Node *) volume()) {
62  Char_t *nodeName = node->GetName();
63  if (nodeName && gGeant3->Agsens(nodeName)) {
64  iAcceptedCounter++;
65  node->Mark();
66  node->SetVisibility(1);
67  }
68  else iRefusedCounter++;
69  }
70 
71  // Create the "open" structure from the "closed" one
72  printf("%d nodes have been accepted and %d refused \n",iAcceptedCounter,iRefusedCounter);
73  TFile f("STAR","RECREATE");
74  gGeometry->Write();
75  f.Write();
76  f.Close();
77  St_NodeView *fullView = new St_NodeView(*hall);
78  // Create the "open" sub-structure from the full one
79  St_NodeView *s = new St_NodeView(fullView);
80 
81  printf( " Creating an empty TCanvas object to draw in\n");
82 
83 // s->Draw();
84 // gPad->Update();
85 }
virtual void SetVisibility(ENodeSEEN vis=TVolume::kBothVisible)
Definition: TVolume.cxx:753