57#include "TRestRawSignalViewerProcess.h"
107 fSignalEvent =
nullptr;
147 if (eveCounter >= fDrawRefresh) {
153 for (
auto object : fDrawingObjects) {
157 fDrawingObjects.clear();
165 RESTcout.setborder(
"");
166 RESTcout.setorientation(TRestStringOutput::REST_Display_Orientation::kLeft);
167 RESTcout <<
"Press Enter to continue\nPress Esc to stop viewing\nPress n/p to "
179 while (getchar() !=
'\n')
182 }
else if (a == 110 || a == 78)
185 if (sgnCounter >= 0 && sgnCounter < fSignalEvent->GetNumberOfSignals()) {
191 RESTWarning <<
"cannot plot signal with id " << sgnCounter <<
RESTendl;
193 }
else if (a == 112 || a == 80)
196 if (sgnCounter >= 0 && sgnCounter < fSignalEvent->GetNumberOfSignals()) {
202 RESTWarning <<
"cannot plot signal with id " << sgnCounter <<
RESTendl;
205 while (getchar() !=
'\n')
230 TPad* pad =
new TPad(this->GetName(), this->GetTitle(), 0, 0, 1, 1);
234 fDrawingObjects.push_back((TObject*)pad);
236 TGraph* gr =
new TGraph();
237 fDrawingObjects.push_back((TObject*)gr);
241 RESTInfo <<
"Drawing signal. Event ID : " << fSignalEvent->GetID() <<
" Signal ID : " << sgnl->
GetID()
248 TGraph* gr2 =
new TGraph();
249 fDrawingObjects.push_back((TObject*)gr2);
251 gr2->SetLineWidth(2);
252 gr2->SetLineColor(2);
254 for (
int n = fBaseLineRange.X(); n < fBaseLineRange.Y(); n++)
255 gr2->SetPoint(n - fBaseLineRange.X(), n, sgnl->
GetData(n));
263 gr3[nGraphs] =
new TGraph();
264 fDrawingObjects.push_back((TObject*)gr3[nGraphs]);
265 gr3[nGraphs]->SetLineWidth(2);
266 gr3[nGraphs]->SetLineColor(3);
268 Int_t nPoints = pOver.size();
269 for (
int n = 0; n < nPoints; n++) {
270 gr3[nGraphs]->SetPoint(point, pOver[n], sgnl->
GetData(pOver[n]));
272 if (n + 1 < nPoints && pOver[n + 1] - pOver[n] > 1) {
273 gr3[nGraphs]->Draw(
"CP");
275 if (nGraphs > 4) cout <<
"Ngraphs : " << nGraphs << endl;
277 gr3[nGraphs] =
new TGraph();
278 fDrawingObjects.push_back((TObject*)gr3[nGraphs]);
279 gr3[nGraphs]->SetLineWidth(2);
280 gr3[nGraphs]->SetLineColor(3);
284 if (nPoints > 0) gr3[nGraphs]->Draw(
"CP");
TVector2 fCanvasSize
Canvas size.
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.
An event container for time rawdata signals with fixed length.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
TPad * DrawSignal(Int_t signal)
A helper method to draw signals in a pad.
TRestRawSignalViewerProcess()
Default constructor.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
void InitProcess() override
Process initialization. It creates the canvas available in TRestEventProcess.
void EndProcess() override
Function to include required actions after all events have been processed.
void Initialize() override
Function to initialize input/output event members and define the section name.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
~TRestRawSignalViewerProcess()
Default destructor.
void InitFromConfigFile() override
Function to read input parameters from the RML TRestRawSignalViewerProcess metadata section.
It defines a Short_t array with a physical parameter that evolves in time using a fixed time bin.
Int_t GetID() const
Returns the value of signal ID.
std::vector< Int_t > GetPointsOverThreshold() const
Returns a std::vector containing the indexes of data points over threshold.
Double_t GetData(Int_t n) const
It returns the data value of point n including baseline correction.
Int_t GetNumberOfPoints() const
Returns the actual number of points, or size of the signal.
@ 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.