ATLAS Offline Software
Loading...
Searching...
No Matches
CscRODReadOutV0.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "CscRODReadOutV0.h"
6
7// constructor
9 m_cscHelper(nullptr),
10 m_sourceID(0),
11 m_moduleType(0),
12 m_rodId(0),
14 m_amp1(0),
15 m_amp2(0),
16 m_amp3(0),
17 m_amp4(0),
18 m_address(0) {
19 m_TIME_OFFSET = 46.825; // ns
20 m_SIGNAL_WIDTH = 16.08; // ns
21 m_SAMPLING_TIME = 50.0; // ns
22 m_Z0 = 9.394; // time bin at the maximum
23 // obtained by setting the derivative = 0
24 // this gives 2 solutions: Z0=9.394 and 16.606
25 // 9.394 is for positive amplitude
26
28
29 // conversion factor from ee charge to ADC count
30 // assuming for now 1 ADC count = 0.32 femtoCoulomb!
31
32 /* From Valeri Tcherniatine --- April 11, 2004
33 conversion= ( e*G*k*m*d*1.6e-19)/2000
34 e=75 - average number ionization e in CSC
35 G=10^5 - gas gain
36 k=0.15 - factor taking to account electronic time integration (charge
37 deficit) and only one cathode readout
38 m=0.5 - part of induce charge contained in max. strip
39 d=7 - value of dynamic range expressed in average particle ionization
40 deposition in CSC. At this value (7) out of region inefficiency is <2%.
41 1.6e-19 - e charge
42 2000 - max. ADC counts for positive part of signal
43 Collect all numbers together conversion = 0.32 femtoCoulomb per ADC count
44 */
45
46 m_CHARGE_TO_ADC_COUNT = (0.32e-15) / (1.602e-19);
48}
49
50// destructor
51
52
53void CscRODReadOutV0::encodeFragments(const uint16_t* amplitude, const uint32_t& address, std::vector<uint32_t>& v) const {
54 uint16_t amp[2] = {0, 0};
55 uint32_t v32 = 0;
56
57 for (int i = 0; i < 2; i++) amp[i] = (BODY_AMPLITUDE << 12) | *(amplitude + i);
58 set32bits(amp, v32);
59 v[0] = v32;
60 v32 = 0;
61 for (int i = 2; i < 4; i++) amp[i - 2] = (BODY_AMPLITUDE << 12) | *(amplitude + i);
62 set32bits(amp, v32);
63 v[1] = v32;
64
65 v[2] = (BODY_ADDRESS << 28) | address;
66}
67
69 const int N_SAMPLE = 4;
70
71 // the sampling times
72 double time[N_SAMPLE];
73 for (int i = 0; i < N_SAMPLE; i++) time[i] = (i + 1) * m_SAMPLING_TIME + m_TIME_OFFSET;
74
75 // the corresponding amplitudes
76 uint16_t amp[N_SAMPLE];
77 amp[0] = m_amp1;
78 amp[1] = m_amp2;
79 amp[2] = m_amp3;
80 amp[3] = m_amp4;
81
82 // to be replaced by a fitting procedure
83 double adcCount = 0.0;
84 int n = 0;
85 for (int i = 0; i < N_SAMPLE; i++) {
86 adcCount = adcCount + amp[i] / signal_amplitude(time[i]);
87 if (amp[i] > 0) n++;
88 }
89 adcCount = adcCount / n;
90
91 return adcCount;
92}
static const uint16_t BODY_AMPLITUDE
void encodeFragments(const uint16_t *amplitude, const uint32_t &address, std::vector< uint32_t > &v) const
static const uint32_t BODY_ADDRESS
double signal(double z) const
double signal_amplitude(double samplingTime) const
uint16_t m_subDetectorId
uint32_t address(const Identifier &channelId, int &eta, int &phi) const
const CscIdHelper * m_cscHelper
void set32bits(const uint16_t *v16, uint32_t &v32) const
double m_CHARGE_TO_ADC_COUNT