REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorSignalToHitsProcess.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_TRestDetectorSignalToHitsProcess
24 #define RestCore_TRestDetectorSignalToHitsProcess
25 
26 #include <TRestEventProcess.h>
27 
28 #include "TRestDetectorGas.h"
29 #include "TRestDetectorHitsEvent.h"
30 #include "TRestDetectorReadout.h"
31 #include "TRestDetectorSignalEvent.h"
32 
35  private:
38 
41 
44 
47 
48  void Initialize() override;
49 
50  void LoadDefaultConfig();
51 
52  protected:
54  Double_t fElectricField = 100;
55 
57  Double_t fGasPressure = 1;
58 
60  Double_t fDriftVelocity = -1;
61 
63  TString fMethod = "tripleMaxAverage";
64 
65  // Time window to integrate in case intwindow method is requested, units (us)
66  Double_t fIntWindow = 5;
67 
68  // Threshold value for in case intwindow method is requested
69  Double_t fThreshold = 100.;
70 
71  public:
72  RESTValue GetInputEvent() const override { return fSignalEvent; }
73  RESTValue GetOutputEvent() const override { return fHitsEvent; }
74 
75  void InitProcess() override;
76  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
77 
78  void LoadConfig(const std::string& configFilename, const std::string& name = "");
79 
81  void PrintMetadata() override {
83 
84  RESTMetadata << "Electric field : " << fElectricField * units("V/cm") << " V/cm" << RESTendl;
85  RESTMetadata << "Gas pressure : " << fGasPressure << " atm" << RESTendl;
86  RESTMetadata << "Drift velocity : " << fDriftVelocity << " mm/us" << RESTendl;
87  RESTMetadata << "Signal to hits method : " << fMethod << RESTendl;
88  if (fMethod == "intwindow") {
89  RESTMetadata << "Threshold : " << fThreshold << " ADC" << RESTendl;
90  RESTMetadata << "Integral window : " << fIntWindow << " us" << RESTendl;
91  }
92 
93  EndPrintProcess();
94  }
95 
97  const char* GetProcessName() const override { return "signalToHits"; }
98 
100  TRestDetectorSignalToHitsProcess(const char* configFilename);
102 
103  ClassDefOverride(TRestDetectorSignalToHitsProcess, 4);
104 };
105 #endif
A metadata class to generate/store a readout description.
A process to transform a daq channel and physical time to spatial coordinates.
Double_t fDriftVelocity
The drift velocity in standard REST units (mm/us).
void InitProcess() override
Process initialization. Observable names are interpreted and auxiliar observable members,...
TRestDetectorHitsEvent * fHitsEvent
A pointer to the specific TRestDetectorHitsEvent output.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
Double_t fGasPressure
The gas pressure in atm. Only relevant if TRestDetectorGas is used.
TRestDetectorGas * fGas
A pointer to the detector gas definition accessible to TRestRun.
void Initialize() override
Function to initialize input/output event members and define the section name.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
Double_t fElectricField
The electric field in standard REST units (V/mm). Only relevant if TRestDetectorGas is used.
TString fMethod
The method used to transform the signal points to hits.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
TRestDetectorSignalEvent * fSignalEvent
A pointer to the specific TRestDetectorHitsEvent input.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
const char * GetProcessName() const override
Returns the name of this process.
TRestDetectorReadout * fReadout
A pointer to the detector readout definition accesible to TRestRun.
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.