 |
Belle II Software
release-05-02-19
|
12 #include <ecl/modules/eclDisplay/EclDisplayModule.h>
15 #include <TApplication.h>
20 #include <framework/utilities/EnvironmentVariables.h>
23 #include <ecl/dataobjects/ECLCalDigit.h>
24 #include <ecl/modules/eclDisplay/EclFrame.h>
25 #include <ecl/modules/eclDisplay/EclData.h>
26 #include <ecl/modules/eclDisplay/geometry.h>
29 using namespace ECLDisplayUtility;
40 EclDisplayModule::EclDisplayModule() :
Module()
43 setDescription(
"Event display module for ECL.");
46 addParam(
"showDisplay", m_showDisplay,
47 "Show GUI. Off by default because GUI crashes automatic tests.",
false);
48 addParam(
"keepOpen", m_keepOpen,
49 "Keep window open after all events have been processed",
false);
50 addParam(
"displayEnergy", m_displayEnergy,
51 "If true, energy distribution per channel (shaper, crate) is displayed. Otherwise, number of counts is displayed",
false);
52 addParam(
"displayMode", m_displayMode,
53 "Default display mode. Can be later changed in GUI.", 9);
54 addParam(
"autoDisplay", m_autoDisplay,
55 "If true, events are displayed as soon as they are loaded.",
true);
56 addParam(
"InitFileName", m_eclMapperInitFileName,
57 "Initialization file for eclMapper", std::string(
"ecl/data/ecl_channels_map.txt"));
76 B2WARNING(
"Environment variable DISPLAY is not set, event display won't be opened");
91 throw std::runtime_error(
"ECLDisplay: failed to create temp file.");
98 m_app =
new TApplication(
"ECLDisplay App", 0, 0);
102 m_frame->Connect(
"CloseWindow()",
"Belle2::EclDisplayModule",
this,
"handleClosedFrame()");
104 B2DEBUG(100,
"EclDisplayModule::create ECLFrame");
117 B2FATAL(
"ECL Display:: Can't initialize eclChannelMapper");
126 int added_entries = 0;
128 for (
int i = 0; i <
m_eclarray.getEntries(); i++) {
139 gSystem->ProcessEvents();
143 if (added_entries > 0)
160 gSystem->ProcessEvents();
double getEnergy() const
Get Calibrated Energy.
TFile * m_tempfile
Temporary file to store TTree.
StoreArray< ECLCalDigit > m_eclarray
Displayed ECL events.
bool m_showDisplay
Show GUI.
Class to store calibrated ECLDigits: ECLCalDigits.
int m_displayMode
Default display mode.
bool m_frame_closed
Flag to check if EclFrame is closed;.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
bool m_keepOpen
Keep window open after all events have been processed.
TString m_tempname
Name of temporary file.
void update(bool reset_event_ranges=false)
Update time_min, time_max, event_counts and energy_sums.
bool m_displayEnergy
If true, energy distribution in ECL is displayed.
int addEvent(ECLCalDigit *event, int evtn)
Add ECLDigit event to inner TTree (m_tree).
void handleClosedFrame()
This method is called when EclFrame is closed.
virtual void initialize() override
Initialize EclChannelMapper.
virtual void terminate() override
Wait till EclFrame is closed then free allocated resources.
static std::string get(const std::string &name, const std::string &fallback="")
Get the value of an environment variable or the given fallback value if the variable is not set.
void initFrame()
Initialize EclFrame.
Root TGMainFrame that contains multiple widgets that display the ECLSimHit's w.r.t.
TApplication * m_app
Application to contain EclFrame.
Abstract base class for different kinds of events.
EclFrame * m_frame
Root GUI to display ECL data.
EclData * m_data
Class that provides interface for quick and comprehensive analysis of large number of events.
void loadNewData()
Update view of the data.
virtual ~EclDisplayModule()
Module destructor.
This class contains data for ECLSimHit's and provides several relevant conversion functions for bette...
bool initFromDB()
Initialize channel mapper from the conditions database.
ECL::ECLChannelMapper m_mapper
Channel mapper to show channel <-> (crate, shaper) distributions.
virtual void beginRun() override
Empty method.
int m_evtNum
Counter of added events.
bool m_autoDisplay
If true, events are displayed as soon as they are loaded.
virtual void endRun() override
Empty method.
virtual void event() override
Handle event.