CbmRoot
Loading...
Searching...
No Matches
CbmTrdFASP.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 Horia Hulubei National Institute of Physics and Nuclear Engineering, Bucharest
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Alexandru Bercuci [committer] */
4
5#ifndef CBMTRDFASP_H
6#define CBMTRDFASP_H
7
8#include "CbmTrdParFasp.h"
9
10#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
11#include <RtypesCore.h> // for Int_t, Float_t, ULong64_t, UInt_t, Bool_t
12#include <TObject.h> // for TObject
13
14#include <map> // for map
15#include <tuple> // for tuple
16#include <utility> // for pair
17
18class CbmMatch;
19class CbmTrdDigi;
21class TCanvas;
22class TGraph;
23class TLine;
24
25#define FASP_WINDOW 200
26#define SHAPER_LUT 80
27#define NGRAPH (NFASPMOD * NFASPCH + 1)
28
30class CbmTrdFASP : public TObject {
31public:
35 CbmTrdFASP(UInt_t uslice = 1000);
36 virtual ~CbmTrdFASP();
38 virtual void Clear(Option_t* opt = "");
40 virtual void Draw(Option_t* opt = "");
41 virtual ULong64_t GetEndTime() const { return fStartTime + fProcTime; }
42 virtual ULong64_t GetStartTime() const { return fStartTime; }
44 static Float_t GetBaselineCorr() { return 4095. * fgBaseline / fgOutGain; }
46 virtual Bool_t Go(ULong64_t time);
53 virtual void InitChannel(int id, const CbmTrdParFaspChannel* par, int asicId = -1, int chId = -1);
57 virtual void PhysToRaw(std::vector<std::pair<CbmTrdDigi*, CbmMatch*>>* digi);
59 virtual void Print(Option_t* opt = "") const;
63 static void SetLGminLength(Int_t nclk) { fgNclkLG = nclk; }
67 static void SetNeighbourTrigger(Bool_t nb = kTRUE) { fgNeighbour = nb; }
71 static void SetNeighbourThr(Float_t thr = 0.1) { fgNeighbourThr = thr; }
75 static void SetShaperThr(Float_t thr = 0.2) { fgShaperThr = thr; }
77 void SetProcTime(ULong64_t t = 0);
79 void SetStartTime(ULong64_t t) { fStartTime = t; }
80
81protected:
82 int AddGraph(char typ = 'T');
86 void GetShaperSignal(Double_t charge);
88 Double_t MakeOut(Int_t t);
92 Int_t ProcessShaper(Char_t typ = 'T');
96 void ScanDigi(std::vector<std::pair<CbmTrdDigi*, CbmMatch*>>* digi);
98 void ScanDigiNE(std::vector<std::pair<CbmTrdDigi*, CbmMatch*>>* digi);
100 void WriteDigi();
101
102 ULong64_t fStartTime = 0;
103 UInt_t fProcTime = 0;
104 int fPad = -1;
105 Int_t fNphys[2];
106 Int_t fNraw = 0;
107 std::vector<std::pair<CbmTrdDigi*, CbmMatch*>>* fDigi = nullptr;
108
109 // analog support
110 std::vector<bool> fHitThPrev = {0};
111 std::vector<Float_t> fShaper = {0.};
112 std::vector<Float_t> fShaperNext = {0.};
113 std::vector<std::tuple<UInt_t, UInt_t, UInt_t, Bool_t>> fDigiProc =
114 {};
115 Float_t fSignal[FASP_WINDOW] = {
116 0.};
117
118 // FASP channel characteristics
119 const CbmTrdParFaspChannel* fPar[2] = {nullptr};
120 Int_t fTimeLG = -1;
121 Int_t fTimeFT = -1;
122 Int_t fTimeDY = -1;
123 Float_t fFT = 0.;
124
125 // FASP graphic support
126 int fNgraph = 1;
127 int fAsicId[2] = {-1, -1};
128 int fChId[2] = {-1, -1};
129 std::vector<Float_t> fOut = {0.};
130 std::map<int, std::array<int, NFASPCH>>
132 TGraph* fGraph[NGRAPH] = {nullptr};
133 TGraph* fGraphShp[NGRAPH] = {nullptr};
134 TGraph* fGraphPhys[NGRAPH] = {nullptr};
135 TLine* fGthr = nullptr;
136 TCanvas* fMonitor = nullptr;
137
138 // CADENCE parameters
139 static const Int_t fgkNDB = 53;
140 static const Float_t fgkCharge[fgkNDB];
141 static const Float_t fgkShaper[fgkNDB][FASP_WINDOW];
142 static const Float_t fgkShaperPar[4];
143 static const Float_t fgkShaperLUT[SHAPER_LUT];
144 static const Float_t fgkDecayLUT[SHAPER_LUT];
145
146 // FASP configuration parameters
147 static const Int_t fgkNclkFT;
148 static Int_t fgNclkLG;
149 static Bool_t fgNeighbour;
150 static Float_t fgNeighbourThr;
151 static Float_t fgShaperThr;
152 static Float_t fgBaseline;
153 static Float_t fgOutGain;
154
155 // FASP simulator configuration
156 static const Int_t fgkBufferKeep;
157
158 ClassDef(CbmTrdFASP, 1) // FASP ASIC simulator
159};
160
161#endif
#define FASP_WINDOW
Definition CbmTrdFASP.h:25
#define SHAPER_LUT
Definition CbmTrdFASP.h:26
#define NGRAPH
Definition CbmTrdFASP.h:27
FASP channel simulator.
Definition CbmTrdFASP.h:30
static Float_t GetBaselineCorr()
Return the baseline value in ADC ch.
Definition CbmTrdFASP.h:44
void GetShaperSignal(Double_t charge)
Retrive linear interpolation of CADENCE for signal.
int fAsicId[2]
identifier of FASP(s) in module
Definition CbmTrdFASP.h:127
std::vector< Float_t > fShaperNext
next channel shaper analog
Definition CbmTrdFASP.h:112
TLine * fGthr
graph representation of various thresholds
Definition CbmTrdFASP.h:135
static const Int_t fgkNDB
DB shaper size.
Definition CbmTrdFASP.h:139
Int_t fNphys[2]
number of physical digi in the current [0] and next [1] shaper
Definition CbmTrdFASP.h:105
Int_t ProcessShaper(Char_t typ='T')
Calculate output FASP signal and CS timming for the signal array stored in fShaper.
UInt_t fProcTime
time window [ns] for actual digi processing (excluded fgkBufferKeep)
Definition CbmTrdFASP.h:103
static void SetNeighbourTrigger(Bool_t nb=kTRUE)
Set FASP trigger mode.
Definition CbmTrdFASP.h:67
static Bool_t fgNeighbour
Neighbour enable flag.
Definition CbmTrdFASP.h:149
void SetProcTime(ULong64_t t=0)
Set limit in time for processing digis.
Int_t fTimeDY
Time decay from FT [5*ns].
Definition CbmTrdFASP.h:122
static void SetLGminLength(Int_t nclk)
Set linear-gate minimum length.
Definition CbmTrdFASP.h:63
Int_t fNraw
number of raw digi for the tilt channel
Definition CbmTrdFASP.h:106
virtual void InitChannel(int id, const CbmTrdParFaspChannel *par, int asicId=-1, int chId=-1)
[Re]Initialize one of the two FASP channels
static const Int_t fgkBufferKeep
length of buffer time in 5ns which is kept between cycles
Definition CbmTrdFASP.h:156
TGraph * fGraphShp[NGRAPH]
graph representations of FASP shaper
Definition CbmTrdFASP.h:133
virtual Bool_t Go(ULong64_t time)
Check if there is enough time elapsed from fStartTime to run simulator.
static const Int_t fgkNclkFT
length of flat top in FASP clocks
Definition CbmTrdFASP.h:147
Float_t fFT
Flat Top value [V].
Definition CbmTrdFASP.h:123
static Float_t fgShaperThr
shaper threshold [V]
Definition CbmTrdFASP.h:151
virtual void Clear(Option_t *opt="")
Finalize currently stored data.
void ScanDigi(std::vector< std::pair< CbmTrdDigi *, CbmMatch * > > *digi)
Read digi array for one pair T/R defined by the pad column.
static const Float_t fgkShaperLUT[SHAPER_LUT]
shaper LUT
Definition CbmTrdFASP.h:908
Double_t MakeOut(Int_t t)
Make convolution of shaper1 superposition and theoretic shaping model (see fgkShaperPar)
TGraph * fGraphPhys[NGRAPH]
graph representations of physics digi
Definition CbmTrdFASP.h:134
virtual void Print(Option_t *opt="") const
Print-out FASP analog/digital response to currently stored data.
virtual void Draw(Option_t *opt="")
Graphical representation of FASP analog/digital response to currently stored data.
TCanvas * fMonitor
monitor canvas when drawing
Definition CbmTrdFASP.h:136
static void SetShaperThr(Float_t thr=0.2)
Set threshold for the current channel. CADENCE value.
Definition CbmTrdFASP.h:75
int fChId[2]
FASP channels being processed.
Definition CbmTrdFASP.h:128
void WriteDigi()
Write processed digi to output array.
std::vector< bool > fHitThPrev
previous channel hit threshold
Definition CbmTrdFASP.h:110
static const Float_t fgkShaperPar[4]
shaper parameters
Definition CbmTrdFASP.h:907
void ScanDigiNE(std::vector< std::pair< CbmTrdDigi *, CbmMatch * > > *digi)
Read digi array for neighbour trigger processing.
CbmTrdFASP(UInt_t uslice=1000)
Constructor of FASP simulator.
std::vector< std::pair< CbmTrdDigi *, CbmMatch * > > * fDigi
link to digi vector to be transformed
Definition CbmTrdFASP.h:107
static Float_t fgBaseline
FASP baseline [V].
Definition CbmTrdFASP.h:152
int fPad
current pad as defined by CbmTrdModuleAbstract::GetPadAddress()
Definition CbmTrdFASP.h:104
virtual void PhysToRaw(std::vector< std::pair< CbmTrdDigi *, CbmMatch * > > *digi)
Convert physics information in digi to the raw format.
Int_t fTimeLG
Linear gate time length [5*ns].
Definition CbmTrdFASP.h:120
static Float_t fgNeighbourThr
neighbour threshold [V] for fgNeighbour=kTRUE
Definition CbmTrdFASP.h:150
virtual ~CbmTrdFASP()
Float_t fSignal[FASP_WINDOW]
temporary array to store shaper analog signal for current charge interpolation
Definition CbmTrdFASP.h:115
virtual ULong64_t GetStartTime() const
Definition CbmTrdFASP.h:42
static Int_t fgNclkLG
length of linear-gate command in FASP clocks
Definition CbmTrdFASP.h:148
int AddGraph(char typ='T')
std::vector< Float_t > fOut
analog output for the current channel
Definition CbmTrdFASP.h:129
void SetStartTime(ULong64_t t)
Set buffer time offset [ns].
Definition CbmTrdFASP.h:79
ULong64_t fStartTime
time offset [ns] for the current simulation
Definition CbmTrdFASP.h:102
std::vector< Float_t > fShaper
current channel shaper analog
Definition CbmTrdFASP.h:111
TGraph * fGraph[NGRAPH]
graph representations of analog FASP response
Definition CbmTrdFASP.h:132
std::map< int, std::array< int, NFASPCH > > fGraphMap
map of ASIC_id and (ch_id, output_id of FASP signals graphs) pairs
Definition CbmTrdFASP.h:131
static const Float_t fgkShaper[fgkNDB][FASP_WINDOW]
DB shaper signals for each input charge discretization.
Definition CbmTrdFASP.h:930
int fNgraph
No of graphs generated.
Definition CbmTrdFASP.h:126
static void SetNeighbourThr(Float_t thr=0.1)
Set threshold for the neighbour channel. CADENCE value.
Definition CbmTrdFASP.h:71
virtual ULong64_t GetEndTime() const
Definition CbmTrdFASP.h:41
const CbmTrdParFaspChannel * fPar[2]
current FASP ASIC parametrization
Definition CbmTrdFASP.h:119
static Float_t fgOutGain
FASP -> ADC gain [V/4095 ADC].
Definition CbmTrdFASP.h:153
static const Float_t fgkCharge[fgkNDB]
DB input charge discretization.
Definition CbmTrdFASP.h:926
Int_t fTimeFT
Chip Select time legth [5*ns].
Definition CbmTrdFASP.h:121
static const Float_t fgkDecayLUT[SHAPER_LUT]
forced discharged of FASP LUT
Definition CbmTrdFASP.h:917
std::vector< std::tuple< UInt_t, UInt_t, UInt_t, Bool_t > > fDigiProc
proccessed info wrt fStartTime <hit_time[ns], CS_time[ns], OUT[ADC], trigger>
Definition CbmTrdFASP.h:113
Definition of FASP channel calibration container.