]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant3/TPaveTree.cxx
Use directly (TGeant3*)gMC for call to TGeant3 specific functions
[u/mrichter/AliRoot.git] / TGeant3 / TPaveTree.cxx
1 ///////////////////////////////////////////////////////////////////////////////
2 //                                                                           //
3 //  Interface Class to the Geant3.21 MonteCarlo                              //
4 //  Author :    Rene Brun   08/12/98                                         //
5 //                                                                           //
6 //  A TPaveTree is a TPaveLabel  specialized to draw Geant GDtree            //
7 //                                                                           //
8 //  When a TPaveTree object is drawn in a canvas, one can:                   //
9 //    - double click to draw the spec                                        //
10 //    - select pop-up item DrawTree to draw its tree                         //
11 //    - select pop-up item DrawTreeParent to draw its parent tree            //
12 //                                                                           //
13 //Begin_Html
14 /*
15 <img src="picts/TPaveTreeClass.gif">
16 */
17 //End_Html
18 //                                                                           //
19 ///////////////////////////////////////////////////////////////////////////////
20 #include <fstream.h>
21 #include <iostream.h>
22
23 #include <TROOT.h>
24 #include <TVirtualPad.h>
25 #include <Buttons.h>
26 #include "TPaveTree.h"
27 #include "TGeant3.h"
28
29
30 ClassImp(TPaveTree)
31
32 //_____________________________________________________________________________
33 TPaveTree::TPaveTree(): TPaveLabel()
34 {
35   //
36   // Default Constructor
37   //
38 }
39
40 //_____________________________________________________________________________
41 TPaveTree::TPaveTree(Coord_t x1, Coord_t y1,Coord_t x2, Coord_t  y2, 
42                      const Text_t *label)
43   :TPaveLabel(x1,y1,x2,y2,label,"br")
44 {
45   //
46   // TPaveTree normal constructor
47   //
48   SetName(label);
49 }
50
51 //_____________________________________________________________________________
52 TPaveTree::~TPaveTree()
53 {
54   //
55   // Standard Destructor
56   //
57 }
58
59 //_____________________________________________________________________________
60 TPaveTree::TPaveTree(const TPaveTree &PaveTree)
61 {
62   //
63   // Copy Constructor
64   //
65   ((TPaveTree&)PaveTree).Copy(*this);
66 }
67
68 //_____________________________________________________________________________
69 void TPaveTree::Copy(TObject &obj)
70 {
71   //
72   //  Copy this PaveTree to PaveTree
73   //
74   TPaveLabel::Copy(obj);
75 }
76
77 //_____________________________________________________________________________
78 void TPaveTree::DrawSpec()
79 {
80   //
81   //  Draw specs of the volume in this TPaveTree
82   //
83   gMC->DrawOneSpec(GetLabel());
84 }
85
86 //_____________________________________________________________________________
87 void TPaveTree::DrawTree(Int_t levmax, Int_t isel)
88 {
89   //
90   //  Draw tree of the volume in this TPaveTree
91   //
92   ((TGeant3*)gMC)->Gdtree(GetLabel(),levmax,isel);
93 }
94
95 //_____________________________________________________________________________
96 void TPaveTree::DrawTreeParent(Int_t levmax, Int_t isel)
97 {
98   //
99   //  Draw parent tree of the volume in this TPaveTree
100   //
101   ((TGeant3*)gMC)->GdtreeParent(GetLabel(),levmax,isel);
102 }
103
104 //_____________________________________________________________________________
105 void TPaveTree::ExecuteEvent(Int_t event, Int_t px, Int_t py)
106 {
107   //
108   // Process mouse events.
109   // Invokes TPabeLabel::ExecuteEvent. In case of a double click
110   // draw specs of volume corresponding to this TPaveTree
111   //
112   
113   TPaveLabel::ExecuteEvent(event,px,py);
114   
115   if (event == kButton1Double) {
116     //printf("TPaveTree::ExecuteEvent\n");
117     gPad->SetCursor(kWatch);
118     gMC->DrawOneSpec(GetLabel());
119   }
120 }
121
122 //_____________________________________________________________________________
123 void TPaveTree::SavePrimitive(ofstream &out, Option_t *)
124 {
125   //
126   // Save primitive as a C++ statement(s) on output stream out
127   //
128   char quote = '"';
129   out<<"   "<<endl;
130   if (gROOT->ClassSaved(TPaveTree::Class())) {
131     out<<"   ";
132   } else {
133     out<<"   TPaveTree *";
134   }
135   out<<"pvar = new TPaveTree("<<fX1<<","<<fY1<<","<<fX2<<","<<fY2
136      <<","<<quote<<fLabel<<quote<<","<<quote<<fOption<<quote<<");"<<endl;
137   
138   SaveFillAttributes(out,"pvar",0,1001);
139   SaveLineAttributes(out,"pvar",1,1,1);
140   SaveTextAttributes(out,"pvar",22,0,1,62,0);
141   
142   out<<"   pvar->Draw();"<<endl;
143 }