REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorPositionMappingProcess.h
1 
12 #ifndef RestCore_TRestDetectorPositionMappingProcess
13 #define RestCore_TRestDetectorPositionMappingProcess
14 
15 #include <TH1D.h>
16 #include <TRestEventProcess.h>
17 
18 #include "TRestDetectorGainMap.h"
19 #include "TRestDetectorGas.h"
20 #include "TRestDetectorHitsEvent.h"
21 #include "TRestDetectorReadout.h"
22 #include "TRestDetectorSignalEvent.h"
23 
25  private:
26  TRestDetectorHitsEvent* fHitsEvent;
27  TRestDetectorReadout* fReadout;
28  TRestDetectorGainMap* fCalib;
29  TRestDetectorGas* fGas;
30 
31  void InitFromConfigFile() override;
32 
33  void Initialize() override;
34  // parameters
35  bool fApplyGainCorrection;
36  bool fCreateGainMap;
37  TVector2 fEnergyCutRange;
38  TVector2 fNHitsCutRange;
39  std::string fMappingSave;
40 
41  double fNBinsX;
42  double fNBinsY;
43  double fNBinsZ;
44 
45  // temp data
46  TH2D* fAreaThrIntegralSum;
47  TH2D* fAreaCounts;
48 
49  // analysis result
50  TH2F* fAreaGainMap;
51 
52  public:
53  RESTValue GetInputEvent() const override { return fHitsEvent; }
54  RESTValue GetOutputEvent() const override { return fHitsEvent; }
55 
56  void InitProcess() override;
57  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
58  void EndProcess() override;
59 
60  double GetCorrection2(double x, double y);
61  double GetCorrection3(double x, double y, double z);
62 
63  void PrintMetadata() override {
65 
66  RESTMetadata << "the mode is:" << RESTendl;
67  RESTMetadata << (fApplyGainCorrection ? "> " : " ")
68  << "Apply position correction std::map for spectrum " << RESTendl;
69  RESTMetadata << (fCreateGainMap ? "> " : " ")
70  << "Create new correction std::map for each position" << RESTendl;
71  RESTMetadata << "output mapping file: " << fMappingSave << RESTendl;
72  RESTMetadata << "Energy cut for Threshold integral: " << RESTValue(fEnergyCutRange) << RESTendl;
73  RESTMetadata << "Energy cut for NGoodSignals: " << RESTValue(fNHitsCutRange) << RESTendl;
74  RESTMetadata << "Binning: " << fNBinsX << ", " << fNBinsY << ", " << fNBinsZ << RESTendl;
75 
76  EndPrintProcess();
77  }
78 
79  const char* GetProcessName() const override { return "readoutAnalysis"; }
80 
82  TRestDetectorPositionMappingProcess(const char* configFilename);
83 
85 
86  ClassDefOverride(TRestDetectorPositionMappingProcess, 1);
87 };
88 #endif
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
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)
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
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
endl_t RESTendl
Termination flag object for TRestStringOutput.