]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TGeant3/TPaveTree.cxx
Import gAlice from the signal file before InitGlobal() to allow detectors to use...
[u/mrichter/AliRoot.git] / TGeant3 / TPaveTree.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
ef42d733 18Revision 1.5 1999/09/29 09:24:31 fca
19Introduction of the Copyright and cvs Log
20
4c039060 21*/
22
fe4da5cc 23///////////////////////////////////////////////////////////////////////////////
24// //
25// Interface Class to the Geant3.21 MonteCarlo //
26// Author : Rene Brun 08/12/98 //
27// //
28// A TPaveTree is a TPaveLabel specialized to draw Geant GDtree //
29// //
30// When a TPaveTree object is drawn in a canvas, one can: //
31// - double click to draw the spec //
32// - select pop-up item DrawTree to draw its tree //
33// - select pop-up item DrawTreeParent to draw its parent tree //
34// //
35//Begin_Html
36/*
1439f98e 37<img src="picts/TPaveTreeClass.gif">
fe4da5cc 38*/
39//End_Html
40// //
41///////////////////////////////////////////////////////////////////////////////
42#include <fstream.h>
43#include <iostream.h>
44
45#include <TROOT.h>
46#include <TVirtualPad.h>
47#include <Buttons.h>
48#include "TPaveTree.h"
49#include "TGeant3.h"
50
cfce8870 51
fe4da5cc 52ClassImp(TPaveTree)
53
54//_____________________________________________________________________________
55TPaveTree::TPaveTree(): TPaveLabel()
56{
57 //
58 // Default Constructor
59 //
60}
61
62//_____________________________________________________________________________
63TPaveTree::TPaveTree(Coord_t x1, Coord_t y1,Coord_t x2, Coord_t y2,
64 const Text_t *label)
65 :TPaveLabel(x1,y1,x2,y2,label,"br")
66{
67 //
68 // TPaveTree normal constructor
69 //
70 SetName(label);
71}
72
73//_____________________________________________________________________________
74TPaveTree::~TPaveTree()
75{
76 //
77 // Standard Destructor
78 //
79}
80
fe4da5cc 81//_____________________________________________________________________________
82void TPaveTree::DrawSpec()
83{
84 //
85 // Draw specs of the volume in this TPaveTree
86 //
cfce8870 87 gMC->DrawOneSpec(GetLabel());
fe4da5cc 88}
89
90//_____________________________________________________________________________
91void TPaveTree::DrawTree(Int_t levmax, Int_t isel)
92{
93 //
94 // Draw tree of the volume in this TPaveTree
95 //
2e5a1b64 96 ((TGeant3*)gMC)->Gdtree(GetLabel(),levmax,isel);
fe4da5cc 97}
98
99//_____________________________________________________________________________
100void TPaveTree::DrawTreeParent(Int_t levmax, Int_t isel)
101{
102 //
103 // Draw parent tree of the volume in this TPaveTree
104 //
2e5a1b64 105 ((TGeant3*)gMC)->GdtreeParent(GetLabel(),levmax,isel);
fe4da5cc 106}
107
108//_____________________________________________________________________________
109void TPaveTree::ExecuteEvent(Int_t event, Int_t px, Int_t py)
110{
111 //
112 // Process mouse events.
113 // Invokes TPabeLabel::ExecuteEvent. In case of a double click
114 // draw specs of volume corresponding to this TPaveTree
115 //
fe4da5cc 116
117 TPaveLabel::ExecuteEvent(event,px,py);
118
119 if (event == kButton1Double) {
120 //printf("TPaveTree::ExecuteEvent\n");
121 gPad->SetCursor(kWatch);
cfce8870 122 gMC->DrawOneSpec(GetLabel());
fe4da5cc 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}