Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
EDep::TEventDisplay Class Reference

A singleton class for an event display based on EVE. More...

#include <TEventDisplay.hxx>

Public Member Functions

virtual ~TEventDisplay ()
 Deconstruct the event display. More...
 
EDep::TGUIManagerGUI ()
 Return a reference to the gui manager. More...
 
EDep::TEventChangeManagerEventChange ()
 Return a reference to the event change manager. More...
 
int LinearColor (double val, double minVal, double maxVal)
 Get a color from the palette using a linear value scale. More...
 
int LogColor (double val, double minVal, double maxVal, double magScale=5.0)
 Get a color from the palette using a logarithmic value scale. More...
 
double CrudeEnergy (double charge)
 Convert an charge into a crude energy. More...
 

Static Public Member Functions

static TEventDisplayGet (void)
 

Private Member Functions

 TEventDisplay ()
 
void Init ()
 

Private Attributes

TGUIManagerfGUIManager
 
TEventChangeManagerfEventChangeManager
 
TPlotDigitsHits * fPlotDigitsHits
 
TPlotTimeCharge * fPlotTimeCharge
 
int fColorBase
 
int fColorCount
 
double fEnergyPerCharge
 

Static Private Attributes

static EDep::TEventDisplayfEventDisplay = NULL
 

Detailed Description

A singleton class for an event display based on EVE.

Definition at line 13 of file TEventDisplay.hxx.

Constructor & Destructor Documentation

EDep::TEventDisplay::~TEventDisplay ( )
virtual

Deconstruct the event display.

Definition at line 67 of file TEventDisplay.cxx.

67  {
68  std::cout << "Event display deconstructed" << std::endl;
69 }
QTextStream & endl(QTextStream &s)
EDep::TEventDisplay::TEventDisplay ( )
private

Definition at line 26 of file TEventDisplay.cxx.

26 {}

Member Function Documentation

double EDep::TEventDisplay::CrudeEnergy ( double  charge)
inline

Convert an charge into a crude energy.

Definition at line 36 of file TEventDisplay.hxx.

36 {return fEnergyPerCharge*charge;}
EDep::TEventChangeManager& EDep::TEventDisplay::EventChange ( )
inline

Return a reference to the event change manager.

Definition at line 27 of file TEventDisplay.hxx.

27 {return *fEventChangeManager;}
TEventChangeManager * fEventChangeManager
EDep::TEventDisplay & EDep::TEventDisplay::Get ( void  )
static

Get a pointer to the singleton instance of the event display. This creates the event display the first time it is called.

Definition at line 18 of file TEventDisplay.cxx.

18  {
19  if (!fEventDisplay) {
22  }
23  return *fEventDisplay;
24 }
static EDep::TEventDisplay * fEventDisplay
A singleton class for an event display based on EVE.
EDep::TGUIManager& EDep::TEventDisplay::GUI ( )
inline

Return a reference to the gui manager.

Definition at line 24 of file TEventDisplay.hxx.

24 {return *fGUIManager;}
TGUIManager * fGUIManager
void EDep::TEventDisplay::Init ( )
private

Definition at line 28 of file TEventDisplay.cxx.

