Introducing Copyright include file
[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 29
fe4da5cc 30ClassImp(TPaveTree)
31
32//_____________________________________________________________________________
33TPaveTree::TPaveTree(): TPaveLabel()
34{
35 //
36 // Default Constructor
37 //
38}
39
40//_____________________________________________________________________________
41TPaveTree::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//_____________________________________________________________________________
52TPaveTree::~TPaveTree()
53{
54 //
55 // Standard Destructor
56 //
57}
58
59//_____________________________________________________________________________
60TPaveTree::TPaveTree(const TPaveTree &PaveTree)
61{
62 //
63 // Copy Constructor
64 //
65 ((TPaveTree&)PaveTree).Copy(*this);
66}
67
68//_____________________________________________________________________________
69void TPaveTree::Copy(TObject &obj)
70{
71 //
72 // Copy this PaveTree to PaveTree
73 //
74 TPaveLabel::Copy(obj);
75}
76
77//_____________________________________________________________________________
78void TPaveTree::DrawSpec()
79{
80 //
81 // Draw specs of the volume in this TPaveTree
82 //
cfce8870 83 gMC->DrawOneSpec(GetLabel());
fe4da5cc 84}
85
86//_____________________________________________________________________________
87void TPaveTree::DrawTree(Int_t levmax, Int_t isel)
88{
89 //
90 // Draw tree of the volume in this TPaveTree
91 //
2e5a1b64 92 ((TGeant3*)gMC)->Gdtree(GetLabel(),levmax,isel);
fe4da5cc 93}
94
95//_____________________________________________________________________________
96void TPaveTree::DrawTreeParent(Int_t levmax, Int_t isel)
97{
98 //
99 // Draw parent tree of the volume in this TPaveTree
100 //
2e5a1b64 101 ((TGeant3*)gMC)->GdtreeParent(GetLabel(),levmax,isel);
fe4da5cc 102}
103
104//_____________________________________________________________________________
105void 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 //
fe4da5cc 112
113 TPaveLabel::ExecuteEvent(event,px,py);
114
115 if (event == kButton1Double) {
116 //printf("TPaveTree::ExecuteEvent\n");
117 gPad->SetCursor(kWatch);
cfce8870 118 gMC->DrawOneSpec(GetLabel());
fe4da5cc 119 }
120}
121
122//_____________________________________________________________________________
123void 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}