CbmRoot
Loading...
Searching...
No Matches
CbmTrdRawToDigiR.h
Go to the documentation of this file.
1/* Copyright (C) 2020 Institut fuer Kernphysik, Goethe-Universitaet Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Etienne Bechtel [committer] */
4
5#ifndef CBMTRDRAWTODIGI_H
6#define CBMTRDRAWTODIGI_H
7
8#include "CbmTrdCheckUtil.h"
9#include "CbmTrdDigi.h"
10//#include "CbmSpadicRawMessage22.h"
11
12#include <FairRootManager.h>
13
14#include <TFile.h>
15#include <TH1D.h>
16#include <TH2D.h>
17
18#include <map>
19#include <string>
20#include <vector>
21
22class CbmTrdRawToDigiR : public TObject {
23
24
25public:
29
30 CbmTrdRawToDigiR(std::string readfile);
31
34 CbmTrdRawToDigiR(Double_t cal, Double_t tau, Int_t mode);
35
38 CbmTrdRawToDigiR(Double_t cal, Double_t tau, std::vector<Int_t> mask);
39
41 virtual ~CbmTrdRawToDigiR() { ; }
42
43 // CbmTrdDigi* MakeDigi(CbmSpadicRawMessage22* raw);
44 CbmTrdDigi* MakeDigi(std::vector<Int_t> samples, Int_t channel, Int_t uniqueModuleId, ULong64_t time,
45 Bool_t FN = false);
46
47 Float_t GetTimeShift(std::vector<Int_t> samples);
48 Double_t GetCharge(std::vector<Int_t> samples, Int_t shift = -1);
49
50 void SetCalibration(Double_t cal) { fCalibration = cal; }
51 void SetTau(Double_t tau) { fTau = tau; }
52 void SetRecoMode(Int_t mode) { fRecoMode = mode; }
53 void SetShapingOrder(Int_t order) { fShapingOrder = order; }
54 void SetRecoMask(std::vector<Int_t> mask) { fSampleMask = mask; }
55 void SetSetter(Bool_t set) { fSet = set; }
56 void SetReadFile(std::string file) { fReadFile = file; }
57 void SetWriteFile(std::string file) { fWriteFile = file; }
58 void SetMaxBin(Int_t bin) { fMaxBin = bin; }
59 void SetMinBin(Int_t bin) { fMinBin = bin; }
60 void SetPresamples(Int_t pre) { fPresamples = pre; }
61 void SetLookup(Int_t mode) { fLookUp = mode; }
62 void SetPars(Int_t mode, Double_t cal, Double_t tau, std::vector<Int_t> mask);
63 void Init();
64 void FillLookUps(std::string write = "");
65 void WriteMaps(std::string file = "") { (void) file; } //dummy for now
66 void ReadMaps(std::string file = "");
67 void SetDebug(Bool_t debug) { fDebug = debug; }
68 void SetQA(CbmTrdCheckUtil* qa) { fQA = qa; }
69
70
71 Bool_t GetSetter() { return fSet; }
72
73private:
76
77 Double_t fCalibration = 35. / 1.1107 / 0.8; // calibrating pulse height to MIP
78 Double_t fEReco = 0.; // calibrating energy reconstruction to the amount and position of used samples of the pulse
79 Double_t fTau = 120; // peaking time of the pulse
80 Int_t fRecoMode = 1; // pre defined mode for reconstruction samples
81 Int_t fShapingOrder = 1; // shaping order in analytic response calculation
82 Int_t fDynamicRange = 500; // maximum of ADC range to identiefy time shift
83 Int_t fHighBin = 3; // additional sample position for lookup table to identiefy time shift
84 Int_t fPresamples = 2; // additional sample position for lookup table to identiefy time shift
85 Int_t fMaxBin = 2 + fPresamples; // expected maximum position for the pulse
86 Int_t fMinBin = 1 + fPresamples; // additional sample position for lookup table
87 Float_t fExtrapolate = .2; // percentage extrapolation range for analytical solution
88 std::vector<Int_t> fSampleMask; // reconstruction mask
89 Double_t CalcResponse(Double_t t);
90
91 Int_t fLookUp = 3;
92
93 Bool_t fDebug = false; // Debug switch to output calculation time of the lookup
94 Bool_t fSet = false; // Boolean for module initialisation in simulation
95 std::string fReadFile = ""; // filepath to existing lookup table
96 std::string fWriteFile = ""; // filepath to write newly calculated lookup table into
97
99
100 std::map<Int_t, std::map<Int_t, Float_t>> fElookupSmall;
101 std::map<Int_t, std::map<Int_t, std::map<Int_t, Int_t>>> fElookupAsym;
102 std::map<Int_t, std::map<Int_t, Int_t>> fElookupA;
103 std::map<Int_t, std::map<Int_t, std::map<Int_t, Int_t>>> fElookupBig;
104 std::map<Int_t, Float_t> fElookup;
105
107};
108
109#endif
void FillLookUps(std::string write="")
CbmTrdDigi * MakeDigi(std::vector< Int_t > samples, Int_t channel, Int_t uniqueModuleId, ULong64_t time, Bool_t FN=false)
CbmTrdRawToDigiR operator=(const CbmTrdRawToDigiR &)
void SetPresamples(Int_t pre)
Double_t CalcResponse(Double_t t)
void SetPars(Int_t mode, Double_t cal, Double_t tau, std::vector< Int_t > mask)
std::map< Int_t, std::map< Int_t, std::map< Int_t, Int_t > > > fElookupBig
void SetMinBin(Int_t bin)
CbmTrdRawToDigiR(const CbmTrdRawToDigiR &)
void SetQA(CbmTrdCheckUtil *qa)
ClassDef(CbmTrdRawToDigiR, 1)
std::map< Int_t, std::map< Int_t, Float_t > > fElookupSmall
void SetLookup(Int_t mode)
std::map< Int_t, Float_t > fElookup
void SetReadFile(std::string file)
std::map< Int_t, std::map< Int_t, Int_t > > fElookupA
void SetRecoMask(std::vector< Int_t > mask)
void WriteMaps(std::string file="")
CbmTrdRawToDigiR()
default Constructor with messages
std::map< Int_t, std::map< Int_t, std::map< Int_t, Int_t > > > fElookupAsym
virtual ~CbmTrdRawToDigiR()
Destructor.
void SetCalibration(Double_t cal)
std::string fReadFile
void SetSetter(Bool_t set)
void SetMaxBin(Int_t bin)
void ReadMaps(std::string file="")
Double_t GetCharge(std::vector< Int_t > samples, Int_t shift=-1)
void SetTau(Double_t tau)
std::string fWriteFile
void SetRecoMode(Int_t mode)
Float_t GetTimeShift(std::vector< Int_t > samples)
std::vector< Int_t > fSampleMask
void SetWriteFile(std::string file)
CbmTrdCheckUtil * fQA
void SetDebug(Bool_t debug)
void SetShapingOrder(Int_t order)