LDMX Software
eventdisplay::Display Class Reference

Public Member Functions

 Display (TEveManager *manager, bool verbose)
 Constructor Builds window frame and and control panel.
 
virtual ~Display ()
 Destructor Deletes hanging pointers from constructor and closes the TFile.
 
bool setFile (const TString file)
 Opens input file and attempts to obtain the necessary information from it.
 
void nextEvent ()
 Goes forward one event unless the current event number equals the maximum event number.
 
void getEcalRecHitsCollInput ()
 Gets ecalRecHits collection name from text box.
 
void getClustersCollInput ()
 Gets clusters collection name from text box.
 
void getTrackerHitsCollInput ()
 Gets trackerHits collection name from text box.
 
void getHcalRecHitsCollInput ()
 Gets hcalRecHits collection name from text box.
 
void getEcalSimParticlesCollInput ()
 Gets ECAL Sim Particles Branch name from text box.
 
bool setSimThresh ()
 Sets threshold energy from a SimParticle to be drawn from text box.
 
void colorClusters ()
 Colors cluster objects and redraws.
 

Private Member Functions

std::string getText (TGTextEntry *box) const
 Get the text from the input text box.
 
template<typename EventObjectType >
void draw (const std::string &name)
 Templated draw method.
 
 ClassDef (Display, 2)
 

Private Attributes

bool verbose_
 
framework::Event the_event_ {"display"}
 Event bus for reading from input file.
 
std::unique_ptr< framework::EventFilethe_file_
 Handle to input file we will be reading.
 
std::string clusters_coll_name_ = "ecalClusters"
 name of ecal clusters collection in event tree
 
std::string ecal_rec_hits_coll_name_ = "EcalRecHits"
 name of ecalRecHits collection in event tree
 
std::string hcal_rec_hits_coll_name_ = "HcalRecHits"
 name of hcalRecHits collection in event tree
 
std::string tracker_hits_coll_name_ = "RecoilSimHits"
 name of recoil hitss collection in event tree
 
std::string ecal_sim_particles_coll_name_ = "EcalScoringPlaneHits"
 name of ecal sim particles collection in
 
EveDetectorGeometrythe_detector_ {nullptr}
 drawing methods for the detector geometry
 
Objects objects_
 drawing methods for event objects
 
TGTextEntry * text_box_clusters_coll_name_
 
TGTextEntry * text_box_sim_thresh_
 
TGTextEntry * text_box_ecal_rec_hits_coll_name_
 
TGTextEntry * text_box_hcal_rec_hits_coll_name_
 
TGTextEntry * text_box_tracker_hits_coll_name_
 
TGTextEntry * text_box_ecal_score_plane_branch_
 
TEveManager * manager_ {nullptr}
 event display manager
 

Detailed Description

Definition at line 32 of file Display.h.

Constructor & Destructor Documentation

◆ Display()

eventdisplay::Display::Display ( TEveManager * manager,
bool verbose )

Constructor Builds window frame and and control panel.

Imports geometry from EveDetectorGeometry.

Definition at line 13 of file Display.cxx.

