REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestTrackViewerProcess.h
1 /*************************************************************************
2  * This file is part of the REST software framework. *
3  * *
4  * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5  * For more information see http://gifna.unizar.es/trex *
6  * *
7  * REST is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * REST is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have a copy of the GNU General Public License along with *
18  * REST in $REST_PATH/LICENSE. *
19  * If not, see http://www.gnu.org/licenses/. *
20  * For the list of contributors see $REST_PATH/CREDITS. *
21  *************************************************************************/
22 
23 #ifndef RestCore_TRestTrackViewerProcess
24 #define RestCore_TRestTrackViewerProcess
25 
26 #include <TGraph.h>
27 #include <TLegend.h>
28 
29 #include "TRestEventProcess.h"
30 #include "TRestTrackEvent.h"
31 
34  private:
35  TRestTrackEvent* fTrackEvent;
36 
37  // In case of alpha tracks one might be interested on drawing the origin and end from the analysis
38  bool fDrawOriginEnd = false;
39  bool fDrawHits = true;
40 
41  // Graph to store the origin of the track
42  std::vector<TGraph*> originGr{nullptr, nullptr};
43  // Graph to store the end of the track
44  std::vector<TGraph*> endGr{nullptr, nullptr};
45  // Graph to store legends
46  std::vector<TLegend*> legOrEnd{nullptr, nullptr};
47 
48  TCanvas* hCanvas = nullptr;
49 
50  void Initialize() override;
51 
52  protected:
53  // add here the members of your event process
54 
55  public:
56  RESTValue GetInputEvent() const override { return fTrackEvent; }
57  RESTValue GetOutputEvent() const override { return fTrackEvent; }
58 
59  void InitProcess() override;
60  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
61  void EndProcess() override;
62 
63  void PrintMetadata() override {
65 
66  RESTMetadata << "Draw Origin End : " << fDrawOriginEnd << RESTendl;
67 
68  EndPrintProcess();
69  }
70 
71  const char* GetProcessName() const override { return "trackViewer"; }
72 
73  // Constructor
75  // Destructor
77 
78  ClassDefOverride(TRestTrackViewerProcess, 1); // Template for a REST "event process" class inherited from
79  // TRestEventProcess
80 };
81 #endif
A base class for any REST event process.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
Definition: TRestEvent.h:38
endl_t RESTendl
Termination flag object for TRestStringOutput.
A generic viewer REST process to visualize track events.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
~TRestTrackViewerProcess()
Default destructor.
void Initialize() override
Function to initialize input/output event members and define the section name.
void InitProcess() override
Process initialization. It creates the canvas available in TRestEventProcess.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void EndProcess() override
Function to include required actions after all events have been processed.
TRestTrackViewerProcess()
Default constructor.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.