ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCellPedShift.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef CALOCONDITIONS_CALOCELLPEDSHIFT
6#define CALOCONDITIONS_CALOCELLPEDSHIFT
7
9
10#include <array>
11#include <vector>
12#include <format>
13#include <stdexcept>
14
15class CaloCell_ID;
16
18
19 public:
20 CaloCellPedShift(const CaloCell_ID* cellid);
21
22 //Getter:
23 float pedShift(const IdentifierHash hash, const int gain) const;
24
25 //Setter:
26 void setPedShift(const IdentifierHash hash, const int gain, const float value);
27
28
29 private:
30 //Underlying data structure:
31 //LAr has 3 gains:
32 std::array<std::vector<float>,3> m_larValues;
33 //Tile has 4 gains:
34 std::array<std::vector<float>,4> m_tileValues;
35 size_t m_tileMinHash{};
36
37};
38
39
40inline
41float CaloCellPedShift::pedShift(const IdentifierHash hash, const int gain) const {
42 try{
43 if (hash<m_tileMinHash) {
44 return m_larValues.at(gain)[hash];
45 } else {
46 return m_tileValues.at(gain)[hash-m_tileMinHash];
47 }
48 } catch (const std::out_of_range & e){
49 throw std::out_of_range(std::format ("CaloCellPedShift::pedShift: {} is out of the array range.", gain));
50 }
51}
52
54CLASS_DEF( CaloCellPedShift, 196920958, 1 )
55#include "AthenaKernel/CondCont.h"
57#endif
58
#define CONDCONT_DEF(...)
Definition CondCont.h:1413
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
std::array< std::vector< float >, 3 > m_larValues
CaloCellPedShift(const CaloCell_ID *cellid)
float pedShift(const IdentifierHash hash, const int gain) const
std::array< std::vector< float >, 4 > m_tileValues
void setPedShift(const IdentifierHash hash, const int gain, const float value)
Helper class for offline cell identifiers.
Definition CaloCell_ID.h:34
This is a "hash" representation of an Identifier.