REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorHitsAnalysisProcess.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_TRestDetectorHitsAnalysisProcess
24 #define RestCore_TRestDetectorHitsAnalysisProcess
25 
26 #include <TCanvas.h>
27 #include <TH1D.h>
28 #include <TRestDetectorGas.h>
29 #include <TRestDetectorHitsEvent.h>
30 #include <TRestDetectorReadout.h>
31 #include <TRestDetectorSignalEvent.h>
32 #include <TRestEventProcess.h>
33 
36  private:
37  TRestDetectorHitsEvent* fInputHitsEvent;
38  TRestDetectorHitsEvent* fOutputHitsEvent;
39 
40  Bool_t fCylinderFiducial;
41  Bool_t fPrismFiducial;
42 
43  void InitFromConfigFile() override;
44 
45  void Initialize() override;
46 
47  void LoadDefaultConfig();
48 
49  protected:
50  // add here the members of your event process
51  //
52  TVector3 fFid_x0;
53  TVector3 fFid_x1;
54  Double_t fFid_R;
55  Double_t fFid_sX;
56  Double_t fFid_sY;
57  Double_t fFid_theta;
58 
59  public:
60  RESTValue GetInputEvent() const override { return fInputHitsEvent; }
61  RESTValue GetOutputEvent() const override { return fOutputHitsEvent; }
62 
63  void InitProcess() override;
64  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
65  void EndProcess() override;
66 
67  void LoadConfig(const std::string& configFilename, const std::string& name = "");
68 
69  void PrintMetadata() override {
71 
72  if (fCylinderFiducial) RESTMetadata << "Cylinder fiducial active" << RESTendl;
73  if (fPrismFiducial) RESTMetadata << "Prism fiducial active" << RESTendl;
74 
75  RESTMetadata << " -------------------" << RESTendl;
76  RESTMetadata << " Fiducial parameters" << RESTendl;
77  RESTMetadata << " -------------------" << RESTendl;
78  RESTMetadata << " x0 : (" << fFid_x0.X() << " , " << fFid_x0.Y() << " , " << fFid_x0.Z() << ")"
79  << RESTendl;
80  RESTMetadata << " x1 : (" << fFid_x1.X() << " , " << fFid_x1.Y() << " , " << fFid_x1.Z() << ")"
81  << RESTendl;
82  RESTMetadata << " R : " << fFid_R << RESTendl;
83  RESTMetadata << " sX : " << fFid_sX << RESTendl;
84  RESTMetadata << " sY : " << fFid_sY << RESTendl;
85  RESTMetadata << " -------------------" << RESTendl;
86 
87  EndPrintProcess();
88  }
89 
90  const char* GetProcessName() const override { return "hitsAnalysis"; }
91 
93  TRestDetectorHitsAnalysisProcess(const char* configFilename);
94 
96 
97  ClassDefOverride(TRestDetectorHitsAnalysisProcess, 1);
98 };
99 #endif
An analysis REST process to extract valuable information from Hits type of data.
void Initialize() override
Making default settings.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
void EndProcess() override
To be executed at the end of the run (outside event loop)
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
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.