REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorHitsToSignalProcess.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_TRestDetectorHitsToSignalProcess
24 #define RestCore_TRestDetectorHitsToSignalProcess
25 
26 #include <TRestEventProcess.h>
27 
28 #include "TRestDetectorGas.h"
29 #include "TRestDetectorHitsEvent.h"
30 #include "TRestDetectorReadout.h"
31 #include "TRestDetectorSignalEvent.h"
32 #include "TRestPhysics.h"
33 
36  private:
39 
42 
45 
48 
49  void Initialize() override;
50 
51  void LoadDefaultConfig();
52 
53  protected:
55  Double_t fSampling = 1; //<
56 
58  Double_t fGasPressure = 1; // atm
59 
61  Double_t fElectricField = 100; //<
62 
64  Double_t fDriftVelocity = -1; // mm/us
65 
66  public:
67  RESTValue GetInputEvent() const override { return fHitsEvent; }
68  RESTValue GetOutputEvent() const override { return fSignalEvent; }
69 
70  void InitProcess() override;
71  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
72 
74  void PrintMetadata() override {
76 
77  RESTMetadata << "Sampling : " << fSampling << " us" << RESTendl;
78  RESTMetadata << "Electric field : " << fElectricField * units("V/cm") << " V/cm" << RESTendl;
79  RESTMetadata << "Gas pressure : " << fGasPressure << " atm" << RESTendl;
80  RESTMetadata << "Drift velocity : " << fDriftVelocity << " mm/us" << RESTendl;
81 
82  EndPrintProcess();
83  }
84 
85  TRestMetadata* GetProcessMetadata() const { return fReadout; }
86 
88  const char* GetProcessName() const override { return "hitsToSignal"; }
89 
91  TRestDetectorHitsToSignalProcess(const char* configFilename);
93 
94  ClassDefOverride(TRestDetectorHitsToSignalProcess, 3);
95 };
96 #endif
A process to transform a x,y,z coordinate hits into daq identified physical time signals.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
Double_t fSampling
The sampling rate in us.
void InitProcess() override
Process initialization. This process accesses the information inside TRestGeant4Metadata to identify ...
TRestDetectorHitsEvent * fHitsEvent
A pointer to the specific TRestDetectorHitsEvent output.
TRestDetectorGas * fGas
A pointer to the detector gas definition accessible to TRestRun.
Double_t fGasPressure
The gas pressure. If defined it will change the TRestDetectorGas pressure in atm.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
TRestDetectorReadout * fReadout
A pointer to the detector readout definition available to TRestRun.
const char * GetProcessName() const override
Returns the name of this process.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
Double_t fDriftVelocity
The drift velocity in mm/us. If it is negative, it will be calculated from TRestDetectorGas.
TRestDetectorSignalEvent * fSignalEvent
A pointer to the specific TRestDetectorHitsEvent input.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
Double_t fElectricField
The electric field in V/mm. Used to calculate the drift velocity if TRestDetectorGas is defined.
void Initialize() override
Function to initialize input/output event members and define the section name.
A metadata class to generate/store a readout description.
A base class for any REST event process.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
Definition: TRestEvent.h:38
A base class for any REST metadata class.
Definition: TRestMetadata.h:74
endl_t RESTendl
Termination flag object for TRestStringOutput.