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