REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorGarfieldDriftProcess.h
1
14
15#ifndef RestCore_TRestDetectorGarfieldDriftProcess
16#define RestCore_TRestDetectorGarfieldDriftProcess
17
18#include "TRestDetectorGas.h"
19
20#if defined USE_Garfield_OLD
21#include "AvalancheMC.hh"
22#include "ComponentBase.hh"
23#include "Sensor.hh"
24typedef AvalancheMC DRIFT_METHOD;
25#elif USE_Garfield
26#include "AvalancheMC.hh"
27#include "Component.hh"
28#include "Sensor.hh"
29typedef AvalancheMC DRIFT_METHOD;
30// TODO Could we have this as an option given through metadata?
31#endif
32
33#include <TRandom3.h>
34
35#include "TRestDetectorGeometry.h"
36#include "TRestDetectorHitsEvent.h"
37#include "TRestDetectorReadout.h"
38#include "TRestDetectorSignalEvent.h"
39#include "TRestEventProcess.h"
40
42 private:
43 void Initialize() override;
44
45 TRandom3* fRandom;
46
47 TRestDetectorHitsEvent* fInputHitsEvent;
48 TRestDetectorHitsEvent* fOutputHitsEvent;
49
50#if defined USE_Garfield
51 TRestDetectorReadout* fReadout;
52 TRestDetectorGas* fGas;
53 TRestDetectorGeometry* fGeometry;
54
55 Garfield::Sensor* fGfSensor;
56 DRIFT_METHOD* fGfDriftMethod;
57
58 void InitFromConfigFile() override;
59
60 void LoadDefaultConfig();
61
62 Int_t FindModule(Int_t readoutPlane, Double_t x, Double_t y);
63 Int_t FindChannel(Int_t module, Double_t x, Double_t y);
64#endif
65 protected:
66#if defined USE_Garfield
67 Double_t fGasPressure = -1; // atm
68 // Double_t fElectricField; // V/cm
69 Double_t fDriftPotential; // V
70 Double_t fPEReduction; // reduction factor of primary electrons to track
71 double fStopDistance;
72
73 TString fGDML_Filename;
74
75#endif
76 public:
77 RESTValue GetInputEvent() const override { return fInputHitsEvent; }
78 RESTValue GetOutputEvent() const override { return fOutputHitsEvent; }
79
80 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
81
82#if defined USE_Garfield
83 void InitProcess() override;
84 void EndProcess() override;
85
86 void LoadConfig(const std::string& configFilename, const std::string& name = "");
87
88 void PrintMetadata() override {
90
91 // std::cout << "Electric field : " << fElectricField << " V/cm"
92 // << endl;
93 RESTMetadata << "Drift electrode potential : " << fDriftPotential << " V" << RESTendl;
94 RESTMetadata << "Gas pressure : " << fGasPressure << " atm" << RESTendl;
95 RESTMetadata << "Electron reduction factor : " << fPEReduction << RESTendl;
96 RESTMetadata << "Drift stop distance : " << fStopDistance << " mm" << RESTendl;
97
98 EndPrintProcess();
99 }
100
101 TRestMetadata* GetProcessMetadata() const { return fReadout; }
102
103 const char* GetProcessName() const override { return "garfieldDrift"; }
104
105 Garfield::Sensor* GetGfSensor() { return fGfSensor; }
106
107 // Constructor
109 TRestDetectorGarfieldDriftProcess(const char* configFilename);
110 // Destructor
112#endif
113 ClassDefOverride(TRestDetectorGarfieldDriftProcess,
114 1); // Template for a REST "event process" class inherited from
115 // TRestEventProcess
116};
117#endif
void Initialize() override
Making default settings.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
A metadata class to generate/store a readout description.
A base class for any REST event process.
virtual void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
virtual void EndProcess()
To be executed at the end of the run (outside event loop)
void BeginPrintProcess()
[name, cut range]
virtual void InitProcess()
To be executed at the beginning of the run (outside event loop)
A base class for any REST event.
Definition: TRestEvent.h:38
A base class for any REST metadata class.
Definition: TRestMetadata.h:70
virtual void PrintMetadata()
Implemented it in the derived metadata class to print out specific metadata information.
endl_t RESTendl
Termination flag object for TRestStringOutput.