ATLAS Offline Software
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 
16  const char *title)
17  : TFCSLateralShapeParametrizationHitBase(name, title), m_extrapWeight(0.5) {
18 }
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) +
27  double z = (1. - m_extrapWeight) * extrapol->z(cs, SUBPOS_ENT) +
29  double eta = (1. - m_extrapWeight) * extrapol->eta(cs, SUBPOS_ENT) +
31  double phi = (1. - m_extrapWeight) * extrapol->phi(cs, SUBPOS_ENT) +
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", "");
75 
76  if (longprint)
77  ATH_MSG_INFO(optprint << " Weight for extrapolated position: "
78  << m_extrapWeight);
79 }
TFCSLateralShapeParametrizationHitBase::Hit::setCenter_phi
void setCenter_phi(float phi)
Definition: TFCSLateralShapeParametrizationHitBase.h:105
TFCSCenterPositionCalculation.h
beamspotman.r
def r
Definition: beamspotman.py:676
FCSReturnCode
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
Definition: TFCSParametrizationBase.h:41
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
TFCSLateralShapeParametrization::Print
void Print(Option_t *option="") const override
Definition: TFCSLateralShapeParametrization.cxx:53
TFCSCenterPositionCalculation::Print
void Print(Option_t *option="") const override
Definition: TFCSCenterPositionCalculation.cxx:68
TFCSExtrapolationState
Definition: TFCSExtrapolationState.h:13
TFCSLateralShapeParametrizationHitBase::Hit::setCenter_z
void setCenter_z(float z)
Definition: TFCSLateralShapeParametrizationHitBase.h:103
TFCSLateralShapeParametrizationHitBase::Hit
Definition: TFCSLateralShapeParametrizationHitBase.h:42
RunActsMaterialValidation.extrapol
extrapol
Definition: RunActsMaterialValidation.py:90
TFCSLateralShapeParametrizationHitBase::Hit::center_phi
float & center_phi()
Definition: TFCSLateralShapeParametrizationHitBase.h:101
TFCSLateralShapeParametrizationHitBase
Definition: TFCSLateralShapeParametrizationHitBase.h:13
TFCSLateralShapeParametrizationHitBase::Hit::setCenter_eta
void setCenter_eta(float eta)
Definition: TFCSLateralShapeParametrizationHitBase.h:104
z
#define z
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
covarianceTool.title
title
Definition: covarianceTool.py:542
TFCSLateralShapeParametrizationHitBase::Hit::center_z
float & center_z()
Definition: TFCSLateralShapeParametrizationHitBase.h:99
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
SUBPOS_ENT
@ SUBPOS_ENT
Definition: FastCaloSim_CaloCell_ID.h:12
FCSSuccess
@ FCSSuccess
Definition: TFCSParametrizationBase.h:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TFCSCenterPositionCalculation::m_extrapWeight
float m_extrapWeight
Definition: TFCSCenterPositionCalculation.h:26
SUBPOS_EXT
@ SUBPOS_EXT
Definition: FastCaloSim_CaloCell_ID.h:13
TFCSLateralShapeParametrization::calosample
int calosample() const
Definition: TFCSLateralShapeParametrization.h:34
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TFCSExtrapolationState.h
DEBUG
#define DEBUG
Definition: page_access.h:11
TFCSCenterPositionCalculation::TFCSCenterPositionCalculation
TFCSCenterPositionCalculation(const char *name=nullptr, const char *title=nullptr)
Definition: TFCSCenterPositionCalculation.cxx:15
TFCSLateralShapeParametrizationHitBase::Hit::center_eta
float & center_eta()
Definition: TFCSLateralShapeParametrizationHitBase.h:100
TFCSLateralShapeParametrizationHitBase::Hit::center_r
float & center_r()
Definition: TFCSLateralShapeParametrizationHitBase.h:98
TFCSSimulationState.h
FastCaloSim_CaloCell_ID.h
TFCSLateralShapeParametrizationHitBase::Hit::setCenter_r
void setCenter_r(float r)
Definition: TFCSLateralShapeParametrizationHitBase.h:102
TFCSTruthState
Definition: TFCSTruthState.h:13
TFCSSimulationState
Definition: TFCSSimulationState.h:32
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