CbmRoot
Loading...
Searching...
No Matches
CbmTrdParFasp.cxx
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer], Alexandru Bercuci */
4
5#include "CbmTrdParFasp.h"
6
7#include <FairParamList.h> // for FairParamList
8
9#include <TArrayI.h> // for TArrayI
10#include <TGenericClassInfo.h> // for TGenericClassInfo
11#include <TMathBase.h> // for Min
12#include <TString.h> // for Form
13
14#include <stdio.h> // for printf
15
16Double_t CbmTrdParFasp::fgSizeX = 2.;
17Double_t CbmTrdParFasp::fgSizeY = 2.;
18Double_t CbmTrdParFasp::fgSizeZ = 0.5;
19//___________________________________________________________________
20CbmTrdParFasp::CbmTrdParFasp(Int_t address, Int_t FebGrouping, Double_t x, Double_t y, Double_t z)
21 : CbmTrdParAsic(address, FebGrouping, x, y, z)
22{
23 SetNameTitle(Form("FASP%d_%d", address / 1000, address % 1000), "FASP definition");
24}
25
26//___________________________________________________________________
27const CbmTrdParFaspChannel* CbmTrdParFasp::GetChannel(Int_t pad_address, UChar_t pairing) const
28{
29 Int_t id = QueryChannel(2 * pad_address + pairing);
30 if (id < 0) return nullptr;
31 return &fCalib[id];
32}
33
34//___________________________________________________________________
35const CbmTrdParFaspChannel* CbmTrdParFasp::GetChannel(Int_t ch_address) const
36{
37 if (ch_address < 0 || ch_address >= NFASPCH) return nullptr;
38 return &fCalib[ch_address];
39}
40
41//___________________________________________________________________
43{
44 if (chId < 0 || chId >= NFASPCH) return false;
45 return fCalib[chId].IsMasked();
46}
47
48//___________________________________________________________________
49void CbmTrdParFasp::LoadParams(FairParamList* l)
50{
51 // printf("CbmTrdParFasp::LoadParams(FairParamList*)\n");
52 TArrayI value(NFASPCH);
53 if (l->fill(Form("%dCHS", fAddress), &value)) {
54 for (Int_t ich(0); ich < NFASPCH; ich++) {
55 Int_t pair = ich % 2;
56 // printf(" ch[%2d] pair[%d] value[%d] ChAddress=%d\n", ich, pair, value[ich], 2 * value[ich] + pair);
57 SetChannelAddress(2 * value[ich] + pair);
58 fCalib[ich].SetPairing(pair);
59 }
60 }
61 if (l->fill(Form("%dPUT", fAddress), &value))
62 for (Int_t ich(0); ich < NFASPCH; ich++)
63 fCalib[ich].fPileUpTime = value[ich];
64 if (l->fill(Form("%dTHR", fAddress), &value))
65 for (Int_t ich(0); ich < NFASPCH; ich++)
66 fCalib[ich].fThreshold = value[ich];
67 if (l->fill(Form("%dMDS", fAddress), &value))
68 for (Int_t ich(0); ich < NFASPCH; ich++)
69 fCalib[ich].fMinDelaySignal = value[ich];
70}
71
72//___________________________________________________________________
73void CbmTrdParFasp::LoadParams(int* valArray)
74{
75 // printf("CbmTrdParFasp::LoadParams(%d)\n", fAddress);
76 int offset(0);
77 SetChannelMask(valArray[offset++]);
78 for (Int_t ich(0); ich < NFASPCH; ich++) {
79 int chAddress = valArray[offset++];
80 SetChannelAddress(abs(chAddress));
81 fCalib[ich].SetPairing(bool(chAddress > 0));
82 }
83 for (Int_t ich(0); ich < NFASPCH; ich++) {
84 fCalib[ich].fPileUpTime = valArray[offset++];
85 }
86 for (Int_t ich(0); ich < NFASPCH; ich++) {
87 fCalib[ich].fThreshold = valArray[offset++];
88 }
89 for (Int_t ich(0); ich < NFASPCH; ich++) {
90 fCalib[ich].fMinDelaySignal = valArray[offset++];
91 }
92}
93
94//___________________________________________________________________
95Bool_t CbmTrdParFasp::SetCalibParameters(Int_t ch, Double_t const* par)
96{
105 if (ch < 0 || ch >= NFASPCH) return kFALSE;
106 fCalib[ch].fPileUpTime = UShort_t(par[0]);
107 fCalib[ch].fFlatTop = UChar_t(par[1]);
108 fCalib[ch].fThreshold = UShort_t(par[2]);
109 fCalib[ch].fMinDelaySignal = UShort_t(par[3]);
110 fCalib[ch].fMinDelayParam = par[4];
111 if (par[5] > 0) fCalib[ch].SetPairing(kTRUE);
112 else
113 fCalib[ch].SetPairing(kFALSE);
114 return kTRUE;
115}
116
117//___________________________________________________________________
119{
120 for (Int_t ich(0); ich < NFASPCH; ich++) {
121 bool on = !bool((mask >> ich) & 0x1);
122 fCalib[ich].SetMask(on);
123 }
124}
125
126//___________________________________________________________________
128{
129 uint32_t mask(0);
130 for (Int_t ich(0); ich < NFASPCH; ich++) {
131 if (!fCalib[ich].IsMasked()) mask |= 0x1;
132 mask <<= 1;
133 }
134 return mask;
135}
136
137//___________________________________________________________________
138void CbmTrdParFasp::Print(Option_t* opt) const
139{
140 CbmTrdParAsic::Print("TrdParFasp");
141 printf(" Nchannels[%2d]\n", (Int_t) fChannelAddresses.size());
142 for (Int_t ich(0); ich < TMath::Min((Int_t) GetNchannels(), (Int_t) fChannelAddresses.size()); ich++) {
143 printf(" %2d pad_addr[%4d]", ich, GetPadAddress(ich));
144 fCalib[ich].Print(opt);
145 }
146}
147
148//___________________________________________________________________
149CbmTrdParFaspChannel::CbmTrdParFaspChannel(Int_t pup, Int_t ft, Int_t thr, Int_t mds, Float_t mdp)
150 : TObject()
151 , fPileUpTime(pup)
152 , fFlatTop(ft)
153 , fConfig(0)
154 , fThreshold(thr)
155 , fMinDelaySignal(mds)
156 , fMinDelayParam(mdp)
157{
158}
159
160//___________________________________________________________________
161void CbmTrdParFaspChannel::Print(Option_t* /*opt*/) const
162{
163 printf("[%c]; MASK{%c}; CALIB{ PUT[ns]=%3d FT[clk]=%2d THR[ADC]=%4d MDS[ADC]=%4d }\n", (HasPairingR() ? 'R' : 'T'),
165}
166
ClassImp(CbmTrdParFasp)
#define NFASPCH
Definition of ASIC parameters.
virtual Int_t QueryChannel(Int_t ch) const
Query ASIC for specific pad address.
std::vector< Int_t > fChannelAddresses
addresses of individual output channels
Int_t fAddress
unique ASIC ID
virtual void SetChannelAddress(Int_t address)
virtual void Print(Option_t *opt="") const
Definition of FASP channel calibration container.
CbmTrdParFaspChannel(Int_t pup=300, Int_t ft=14, Int_t thr=600, Int_t smin=2586, Float_t dtPar=4.181e-6)
Parametrization of a FASP channel based on CADENCE simulations from 12.01.2018 and parabolic parametr...
Bool_t HasPairingR() const
Query pad pairing type.
UShort_t fThreshold
Threshold in ADC units.
bool IsMasked() const
void SetMask(Bool_t set)
Mask channel for processing.
void Print(Option_t *opt="") const
void SetPairing(Bool_t rect)
Specify pad pairing type.
UShort_t fPileUpTime
Signal formation time in ns.
UShort_t fMinDelaySignal
Signal in ADC for minimum delay i.e. fPileUpTime.
Float_t fMinDelayParam
Factor of parabolic dependence dt=fdt*(s-s0)^2 to calculate trigger.
UChar_t fFlatTop
Length of Flat-Top in clocks.
Definition of FASP parameters.
static Double_t fgSizeY
FASP half size in y [cm].
CbmTrdParFaspChannel fCalib[NFASPCH]
calibration map for FASP channels
virtual bool IsChannelMasked(int ch) const
CbmTrdParFasp(Int_t address=0, Int_t FebGrouping=-1, Double_t x=0, Double_t y=0, Double_t z=0)
virtual void SetChannelMask(uint32_t mask)
virtual void Print(Option_t *opt="") const
const CbmTrdParFaspChannel * GetChannel(Int_t pad_address, UChar_t pair) const
Query the calibration for one FASP RO channel.
virtual Bool_t SetCalibParameters(Int_t ch, Double_t const *par)
Load FASP calibration parameters for a specific channel.
static Double_t fgSizeX
FASP half size in x [cm].
int GetPadAddress(Int_t ich) const
virtual void LoadParams(FairParamList *l)
virtual uint32_t GetChannelMask() const
static Double_t fgSizeZ
FASP half size in z [cm].
virtual Int_t GetNchannels() const