ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCalibUtils
src
LArDeltaRespTool.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 "
LArCalibUtils/LArDeltaRespTool.h
"
6
#include "
LArCalibUtils/LArPhysWaveTool.h
"
7
8
const
int
LArDeltaRespTool::DEFAULT
=-1;
9
10
// constructor
11
LArDeltaRespTool::LArDeltaRespTool
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent )
12
:
AthAlgTool
(
type
,name,parent),
13
m_Tdrift
(0),
14
m_Fstep
(0),
15
m_Tcal
(0),
16
m_Omega0
(0),
17
m_Taur
(0),
18
m_Tstart
(0)
19
{
20
declareProperty
(
"InjPointCorr"
,
m_injPointCorr
=
true
) ;
21
declareProperty
(
"NormalizeCali"
,
m_normalizeCali
=
true
) ;
22
declareProperty
(
"TimeOriginShift"
,
m_timeOriginShift
=
false
) ;
23
declareProperty
(
"SubtractBaseline"
,
m_subtractBaseline
=
true
) ;
24
}
25
26
// destructor
27
LArDeltaRespTool::~LArDeltaRespTool
() =
default
;
28
29
LArCaliWave
LArDeltaRespTool::makeLArDeltaResp
(
const
LArWFParams
&larWFParam,
30
const
LArCaliWave
&larCaliWave )
31
{
32
33
m_gCali
= larCaliWave;
34
35
m_Tdrift
= larWFParam.
tdrift
();
36
m_Tcal
= larWFParam.
tcal
();
37
m_Fstep
= larWFParam.
fstep
();
38
m_Taur
= larWFParam.
taur
();
39
m_Omega0
= larWFParam.
omega0
();
40
41
compute_deltaresp
();
42
43
return
m_gDelta
;
44
}
45
46
47
void
LArDeltaRespTool::compute_deltaresp
()
48
{
49
LArWaveHelper
wHelper;
50
51
// calib. signal at Mother Board :
52
LArWave
gCaliMB(
m_gCali
), gDelta;
53
54
// shift gCaliMB to start point and remove baseline
55
m_Tstart
= wHelper.
getStart
(gCaliMB) ;
56
double
baseline
= wHelper.
getBaseline
(gCaliMB,
m_Tstart
) ;
57
if
(
m_subtractBaseline
) gCaliMB = gCaliMB + (-
baseline
) ;
58
if
(
m_timeOriginShift
) gCaliMB = wHelper.
translate
(gCaliMB,-
m_Tstart
,
baseline
) ;
59
60
// normalization of calibration pulse
61
if
(
m_normalizeCali
) {
62
ATH_MSG_VERBOSE
(
"*** Normalisation \t|-> YES"
);
63
double
peak = gCaliMB.getSample( wHelper.
getMax
(gCaliMB) ) ;
64
ATH_MSG_VERBOSE
(
"peak = "
<< peak );
65
if
( peak <=0 ) {
66
ATH_MSG_WARNING
(
"Peak value <=0 , cannot normalize!"
);
67
}
else
{
68
gCaliMB = gCaliMB * (1./peak) ;
69
}
70
}
else
{
71
ATH_MSG_VERBOSE
(
"*** Normalisation \t|-> NO"
);
72
}
73
74
// delta responde waveform prediction
75
ATH_MSG_VERBOSE
(
"*** Delta response \t|-> m_Fstep = "
<<
m_Fstep
<<
" ns "
);
76
ATH_MSG_VERBOSE
(
"*** Delta response \t|-> m_Tcal = "
<<
m_Tcal
<<
" ns "
);
77
ATH_MSG_VERBOSE
(
"*** Delta response \t|-> m_Omega0 = "
<<
m_Omega0
<<
" GHz"
);
78
ATH_MSG_VERBOSE
(
"*** Delta response \t|-> m_Taur = "
<<
m_Taur
<<
" ns "
);
79
80
if
( !
m_injPointCorr
) {
81
// perform only exp->triangle correction
82
ATH_MSG_VERBOSE
(
"*** Inj.Point Corr. \t|-> NO"
);
83
gDelta =
deltaResp
( gCaliMB ) ;
84
}
else
{
85
// perform exp->triangle and then injection point correction
86
ATH_MSG_VERBOSE
(
"*** Inj.Point Corr. \t|-> YES"
);
87
//gDelta = deltaResp ( gCaliMB ) ;
88
//gDelta = LArPhysWaveTool::injResp( gDelta ); // HOW TO MAKE THIS WORKING???
89
gDelta =
injResp
(
deltaResp
( gCaliMB ) ) ;
90
}
91
92
//int deltaRespDAC = m_gCali.getDAC() ;
93
int
deltaRespDAC = -3 ;
94
95
m_gDelta
=
LArCaliWave
( gDelta.
getWave
() ,
96
m_gCali
.getDt() ,
97
deltaRespDAC ,
98
m_gCali
.getIsPulsedInt(),
99
m_gCali
.getFlag() );
100
101
}
102
103
104
LArWave
LArDeltaRespTool::deltaResp
(
const
LArWave
&w)
const
105
{
106
double
fstep =
m_Fstep
;
107
double
Tc
=
m_Tcal
;
108
LArWaveHelper
wHelper;
109
return
( w %
deltaCorr
() ) + w*((1.-fstep)/
Tc
) + wHelper.
derive_smooth
(w);
110
}
111
112
LArWave
LArDeltaRespTool::deltaCorr
()
const
113
{
114
unsigned
N =
m_gCali
.getSize() ;
115
double
dt =
m_gCali
.getDt() ;
116
LArWave
w(N,dt) ;
117
for
(
unsigned
i=0 ; i<N ; i++ ) w.setSample(i,
deltaCorr
(i*dt)) ;
118
return
w ;
119
}
120
121
double
LArDeltaRespTool::deltaCorr
(
double
t )
const
122
{
123
double
fstep =
m_Fstep
;
124
double
Tc
=
m_Tcal
;
125
return
((fstep*fstep-fstep)/(
Tc
*
Tc
)) * exp( -fstep*t/
Tc
);
126
}
127
128
LArWave
LArDeltaRespTool::injResp
(
const
LArWave
& w)
const
{
129
return
w %
injCorr
() ;
130
}
131
132
LArWave
LArDeltaRespTool::injCorr
()
const
{
133
unsigned
N =
m_gCali
.getSize() ;
134
double
dt =
m_gCali
.getDt() ;
135
LArWave
w(N,dt) ;
136
for
(
unsigned
i=0 ; i<N ; i++ ) w.setSample(i,
injCorr
(i*dt)) ;
137
return
w ;
138
}
139
140
double
LArDeltaRespTool::injCorr
(
double
t )
const
{
141
double
tau0
= 1./
m_Omega0
;
142
double
taur =
m_Taur
;
143
double
Delta = pow(taur,2.) - pow(2*
tau0
,2.) ;
144
if
( Delta > 0 ) {
145
double
sqrtDelta = sqrt(Delta) ;
146
double
taup
= 0.5*( taur + sqrtDelta ) ;
147
double
taum = 0.5*( taur - sqrtDelta ) ;
148
return
( exp(-t/
taup
) - exp(-t/taum) ) / (
taup
- taum ) ;
149
}
else
if
( Delta < 0 ) {
150
double
T = sqrt(-Delta) ;
151
double
A
= 2 * taur / ( pow(taur,2.) - Delta ) ;
152
double
B = 2 * T / ( pow(taur,2.) - Delta ) ;
153
return
2 * exp(-
A
*t) * sin(B*t) / T ;
154
}
else
{
155
double
tau = 0.5 * taur ;
156
return
exp(-t/tau) * t / pow(tau,2.) ;
157
}
158
#if 0
159
double
taur2 = taur*taur, tau02 =
tau0
*
tau0
;
160
double
taua = sqrt( 4.*tau02 - taur2 );
161
return
(2./taua)*exp(-t*taur/(2.*tau02))*sin(t*taua/(2.*tau02));
162
#endif
163
}
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
LArDeltaRespTool.h
Tc
static Double_t Tc(Double_t t)
Definition
LArPhysWaveHECTool.cxx:312
taup
static Double_t taup
Definition
LArPhysWaveHECTool.cxx:37
tau0
static Double_t tau0
Definition
LArPhysWaveHECTool.cxx:37
LArPhysWaveTool.h
baseline
@ baseline
Definition
SUSYToolsTester.cxx:94
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
LArCaliWave
Definition
LArCaliWave.h:44
LArDeltaRespTool::LArDeltaRespTool
LArDeltaRespTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
LArDeltaRespTool.cxx:11
LArDeltaRespTool::compute_deltaresp
void compute_deltaresp()
Definition
LArDeltaRespTool.cxx:47
LArDeltaRespTool::injResp
LArWave injResp(const LArWave &w) const
Definition
LArDeltaRespTool.cxx:128
LArDeltaRespTool::m_timeOriginShift
bool m_timeOriginShift
Definition
LArDeltaRespTool.h:43
LArDeltaRespTool::injCorr
LArWave injCorr() const
Definition
LArDeltaRespTool.cxx:132
LArDeltaRespTool::~LArDeltaRespTool
virtual ~LArDeltaRespTool()
LArDeltaRespTool::m_gDelta
LArCaliWave m_gDelta
Definition
LArDeltaRespTool.h:41
LArDeltaRespTool::m_gCali
LArCaliWave m_gCali
Definition
LArDeltaRespTool.h:41
LArDeltaRespTool::m_Taur
double m_Taur
Definition
LArDeltaRespTool.h:45
LArDeltaRespTool::m_injPointCorr
bool m_injPointCorr
Definition
LArDeltaRespTool.h:43
LArDeltaRespTool::m_normalizeCali
bool m_normalizeCali
Definition
LArDeltaRespTool.h:43
LArDeltaRespTool::makeLArDeltaResp
LArCaliWave makeLArDeltaResp(const LArWFParams &, const LArCaliWave &)
Definition
LArDeltaRespTool.cxx:29
LArDeltaRespTool::m_Tdrift
double m_Tdrift
Definition
LArDeltaRespTool.h:45
LArDeltaRespTool::deltaCorr
LArWave deltaCorr() const
Definition
LArDeltaRespTool.cxx:112
LArDeltaRespTool::m_Omega0
double m_Omega0
Definition
LArDeltaRespTool.h:45
LArDeltaRespTool::DEFAULT
static const int DEFAULT
Definition
LArDeltaRespTool.h:39
LArDeltaRespTool::m_Tcal
double m_Tcal
Definition
LArDeltaRespTool.h:45
LArDeltaRespTool::m_Fstep
double m_Fstep
Definition
LArDeltaRespTool.h:45
LArDeltaRespTool::deltaResp
LArWave deltaResp(const LArWave &) const
Definition
LArDeltaRespTool.cxx:104
LArDeltaRespTool::m_Tstart
unsigned m_Tstart
Definition
LArDeltaRespTool.h:46
LArDeltaRespTool::m_subtractBaseline
bool m_subtractBaseline
Definition
LArDeltaRespTool.h:43
LArWFParams
Definition
LArWFParams.h:20
LArWFParams::omega0
double omega0() const
Definition
LArWFParams.h:270
LArWFParams::tdrift
double tdrift() const
Definition
LArWFParams.h:269
LArWFParams::fstep
double fstep() const
Definition
LArWFParams.h:268
LArWFParams::tcal
double tcal() const
Definition
LArWFParams.h:267
LArWFParams::taur
double taur() const
Definition
LArWFParams.h:271
LArWaveHelper
Definition
LArWaveHelper.h:14
LArWaveHelper::translate
LArWave translate(const LArWave &theWave, int nShift, double baseline=0.) const
Definition
LArWaveHelper.cxx:11
LArWaveHelper::derive_smooth
LArWave derive_smooth(const LArWave &theWave) const
smoothed derivative
Definition
LArWaveHelper.cxx:274
LArWaveHelper::getBaseline
double getBaseline(const LArWave &theWave, unsigned nBase) const
Definition
LArWaveHelper.cxx:351
LArWaveHelper::getMax
unsigned int getMax(const LArWave &theWave) const
return index of maximum sample
Definition
LArWaveHelper.cxx:89
LArWaveHelper::getStart
unsigned getStart(const LArWave &theWave) const
Definition
LArWaveHelper.cxx:413
LArWave
Definition
LArWave.h:31
LArWave::getWave
const std::vector< double > & getWave() const
Wave parameters.
Definition
LArWave.h:167
A
hold the test vectors and ease the comparison
type
Generated on
for ATLAS Offline Software by
1.17.0