ATLAS Offline Software
TFCSEnergyRenormalization.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
8 #include "CaloDetDescr/CaloDetDescrElement.h"
9 
10 //=============================================
11 //======= TFCSEnergyRenormalization =========
12 //=============================================
13 
15  const char *title)
17 
19 
21  TFCSSimulationState &simulstate, const TFCSTruthState * /*truth*/,
22  const TFCSExtrapolationState * /*extrapol*/) const {
23  std::vector<double> energies(CaloCell_ID_FCS::MaxSample, 0);
24 
25  // Loop over all cells and sum up energies
26  for (const auto &iter : simulstate.cells()) {
27  const CaloDetDescrElement *theDDE = iter.first;
28  int layer = theDDE->getSampling();
29  energies[layer] += iter.second;
30  }
31 
32  std::vector<float> scalefactor(CaloCell_ID_FCS::MaxSample, 1);
33 
34  const std::map<int, float> approxLayerNoise{{0,150.0},{1,40.0},{2,80.0},{3,40.0},{4,150.0},{5,40.0},{6,80.0},{7,50.0},{8,400.0},{9,400.0},{10,400.0},{11,400.0},{12,300.0},{13,150.0},{14,40.0},{15,150.0},{16,40.0},{17,400.0},{18,300.0},{19,150.0},{20,40.0},{21,400.0},{22,400.0},{23,400.0}};
35 
36  for (int layer = 0; layer < CaloCell_ID_FCS::MaxSample; ++layer) {
37  //catch large amounts of energy not simulated as shower is outside the calorimeter
38  if (energies[layer]==0 && simulstate.E(layer)!=0){
39  if (simulstate.E(layer)>8.0*approxLayerNoise.at(layer) && layer!=5 && layer!=6 && layer!=7) ATH_MSG_INFO("TFCSEnergyRenormalization::simulate(): energy not simulated (out-of-calo) in layer "<<layer<<" expected: "<<simulstate.E(layer)<<" simulated: "<<energies[layer]);
40  if (simulstate.E(layer)>1500.0 && (layer==5 || layer==6 || layer==7)) ATH_MSG_INFO("TFCSEnergyRenormalization::simulate(): energy not simulated (out-of-calo) in layer "<<layer<<" expected: "<<simulstate.E(layer)<<" simulated: "<<energies[layer]);
41  }
42  if (energies[layer] != 0)
43  scalefactor[layer] = simulstate.E(layer) / energies[layer];
44  }
45 
46  // Loop over all cells and apply the scalefactor
47  for (auto &iter : simulstate.cells()) {
48  const CaloDetDescrElement *theDDE = iter.first;
49  int layer = theDDE->getSampling();
50  iter.second *= scalefactor[layer];
51  }
52 
53  if (msgLvl(MSG::DEBUG)) {
54  ATH_MSG_DEBUG("Apply scale factors : ");
55  for (int layer = 0; layer < CaloCell_ID_FCS::MaxSample; ++layer) {
56  ATH_MSG_DEBUG(" " << layer << " *= " << scalefactor[layer] << " : "
57  << energies[layer] << " -> " << simulstate.E(layer));
58  }
59  }
60 
61  return FCSSuccess;
62 }
TFCSEnergyRenormalization.h
FCSReturnCode
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
Definition: TFCSParametrizationBase.h:41
TFCSEnergyRenormalization::simulate
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *, const TFCSExtrapolationState *) const override
Method in all derived classes to do some simulation.
Definition: TFCSEnergyRenormalization.cxx:20
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TFCSSimulationState::cells
Cellmap_t & cells()
Definition: TFCSSimulationState.h:72
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
TFCSEnergyRenormalization::TFCSEnergyRenormalization
TFCSEnergyRenormalization(const char *name=nullptr, const char *title=nullptr)
Definition: TFCSEnergyRenormalization.cxx:14
TFCSExtrapolationState
Definition: TFCSExtrapolationState.h:13
CaloCell_ID_FCS::MaxSample
@ MaxSample
Definition: FastCaloSim_CaloCell_ID.h:47
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
covarianceTool.title
title
Definition: covarianceTool.py:542
FCSSuccess
@ FCSSuccess
Definition: TFCSParametrizationBase.h:41
TFCSParametrization
Definition: TFCSParametrization.h:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
DEBUG
#define DEBUG
Definition: page_access.h:11
TFCSSimulationState::E
double E() const
Definition: TFCSSimulationState.h:42
TFCSEnergyRenormalization::~TFCSEnergyRenormalization
virtual ~TFCSEnergyRenormalization()
Definition: TFCSEnergyRenormalization.cxx:18
TFCSSimulationState.h
FastCaloSim_CaloCell_ID.h
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