28  {
29  TEveManager::Create();
30 
31  TGLViewer* glViewer = gEve->GetDefaultGLViewer();
32  glViewer->SetCurrentCamera(TGLViewer::kCameraPerspXOZ);
33  glViewer->SetGuideState(TGLUtil::kAxesEdge,kTRUE,kFALSE,0);
34  glViewer->SetDrawCameraCenter(kTRUE);
35 
36  // This is accessed through the GUI() method.
37  fGUIManager = new TGUIManager();
38 
39  // Create the event display manager. This needs the GUI, so it has to be
40  // done after TGUIManager is created.
41  fEventChangeManager = new TEventChangeManager();
42  fEventChangeManager->AddUpdateHandler(new TTrajectoryChangeHandler());
43  fEventChangeManager->AddUpdateHandler(new TG4HitChangeHandler());
44 
45  // Create the color palette. This is split into two halves. The first
46  // half is from dark to white and is used for negative values on the
47  // digitization plots, as well has the reconstruction objects. The second
48  // halve is from white to dark and is used for positive values on the
49  // digitization plot.
50  Double_t s[] = { 0.00, 0.20, 0.35, 0.43, 0.45, 0.50, 1.00};
51  Double_t r[] = { 0.00, 0.90, 1.00, 1.00, 1.00, 1.00, 0.00};
52  Double_t g[] = { 0.50, 0.10, 0.75, 0.90, 1.00, 1.00, 0.00};
53  Double_t b[] = { 0.30, 0.00, 0.00, 0.00, 0.00, 1.00, 0.00};
54  fColorCount = 200;
55  unsigned int abc = sizeof(s)/sizeof(s[0]);
56 
57  fColorBase = TColor::CreateGradientColorTable(abc, s, r, g, b,
58  fColorCount);
59 
60  fEnergyPerCharge = 1.0;
61 
62  std::cout << "Event display constructed" << std::endl;
63 
64 
65 }
static constexpr double g
Definition: Units.h:144
TEventChangeManager * fEventChangeManager
TGUIManager * fGUIManager
static bool * b
Definition: config.cpp:1043
static QCString * s
Definition: config.cpp:1042
QTextStream & endl(QTextStream &s)
void AddUpdateHandler(EDep::TVEventChangeHandler *handler)
int EDep::TEventDisplay::LinearColor ( double  val,
double  minVal,
double  maxVal 
)

Get a color from the palette using a linear value scale.

Definition at line 71 of file TEventDisplay.cxx.

71  {
72  int nCol = fColorCount/2;
73  int iValue = nCol*(value - minVal)/(maxVal - minVal);
74  nCol = std::max(0,std::min(iValue,nCol));
75  return fColorBase + nCol;
76 }
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
int EDep::TEventDisplay::LogColor ( double  val,
double  minVal,
double  maxVal,
double  magScale = 5.0 
)

Get a color from the palette using a logarithmic value scale.

Definition at line 78 of file TEventDisplay.cxx.

79  {
80  int nCol = fColorCount/2;
81  double scale = std::pow(10.0,magScale);
82  double nvalue = std::max(0.0,std::min((value-minVal)/(maxVal-minVal),1.0));
83  double lValue = std::log10(1.0+scale*nvalue)/magScale;
84  int iValue = nCol*lValue;
85  iValue = std::max(0,std::min(iValue,nCol-1));
86  return fColorBase + iValue;
87 }
constexpr T pow(T x)
Definition: pow.h:72
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55

Member Data Documentation

int EDep::TEventDisplay::fColorBase
private

Definition at line 62 of file TEventDisplay.hxx.

int EDep::TEventDisplay::fColorCount
private

Definition at line 65 of file TEventDisplay.hxx.

double EDep::TEventDisplay::fEnergyPerCharge
private

Definition at line 68 of file TEventDisplay.hxx.

TEventChangeManager* EDep::TEventDisplay::fEventChangeManager
private

Definition at line 52 of file TEventDisplay.hxx.

EDep::TEventDisplay * EDep::TEventDisplay::fEventDisplay = NULL
staticprivate

Definition at line 46 of file TEventDisplay.hxx.

TGUIManager* EDep::TEventDisplay::fGUIManager
private

Definition at line 49 of file TEventDisplay.hxx.

TPlotDigitsHits* EDep::TEventDisplay::fPlotDigitsHits
private

Definition at line 55 of file TEventDisplay.hxx.

TPlotTimeCharge* EDep::TEventDisplay::fPlotTimeCharge
private

Definition at line 59 of file TEventDisplay.hxx.


The documentation for this class was generated from the following files: