ATLAS Offline Software
Loading...
Searching...
No Matches
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)
16 : TFCSParametrization(name, 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}
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
FCSReturnCode
Base class for all FastCaloSim parametrizations Functionality in derivde classes is provided through ...
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
bool msgLvl(const MSG::Level lvl) const
Check whether the logging system is active at the provided verbosity level.
Definition MLogging.h:222
TFCSEnergyRenormalization(const char *name=nullptr, const char *title=nullptr)
virtual FCSReturnCode simulate(TFCSSimulationState &simulstate, const TFCSTruthState *, const TFCSExtrapolationState *) const override
Method in all derived classes to do some simulation.
TFCSParametrization(const char *name=nullptr, const char *title=nullptr)