ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonCSC_CnvTools
src
CscRODReadOut.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CscRODReadOut.h
"
6
7
// constructor
8
CscRODReadOut::CscRODReadOut
() :
m_cscIdHelper
(nullptr),
m_chamberBitValue
(0) {
9
m_TIME_OFFSET
= 46.825;
// ns
10
m_SIGNAL_WIDTH
= 16.08;
// ns
11
m_NUMBER_OF_INTEGRATION
= 12;
12
m_Z0
= (
m_NUMBER_OF_INTEGRATION
+ 1) - sqrt(
m_NUMBER_OF_INTEGRATION
+ 1);
// time bin at the maximum
13
// obtained by setting the derivative = 0
14
// this gives 2 solutions:
15
// Z0=9.394 and 16.606
16
// 9.394 is for positive amplitude
17
18
// conversion factor from ee charge to ADC count
19
// assuming for now 1 ADC count = 0.32 femtoCoulomb!
20
21
/* From Valeri Tcherniatine --- April 11, 2004
22
conversion= ( e*G*k*m*d*1.6e-19)/2000
23
e=75 - average number ionization e in CSC
24
G=10^5 - gas gain
25
k=0.15 - factor taking to account electronic time integration (charge
26
deficit) and only one cathode readout
27
m=0.5 - part of induce charge contained in max. strip
28
d=7 - value of dynamic range expressed in average particle ionization
29
deposition in CSC. At this value (7) out of region inefficiency is <2%.
30
1.6e-19 - e charge
31
2000 - max. ADC counts for positive part of signal
32
Collect all numbers together conversion = 0.32 femtoCoulomb per ADC count
33
*/
34
35
m_CHARGE_TO_ADC_COUNT
= (0.32e-15) / (1.602e-19);
36
m_norm
=
signal
(
m_Z0
);
37
}
38
39
CscRODReadOut::CscRODReadOut
(
double
startTime,
double
signalWidth, uint16_t numIntegration) :
m_cscIdHelper
(nullptr),
m_chamberBitValue
(0) {
40
m_TIME_OFFSET
= startTime;
// ns
41
m_SIGNAL_WIDTH
= signalWidth;
// ns
42
m_NUMBER_OF_INTEGRATION
= numIntegration;
43
m_Z0
= (
m_NUMBER_OF_INTEGRATION
+ 1) - sqrt(
m_NUMBER_OF_INTEGRATION
+ 1);
// time bin at the maximum
44
// obtained by setting the derivative = 0
45
// this gives 2 solutions:
46
// Z0=9.394 and 16.606
47
// 9.394 is for positive amplitude
48
49
m_CHARGE_TO_ADC_COUNT
= (0.32e-15) / (1.602e-19);
50
m_norm
=
signal
(
m_Z0
);
51
}
52
53
void
CscRODReadOut::encodeFragments
(
const
std::vector<uint16_t>& amplitude, std::vector<uint32_t>& v)
const
{
54
int
numberOfFragments = amplitude.size();
55
56
// now the data
58
59
int
j = 0;
60
while
(j < numberOfFragments) {
61
uint32_t v32 = 0;
62
uint16_t amp[2] = {0, 0};
63
for
(
int
i = 0; i < 2; i++) { amp[i] = (
BODY_AMPLITUDE
<< 12) | amplitude[i + j]; }
64
set32bits
(amp, v32);
65
v.push_back(v32);
66
j += 2;
67
}
68
}
69
70
int
CscRODReadOut::findCharge
(
double
samplingTime,
const
std::vector<uint16_t>& amplitude,
double
& time) {
71
// very crude - to be done better
72
73
int
charge
= 0;
74
time = 0.0;
75
76
int
numberOfSamplings = amplitude.size();
77
78
uint16_t
max
= 0;
79
int
maxIndex = -1;
80
for
(
int
i = 0; i < numberOfSamplings; i++) {
81
if
(amplitude[i] >
max
) {
82
max
= amplitude[i];
83
maxIndex = i;
84
}
85
}
86
87
if
(
max
== 0)
return
charge
;
88
if
(maxIndex < 0 || maxIndex >= numberOfSamplings)
return
charge
;
89
91
if
(maxIndex == 0)
92
return
amplitude[0];
93
else
if
(maxIndex == (numberOfSamplings - 1))
94
return
amplitude[numberOfSamplings - 1];
95
else
{
96
double
a
, b, c;
97
double
y1 = amplitude[maxIndex - 1];
98
double
y2 = amplitude[maxIndex];
99
double
y3 = amplitude[maxIndex + 1];
100
a
= 0.5 * (y3 + y1 - 2 * y2);
101
b = 0.5 * (y3 - y1);
102
c = y2;
103
106
double
offset = (
a
== 0) ? 0 : -b / (2 *
a
);
107
charge
=
static_cast<
int
>
(
a
* offset * offset + b * offset + c - amplitude[0]);
108
time = (maxIndex + offset) * samplingTime;
109
return
charge
;
110
}
111
}
charge
double charge(const T &p)
Definition
AtlasPID.h:1003
CscRODReadOut.h
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
max
#define max(a, b)
Definition
cfImp.cxx:41
CscRODReadOut::m_Z0
double m_Z0
Definition
CscRODReadOut.h:84
CscRODReadOut::m_chamberBitValue
uint32_t m_chamberBitValue
Definition
CscRODReadOut.h:77
CscRODReadOut::set32bits
void set32bits(const uint16_t *v16, uint32_t &v32) const
Definition
CscRODReadOut.h:129
CscRODReadOut::encodeFragments
void encodeFragments(const std::vector< uint16_t > &litude, std::vector< uint32_t > &v) const
Definition
CscRODReadOut.cxx:53
CscRODReadOut::m_TIME_OFFSET
double m_TIME_OFFSET
Definition
CscRODReadOut.h:80
CscRODReadOut::BODY_AMPLITUDE
static const uint16_t BODY_AMPLITUDE
Definition
CscRODReadOut.h:93
CscRODReadOut::findCharge
static int findCharge(double samplingTime, const std::vector< uint16_t > &litude, double &time)
Definition
CscRODReadOut.cxx:70
CscRODReadOut::m_NUMBER_OF_INTEGRATION
int m_NUMBER_OF_INTEGRATION
Definition
CscRODReadOut.h:82
CscRODReadOut::m_norm
double m_norm
Definition
CscRODReadOut.h:78
CscRODReadOut::m_SIGNAL_WIDTH
double m_SIGNAL_WIDTH
Definition
CscRODReadOut.h:81
CscRODReadOut::CscRODReadOut
CscRODReadOut()
Definition
CscRODReadOut.cxx:8
CscRODReadOut::m_CHARGE_TO_ADC_COUNT
double m_CHARGE_TO_ADC_COUNT
Definition
CscRODReadOut.h:83
CscRODReadOut::m_cscIdHelper
const CscIdHelper * m_cscIdHelper
Definition
CscRODReadOut.h:76
CscRODReadOut::signal
double signal(double z) const
Definition
CscRODReadOut.h:246
Generated on
for ATLAS Offline Software by
1.17.0