New geometry files from R.Barbera
[u/mrichter/AliRoot.git] / TGeant3 / TPaveTree.cxx
CommitLineData
fe4da5cc 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/*
1439f98e 15<img src="picts/TPaveTreeClass.gif">
fe4da5cc 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
cfce8870 29static TGeant3 *geant3=(TGeant3*)gMC;
30
31
fe4da5cc 32ClassImp(TPaveTree)
33
34//_____________________________________________________________________________
35TPaveTree::TPaveTree(): TPaveLabel()
36{
37 //
38 // Default Constructor
39 //
40}
41
42//_____________________________________________________________________________
43TPaveTree::TPaveTree(Coord_t x1, Coord_t y1,Coord_t x2, Coord_t y2,
44 const Text_t *label)
45 :TPaveLabel(x1,y1,x2,y2,label,"br")
46{
47 //
48 // TPaveTree normal constructor
49 //
50 SetName(label);
51}
52
53//_____________________________________________________________________________
54TPaveTree::~TPaveTree()
55{
56 //
57 // Standard Destructor
58 //
59}
60
61//_____________________________________________________________________________
62TPaveTree::TPaveTree(const TPaveTree &PaveTree)
63{
64 //
65 // Copy Constructor
66 //
67 ((TPaveTree&)PaveTree).Copy(*this);
68}
69
70//_____________________________________________________________________________
71void TPaveTree::Copy(TObject &obj)
72{
73 //
74 // Copy this PaveTree to PaveTree
75 //
76 TPaveLabel::Copy(obj);
77}
78
79//_____________________________________________________________________________
80void TPaveTree::DrawSpec()
81{
82 //
83 // Draw specs of the volume in this TPaveTree
84 //
cfce8870 85 gMC->DrawOneSpec(GetLabel());
fe4da5cc 86}
87
88//_____________________________________________________________________________
89void TPaveTree::DrawTree(Int_t levmax, Int_t isel)
90{
91 //
92 // Draw tree of the volume in this TPaveTree
93 //
fe4da5cc 94 geant3->Gdtree(GetLabel(),levmax,isel);
95}
96
97//_____________________________________________________________________________
98void TPaveTree::DrawTreeParent(Int_t levmax, Int_t isel)
99{
100 //
101 // Draw parent tree of the volume in this TPaveTree
102 //
fe4da5cc 103 geant3->GdtreeParent(GetLabel(),levmax,isel);
104}
105
106//_____________________________________________________________________________
107void TPaveTree::ExecuteEvent(Int_t event, Int_t px, Int_t py)
108{
109 //
110 // Process mouse events.
111 // Invokes TPabeLabel::ExecuteEvent. In case of a double click
112 // draw specs of volume corresponding to this TPaveTree
113 //
fe4da5cc 114
115 TPaveLabel::ExecuteEvent(event,px,py);
116
117 if (event == kButton1Double) {
118 //printf("TPaveTree::ExecuteEvent\n");
119 gPad->SetCursor(kWatch);
cfce8870 120 gMC->DrawOneSpec(GetLabel());
fe4da5cc 121 }
122}
123
124//_____________________________________________________________________________
125void TPaveTree::SavePrimitive(ofstream &out, Option_t *)
126{
127 //
128 // Save primitive as a C++ statement(s) on output stream out
129 //
130 char quote = '"';
131 out<<" "<<endl;
132 if (gROOT->ClassSaved(TPaveTree::Class())) {
133 out<<" ";
134 } else {
135 out<<" TPaveTree *";
136 }
137 out<<"pvar = new TPaveTree("<<fX1<<","<<fY1<<","<<fX2<<","<<fY2
138 <<","<<quote<<fLabel<<quote<<","<<quote<<fOption<<quote<<");"<<endl;
139
140 SaveFillAttributes(out,"pvar",0,1001);
141 SaveLineAttributes(out,"pvar",1,1,1);
142 SaveTextAttributes(out,"pvar",22,0,1,62,0);
143
144 out<<" pvar->Draw();"<<endl;
145}