17#include "TRestDetectorSignalViewerProcess.h"
28TRestDetectorSignalViewerProcess::TRestDetectorSignalViewerProcess() {
Initialize(); }
30TRestDetectorSignalViewerProcess::TRestDetectorSignalViewerProcess(
const char* configFilename) {
37TRestDetectorSignalViewerProcess::~TRestDetectorSignalViewerProcess() {}
39void TRestDetectorSignalViewerProcess::LoadDefaultConfig() { SetTitle(
"Default config"); }
45 fSignalEvent =
nullptr;
52void TRestDetectorSignalViewerProcess::LoadConfig(
const string& configFilename,
const string& name) {
64 fSignalEvent = fInputSignalEvent;
81 if (eveCounter >= fDrawRefresh) {
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')
163TPad* 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.
TVector2 fCanvasSize
Canvas size.
TCanvas * GetCanvas() const
Get canvas.
TRestAnalysisTree * GetAnalysisTree() const
Return the local analysis tree (dummy)
TCanvas * fCanvas
< Canvas for some viewer event
void CreateCanvas()
Create the canvas.
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.