CbmRoot
CbmTrdParFasp.cxx
Go to the documentation of this file.
1 #include "CbmTrdParFasp.h"
2 
3 #include <FairParamList.h> // for FairParamList
4 
5 #include <TArrayI.h> // for TArrayI
6 #include <TGenericClassInfo.h> // for TGenericClassInfo
7 #include <TMathBase.h> // for Min
8 #include <TString.h> // for Form
9 
10 #include <stdio.h> // for printf
11 
12 Double_t CbmTrdParFasp::fgSizeX = 2.;
13 Double_t CbmTrdParFasp::fgSizeY = 2.;
14 Double_t CbmTrdParFasp::fgSizeZ = 0.5;
15 //___________________________________________________________________
17  Int_t FebGrouping,
18  Double_t x,
19  Double_t y,
20  Double_t z)
21  : CbmTrdParAsic(address, FebGrouping, x, y, z) {
22  SetNameTitle(Form("FASP%d_%d", address / 1000, address % 1000),
23  "FASP definition");
24 }
25 
26 //___________________________________________________________________
28  UChar_t pairing) const {
29  Int_t id = QueryChannel(2 * address + pairing);
30  if (id < 0) return nullptr;
31  return &fCalib[id];
32 }
33 
34 //___________________________________________________________________
35 void CbmTrdParFasp::LoadParams(FairParamList* l) {
36  TArrayI value(NFASPCH);
37  if (l->fill(Form("%dCHS", fAddress), &value)) {
38  for (Int_t ich(0); ich < NFASPCH; ich++) {
39  Int_t pair = ich % 2;
40  SetChannelAddress(2 * value[ich] + pair);
41  fCalib[ich].SetPairing(pair);
42  }
43  }
44  if (l->fill(Form("%dPUT", fAddress), &value))
45  for (Int_t ich(0); ich < NFASPCH; ich++)
46  fCalib[ich].fPileUpTime = value[ich];
47  if (l->fill(Form("%dTHR", fAddress), &value))
48  for (Int_t ich(0); ich < NFASPCH; ich++)
49  fCalib[ich].fThreshold = value[ich];
50  if (l->fill(Form("%dMDS", fAddress), &value))
51  for (Int_t ich(0); ich < NFASPCH; ich++)
52  fCalib[ich].fMinDelaySignal = value[ich];
53 }
54 
55 void CbmTrdParFasp::LoadParams(TArrayI& valArray, Int_t iAsic) {
56  // Where does the asic info start in large array
57  Int_t offset = iAsic * (1 + NFASPCH * 4);
58  // Int_t asicAddress = valArray[ offset++ ];
59  offset++;
60  for (Int_t ich(0); ich < NFASPCH; ich++) {
61  Int_t pair = ich % 2;
62  SetChannelAddress(2 * valArray[offset++] + pair);
63  fCalib[ich].SetPairing(pair);
64  }
65  for (Int_t ich(0); ich < NFASPCH; ich++) {
66  fCalib[ich].fPileUpTime = valArray[offset++];
67  }
68  for (Int_t ich(0); ich < NFASPCH; ich++) {
69  fCalib[ich].fThreshold = valArray[offset++];
70  }
71  for (Int_t ich(0); ich < NFASPCH; ich++) {
72  fCalib[ich].fMinDelaySignal = valArray[offset++];
73  }
74 }
75 
76 //___________________________________________________________________
77 Bool_t CbmTrdParFasp::SetCalibParameters(Int_t ch, Double_t const* par) {
86  if (ch < 0 || ch >= NFASPCH) return kFALSE;
87  fCalib[ch].fPileUpTime = UShort_t(par[0]);
88  fCalib[ch].fFlatTop = UChar_t(par[1]);
89  fCalib[ch].fThreshold = UShort_t(par[2]);
90  fCalib[ch].fMinDelaySignal = UShort_t(par[3]);
91  fCalib[ch].fMinDelayParam = par[4];
92  if (par[5] > 0)
93  fCalib[ch].SetPairing(kTRUE);
94  else
95  fCalib[ch].SetPairing(kFALSE);
96  return kTRUE;
97 }
98 
99 //___________________________________________________________________
100 void CbmTrdParFasp::Print(Option_t* opt) const {
101  CbmTrdParAsic::Print("TrdParFasp");
102  printf(" Nchannels[%2d]\n", (Int_t) fChannelAddresses.size());
103  for (Int_t ich(0); ich < TMath::Min((Int_t) GetNchannels(),
104  (Int_t) fChannelAddresses.size());
105  ich++) {
106  printf(" %2d pad_addr[%4d]", ich, GetChannelAddress(ich));
107  fCalib[ich].Print(opt);
108  }
109 }
110 
111 //___________________________________________________________________
113  Int_t ft,
114  Int_t thr,
115  Int_t mds,
116  Float_t mdp)
117  : TObject()
118  , fPileUpTime(pup)
119  , fFlatTop(ft)
120  , fConfig(0)
121  , fThreshold(thr)
122  , fMinDelaySignal(mds)
123  , fMinDelayParam(mdp) {}
124 
125 //___________________________________________________________________
126 void CbmTrdParFaspChannel::Print(Option_t* /*opt*/) const {
127  printf("[%c]; CALIB { PUT[ns]=%3d FT[clk]=%2d THR[ADC]=%4d MDS[ADC]=%4d }\n",
128  (HasPairing(kTRUE) ? 'R' : 'T'),
129  fPileUpTime,
130  fFlatTop,
131  fThreshold,
133 }
134 
CbmTrdParFasp::fgSizeX
static Double_t fgSizeX
FASP half size in x [cm].
Definition: CbmTrdParFasp.h:102
CbmTrdParAsic
Definition of ASIC parameters.
Definition: CbmTrdParAsic.h:15
CbmTrdParFasp::Print
virtual void Print(Option_t *opt="") const
Definition: CbmTrdParFasp.cxx:100
NFASPCH
#define NFASPCH
Definition: CbmTrdParFasp.h:4
CbmTrdParFaspChannel::HasPairing
Bool_t HasPairing(Bool_t rect) const
Query pad pairing type.
Definition: CbmTrdParFasp.h:43
CbmTrdParFasp::fCalib
CbmTrdParFaspChannel fCalib[NFASPCH]
calibration map for FASP channels
Definition: CbmTrdParFasp.h:106
CbmTrdParFasp::GetChannel
const CbmTrdParFaspChannel * GetChannel(Int_t pad_address, UChar_t pair) const
Definition: CbmTrdParFasp.cxx:27
CbmTrdParFaspChannel
Definition of FASP channel calibration container.
Definition: CbmTrdParFasp.h:18
CbmTrdParFaspChannel::Print
void Print(Option_t *opt="") const
Definition: CbmTrdParFasp.cxx:126
CbmTrdParAsic::Print
virtual void Print(Option_t *opt="") const
Definition: CbmTrdParAsic.cxx:24
CbmTrdParFasp::LoadParams
virtual void LoadParams(FairParamList *l)
Definition: CbmTrdParFasp.cxx:35
CbmTrdParFaspChannel::fFlatTop
UChar_t fFlatTop
Length of Flat-Top in clocks.
Definition: CbmTrdParFasp.h:57
CbmTrdParFaspChannel::fThreshold
UShort_t fThreshold
Threshold in ADC units.
Definition: CbmTrdParFasp.h:61
CbmTrdParFaspChannel::CbmTrdParFaspChannel
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...
Definition: CbmTrdParFasp.cxx:112
CbmTrdParFasp.h
ClassImp
ClassImp(CbmTrdParFasp)
CbmTrdParFaspChannel::fMinDelayParam
Float_t fMinDelayParam
Factor of parabolic dependence dt=fdt*(s-s0)^2 to calculate trigger.
Definition: CbmTrdParFasp.h:67
CbmTrdParAsic::fChannelAddresses
std::vector< Int_t > fChannelAddresses
addresses of individual output channels
Definition: CbmTrdParAsic.h:77
CbmTrdParFasp::fgSizeY
static Double_t fgSizeY
FASP half size in y [cm].
Definition: CbmTrdParFasp.h:103
CbmTrdParFasp::fgSizeZ
static Double_t fgSizeZ
FASP half size in z [cm].
Definition: CbmTrdParFasp.h:104
CbmTrdParFaspChannel::fMinDelaySignal
UShort_t fMinDelaySignal
Signal in ADC for minimum delay i.e. fPileUpTime.
Definition: CbmTrdParFasp.h:65
CbmTrdParFasp
Definition of FASP parameters.
Definition: CbmTrdParFasp.h:74
CbmTrdParAsic::QueryChannel
virtual Int_t QueryChannel(Int_t ch) const
Query ASIC for specific pad address.
Definition: CbmTrdParAsic.cxx:30
CbmTrdParFaspChannel::fPileUpTime
UShort_t fPileUpTime
Signal formation time in ns.
Definition: CbmTrdParFasp.h:56
CbmTrdParFaspChannel::SetPairing
void SetPairing(Bool_t rect)
Specify pad pairing type.
Definition: CbmTrdParFasp.h:51
CbmTrdParAsic::fAddress
Int_t fAddress
unique ASIC ID
Definition: CbmTrdParAsic.h:69
CbmTrdParFasp::GetChannelAddress
Int_t GetChannelAddress(Int_t ich) const
Definition: CbmTrdParFasp.h:85
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTrdParFasp::GetNchannels
virtual Int_t GetNchannels() const
Definition: CbmTrdParFasp.h:83
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTrdParAsic::SetChannelAddress
virtual void SetChannelAddress(Int_t address)
Definition: CbmTrdParAsic.cxx:41
CbmTrdParFasp::CbmTrdParFasp
CbmTrdParFasp(Int_t address=0, Int_t FebGrouping=-1, Double_t x=0, Double_t y=0, Double_t z=0)
Definition: CbmTrdParFasp.cxx:16
CbmTrdParFasp::SetCalibParameters
virtual Bool_t SetCalibParameters(Int_t ch, Double_t const *par)
Load FASP calibration parameters for a specific channel.
Definition: CbmTrdParFasp.cxx:77