LDMX Software
Display.h
Go to the documentation of this file.
1
6#ifndef EVENTDISPLAY_EVENTDISPLAY_H_
7#define EVENTDISPLAY_EVENTDISPLAY_H_
8
9#include <iostream>
10
13#include "Framework/Event.h"
14#include "Framework/EventFile.h"
15#include "TBranchElement.h"
16#include "TEveBrowser.h"
17#include "TEveElement.h"
18#include "TEveEventManager.h"
19#include "TEveManager.h"
20#include "TEveViewer.h"
21#include "TFile.h"
22#include "TGButton.h"
23#include "TGFrame.h"
24#include "TGLViewer.h"
25#include "TGTextEntry.h"
26#include "TRint.h"
27#include "TString.h"
28#include "TTree.h"
29
30namespace eventdisplay {
31
32class Display : public TGMainFrame {
33 public:
39 Display(TEveManager* manager, bool verbose);
40
45 virtual ~Display() {
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 }
60
72 bool setFile(const TString file);
73
78 void nextEvent();
79
84
89
94
99
104
111
116
117 private:
121 std::string getText(TGTextEntry* box) const { return box->GetText(); }
122
126 template <typename EventObjectType>
127 void draw(const std::string& name) {
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 }
142
143 private:
144 bool verbose_; //* verbosity flag
145
148
150 std::unique_ptr<framework::EventFile> the_file_;
151
153 std::string clusters_coll_name_ = "ecalClusters";
155 std::string ecal_rec_hits_coll_name_ = "EcalRecHits";
157 std::string hcal_rec_hits_coll_name_ = "HcalRecHits";
159 std::string tracker_hits_coll_name_ = "RecoilSimHits";
161 std::string ecal_sim_particles_coll_name_ = "EcalScoringPlaneHits";
162
165
168
169 TGTextEntry* text_box_clusters_coll_name_;
170 TGTextEntry* text_box_sim_thresh_;
171 TGTextEntry* text_box_ecal_rec_hits_coll_name_;
172 TGTextEntry* text_box_hcal_rec_hits_coll_name_;
173 TGTextEntry* text_box_tracker_hits_coll_name_;
174 TGTextEntry* text_box_ecal_score_plane_branch_;
175
177 TEveManager* manager_{nullptr};
178
179 ClassDef(Display, 2);
180};
181} // namespace eventdisplay
182
183#endif
Header file for EveDetectorGeometry Class.
Class implementing an event buffer system for storing event data.
TEveManager * manager_
event display manager
Definition Display.h:177
std::unique_ptr< framework::EventFile > the_file_
Handle to input file we will be reading.
Definition Display.h:150
Display(TEveManager *manager, bool verbose)
Constructor Builds window frame and and control panel.
Definition Display.cxx:13
std::string clusters_coll_name_
name of ecal clusters collection in event tree
Definition Display.h:153
bool setSimThresh()
Sets threshold energy from a SimParticle to be drawn from text box.
virtual ~Display()
Destructor Deletes hanging pointers from constructor and closes the TFile.
Definition Display.h:45
void getTrackerHitsCollInput()
Gets trackerHits collection name from text box.
Objects objects_
drawing methods for event objects
Definition Display.h:167
void getHcalRecHitsCollInput()
Gets hcalRecHits collection name from text box.
void nextEvent()
Goes forward one event unless the current event number equals the maximum event number.
std::string hcal_rec_hits_coll_name_
name of hcalRecHits collection in event tree
Definition Display.h:157
bool setFile(const TString file)
Opens input file and attempts to obtain the necessary information from it.
framework::Event the_event_
Event bus for reading from input file.
Definition Display.h:147
void draw(const std::string &name)
Templated draw method.
Definition Display.h:127
void getEcalSimParticlesCollInput()
Gets ECAL Sim Particles Branch name from text box.
void getClustersCollInput()
Gets clusters collection name from text box.
std::string getText(TGTextEntry *box) const
Get the text from the input text box.
Definition Display.h:121
EveDetectorGeometry * the_detector_
drawing methods for the detector geometry
Definition Display.h:164
void colorClusters()
Colors cluster objects and redraws.
std::string tracker_hits_coll_name_
name of recoil hitss collection in event tree
Definition Display.h:159
void getEcalRecHitsCollInput()
Gets ecalRecHits collection name from text box.
std::string ecal_rec_hits_coll_name_
name of ecalRecHits collection in event tree
Definition Display.h:155
std::string ecal_sim_particles_coll_name_
name of ecal sim particles collection in
Definition Display.h:161
Class that constructs the detector components for the event display.
Drawing methods for event objects.
Definition Objects.h:34
void draw(T o)
Not implemented.
Definition Objects.h:61
Implements an event buffer system for storing event data.
Definition Event.h:42
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