17 #include "TRestDetectorSignalViewerProcess.h"
20 #include <TPaveText.h>
28 TRestDetectorSignalViewerProcess::TRestDetectorSignalViewerProcess() { Initialize(); }
30 TRestDetectorSignalViewerProcess::TRestDetectorSignalViewerProcess(
const char* configFilename) {
32 if (LoadConfigFromFile(configFilename)) {
37 TRestDetectorSignalViewerProcess::~TRestDetectorSignalViewerProcess() {}
39 void TRestDetectorSignalViewerProcess::LoadDefaultConfig() { SetTitle(
"Default config"); }
42 SetSectionName(this->ClassName());
43 SetLibraryVersion(LIBRARY_VERSION);
45 fSignalEvent =
nullptr;
49 fSingleThreadOnly =
true;
52 void TRestDetectorSignalViewerProcess::LoadConfig(
const string& configFilename,
const string& name) {
53 if (LoadConfigFromFile(configFilename, name)) LoadDefaultConfig();
64 fSignalEvent = fInputSignalEvent;
78 GetCanvas()->SetGrid();
81 if (eveCounter >= fDrawRefresh) {
85 GetAnalysisTree()->PrintObservables();
87 for (
auto object : fDrawingObjects) {
90 fDrawingObjects.clear();
92 TPad* pad2 = DrawSignal(sgnCounter);
98 RESTcout.setborder(
"");
99 RESTcout.setorientation(TRestStringOutput::REST_Display_Orientation::kLeft);
100 RESTcout <<
"Press Enter to continue\nPress Esc to stop viewing\nPress n/p to "
112 while (getchar() !=
'\n')
115 }
else if (a == 110 || a == 78)
118 if (sgnCounter >= 0 && sgnCounter < fInputSignalEvent->GetNumberOfSignals()) {
119 TPad* pad2 = DrawSignal(sgnCounter);
124 RESTWarning <<
"cannot plot signal with id " << sgnCounter << RESTendl;
126 }
else if (a == 112 || a == 80)
129 if (sgnCounter >= 0 && sgnCounter < fInputSignalEvent->GetNumberOfSignals()) {
130 TPad* pad2 = DrawSignal(sgnCounter);
135 RESTWarning <<
"cannot plot signal with id " << sgnCounter << RESTendl;
138 while (getchar() !=
'\n')
163 TPad* TRestDetectorSignalViewerProcess::DrawSignal(Int_t signal) {
164 TPad* pad =
new TPad(this->GetName(), this->GetTitle(), 0, 0, 1, 1);
166 pad->DrawFrame(fSignalEvent->GetMinTime() - 1, -10, fSignalEvent->GetMaxTime() + 1,
167 fSignalEvent->GetMaxValue() + 10, this->GetTitle());
169 TMultiGraph* mg =
new TMultiGraph();
170 mg->SetTitle(this->GetTitle());
171 mg->GetXaxis()->SetTitle(
"time bins");
172 mg->GetYaxis()->SetTitleOffset(1.4);
173 mg->GetYaxis()->SetTitle(
"Energy");
175 for (
int n = 0; n < fSignalEvent->GetNumberOfSignals(); n++) {
176 TGraph* gr = fSignalEvent->GetSignal(n)->GetGraph((n + 1) % 6);
void Initialize() override
Making default settings.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
void EndProcess() override
To be executed at the end of the run (outside event loop)
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
A base class for any REST event.
@ REST_Debug
+show the defined debug messages
Int_t GetChar(std::string hint="Press a KEY to continue ...")
Helps to pause the program, printing a message before pausing.
Double_t StringToDouble(std::string in)
Gets a double from a string.
TVector2 StringTo2DVector(std::string in)
Gets a 2D-vector from a string.