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 textBoxClustersCollName_;
52 delete textBoxSimThresh_;
53 delete textBoxEcalRecHitsCollName_;
54 delete textBoxHcalRecHitsCollName_;
55 delete textBoxTrackerHitsCollName_;
56 delete textBoxEcalScorePlaneBranch_;
57
58 delete manager_;
59 }
60
72 bool SetFile(const TString file);
73
78 void NextEvent();
79
84
89
94
99
104
110 bool SetSimThresh();
111
115 void ColorClusters();
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 clustersCollName_ = "ecalClusters";
155 std::string ecalRecHitsCollName_ = "EcalRecHits";
157 std::string hcalRecHitsCollName_ = "HcalRecHits";
159 std::string trackerHitsCollName_ = "RecoilSimHits";
161 std::string ecalSimParticlesCollName_ = "EcalScoringPlaneHits";
162
165
168
169 TGTextEntry* textBoxClustersCollName_;
170 TGTextEntry* textBoxSimThresh_;
171 TGTextEntry* textBoxEcalRecHitsCollName_;
172 TGTextEntry* textBoxHcalRecHitsCollName_;
173 TGTextEntry* textBoxTrackerHitsCollName_;
174 TGTextEntry* textBoxEcalScorePlaneBranch_;
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
std::string clustersCollName_
name of ecal clusters collection in event tree
Definition Display.h:153
std::string ecalSimParticlesCollName_
name of ecal sim particles collection in
Definition Display.h:161
std::string ecalRecHitsCollName_
name of ecalRecHits collection in event tree
Definition Display.h:155
virtual ~Display()
Destructor Deletes hanging pointers from constructor and closes the TFile.
Definition Display.h:45
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
bool SetFile(const TString file)
Opens input file and attempts to obtain the necessary information from it.
Definition Display.cxx:182
void ColorClusters()
Colors cluster objects and redraws.
Definition Display.cxx:279
bool SetSimThresh()
Sets threshold energy from a SimParticle to be drawn from text box.
Definition Display.cxx:260
void NextEvent()
Goes forward one event unless the current event number equals the maximum event number.
Definition Display.cxx:205
std::string trackerHitsCollName_
name of recoil hitss collection in event tree
Definition Display.h:159
void draw(const std::string &name)
Templated draw method.
Definition Display.h:127
std::string getText(TGTextEntry *box) const
Get the text from the input text box.
Definition Display.h:121
void GetECALRecHitsCollInput()
Gets ecalRecHits collection name from text box.
Definition Display.cxx:240
void GetHCALRecHitsCollInput()
Gets hcalRecHits collection name from text box.
Definition Display.cxx:244
EveDetectorGeometry * theDetector_
drawing methods for the detector geometry
Definition Display.h:164
void GetEcalSimParticlesCollInput()
Gets ECAL Sim Particles Branch name from text box.
Definition Display.cxx:256
void GetTrackerHitsCollInput()
Gets trackerHits collection name from text box.
Definition Display.cxx:248
std::string hcalRecHitsCollName_
name of hcalRecHits collection in event tree
Definition Display.h:157
void GetClustersCollInput()
Gets clusters collection name from text box.
Definition Display.cxx:252
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:41
const T & getObject(const std::string &collectionName, const std::string &passName="") const
Get an general object from the event bus.
Definition Event.h:277
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