REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawVetoAnalysisProcess.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_TRestRawVetoAnalysisProcess
24 #define RestCore_TRestRawVetoAnalysisProcess
25 
26 #include "TRestEventProcess.h"
27 #include "TRestRawSignalEvent.h"
28 
33  private:
35  TVector2 fBaseLineRange; //<
36 
38  TVector2 fRange; //<
39 
41  Int_t fThreshold;
42 
44  std::vector<double> fTimeWindow;
45 
47  std::vector<double> fVetoSignalId;
48 
50  std::vector<std::string> fVetoGroupIds;
51 
53  std::vector<std::string> fVetoGroupNames;
54 
56  std::vector<std::string> fPeakTime;
57 
59  std::vector<std::string> fPeakAmp;
60 
63 
65  Double_t fPointThreshold;
66  Double_t fSignalThreshold;
67  Int_t fPointsOverThreshold;
68 
69  void InitFromConfigFile() override;
70 
71  void Initialize() override;
72 
73  void LoadDefaultConfig();
74 
75  protected:
76  public:
77  RESTValue GetInputEvent() const override { return fSignalEvent; }
78  RESTValue GetOutputEvent() const override { return fSignalEvent; }
79 
80  void InitProcess() override;
81  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
82 
83  void LoadConfig(const std::string& configFilename, const std::string& name = "");
84 
85  void PrintMetadata() override;
86 
89 
91  const char* GetProcessName() const override { return "vetoAnalysis"; }
92 
94  std::vector<double> GetVetoSignalIDs() { return fVetoSignalId; }
95  double GetVetoSignalIDs(Int_t index) {
96  if (index >= (int)fVetoSignalId.size()) return -1;
97  return fVetoSignalId[index];
98  }
99 
101  std::pair<std::vector<std::string>, std::vector<std::string>> GetVetoGroups() {
102  std::pair<std::vector<std::string>, std::vector<std::string>> output;
103  output.first = fVetoGroupNames;
104  output.second = fVetoGroupIds;
105  return output;
106  }
107 
108  Int_t GetGroupIndex(std::string groupName);
109  std::string GetGroupIds(std::string groupName);
110 
112  TRestRawVetoAnalysisProcess(const char* configFilename);
113 
115 
116  // If new members are added, removed or modified in this class version number
117  // must be increased!
118  ClassDefOverride(TRestRawVetoAnalysisProcess, 2);
119 };
120 #endif
A base class for any REST event process.
A base class for any REST event.
Definition: TRestEvent.h:38
An event container for time rawdata signals with fixed length.
const char * GetProcessName() const override
Returns the name of this process.
TRestEventProcess * Maker()
Returns a new instance of this class.
std::vector< double > fVetoSignalId
Veto signal IDs.
std::pair< std::vector< std::string >, std::vector< std::string > > GetVetoGroups()
Returns the veto group names and IDs.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
std::vector< std::string > fPeakTime
Peak Time observable names.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
void Initialize() override
Function to initialize input/output event members and define the section name and library version.
Int_t fThreshold
Threshold of the vetoes.
Double_t fPointThreshold
PointsOverThreshold() Parameters:
void InitProcess() override
Function to use in initialization of process members before starting to process the event.
TRestRawSignalEvent * fSignalEvent
A pointer to the specific TRestRawSignalEvent.
std::vector< std::string > fPeakAmp
Max peak amplitude observable names.
TVector2 fRange
The range used to calculate the veto signal parameters.
std::vector< std::string > fVetoGroupIds
Veto signal IDs per group.
void InitFromConfigFile() override
Function reading input parameters from the RML TRestRawVetoAnalysisProcess section.
std::string GetGroupIds(std::string groupName)
Function that returns a string of the signal IDs for the specified veto group.
TRestRawVetoAnalysisProcess()
Default constructor.
Int_t GetGroupIndex(std::string groupName)
Function that returns the index of a specified veto group within the group name vector and ID vector.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
TVector2 fBaseLineRange
The range used to calculate the baseline parameters from the veto signal.
std::vector< double > GetVetoSignalIDs()
Returns the veto IDs, if they where defined in a list.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
std::vector< std::string > fVetoGroupNames
Veto group Names.
std::vector< double > fTimeWindow
Peak time window for cut.