ATLAS Offline Software
TFCSHitCellMapping.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 
10 //=============================================
11 //======= TFCSHitCellMapping =========
12 //=============================================
13 
18 }
19 
22  const TFCSTruthState * /*truth*/,
23  const TFCSExtrapolationState * /*extrapol*/) {
24  int cs = calosample();
25  float distance;
26  const CaloDetDescrElement* cellele=m_geo->getDDE(cs,hit.eta(),hit.phi(),&distance);
27  ATH_MSG_DEBUG("HIT: cellele=" << cellele << " E=" << hit.E() << " cs=" << cs
28  << " eta=" << hit.eta()
29  << " phi=" << hit.phi());
30  if(cellele) {
31  // If the distance is positive then we are using the nearest cell rather than are inside a cell
32  // If we are more than 0.005mm from the nearest cell we don't create a hit to avoid the build-up of energy in edge cells
33  // For FCSV2 another hit can be created but with a cutoff to avoid looping,
34  // for FastCaloGAN the rest of the hits in the layer will be scaled up by the energy renormalization step.
35  if (distance<0.005){
36  simulstate.deposit(cellele,hit.E());
37  }else{
38  hit.setXYZE(hit.x(),hit.y(),hit.z(),0.0);
39  }
40  return FCSSuccess;
41  } else {
43  "TFCSLateralShapeParametrizationHitCellMapping::simulate_hit: cellele="
44  << cellele << " E=" << hit.E() << " cs=" << cs << " eta=" << hit.eta()
45  << " phi=" << hit.phi());
46  return FCSFatal;
47  }
48 }
49 
52  return true;
54  return false;
56  return false;
57 
58  return true;
59 }
60 
61 void TFCSHitCellMapping::Print(Option_t *option) const {
62  TString opt(option);
63  bool shortprint = opt.Index("short") >= 0;
64  bool longprint = msgLvl(MSG::DEBUG) || (msgLvl(MSG::INFO) && !shortprint);
65  TString optprint = opt;
66  optprint.ReplaceAll("short", "");
68 
69  if (longprint)
70  ATH_MSG_INFO(optprint << " geo=" << CxxUtils::as_const_ptr(m_geo));
71 }
FCSReturnCode
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
Definition: TFCSParametrizationBase.h:41
TFCSParametrization::compare
bool compare(const TFCSParametrizationBase &ref) const
Definition: TFCSParametrization.cxx:78
TFCSLateralShapeParametrizationHitBase::Hit::x
float & x()
Definition: TFCSLateralShapeParametrizationHitBase.h:88
TFCSParametrizationBase::compare
bool compare(const TFCSParametrizationBase &ref) const
Do not persistify!
Definition: TFCSParametrizationBase.cxx:42
TFCSLateralShapeParametrizationHitBase::Hit::setXYZE
void setXYZE(float x, float y, float z, float E)
Definition: TFCSLateralShapeParametrizationHitBase.h:63
TFCSLateralShapeParametrizationHitBase::Hit::phi
float & phi()
Definition: TFCSLateralShapeParametrizationHitBase.h:87
TFCSHitCellMapping::Print
void Print(Option_t *option) const override
Definition: TFCSHitCellMapping.cxx:61
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TFCSLateralShapeParametrizationHitBase::Hit::y
float & y()
Definition: TFCSLateralShapeParametrizationHitBase.h:89
TFCSHitCellMapping::operator==
virtual bool operator==(const TFCSParametrizationBase &ref) const override
The == operator compares the content of instances.
Definition: TFCSHitCellMapping.cxx:50
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
as_const_ptr.h
Helper for getting a const version of a pointer.
TFCSLateralShapeParametrization::Print
void Print(Option_t *option="") const override
Definition: TFCSLateralShapeParametrization.cxx:53
TFCSExtrapolationState
Definition: TFCSExtrapolationState.h:13
TFCSLateralShapeParametrizationHitBase::Hit
Definition: TFCSLateralShapeParametrizationHitBase.h:42
TFCSLateralShapeParametrizationHitBase
Definition: TFCSLateralShapeParametrizationHitBase.h:13
TFCSLateralShapeParametrizationHitBase::Hit::E
float & E()
Definition: TFCSLateralShapeParametrizationHitBase.h:90
TFCSParametrizationBase
Definition: TFCSParametrizationBase.h:46
TFCSHitCellMapping::TFCSHitCellMapping
TFCSHitCellMapping(const char *name=nullptr, const char *title=nullptr, ICaloGeometry *geo=nullptr)
Definition: TFCSHitCellMapping.cxx:14
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ICaloGeometry
Definition: ICaloGeometry.h:14
TFCSSimulationState::deposit
void deposit(const CaloDetDescrElement *cellele, float E)
Definition: TFCSSimulationState.cxx:31
covarianceTool.title
title
Definition: covarianceTool.py:542
TFCSParametrizationBase::set_match_all_pdgid
virtual void set_match_all_pdgid()
Definition: TFCSParametrizationBase.h:83
FCSFatal
@ FCSFatal
Definition: TFCSParametrizationBase.h:41
FCSSuccess
@ FCSSuccess
Definition: TFCSParametrizationBase.h:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
pmontree.opt
opt
Definition: pmontree.py:16
CxxUtils::as_const_ptr
const T * as_const_ptr(const T *p)
Helper for getting a const version of a pointer.
Definition: as_const_ptr.h:32
TFCSHitCellMapping::m_geo
ICaloGeometry * m_geo
Definition: TFCSHitCellMapping.h:31
TFCSHitCellMapping.h
TFCSLateralShapeParametrizationHitBase::Hit::z
float & z()
Definition: TFCSLateralShapeParametrizationHitBase.h:91
TFCSLateralShapeParametrization::compare
bool compare(const TFCSParametrizationBase &ref) const
Definition: TFCSLateralShapeParametrization.cxx:32
TFCSLateralShapeParametrization::calosample
int calosample() const
Definition: TFCSLateralShapeParametrization.h:34
ref
const boost::regex ref(r_ef)
LArCellConditions.geo
bool geo
Definition: LArCellConditions.py:46
DEBUG
#define DEBUG
Definition: page_access.h:11
TFCSLateralShapeParametrizationHitBase::Hit::eta
float & eta()
Definition: TFCSLateralShapeParametrizationHitBase.h:86
TFCSSimulationState.h
ICaloGeometry.h
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
TFCSHitCellMapping::simulate_hit
virtual FCSReturnCode simulate_hit(Hit &hit, TFCSSimulationState &simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) override
fills all hits into calorimeter cells
Definition: TFCSHitCellMapping.cxx:21
TFCSTruthState
Definition: TFCSTruthState.h:13
ICaloGeometry::getDDE
virtual const CaloDetDescrElement * getDDE(Identifier identify)=0
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