CbmRoot
Loading...
Searching...
No Matches
CbmTrdModuleRec2D.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 CBMTRDMODULEREC2D_H
6#define CBMTRDMODULEREC2D_H
7
8#include "CbmTrdModuleRec.h"
9
10#include <list>
11#include <map>
12#include <vector>
13#define NBINSCORRX 50
14#define NBINSCORRY 4
15#define NANODE 9
16
17using std::list;
18using std::map;
19using std::vector;
20class TGraphErrors;
21class CbmTrdDigiRec;
23class TF1;
38 public:
46
50 CbmTrdModuleRec2D(Int_t mod, Int_t ly = -1, Int_t rot = 0);
51 virtual ~CbmTrdModuleRec2D();
52
53
55 virtual Bool_t AddDigi(const CbmTrdDigi* d, Int_t id);
56 virtual void DrawHit(CbmTrdHit*) const { ; }
58 virtual Int_t GetOverThreshold() const;
60 virtual Bool_t PreProcessHits();
62 virtual Bool_t PostProcessHits();
64 virtual Int_t FindClusters(bool clr);
66 virtual Bool_t MakeHits();
68 virtual CbmTrdHit* MakeHit(Int_t cId, const CbmTrdCluster* c, std::vector<const CbmTrdDigi*>* digis);
74 Int_t LoadDigis(vector<const CbmTrdDigi*>* din, Int_t cid);
75 Int_t ProjectDigis(Int_t cid, Int_t cjd = -1);
79 Int_t CheckMerge(Int_t cid, Int_t cjd);
85 Bool_t MergeHits(CbmTrdHit* h, Int_t a0);
86 Bool_t BuildHit(CbmTrdHit* h);
87 UShort_t GetHitMap() const { return vyM; }
94 Double_t GetXcorr(Double_t dx, Int_t typ, Int_t cls = 0) const;
100 Double_t GetYcorr(Double_t dy, Int_t cls = 0) const;
104 void RecenterXoffset(Double_t& dx);
108 void RecenterYoffset(Double_t& dy);
112 Int_t GetHitClass() const;
116 Int_t GetHitRcClass(Int_t a0) const;
117
128 void SetHitTimeOffset(int dt) { fHitTimeOff = dt; }
129
130 protected:
131 private:
134
140 virtual inline void Config(Bool_t vcl, Bool_t vrc, Bool_t dw);
142 Bool_t CWRITE(int level) const
143 {
144 if (level)
146 else
148 }
150
159 Bool_t CheckConvolution(CbmTrdHit* h) const;
164 Bool_t Deconvolute(CbmTrdHit* h);
165 Double_t GetXoffset(Int_t n0 = 0) const;
166 Double_t GetYoffset(Int_t n0 = 0) const;
170 const CbmTrdParFaspChannel* GetFaspChCalibrator(uint16_t ch) const;
179 Int_t LoadDigis(std::vector<const CbmTrdDigi*>* digis, std::vector<CbmTrdDigi*>* vdgM, std::vector<Bool_t>* vmask,
180 ULong64_t& t0, Int_t& cM);
181 Int_t LoadDigisRC(vector<const CbmTrdDigi*>* digis, const Int_t r0, const Int_t a0,
182 /*vector<CbmTrdDigi*> *vdgM, */ ULong64_t& t0, Int_t& cM);
183
190 Bool_t MergeDigis(std::vector<const CbmTrdDigi*>* digis, std::vector<CbmTrdDigi*>* vdgM, std::vector<Bool_t>* vmask);
191
192 Bool_t HasLeftSgn() const { return TESTBIT(vyM, 3); }
193 Bool_t HasOvf() const { return TESTBIT(vyM, 12); }
194 Bool_t IsBiasX() const { return TESTBIT(vyM, 4); }
195 Bool_t IsBiasXleft() const { return TESTBIT(vyM, 5); }
196 Bool_t IsBiasXmid() const { return TESTBIT(vyM, 6); }
197 Bool_t IsBiasXright() const { return TESTBIT(vyM, 7); }
198 Bool_t IsBiasY() const { return TESTBIT(vyM, 8); }
199 Bool_t IsBiasYleft() const { return TESTBIT(vyM, 9); }
200 Bool_t IsLeftHit() const { return TESTBIT(vyM, 2); }
201 Bool_t IsMaxTilt() const { return TESTBIT(vyM, 0); }
202 Bool_t IsOpenLeft() const { return (viM % 2 && !IsMaxTilt()) || (!(viM % 2) && IsMaxTilt()); }
203 inline Bool_t IsOpenRight() const;
204 Bool_t IsSymmHit() const { return TESTBIT(vyM, 1); }
205 void SetBiasX(Bool_t set = 1) { set ? SETBIT(vyM, 4) : CLRBIT(vyM, 4); }
206 void SetBiasXleft(Bool_t set = 1) { set ? SETBIT(vyM, 5) : CLRBIT(vyM, 5); }
207 void SetBiasXmid(Bool_t set = 1) { set ? SETBIT(vyM, 6) : CLRBIT(vyM, 6); }
208 void SetBiasXright(Bool_t set = 1) { set ? SETBIT(vyM, 7) : CLRBIT(vyM, 7); }
209 void SetBiasY(Bool_t set = 1) { set ? SETBIT(vyM, 8) : CLRBIT(vyM, 8); }
210 void SetBiasYleft(Bool_t set = 1) { set ? SETBIT(vyM, 9) : CLRBIT(vyM, 9); }
211 void SetBiasYmid(Bool_t set = 1) { set ? SETBIT(vyM, 10) : CLRBIT(vyM, 10); }
212 void SetBiasYright(Bool_t set = 1) { set ? SETBIT(vyM, 11) : CLRBIT(vyM, 11); }
213 void SetLeftSgn(Bool_t set = 1) { set ? SETBIT(vyM, 3) : CLRBIT(vyM, 3); }
214 void SetLeftHit(Bool_t set = 1) { set ? SETBIT(vyM, 2) : CLRBIT(vyM, 2); }
215 void SetSymmHit(Bool_t set = 1) { set ? SETBIT(vyM, 1) : CLRBIT(vyM, 1); }
216 void SetMaxTilt(Bool_t set = 1) { set ? SETBIT(vyM, 0) : CLRBIT(vyM, 0); }
217 void SetOvf(Bool_t set = 1) { set ? SETBIT(vyM, 12) : CLRBIT(vyM, 12); }
218
219 UChar_t fConfigMap = 0;
220 ULong64_t fT0 = 0;
221 UInt_t fTimeLast = 0;
222 UInt_t fTimeWinKeep = 11;
223 std::map<Int_t, std::list<CbmTrdCluster*>> fBuffer; //row-wise organized clusters
224 std::map<Int_t, vector<CbmTrdDigiRec*>> fDigis;
225 // working representation of a hit on which the reconstruction is performed
226 ULong64_t vt0 = 0;
227 UChar_t vcM = 0;
228 UChar_t vrM = 0;
229 UChar_t viM = 0;
230 UShort_t vyM = 0;
231 int fHitTimeOff = 0;
232 std::vector<Double_t> vs;
233 std::vector<Double_t> vse;
234 std::vector<Char_t> vt;
235 std::vector<Double_t> vx;
236 std::vector<Double_t> vxe;
237
238 static Float_t fgCorrXdx;
239 static Float_t fgCorrXval[3][NBINSCORRX];
240 static Float_t fgCorrYval[NBINSCORRY][2];
241 static Float_t fgCorrRcXval[2][NBINSCORRX];
242 static Float_t fgCorrRcXbiasXval[3][NBINSCORRX];
243 static Double_t fgDT[3];
244 static TGraphErrors* fgEdep;
245 static TF1* fgPRF;
246 static TGraphErrors* fgT;
247
248 ClassDef(CbmTrdModuleRec2D,
249 2) // Triangular pad module; Cluster finding and hit reconstruction algorithms
250};
251
252void CbmTrdModuleRec2D::Config(Bool_t vcl, Bool_t vrc, Bool_t dw)
253{
254 if (vcl)
256 else
258 printf("CbmTrdModuleRec2D::kVerbCluster[%c]\n", CWRITE(0) ? 'y' : 'n');
259 if (vrc)
261 else
263 printf("CbmTrdModuleRec2D::kVerbReco[%c]\n", CWRITE(1) ? 'y' : 'n');
264 if (dw)
266 else
268 printf("CbmTrdModuleRec2D::Draw[%c]\n", CDRAW() ? 'y' : 'n');
269}
270
272{
273 Int_t nR = vs.size() - 1 - viM;
274 return (nR % 2 && IsMaxTilt()) || (!(nR % 2) && !IsMaxTilt());
275}
276#endif
#define NBINSCORRY
#define NBINSCORRX
#define SETBIT(n, i)
Definition RTypes.h:15
#define TESTBIT(n, i)
Definition RTypes.h:17
#define CLRBIT(n, i)
Definition RTypes.h:16
Data class with information on a STS local track.
Data Container for TRD clusters.
Extend the TRD(2D) digi class to incorporate FEE calibration.
data class for a reconstructed Energy-4D measurement in the TRD
Definition CbmTrdHit.h:40
Cluster finding and hit reconstruction algorithms for the TRD(2D) module.
UShort_t GetHitMap() const
static Float_t fgCorrYval[NBINSCORRY][2]
discretized correction LUT
void SetSymmHit(Bool_t set=1)
void SetBiasYright(Bool_t set=1)
std::vector< Char_t > vt
working copy of signal errors from cluster
Bool_t HasOvf() const
void SetBiasXleft(Bool_t set=1)
Bool_t Deconvolute(CbmTrdHit *h)
Algorithm for cluster spliting.
int fHitTimeOff
bit map for cluster topology classification
virtual void Config(Bool_t vcl, Bool_t vrc, Bool_t dw)
Config task with the following settings.
Bool_t CWRITE(int level) const
virtual Int_t GetOverThreshold() const
Count RO channels (R or T) with data.
Bool_t MergeHits(CbmTrdHit *h, Int_t a0)
Algorithm for hit merging.
std::map< Int_t, vector< CbmTrdDigiRec * > > fDigis
Bool_t CHELPERS() const
CbmTrdModuleRec2D(const CbmTrdModuleRec2D &ref)
UShort_t vyM
index of maximum signal in the projection
void SetLeftSgn(Bool_t set=1)
std::map< Int_t, std::list< CbmTrdCluster * > > fBuffer
time interval to still keep clusters in buffer [clk]
void SetMaxTilt(Bool_t set=1)
void SetHitTimeOffset(int dt)
Time offset to synchronize TRD2D hits to the rest of detectors.
CbmTrdModuleRec2D()
Default constructor.
Bool_t IsOpenRight() const
UChar_t vrM
maximum col
Double_t GetYcorr(Double_t dy, Int_t cls=0) const
y position correction based on LUT
std::vector< Double_t > vxe
working copy of signal relative positions
Bool_t IsBiasY() const
Bool_t IsBiasXmid() const
static Float_t fgCorrXval[3][NBINSCORRX]
step of the discretized correction LUT
std::vector< Double_t > vse
working copy of signals from cluster
ULong64_t fT0
task configuration settings
void SetBiasY(Bool_t set=1)
void SetBiasYmid(Bool_t set=1)
virtual CbmTrdHit * MakeHit(Int_t cId, const CbmTrdCluster *c, std::vector< const CbmTrdDigi * > *digis)
Steering routine for converting cluster to hit.
virtual void DrawHit(CbmTrdHit *) const
void RecenterXoffset(Double_t &dx)
Shift graph representation to [-0.5, 0.5].
@ kHelpers
use helper graph for time and energy estimation
@ kVerbCluster
steer clusterizer verbosity on/off
@ kDraw
steer graphic representation on/off
@ kVerbReco
steer reconstructor verbosity on/off
Bool_t CheckConvolution(CbmTrdHit *h) const
Implement cuts for hit convolution definition.
Bool_t IsLeftHit() const
Bool_t IsOpenLeft() const
Bool_t HasLeftSgn() const
Bool_t BuildHit(CbmTrdHit *h)
Int_t LoadDigis(std::vector< const CbmTrdDigi * > *digis, std::vector< CbmTrdDigi * > *vdgM, std::vector< Bool_t > *vmask, ULong64_t &t0, Int_t &cM)
Load digis info into local data structures.
void SetBiasYleft(Bool_t set=1)
std::vector< Double_t > vs
hit time offset for synchronization
void SetUseHelpers(bool use=true)
Steer usage of helper graphs for computing time and energy per hit. A cost wrt the additional perform...
UInt_t fTimeLast
start time of event/time slice [clk]
UChar_t vcM
start time of current hit [clk]
static TGraphErrors * fgT
fitter for cluster PRF
const CbmTrdModuleRec2D & operator=(const CbmTrdModuleRec2D &ref)
UInt_t fTimeWinKeep
time of last digi processed in module [clk]
Int_t LoadDigis(vector< const CbmTrdDigi * > *din, Int_t cid)
Load RAW digis into working array of RECO digis.
Bool_t IsSymmHit() const
void SetBiasX(Bool_t set=1)
Int_t CheckMerge(Int_t cid, Int_t cjd)
Implement topologic cuts for hit merging.
void SetOvf(Bool_t set=1)
Int_t GetHitRcClass(Int_t a0) const
Hit classification wrt signal bias.
virtual Int_t FindClusters(bool clr)
Finalize clusters.
Int_t ProjectDigis(Int_t cid, Int_t cjd=-1)
ULong64_t vt0
cluster-wise organized calibrated digi
static Float_t fgCorrRcXbiasXval[3][NBINSCORRX]
discretized correction LUT
Int_t LoadDigisRC(vector< const CbmTrdDigi * > *digis, const Int_t r0, const Int_t a0, ULong64_t &t0, Int_t &cM)
virtual Bool_t PostProcessHits()
Finalize hits (merge RC hits, etc)
Bool_t IsBiasYleft() const
void RecenterYoffset(Double_t &dy)
Shift graph representation to [-0.5, 0.5].
Double_t GetXcorr(Double_t dx, Int_t typ, Int_t cls=0) const
x position correction based on LUT
static Float_t fgCorrRcXval[2][NBINSCORRX]
discretized correction params
Bool_t IsBiasX() const
Double_t GetYoffset(Int_t n0=0) const
void SetLeftHit(Bool_t set=1)
Bool_t MergeDigis(std::vector< const CbmTrdDigi * > *digis, std::vector< CbmTrdDigi * > *vdgM, std::vector< Bool_t > *vmask)
Merge R/T signals to digis if topological conditions in cluster are fulfilled.
virtual Bool_t AddDigi(const CbmTrdDigi *d, Int_t id)
Add digi to local module.
void SetBiasXmid(Bool_t set=1)
UChar_t viM
maximum row
virtual Bool_t PreProcessHits()
Check hit quality (deconvolute pile-ups, etc)
Bool_t IsBiasXleft() const
static TGraphErrors * fgEdep
FASP delay wrt signal.
Int_t GetHitClass() const
Hit classification wrt center pad.
virtual Bool_t MakeHits()
Steering routine for building hits.
static Float_t fgCorrXdx
working copy of signal relative position errors
void SetBiasXright(Bool_t set=1)
Bool_t IsMaxTilt() const
const CbmTrdParFaspChannel * GetFaspChCalibrator(uint16_t ch) const
Retrive FASP ch calibrator by RO ch number in the module.
Bool_t IsBiasXright() const
std::vector< Double_t > vx
working copy of signal relative timing
int AddClusterEdges(CbmTrdCluster *cl)
Add left and right edge channels to the cluster in case this are masked channels.
static TF1 * fgPRF
data handler for cluster PRF
static Double_t fgDT[3]
discretized correction LUT
Double_t GetXoffset(Int_t n0=0) const
Abstract class for module wise cluster finding and hit reconstruction.
Definition of FASP channel calibration container.