ATLAS Offline Software
Loading...
Searching...
No Matches
TFCSSimulationState.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "CLHEP/Random/RandomEngine.h"
6
9#include <iostream>
10#include <cstring>
11
12//=============================================
13//======= TFCSSimulationState =========
14//=============================================
15
20
22 set_SF(1);
23 m_Ebin = -1;
24 m_Etot = 0;
25 for (int i = 0; i < CaloCell_ID_FCS::MaxSample; ++i) {
26 m_E[i] = 0;
27 m_Efrac[i] = 0;
28 }
29}
30
32 auto mele = m_cells.find(cellele);
33 if (mele == m_cells.end()) {
34 m_cells.emplace(cellele, 0);
35 mele = m_cells.find(cellele);
36 }
37 m_cells[cellele] += E;
38}
39
40void TFCSSimulationState::Print(Option_t *) const {
41 ATH_MSG_INFO("Ebin=" << m_Ebin << " E=" << E()
42 << " #cells=" << m_cells.size());
43 for (int i = 0; i < CaloCell_ID_FCS::MaxSample; ++i)
44 if (E(i) != 0) {
45 ATH_MSG_INFO(" E" << i << "(" << CaloSampling::getSamplingName(i)
46 << ")=" << E(i) << " E" << i << "/E=" << Efrac(i));
47 }
48 if (!m_AuxInfo.empty()) {
49 ATH_MSG_INFO(" AuxInfo has " << m_AuxInfo.size() << " elements");
50 for (const auto &a : m_AuxInfo) {
51 ATH_MSG_INFO(" " << a.first << " : "
52 // Dont print as char/bool.
53 // Accessing as a bool is likely to undefined
54 // behavior (which triggers a warning from
55 // the sanitizer). As a char, it may not
56 // be printable.
57 //<< "bool=" << a.second.b
58 //<< " char=" << a.second.c
59 << " int=" << a.second.i
60 << " float=" << a.second.f << " double=" << a.second.d
61 << " void*=" << a.second.p);
62 }
63 }
64}
65
66std::uint32_t TFCSSimulationState::getAuxIndex(const std::string &s) {
67 return TFCSSimulationState::fnv1a_32(s.c_str(), s.size());
68}
69
70std::uint32_t TFCSSimulationState::getAuxIndex(const char *s) {
71 return TFCSSimulationState::fnv1a_32(s, std::strlen(s));
72}
73
78
80 for (const auto *para : m_AuxInfoCleanup) {
81 para->CleanAuxInfo(*this);
82 }
83}
#define ATH_MSG_INFO(x)
static Double_t a
This class groups all DetDescr information related to a CaloCell.
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
double Efrac(int sample) const
static constexpr std::uint32_t fnv1a_32(char const *s, std::size_t count)
void Print(Option_t *option="") const
void set_SF(double mysf)
static std::uint32_t getAuxIndex(const std::string &s)
void AddAuxInfoCleanup(const TFCSParametrizationBase *para)
std::set< const TFCSParametrizationBase * > m_AuxInfoCleanup
Do not persistify.
std::unordered_map< std::uint32_t, AuxInfo_t > m_AuxInfo
TFCSSimulationState(CLHEP::HepRandomEngine *randomEngine=nullptr)
double m_Efrac[CaloCell_ID_FCS::MaxSample]
void deposit(const CaloDetDescrElement *cellele, float E)
double m_E[CaloCell_ID_FCS::MaxSample]
CLHEP::HepRandomEngine * m_randomEngine
CLHEP::HepRandomEngine * randomEngine()