1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 ///////////////////////////////////////////////////////////////////////////////
22 // Interface Class to the Geant3.21 MonteCarlo //
23 // Author : Rene Brun 08/12/98 //
25 // A TPaveTree is a TPaveLabel specialized to draw Geant GDtree //
27 // When a TPaveTree object is drawn in a canvas, one can: //
28 // - double click to draw the spec //
29 // - select pop-up item DrawTree to draw its tree //
30 // - select pop-up item DrawTreeParent to draw its parent tree //
34 <img src="picts/TPaveTreeClass.gif">
38 ///////////////////////////////////////////////////////////////////////////////
43 #include <TVirtualPad.h>
45 #include "TPaveTree.h"
51 //_____________________________________________________________________________
52 TPaveTree::TPaveTree(): TPaveLabel()
55 // Default Constructor
59 //_____________________________________________________________________________
60 TPaveTree::TPaveTree(Coord_t x1, Coord_t y1,Coord_t x2, Coord_t y2,
62 :TPaveLabel(x1,y1,x2,y2,label,"br")
65 // TPaveTree normal constructor
70 //_____________________________________________________________________________
71 TPaveTree::~TPaveTree()
74 // Standard Destructor
78 //_____________________________________________________________________________
79 TPaveTree::TPaveTree(const TPaveTree &PaveTree)
84 ((TPaveTree&)PaveTree).Copy(*this);
87 //_____________________________________________________________________________
88 void TPaveTree::Copy(TObject &obj)
91 // Copy this PaveTree to PaveTree
93 TPaveLabel::Copy(obj);
96 //_____________________________________________________________________________
97 void TPaveTree::DrawSpec()
100 // Draw specs of the volume in this TPaveTree
102 gMC->DrawOneSpec(GetLabel());
105 //_____________________________________________________________________________
106 void TPaveTree::DrawTree(Int_t levmax, Int_t isel)
109 // Draw tree of the volume in this TPaveTree
111 ((TGeant3*)gMC)->Gdtree(GetLabel(),levmax,isel);
114 //_____________________________________________________________________________
115 void TPaveTree::DrawTreeParent(Int_t levmax, Int_t isel)
118 // Draw parent tree of the volume in this TPaveTree
120 ((TGeant3*)gMC)->GdtreeParent(GetLabel(),levmax,isel);
123 //_____________________________________________________________________________
124 void TPaveTree::ExecuteEvent(Int_t event, Int_t px, Int_t py)
127 // Process mouse events.
128 // Invokes TPabeLabel::ExecuteEvent. In case of a double click
129 // draw specs of volume corresponding to this TPaveTree
132 TPaveLabel::ExecuteEvent(event,px,py);
134 if (event == kButton1Double) {
135 //printf("TPaveTree::ExecuteEvent\n");
136 gPad->SetCursor(kWatch);
137 gMC->DrawOneSpec(GetLabel());
141 //_____________________________________________________________________________
142 void TPaveTree::SavePrimitive(ofstream &out, Option_t *)
145 // Save primitive as a C++ statement(s) on output stream out
149 if (gROOT->ClassSaved(TPaveTree::Class())) {
154 out<<"pvar = new TPaveTree("<<fX1<<","<<fY1<<","<<fX2<<","<<fY2
155 <<","<<quote<<fLabel<<quote<<","<<quote<<fOption<<quote<<");"<<endl;
157 SaveFillAttributes(out,"pvar",0,1001);
158 SaveLineAttributes(out,"pvar",1,1,1);
159 SaveTextAttributes(out,"pvar",22,0,1,62,0);
161 out<<" pvar->Draw();"<<endl;