ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
10
11//=============================================
12//======= TFCSCenterPositionCalculation =========
13//=============================================
14
19
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
68void 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", "");
75
76 if (longprint)
77 ATH_MSG_INFO(optprint << " Weight for extrapolated position: "
79}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
#define z
bool msgLvl(const MSG::Level lvl) const
Check whether the logging system is active at the provided verbosity level.
Definition MLogging.h:222
virtual FCSReturnCode simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) override
Used to decorate Hit with extrap center positions.
void Print(Option_t *option="") const override
TFCSCenterPositionCalculation(const char *name=nullptr, const char *title=nullptr)
TFCSLateralShapeParametrizationHitBase(const char *name=nullptr, const char *title=nullptr)
void Print(Option_t *option="") const override
int r
Definition globals.cxx:22