Project
Loading...
Searching...
No Matches
SimParam.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
13// //
14// Class containing constant simulation parameters //
15// //
17
20#include "Field/MagneticField.h"
21#include <TGeoGlobalMagField.h>
22#include <fairlogger/Logger.h>
23
24using namespace o2::trd;
25
34
36{
37 // The magnetic field strength
38 const o2::field::MagneticField* fld = static_cast<o2::field::MagneticField*>(TGeoGlobalMagField::Instance()->GetField());
39 if (!fld) {
40 LOG(fatal) << "Magnetic field is not initialized!";
41 return;
42 }
43 mField = 0.1 * fld->solenoidField(); // kGauss -> Tesla
44 mFieldCached = true;
45}
46
48{
49 if (mFieldCached) {
50 return mField;
51 } else {
52 LOG(fatal) << "Magnetic field has not been cached yet";
53 }
54 return 0.f;
55}
56
57double SimParam::timeResponse(double time) const
58{
59 //
60 // Applies the preamp shaper time response
61 // (We assume a signal rise time of 0.2us = fTRFlo/2.
62 //
63
64 double rt = (time - .5 * mTRFlo) * mInvTRFwid;
65 int iBin = (int)rt;
66 double dt = rt - iBin;
67 if ((iBin >= 0) && (iBin + 1 < mTRFbin)) {
68 return mTRFsmp[iBin] + (mTRFsmp[iBin + 1] - mTRFsmp[iBin]) * dt;
69 } else {
70 return 0.0;
71 }
72}
73
74double SimParam::crossTalk(double time) const
75{
76 //
77 // Applies the pad-pad capacitive cross talk
78 //
79
80 double rt = (time - mTRFlo) * mInvTRFwid;
81 int iBin = (int)rt;
82 double dt = rt - iBin;
83 if ((iBin >= 0) && (iBin + 1 < mTRFbin)) {
84 return mCTsmp[iBin] + (mCTsmp[iBin + 1] - mCTsmp[iBin]) * dt;
85 } else {
86 return 0.0;
87 }
88}
89
91{
92 //
93 // initializes the parameter class for a given gas mixture
94 //
95
96 if (isXenon()) {
97 // The range and the binwidth for the sampled TRF
98 mTRFbin = 200;
99 // Start 0.2 mus before the signal
100 mTRFlo = -0.4;
101 // End the maximum drift time after the signal
102 mTRFhi = 3.58;
103 // Standard gas gain
104 mGasGain = 4000.0;
105 } else if (isArgon()) {
106 // The range and the binwidth for the sampled TRF
107 mTRFbin = 50;
108 // Start 0.2 mus before the signal
109 mTRFlo = 0.02;
110 // End the maximum drift time after the signal
111 mTRFhi = 1.98;
112 // Higher gas gain
113 mGasGain = 8000.0;
114 } else {
115 LOG(fatal) << "Not a valid gas mixture!\n";
116 }
117 mInvTRFwid = ((float)mTRFbin) / (mTRFhi - mTRFlo); // Inverse of the bin width of the integrated TRF
118
119 // Create the sampled TRF
120 sampleTRF();
121}
122
123//_____________________________________________________________________________
124void SimParam::sampleTRF()
125{
126 //
127 // Samples the new time response function.
128 //
129
130 int ipasa = 0;
131
132 // Xenon
133 // From Antons measurements with Fe55 source, adjusted by C. Lippmann.
134 // time bins are -0.4, -0.38, -0.36, ...., 3.54, 3.56, 3.58 microseconds
135 const int kNpasa = 200; // kNpasa should be equal to fTRFbin!
136 float xtalk[kNpasa];
137
138 float signals[4][kNpasa] =
139 {{0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0002, 0.0007, 0.0026, 0.0089, 0.0253, 0.0612, 0.1319,
140 0.2416, 0.3913, 0.5609, 0.7295, 0.8662, 0.9581, 1.0000, 0.9990, 0.9611, 0.8995, 0.8269, 0.7495, 0.6714, 0.5987,
141 0.5334, 0.4756, 0.4249, 0.3811, 0.3433, 0.3110, 0.2837, 0.2607, 0.2409, 0.2243, 0.2099, 0.1974, 0.1868, 0.1776,
142 0.1695, 0.1627, 0.1566, 0.1509, 0.1457, 0.1407, 0.1362, 0.1317, 0.1274, 0.1233, 0.1196, 0.1162, 0.1131, 0.1102,
143 0.1075, 0.1051, 0.1026, 0.1004, 0.0979, 0.0956, 0.0934, 0.0912, 0.0892, 0.0875, 0.0858, 0.0843, 0.0829, 0.0815,
144 0.0799, 0.0786, 0.0772, 0.0757, 0.0741, 0.0729, 0.0718, 0.0706, 0.0692, 0.0680, 0.0669, 0.0655, 0.0643, 0.0630,
145 0.0618, 0.0607, 0.0596, 0.0587, 0.0576, 0.0568, 0.0558, 0.0550, 0.0541, 0.0531, 0.0522, 0.0513, 0.0505, 0.0497,
146 0.0490, 0.0484, 0.0474, 0.0465, 0.0457, 0.0449, 0.0441, 0.0433, 0.0425, 0.0417, 0.0410, 0.0402, 0.0395, 0.0388,
147 0.0381, 0.0374, 0.0368, 0.0361, 0.0354, 0.0348, 0.0342, 0.0336, 0.0330, 0.0324, 0.0318, 0.0312, 0.0306, 0.0301,
148 0.0296, 0.0290, 0.0285, 0.0280, 0.0275, 0.0270, 0.0265, 0.0260, 0.0256, 0.0251, 0.0246, 0.0242, 0.0238, 0.0233,
149 0.0229, 0.0225, 0.0221, 0.0217, 0.0213, 0.0209, 0.0206, 0.0202, 0.0198, 0.0195, 0.0191, 0.0188, 0.0184, 0.0181,
150 0.0178, 0.0175, 0.0171, 0.0168, 0.0165, 0.0162, 0.0159, 0.0157, 0.0154, 0.0151, 0.0148, 0.0146, 0.0143, 0.0140,
151 0.0138, 0.0135, 0.0133, 0.0131, 0.0128, 0.0126, 0.0124, 0.0121, 0.0119, 0.0120, 0.0115, 0.0113, 0.0111, 0.0109,
152 0.0107, 0.0105, 0.0103, 0.0101, 0.0100, 0.0098, 0.0096, 0.0094, 0.0092, 0.0091, 0.0089, 0.0088, 0.0086, 0.0084,
153 0.0083, 0.0081, 0.0080, 0.0078}, // Default TRF
154 {
155 0.00334448, 0.00334448, 0.00334448, 0.00334448, 0.00334448,
156 0.00334448, 0.00167224, 0.00167224, 0.00167224, 0.00167224,
157 0.00167224, 0.00167224, 0.00167224, 0.00167224, 0.00501672,
158 0.0735786, 0.25585284, 0.5367893, 0.7909699, 0.94816054,
159 1., 0.96989967, 0.88628763, 0.77424749, 0.67056856,
160 0.56856187, 0.48494983, 0.40468227, 0.34448161, 0.2993311,
161 0.26086957, 0.22909699, 0.20568562, 0.18561873, 0.17056856,
162 0.15719064, 0.14548495, 0.13545151, 0.1270903, 0.12040134,
163 0.11204013, 0.10702341, 0.10200669, 0.09698997, 0.09197324,
164 0.08862876, 0.08528428, 0.0819398, 0.07859532, 0.07525084,
165 0.07190635, 0.07023411, 0.06688963, 0.06521739, 0.06354515,
166 0.06187291, 0.05852843, 0.05685619, 0.05518395, 0.05351171,
167 0.05183946, 0.05016722, 0.04849498, 0.04682274, 0.0451505,
168 0.04347826, 0.04347826, 0.04347826, 0.04180602, 0.04013378,
169 0.03846154, 0.03846154, 0.0367893, 0.03511706, 0.03511706,
170 0.03344482, 0.03344482, 0.03344482, 0.03177258, 0.03177258,
171 0.03177258, 0.03010033, 0.03010033, 0.02842809, 0.02842809,
172 0.02842809, 0.02675585, 0.02675585, 0.02508361, 0.02508361,
173 0.02675585, 0.02508361, 0.02341137, 0.02341137, 0.02341137,
174 0.02341137, 0.02341137, 0.02341137, 0.02173913, 0.02173913,
175 0.02173913, 0.02173913, 0.02006689, 0.02006689, 0.02006689,
176 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
177 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
178 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
179 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
180 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
181 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
182 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
183 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
184 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
185 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
186 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
187 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
188 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
189 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
190 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
191 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
192 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
193 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689,
194 0.02006689, 0.02006689, 0.02006689, 0.02006689, 0.02006689}, // TDR TRF
195 {
196 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
197 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
198 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
199 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
200 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
201 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
202 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
203 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
204 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
205 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
206 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
207 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}, // Delta distribution/no TRF
208 {
209 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
210 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
211 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
212 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
213 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
214 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
215 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
216 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
217 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
218 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
219 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
220 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.}}; // Landau TRF to be filled later
221 for (int i = 0; i < 200; i++) {
222 float tb = (i * 4. / 200.) - 0.4;
223 signals[3][i] = TMath::Landau(tb, mMu, mSigma) / TMath::Landau(mMu - 0.22278 * mSigma, mMu, mSigma); // Fill Landau TRF (and normalize maximum to 1)
224 }
225
226 float signal[kNpasa];
227 for (int i = 0; i < 200; i++) {
228 signal[i] = signals[mTRF][i];
229 }
230 // With undershoot, positive peak corresponds to ~3% of the main signal:
231 for (ipasa = 3; ipasa < kNpasa; ipasa++) {
232 xtalk[ipasa] = 0.2 * (signal[ipasa - 2] - signal[ipasa - 3]);
233 }
234 xtalk[0] = 0.0;
235 xtalk[1] = 0.0;
236 xtalk[2] = 0.0;
237
238 // Argon
239 // Ar measurement with Fe55 source by Anton
240 // time bins are 0.02, 0.06, 0.10, ...., 1.90, 1.94, 1.98 microseconds
241 const int kNpasaAr = 50;
242 float xtalkAr[kNpasaAr];
243 float signalAr[kNpasaAr] = {-0.01, 0.01, 0.00, 0.00, 0.01, -0.01, 0.01, 2.15, 22.28, 55.53, 68.52, 58.21, 40.92,
244 27.12, 18.49, 13.42, 10.48, 8.67, 7.49, 6.55, 5.71, 5.12, 4.63, 4.22, 3.81, 3.48,
245 3.20, 2.94, 2.77, 2.63, 2.50, 2.37, 2.23, 2.13, 2.03, 1.91, 1.83, 1.75, 1.68,
246 1.63, 1.56, 1.49, 1.50, 1.49, 1.29, 1.19, 1.21, 1.21, 1.20, 1.10};
247 // Normalization to maximum
248 for (ipasa = 0; ipasa < kNpasaAr; ipasa++) {
249 signalAr[ipasa] /= 68.52;
250 }
251 signalAr[0] = 0.0;
252 signalAr[1] = 0.0;
253 signalAr[2] = 0.0;
254 // With undershoot, positive peak corresponds to ~3% of the main signal:
255 for (ipasa = 3; ipasa < kNpasaAr; ipasa++) {
256 xtalkAr[ipasa] = 0.2 * (signalAr[ipasa - 2] - signalAr[ipasa - 3]);
257 }
258 xtalkAr[0] = 0.0;
259 xtalkAr[1] = 0.0;
260 xtalkAr[2] = 0.0;
261
262 for (int iBin = 0; iBin < mTRFbin; iBin++) {
263 if (isXenon()) {
264 mTRFsmp[iBin] = signal[iBin];
265 mCTsmp[iBin] = xtalk[iBin];
266 } else if (isArgon()) {
267 mTRFsmp[iBin] = signalAr[iBin];
268 mCTsmp[iBin] = xtalkAr[iBin];
269 }
270 }
271}
int16_t time
Definition RawEventData.h:4
int32_t i
Definition of the MagF class.
Double_t solenoidField() const
bool isArgon() const
Definition SimParam.h:91
float getCachedField() const
Definition SimParam.cxx:47
double timeResponse(double) const
Definition SimParam.cxx:57
double crossTalk(double) const
Definition SimParam.cxx:74
bool isXenon() const
Definition SimParam.h:90
void init()
initialization based on configured gas mixture in TRDSimParams
Definition SimParam.cxx:90
SimParam::GasMixture gas
the gas mixture in the TRD
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"