ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
HeavyIonPhys
HIEventUtils
Root
HIEventShapeMapTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
xAODHIEvent/HIEventShape.h
"
6
#include "
HIEventUtils/HIEventShapeIndex.h
"
7
#include "
HIEventUtils/HIEventShapeMapTool.h
"
8
9
HIEventShapeMapTool::HIEventShapeMapTool
(
const
std::string& n) :
asg
::
AsgTool
(n){
10
11
}
12
13
StatusCode
HIEventShapeMapTool::initialize
(){
14
15
HIEventShapeIndex
index_1, index_2;
16
index_1.
setBinning
(
HI::BinningScheme::COMPACT
);
17
index_2.
setBinning
(
HI::BinningScheme::TOWER
);
18
m_map
[
HI::BinningScheme::COMPACT
] = index_1;
19
m_map
[
HI::BinningScheme::TOWER
] = index_2;
20
21
return
StatusCode::SUCCESS;
22
}
23
24
const
HIEventShapeIndex
*
HIEventShapeMapTool::getIndex
(
HI::BinningScheme
key)
const
25
{
26
std::string myKey;
27
if
(key ==
HI::BinningScheme::COMPACT
) myKey=
"COMPACT"
;
28
else
if
(key ==
HI::BinningScheme::TOWER
) myKey=
"TOWER"
;
29
else
myKey =
"UNKNOWN SHAPE"
;
30
31
auto
itr=
m_map
.find(key);
32
if
(itr==
m_map
.end()) {
33
ATH_MSG_ERROR
(
"HIEventShapeMapTool failed to find map w/ format "
<< myKey);
34
return
nullptr
;
35
}
36
return
&(itr->second);
37
}
38
39
const
HIEventShapeIndex
*
HIEventShapeMapTool::getIndexFromShape
(
const
xAOD::HIEventShapeContainer
* shape)
const
40
{
41
ATH_MSG_DEBUG
(
"In getIndexFromShape, Shape size "
<< shape->
size
() <<
" And TOWER is: "
<< (
HI::TowerBins::numLayers
()*
HI::TowerBins::numEtaBins
()));
42
if
(shape->
size
() ==
HI::BinningScheme::TOWER
){
43
//TOWER
44
auto
itr =
m_map
.find(
HI::BinningScheme::TOWER
);
45
if
(itr ==
m_map
.end())
return
nullptr
;
46
return
&(itr->second);
47
}
48
else
if
(shape->
size
() ==
HI::BinningScheme::COMPACT
){
49
//COMPACT
50
auto
itr =
m_map
.find(
HI::BinningScheme::COMPACT
);
51
if
(itr ==
m_map
.end())
return
nullptr
;
52
return
&(itr->second);
53
}
54
else
{
55
ATH_MSG_FATAL
(
"Event Shape w/ unknown binning! Not TOWER or COMPACT. Not possible to get Index"
);
56
return
nullptr
;
57
}
58
}
59
60
bool
HIEventShapeMapTool::hasKey
(
HI::BinningScheme
key)
61
{
62
return
(
m_map
.find(key)!=
m_map
.end());
63
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x,...)
Definition
AthMsgStreamMacros.h:48
HIEventShapeIndex.h
HIEventShapeMapTool.h
HIEventShape.h
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
HIEventShapeIndex
Definition
HIEventShapeIndex.h:16
HIEventShapeIndex::setBinning
unsigned int setBinning(const TH2 *h2, bool asMask)
Definition
HIEventShapeIndex.cxx:24
HIEventShapeMapTool::hasKey
virtual bool hasKey(HI::BinningScheme key) override
Definition
HIEventShapeMapTool.cxx:60
HIEventShapeMapTool::HIEventShapeMapTool
HIEventShapeMapTool(const std::string &n)
Definition
HIEventShapeMapTool.cxx:9
HIEventShapeMapTool::getIndex
virtual const HIEventShapeIndex * getIndex(HI::BinningScheme key) const override
Definition
HIEventShapeMapTool.cxx:24
HIEventShapeMapTool::m_map
std::map< HI::BinningScheme,HIEventShapeIndex > m_map
Definition
HIEventShapeMapTool.h:36
HIEventShapeMapTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
HIEventShapeMapTool.cxx:13
HIEventShapeMapTool::getIndexFromShape
virtual const HIEventShapeIndex * getIndexFromShape(const xAOD::HIEventShapeContainer *shape) const override
Definition
HIEventShapeMapTool.cxx:39
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
HI::TowerBins::numLayers
constexpr unsigned int numLayers()
Definition
HIEventDefs.h:23
HI::TowerBins::numEtaBins
constexpr unsigned int numEtaBins()
Definition
HIEventDefs.h:19
HI::BinningScheme
BinningScheme
Definition
HIEventDefs.h:16
HI::COMPACT
@ COMPACT
Definition
HIEventDefs.h:16
HI::TOWER
@ TOWER
Definition
HIEventDefs.h:16
asg
Definition
DataHandleTestTool.h:28
xAOD::HIEventShapeContainer
HIEventShapeContainer_v2 HIEventShapeContainer
Define the latest version of the container.
Definition
HIEventShapeContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0