HGCal Test Beam  03a93d6239a951948e06fb3ef8dae4cbdebfad30
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
root.cc
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 /** PhysicsTools/PyGui/src/root.cc
3 
4  Description: A collection of simple Root utilities.
5 
6  Implementation:
7  As simple as possible
8 */
9 // Created: Summer-2008 Harrison B. Prosper
10 //-----------------------------------------------------------------------------
11 //$Revision: 1.1.1.1 $
12 
13 #include <cassert>
14 #include <algorithm>
15 
16 //#include "PhysicsTools/PyGui/interface/root.h"
17 #include "HGCal/TBEventDisplay/interface/root.h"
18 #include "TRootHelpDialog.h"
19 #include "TGFont.h"
20 #include "TGListBox.h"
21 #include "TGResourcePool.h"
22 #include "TGLUtil.h"
23 #include "TColor.h"
24 
25 using namespace std;
26 
27 
28 const TGClient*
29 root::Client() { return gClient; }
30 
31 const TGWindow*
32 root::GetRoot() { return gClient->GetRoot(); }
33 
34 Pixel_t
35 root::Color(std::string name)
36 {
37  Pixel_t pixel;
38  gClient->GetColorByName(name.c_str(), pixel);
39  return pixel;
40 }
41 
42 TGLBEntry*
43 root::GLBEntry(TGListBox* listbox,
44  std::string str, int id,
45  std::string font, int fontsize)
46 {
47  // Create font object
48 
49  char fontstr[256];
50  sprintf(fontstr,"-adobe-%s-*-*-%d-*-*-*-*-*-iso8859-1",
51  font.c_str(), fontsize);
52 
53  const TGFont* ufont = gClient->GetFont(fontstr);
54  if (!ufont)
55  ufont = gClient->GetResourcePool()->GetDefaultFont();
56 
57  // Create graphics context object
58 
59  GCValues_t val;
60  val.fMask = kGCFont;
61  val.fFont = ufont->GetFontHandle();
62  TGGC* uGC = gClient->GetGC(&val, kTRUE);
63 
64  TGTextLBEntry* entry = new TGTextLBEntry(listbox->GetContainer(),
65  new TGString(str.c_str()),
66  id,
67  uGC->GetGC(),
68  ufont->GetFontStruct());
69  return (TGLBEntry*)entry;
70 }
71 
72 void
73 root::DrawAxes(TGLViewer* viewer)
74 {
75  viewer->SetGuideState(TGLUtil::kAxesOrigin,
76  kTRUE,
77  kFALSE,
78  0);
79 }
80 
81 int
83 {
84  TColor::SetPalette(1, 0);
85  return TColor::GetNumberOfColors();
86 }
static Pixel_t Color(std::string name)
Definition: root.cc:35
static TGLBEntry * GLBEntry(TGListBox *listbox, std::string str, int id, std::string font="helvetica-medium-r", int fontsize=14)
Definition: root.cc:43
static void DrawAxes(TGLViewer *viewer)
Definition: root.cc:73
static const TGClient * Client()
Definition: root.cc:29
static const TGWindow * GetRoot()
Definition: root.cc:32
static int SetSpectrumPalette()
Definition: root.cc:82