ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
ISF
ISF_FastCaloSim
ISF_FastCaloSimEvent
src
TFCSCenterPositionCalculation.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ISF_FastCaloSimEvent/TFCSCenterPositionCalculation.h
"
6
#include "
ISF_FastCaloSimEvent/FastCaloSim_CaloCell_ID.h
"
7
8
#include "
ISF_FastCaloSimEvent/TFCSSimulationState.h
"
9
#include "
ISF_FastCaloSimEvent/TFCSExtrapolationState.h
"
10
11
//=============================================
12
//======= TFCSCenterPositionCalculation =========
13
//=============================================
14
15
TFCSCenterPositionCalculation::TFCSCenterPositionCalculation
(
const
char
*name,
16
const
char
*title)
17
:
TFCSLateralShapeParametrizationHitBase
(name, title),
m_extrapWeight
(0.5) {
18
}
19
20
FCSReturnCode
TFCSCenterPositionCalculation::simulate_hit
(
21
Hit
&
hit
,
TFCSSimulationState
&
/*simulstate*/
,
22
const
TFCSTruthState
*
/*truth*/
,
const
TFCSExtrapolationState
*extrapol) {
23
const
int
cs =
calosample
();
24
25
double
r
= (1. -
m_extrapWeight
) * extrapol->
r
(cs,
SUBPOS_ENT
) +
26
m_extrapWeight
* extrapol->
r
(cs,
SUBPOS_EXT
);
27
double
z
= (1. -
m_extrapWeight
) * extrapol->
z
(cs,
SUBPOS_ENT
) +
28
m_extrapWeight
* extrapol->
z
(cs,
SUBPOS_EXT
);
29
double
eta
= (1. -
m_extrapWeight
) * extrapol->
eta
(cs,
SUBPOS_ENT
) +
30
m_extrapWeight
* extrapol->
eta
(cs,
SUBPOS_EXT
);
31
double
phi
= (1. -
m_extrapWeight
) * extrapol->
phi
(cs,
SUBPOS_ENT
) +
32
m_extrapWeight
* extrapol->
phi
(cs,
SUBPOS_EXT
);
33
34
if
(!std::isfinite(
r
) || !std::isfinite(
z
) || !std::isfinite(
eta
) ||
35
!std::isfinite(
phi
)) {
36
ATH_MSG_WARNING
(
"Extrapolator contains NaN or infinite number.\nSetting "
37
"center position to calo boundary."
);
38
ATH_MSG_WARNING
(
"Before fix: center_r: "
39
<<
r
<<
" center_z: "
<<
z
<<
" center_phi: "
<<
phi
40
<<
" center_eta: "
<<
eta
<<
" weight: "
<<
m_extrapWeight
41
<<
" cs: "
<< cs);
42
// If extrapolator fails we can set position to calo boundary
43
r
= extrapol->
IDCaloBoundary_r
();
44
z
= extrapol->
IDCaloBoundary_z
();
45
eta
= extrapol->
IDCaloBoundary_eta
();
46
phi
= extrapol->
IDCaloBoundary_phi
();
47
48
ATH_MSG_WARNING
(
"After fix: center_r: "
49
<<
r
<<
" center_z: "
<<
z
<<
" center_phi: "
<<
phi
50
<<
" center_eta: "
<<
eta
<<
" weight: "
<<
m_extrapWeight
51
<<
" cs: "
<< cs);
52
}
53
54
hit
.setCenter_r(
r
);
55
hit
.setCenter_z(
z
);
56
hit
.setCenter_eta(
eta
);
57
hit
.setCenter_phi(
phi
);
58
59
ATH_MSG_DEBUG
(
"TFCSCenterPositionCalculation: center_r: "
60
<<
hit
.center_r() <<
" center_z: "
<<
hit
.center_z()
61
<<
" center_phi: "
<<
hit
.center_phi()
62
<<
" center_eta: "
<<
hit
.center_eta()
63
<<
" weight: "
<<
m_extrapWeight
<<
" cs: "
<< cs);
64
65
return
FCSSuccess
;
66
}
67
68
void
TFCSCenterPositionCalculation::Print
(Option_t *option)
const
{
69
TString opt(option);
70
bool
shortprint = opt.Index(
"short"
) >= 0;
71
bool
longprint =
msgLvl
(MSG::DEBUG) || (
msgLvl
(MSG::INFO) && !shortprint);
72
TString optprint = opt;
73
optprint.ReplaceAll(
"short"
,
""
);
74
TFCSLateralShapeParametrizationHitBase::Print
(option);
75
76
if
(longprint)
77
ATH_MSG_INFO
(optprint <<
" Weight for extrapolated position: "
78
<<
m_extrapWeight
);
79
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
FastCaloSim_CaloCell_ID.h
SUBPOS_ENT
@ SUBPOS_ENT
Definition
FastCaloSim_CaloCell_ID.h:12
SUBPOS_EXT
@ SUBPOS_EXT
Definition
FastCaloSim_CaloCell_ID.h:13
hit
bool hit(const Container &ids, int pdgId)
Definition
JetIRCSafeLabelTool.cxx:64
TFCSCenterPositionCalculation.h
TFCSExtrapolationState.h
FCSReturnCode
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
Definition
TFCSParametrizationBase.h:41
FCSSuccess
@ FCSSuccess
Definition
TFCSParametrizationBase.h:41
TFCSSimulationState.h
z
#define z
ISF_FCS::MLogging::msgLvl
bool msgLvl(const MSG::Level lvl) const
Check whether the logging system is active at the provided verbosity level.
Definition
MLogging.h:222
TFCSCenterPositionCalculation::simulate_hit
virtual FCSReturnCode simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) override
Used to decorate Hit with extrap center positions.
Definition
TFCSCenterPositionCalculation.cxx:20
TFCSCenterPositionCalculation::m_extrapWeight
float m_extrapWeight
Definition
TFCSCenterPositionCalculation.h:26
TFCSCenterPositionCalculation::Print
void Print(Option_t *option="") const override
Definition
TFCSCenterPositionCalculation.cxx:68
TFCSCenterPositionCalculation::TFCSCenterPositionCalculation
TFCSCenterPositionCalculation(const char *name=nullptr, const char *title=nullptr)
Definition
TFCSCenterPositionCalculation.cxx:15
TFCSExtrapolationState
Definition
TFCSExtrapolationState.h:13
TFCSExtrapolationState::phi
double phi(int layer, int subpos) const
Definition
TFCSExtrapolationState.h:55
TFCSExtrapolationState::z
double z(int layer, int subpos) const
Definition
TFCSExtrapolationState.h:57
TFCSExtrapolationState::IDCaloBoundary_z
double IDCaloBoundary_z() const
Definition
TFCSExtrapolationState.h:66
TFCSExtrapolationState::IDCaloBoundary_eta
double IDCaloBoundary_eta() const
Definition
TFCSExtrapolationState.h:63
TFCSExtrapolationState::r
double r(int layer, int subpos) const
Definition
TFCSExtrapolationState.h:56
TFCSExtrapolationState::IDCaloBoundary_phi
double IDCaloBoundary_phi() const
Definition
TFCSExtrapolationState.h:64
TFCSExtrapolationState::eta
double eta(int layer, int subpos) const
Definition
TFCSExtrapolationState.h:54
TFCSExtrapolationState::IDCaloBoundary_r
double IDCaloBoundary_r() const
Definition
TFCSExtrapolationState.h:65
TFCSLateralShapeParametrizationHitBase::Hit
Definition
TFCSLateralShapeParametrizationHitBase.h:42
TFCSLateralShapeParametrizationHitBase::TFCSLateralShapeParametrizationHitBase
TFCSLateralShapeParametrizationHitBase(const char *name=nullptr, const char *title=nullptr)
Definition
TFCSLateralShapeParametrizationHitBase.cxx:15
TFCSLateralShapeParametrization::Print
void Print(Option_t *option="") const override
Definition
TFCSLateralShapeParametrization.cxx:53
TFCSLateralShapeParametrization::calosample
int calosample() const
Definition
TFCSLateralShapeParametrization.h:34
TFCSSimulationState
Definition
TFCSSimulationState.h:32
TFCSTruthState
Definition
TFCSTruthState.h:13
r
int r
Definition
globals.cxx:22
Generated on
for ATLAS Offline Software by
1.17.0