14 : TGMainFrame(gClient->GetRoot(), 320, 320), verbose_(verbose) {
15 /****************************************************************************
16 * GUI Set Up
17 ***************************************************************************/
18
19 SetWindowName("LDMX Event Display");
20
21 manager_ = manager;
22 TGLViewer* viewer = manager_->GetDefaultGLViewer();
23 viewer->UseLightColorSet();
24
25 if (verbose_) {
26 std::cout << "[ Display ] : Drawing detector geometry... " << std::flush;
27 }
28
29 // when the first TGeoShape (a TGeoTube) is drawn, ROOT creates a default
30 // geometry for this drawing and
31 // prints an Info statement to std-out. Currently, I can't figure out how to
32 // turn this behavior off.
33 the_detector_ = new EveDetectorGeometry();
34
35 manager_->AddEvent(new TEveEventManager("LDMX Detector", ""));
36 manager_->AddElement(the_detector_->getECAL());
37 manager_->AddElement(the_detector_->getHCAL());
39 manager_->AddEvent(new TEveEventManager("LDMX Event", ""));
40
41 if (verbose_) {
42 std::cout << "done" << std::endl;
43 std::cout << "[ Display ] : Constructing and linking buttons... "
44 << std::flush;
45 }
46
47 TGVerticalFrame* contents = new TGVerticalFrame(this, 1000, 1200);
48 TGHorizontalFrame* commandFrameNextEvent =
49 new TGHorizontalFrame(contents, 100, 0);
50 TGHorizontalFrame* commandFrameColorClusters =
51 new TGHorizontalFrame(contents, 100, 0);
52 TGHorizontalFrame* commandFrameEcalClusterBranch =
53 new TGHorizontalFrame(contents, 100, 0);
54 TGHorizontalFrame* commandFrameSimThresh =
55 new TGHorizontalFrame(contents, 100, 0);
56 TGHorizontalFrame* commandFrameEcalHitBranch =
57 new TGHorizontalFrame(contents, 100, 0);
58 TGHorizontalFrame* commandFrameHcalHitBranch =
59 new TGHorizontalFrame(contents, 100, 0);
60 TGHorizontalFrame* commandFrameTrackerHitsBranch =
61 new TGHorizontalFrame(contents, 100, 0);
62 TGHorizontalFrame* commandFrameEcalScorePlaneBranch =
63 new TGHorizontalFrame(contents, 100, 0);
64
65 TGButton* buttonColor =
66 new TGTextButton(commandFrameColorClusters, "Color Clusters");
67 commandFrameColorClusters->AddFrame(buttonColor,
68 new TGLayoutHints(kLHintsExpandX));
69 buttonColor->Connect("Pressed()", "eventdisplay::Display", this,
70 "ColorClusters()");
71
72 TGButton* buttonNext =
73 new TGTextButton(commandFrameNextEvent, "Next Event >>>");
74 commandFrameNextEvent->AddFrame(buttonNext,
75 new TGLayoutHints(kLHintsExpandX));
76 buttonNext->Connect("Pressed()", "eventdisplay::Display", this,
77 "NextEvent()");
78
79 text_box_clusters_coll_name_ =
80 new TGTextEntry(commandFrameEcalClusterBranch, new TGTextBuffer(100));
81 commandFrameEcalClusterBranch->AddFrame(text_box_clusters_coll_name_,
82 new TGLayoutHints(kLHintsExpandX));
83
84 TGButton* buttonClusterName =
85 new TGTextButton(commandFrameEcalClusterBranch, "Set Clusters Branch");
86 commandFrameEcalClusterBranch->AddFrame(buttonClusterName,
87 new TGLayoutHints(kLHintsExpandX));
88 buttonClusterName->Connect("Pressed()", "eventdisplay::Display", this,
89 "GetClustersCollInput()");
90
91 text_box_sim_thresh_ =
92 new TGTextEntry(commandFrameSimThresh, new TGTextBuffer(100));
93 commandFrameSimThresh->AddFrame(text_box_sim_thresh_,
94 new TGLayoutHints(kLHintsExpandX));
95
96 TGButton* buttonDrawThresh =
97 new TGTextButton(commandFrameSimThresh, "Sim P [MeV] Threshold");
98 commandFrameSimThresh->AddFrame(buttonDrawThresh,
99 new TGLayoutHints(kLHintsExpandX));
100 buttonDrawThresh->Connect("Pressed()", "eventdisplay::Display", this,
101 "SetSimThresh()");
102
103 text_box_ecal_rec_hits_coll_name_ =
104 new TGTextEntry(commandFrameEcalHitBranch, new TGTextBuffer(100));
105 commandFrameEcalHitBranch->AddFrame(text_box_ecal_rec_hits_coll_name_,
106 new TGLayoutHints(kLHintsExpandX));
107
108 TGButton* buttonSetECALBranch =
109 new TGTextButton(commandFrameEcalHitBranch, "Set ECAL RecHits Branch");
110 commandFrameEcalHitBranch->AddFrame(buttonSetECALBranch,
111 new TGLayoutHints(kLHintsExpandX));
112 buttonSetECALBranch->Connect("Pressed()", "eventdisplay::Display", this,
113 "GetECALRecHitsCollInput()");
114
115 text_box_hcal_rec_hits_coll_name_ =
116 new TGTextEntry(commandFrameHcalHitBranch, new TGTextBuffer(100));
117 commandFrameHcalHitBranch->AddFrame(text_box_hcal_rec_hits_coll_name_,
118 new TGLayoutHints(kLHintsExpandX));
119
120 TGButton* buttonSetHCALBranch =
121 new TGTextButton(commandFrameHcalHitBranch, "Set HCAL RecHits Branch");
122 commandFrameHcalHitBranch->AddFrame(buttonSetHCALBranch,
123 new TGLayoutHints(kLHintsExpandX));
124 buttonSetHCALBranch->Connect("Pressed()", "eventdisplay::Display", this,
125 "GetHCALRecHitsCollInput()");
126
127 text_box_tracker_hits_coll_name_ =
128 new TGTextEntry(commandFrameTrackerHitsBranch, new TGTextBuffer(100));
129 commandFrameTrackerHitsBranch->AddFrame(text_box_tracker_hits_coll_name_,
130 new TGLayoutHints(kLHintsExpandX));
131
132 TGButton* buttonSetRecoilBranch =
133 new TGTextButton(commandFrameTrackerHitsBranch, "Set Recoil Sims Branch");
134 commandFrameTrackerHitsBranch->AddFrame(buttonSetRecoilBranch,
135 new TGLayoutHints(kLHintsExpandX));
136 buttonSetRecoilBranch->Connect("Pressed()", "eventdisplay::Display", this,
137 "GetTrackerHitsCollInput()");
138
139 text_box_ecal_score_plane_branch_ =
140 new TGTextEntry(commandFrameEcalScorePlaneBranch, new TGTextBuffer(100));
141 commandFrameEcalScorePlaneBranch->AddFrame(text_box_ecal_score_plane_branch_,
142 new TGLayoutHints(kLHintsExpandX));
143
144 TGButton* buttonSetSimParticlesBranch =
145 new TGTextButton(commandFrameEcalScorePlaneBranch, "Set Ecal SP Branch");
146 commandFrameEcalScorePlaneBranch->AddFrame(buttonSetSimParticlesBranch,
147 new TGLayoutHints(kLHintsExpandX));
148 buttonSetSimParticlesBranch->Connect("Pressed()", "eventdisplay::Display",
149 this, "GetEcalSimParticlesCollInput()");
150
151 // Order from top to bottom here
152 contents->AddFrame(commandFrameEcalHitBranch,
153 new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
154 contents->AddFrame(commandFrameHcalHitBranch,
155 new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
156 contents->AddFrame(commandFrameTrackerHitsBranch,
157 new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
158 contents->AddFrame(commandFrameEcalScorePlaneBranch,
159 new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
160 contents->AddFrame(commandFrameEcalClusterBranch,
161 new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
162 contents->AddFrame(commandFrameNextEvent,
163 new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
164 contents->AddFrame(commandFrameColorClusters,
165 new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
166 contents->AddFrame(commandFrameSimThresh,
167 new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
168
169 AddFrame(contents, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));
170
171 MapSubwindows();
172 Resize(GetDefaultSize());
173 MapWindow();
174
175 manager_->FullRedraw3D(kTRUE);
176
177 if (verbose_) {
178 std::cout << "done" << std::endl;
179 }
180}
TEveManager * manager_
event display manager
Definition Display.h:177
EveDetectorGeometry * the_detector_
drawing methods for the detector geometry
Definition Display.h:164
TEveElement * getHCAL()
Access HCAL Eve Element.
TEveElement * getECAL()
Access ECAL Eve Element.
TEveElement * getRecoilTracker()
Access Recoil Tracker Eve Element.

References eventdisplay::EveDetectorGeometry::getECAL(), eventdisplay::EveDetectorGeometry::getHCAL(), eventdisplay::EveDetectorGeometry::getRecoilTracker(), manager_, and the_detector_.

◆ ~Display()

virtual eventdisplay::Display::~Display ( )
inlinevirtual

Destructor Deletes hanging pointers from constructor and closes the TFile.

Definition at line 45 of file Display.h.

45 {
46 // need to delete EventFile so that it is deleted before Event
47 the_file_.reset(nullptr);
48
49 delete theDetector_;
50
51 delete text_box_clusters_coll_name_;
52 delete text_box_sim_thresh_;
53 delete text_box_ecal_rec_hits_coll_name_;
54 delete text_box_hcal_rec_hits_coll_name_;
55 delete text_box_tracker_hits_coll_name_;
56 delete text_box_ecal_score_plane_branch_;
57
58 delete manager_;
59 }
std::unique_ptr< framework::EventFile > the_file_
Handle to input file we will be reading.
Definition Display.h:150

References manager_, and the_file_.

Member Function Documentation

◆ draw()

template<typename EventObjectType >
void eventdisplay::Display::draw ( const std::string & name)
inlineprivate

Templated draw method.

Definition at line 127 of file Display.h.

127 {
128 try {
129 auto event_object{the_event_.getObject<EventObjectType>(name)};
130 objects_.draw(event_object);
131 if (verbose_) {
132 std::cout << "[ Display ] : Loaded '" << name
133 << "' into memory as a EVE object." << std::endl;
134 }
135 } catch (const framework::exception::Exception& e) {
136 std::cerr << "[ Display ] : Unable to draw an event object." << std::endl;
137 std::cerr << "[" << e.name() << "] : " << e.message() << "\n"
138 << " at " << e.module() << ":" << e.line() << " in "
139 << e.function() << std::endl;
140 }
141 }
Objects objects_
drawing methods for event objects
Definition Display.h:167
framework::Event the_event_
Event bus for reading from input file.
Definition Display.h:147
void draw(T o)
Not implemented.
Definition Objects.h:61
const T & getObject(const std::string &collectionName, const std::string &passName) const
Get an general object from the event bus.
Definition Event.h:288
Standard base exception class with some useful output information.
Definition Exception.h:20
const std::string & function() const
Get the function name where the exception occurred.
Definition Exception.h:74
int line() const
Get the source line number where the exception occurred.
Definition Exception.h:80
const std::string & message() const
Get the message of the exception.
Definition Exception.h:62
const std::string & name() const
Get the name of the exception.
Definition Exception.h:56
const std::string & module() const
Get the source filename where the exception occurred.
Definition Exception.h:68

References eventdisplay::Objects::draw(), framework::exception::Exception::function(), framework::Event::getObject(), framework::exception::Exception::line(), framework::exception::Exception::message(), framework::exception::Exception::module(), framework::exception::Exception::name(), objects_, and the_event_.

◆ getText()

std::string eventdisplay::Display::getText ( TGTextEntry * box) const
inlineprivate

Get the text from the input text box.

Definition at line 121 of file Display.h.

121{ return box->GetText(); }

◆ setFile()

bool eventdisplay::Display::setFile ( const TString file)

Opens input file and attempts to obtain the necessary information from it.

Attempts to import the event objects from the event tree using the 'Get...' methods below.

Parameters
filename of file with events
Returns
true if successfully opened file and found tree named eventTreeName_
false unable to open file or find tree named eventTreeName_

◆ setSimThresh()

bool eventdisplay::Display::setSimThresh ( )

Sets threshold energy from a SimParticle to be drawn from text box.

Re-draws the display.

Returns
bool success check

Member Data Documentation

◆ clusters_coll_name_

std::string eventdisplay::Display::clusters_coll_name_ = "ecalClusters"
private

name of ecal clusters collection in event tree

Definition at line 153 of file Display.h.

◆ ecal_rec_hits_coll_name_

std::string eventdisplay::Display::ecal_rec_hits_coll_name_ = "EcalRecHits"
private

name of ecalRecHits collection in event tree

Definition at line 155 of file Display.h.

◆ ecal_sim_particles_coll_name_

std::string eventdisplay::Display::ecal_sim_particles_coll_name_ = "EcalScoringPlaneHits"
private

name of ecal sim particles collection in

Definition at line 161 of file Display.h.

◆ hcal_rec_hits_coll_name_

std::string eventdisplay::Display::hcal_rec_hits_coll_name_ = "HcalRecHits"
private

name of hcalRecHits collection in event tree

Definition at line 157 of file Display.h.

◆ manager_

TEveManager* eventdisplay::Display::manager_ {nullptr}
private

event display manager

Definition at line 177 of file Display.h.

177{nullptr};

Referenced by Display(), and ~Display().

◆ objects_

Objects eventdisplay::Display::objects_
private

drawing methods for event objects

Definition at line 167 of file Display.h.

Referenced by draw().

◆ text_box_clusters_coll_name_

TGTextEntry* eventdisplay::Display::text_box_clusters_coll_name_
private

Definition at line 169 of file Display.h.

◆ text_box_ecal_rec_hits_coll_name_

TGTextEntry* eventdisplay::Display::text_box_ecal_rec_hits_coll_name_
private

Definition at line 171 of file Display.h.

◆ text_box_ecal_score_plane_branch_

TGTextEntry* eventdisplay::Display::text_box_ecal_score_plane_branch_
private

Definition at line 174 of file Display.h.

◆ text_box_hcal_rec_hits_coll_name_

TGTextEntry* eventdisplay::Display::text_box_hcal_rec_hits_coll_name_
private

Definition at line 172 of file Display.h.

◆ text_box_sim_thresh_

TGTextEntry* eventdisplay::Display::text_box_sim_thresh_
private

Definition at line 170 of file Display.h.

◆ text_box_tracker_hits_coll_name_

TGTextEntry* eventdisplay::Display::text_box_tracker_hits_coll_name_
private

Definition at line 173 of file Display.h.

◆ the_detector_

EveDetectorGeometry* eventdisplay::Display::the_detector_ {nullptr}
private

drawing methods for the detector geometry

Definition at line 164 of file Display.h.

164{nullptr};

Referenced by Display().

◆ the_event_

framework::Event eventdisplay::Display::the_event_ {"display"}
private

Event bus for reading from input file.

Definition at line 147 of file Display.h.

147{"display"};

Referenced by draw().

◆ the_file_

std::unique_ptr<framework::EventFile> eventdisplay::Display::the_file_
private

Handle to input file we will be reading.

Definition at line 150 of file Display.h.

Referenced by ~Display().

◆ tracker_hits_coll_name_

std::string eventdisplay::Display::tracker_hits_coll_name_ = "RecoilSimHits"
private

name of recoil hitss collection in event tree

Definition at line 159 of file Display.h.

◆ verbose_

bool eventdisplay::Display::verbose_
private

Definition at line 144 of file Display.h.


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