REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestTrackAnalysisProcess.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_TRestTrackAnalysisProcess
24 #define RestCore_TRestTrackAnalysisProcess
25 
26 #include <TRestTrackEvent.h>
27 
28 #include "TRestEventProcess.h"
29 
32  private:
33 #ifndef __CINT__
34  TRestTrackEvent* fInputTrackEvent;
35  TRestTrackEvent* fOutputTrackEvent;
36 
37  std::vector<Double_t> fPreviousEventTime;
38 
39  Bool_t fCutsEnabled;
40 
41  std::vector<std::string> fTrack_LE_EnergyObservables;
42  std::vector<Double_t> fTrack_LE_Threshold;
43  std::vector<Int_t> nTracks_LE;
44 
45  std::vector<std::string> fTrack_HE_EnergyObservables;
46  std::vector<Double_t> fTrack_HE_Threshold;
47  std::vector<Int_t> nTracks_HE;
48 
49  std::vector<std::string> fTrack_En_EnergyObservables;
50  std::vector<Double_t> fTrack_En_Threshold;
51  std::vector<Int_t> nTracks_En;
52 
53  Bool_t fEnableTwistParameters;
54 
55  std::vector<TString> fTwistLowObservables;
56  std::vector<Double_t> fTwistLowTailPercentage;
57  std::vector<Double_t> fTwistLowValue;
58 
59  std::vector<TString> fTwistHighObservables;
60  std::vector<Double_t> fTwistHighTailPercentage;
61  std::vector<Double_t> fTwistHighValue;
62 
63  std::vector<TString> fTwistBalanceObservables;
64  std::vector<Double_t> fTwistBalanceTailPercentage;
65  std::vector<Double_t> fTwistBalanceValue;
66 
67  std::vector<TString> fTwistRatioObservables;
68  std::vector<Double_t> fTwistRatioTailPercentage;
69  std::vector<Double_t> fTwistRatioValue;
70 
71  std::vector<TString> fTwistWeightedLowObservables;
72  std::vector<Double_t> fTwistWeightedLowTailPercentage;
73  std::vector<Double_t> fTwistWeightedLowValue;
74 
75  std::vector<TString> fTwistWeightedHighObservables;
76  std::vector<Double_t> fTwistWeightedHighTailPercentage;
77  std::vector<Double_t> fTwistWeightedHighValue;
78 
79  std::vector<TString> fTwistLowObservables_X;
80  std::vector<Double_t> fTwistLowTailPercentage_X;
81  std::vector<Double_t> fTwistLowValue_X;
82 
83  std::vector<TString> fTwistHighObservables_X;
84  std::vector<Double_t> fTwistHighTailPercentage_X;
85  std::vector<Double_t> fTwistHighValue_X;
86 
87  std::vector<TString> fTwistBalanceObservables_X;
88  std::vector<Double_t> fTwistBalanceTailPercentage_X;
89  std::vector<Double_t> fTwistBalanceValue_X;
90 
91  std::vector<TString> fTwistRatioObservables_X;
92  std::vector<Double_t> fTwistRatioTailPercentage_X;
93  std::vector<Double_t> fTwistRatioValue_X;
94 
95  std::vector<TString> fTwistWeightedLowObservables_X;
96  std::vector<Double_t> fTwistWeightedLowTailPercentage_X;
97  std::vector<Double_t> fTwistWeightedLowValue_X;
98 
99  std::vector<TString> fTwistWeightedHighObservables_X;
100  std::vector<Double_t> fTwistWeightedHighTailPercentage_X;
101  std::vector<Double_t> fTwistWeightedHighValue_X;
102 
103  std::vector<TString> fTwistLowObservables_Y;
104  std::vector<Double_t> fTwistLowTailPercentage_Y;
105  std::vector<Double_t> fTwistLowValue_Y;
106 
107  std::vector<TString> fTwistHighObservables_Y;
108  std::vector<Double_t> fTwistHighTailPercentage_Y;
109  std::vector<Double_t> fTwistHighValue_Y;
110 
111  std::vector<TString> fTwistBalanceObservables_Y;
112  std::vector<Double_t> fTwistBalanceTailPercentage_Y;
113  std::vector<Double_t> fTwistBalanceValue_Y;
114 
115  std::vector<TString> fTwistRatioObservables_Y;
116  std::vector<Double_t> fTwistRatioTailPercentage_Y;
117  std::vector<Double_t> fTwistRatioValue_Y;
118 
119  std::vector<TString> fTwistWeightedLowObservables_Y;
120  std::vector<Double_t> fTwistWeightedLowTailPercentage_Y;
121  std::vector<Double_t> fTwistWeightedLowValue_Y;
122 
123  std::vector<TString> fTwistWeightedHighObservables_Y;
124  std::vector<Double_t> fTwistWeightedHighTailPercentage_Y;
125  std::vector<Double_t> fTwistWeightedHighValue_Y;
126 #endif
127 
128  void InitFromConfigFile() override;
129 
130  void Initialize() override;
131 
132  void LoadDefaultConfig();
133 
134  protected:
135  // add here the members of your event process
136 
137  TVector2 fNTracksXCut;
138  TVector2 fNTracksYCut;
139  Double_t fDeltaEnergy;
140 
141  public:
142  RESTValue GetInputEvent() const override { return fInputTrackEvent; }
143  RESTValue GetOutputEvent() const override { return fOutputTrackEvent; }
144 
145  void InitProcess() override;
146  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
147  void EndProcess() override;
148 
149  void LoadConfig(const std::string& configFilename, const std::string& name = "");
150 
151  void PrintMetadata() override {
153 
154  if (fCutsEnabled) {
155  std::cout << "Number of tracks in X cut : ( " << fNTracksXCut.X() << " , " << fNTracksXCut.Y()
156  << " ) " << std::endl;
157  std::cout << "Number of tracks in Y cut : ( " << fNTracksYCut.X() << " , " << fNTracksYCut.Y()
158  << " ) " << std::endl;
159  } else {
160  std::cout << std::endl;
161  std::cout << "No cuts have been enabled" << std::endl;
162  }
163 
164  EndPrintProcess();
165  }
166 
167  const char* GetProcessName() const override { return "trackAnalysis"; }
168 
169  // Constructor
171  TRestTrackAnalysisProcess(const char* configFilename);
172  // Destructor
174 
175  ClassDefOverride(TRestTrackAnalysisProcess, 1); // Template for a REST "event process" class inherited
176  // from TRestEventProcess
177 };
178 #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
An analysis REST process to extract valuable information from Track type of data.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
void Initialize() override
Making default settings.
void EndProcess() override
To be executed at the end of the run (outside event loop)