ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloCondBlobAlgs
src
CaloCoolIdTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CaloCondBlobAlgs/CaloCoolIdTool.h
"
6
#include "GaudiKernel/MsgStream.h"
7
#include "Identifier/Identifier.h"
8
#include "
CaloIdentifier/CaloIdManager.h
"
9
#include "
CaloIdentifier/CaloCell_ID.h
"
10
#include "
CaloCondBlobObjs/CaloCondUtils.h
"
11
12
//_______________________________________________________________
13
CaloCoolIdTool::CaloCoolIdTool
(
const
std::string&
type
,
14
const
std::string& name,
15
const
IInterface* parent) :
16
AthAlgTool
(
type
, name, parent),
17
m_calo_id
(nullptr)
18
{
19
declareInterface<ICaloCoolIdTool>(
this
);
20
}
21
22
//
23
//_______________________________________________________________
24
CaloCoolIdTool::~CaloCoolIdTool
()
25
=
default
;
26
27
//
28
//_______________________________________________________________
29
StatusCode
30
CaloCoolIdTool::initialize
()
31
{
32
StatusCode
sc
=
detStore
()->retrieve(
m_calo_id
,
"CaloCell_ID"
);
33
if
(
sc
.isFailure()) {
34
msg
(MSG::ERROR) <<
"Failed to retrieve CaloCell_ID"
<<
endmsg
;
35
return
sc
;
36
}
37
38
return
StatusCode::SUCCESS;
39
}
40
41
//
42
//_______________________________________________________________
43
unsigned
int
44
CaloCoolIdTool::getCoolChannelId
(
unsigned
int
cellHash,
unsigned
int
& subHash)
const
45
{
46
int
subCalo(0);
47
subHash =
m_calo_id
->subcalo_cell_hash(cellHash, subCalo);
48
//std::cout << "Starting with hash=" << cellHash << ", SubCalo=" << subCalo << " subHash=" << subHash << std::endl;
49
//=== EM calo
50
if
(subCalo==
CaloCell_ID::LAREM
) {
51
//Sub-Calo hash gymastics to get sub-sub-calo hash (EMECA, EMBA, EMBC EMEC)
52
//(faster than converting hash to identfier and dealing with identifier)
53
//Here are the magic numbers:
54
// Hash order in LAREMCAL:
55
//Calo Offset
56
//EMEC NEG 0
57
//EMB NEG 31872
58
//EMB POS 31872 + 54784 = 86656
59
//EMEC POS 31872 + 54784 + 54784 =141440
60
61
if
(subHash >= 141440) {
62
subHash-=141440;
63
return
static_cast<
unsigned
int
>
(
CaloCondUtils::EMECZPOS
);
64
}
65
else
if
(subHash>=86656) {
66
subHash-=86656;
67
return
static_cast<
unsigned
int
>
(
CaloCondUtils::EMBZPOS
);
68
}
69
else
if
(subHash>=31872) {
70
subHash-=31872;
71
return
static_cast<
unsigned
int
>
(
CaloCondUtils::EMBZNEG
);
72
}
73
else
74
return
static_cast<
unsigned
int
>
(
CaloCondUtils::EMECZNEG
);
75
}
// end if LAr EM
76
else
if
(subCalo==
CaloCell_ID::LARHEC
){
77
return
static_cast<
unsigned
int
>
(
CaloCondUtils::HEC
);
78
}
79
//=== FCAL
80
else
if
(subCalo==
CaloCell_ID::LARFCAL
){
81
return
static_cast<
unsigned
int
>
(
CaloCondUtils::FCAL
);
82
}
83
//=== TILE
84
else
if
(subCalo==
CaloCell_ID::TILE
) {
85
return
static_cast<
unsigned
int
>
(
CaloCondUtils::TILE
);
86
}
87
88
//=== we should never go here
89
90
msg
(MSG::ERROR) <<
"cellHash is neither LAr nor Tile, something is deeply wrong"
<<
endmsg
;
91
std::abort();
92
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:61
CaloCell_ID.h
CaloCondUtils.h
CaloCoolIdTool.h
CaloIdManager.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
CaloCell_Base_ID::LAREM
@ LAREM
Definition
CaloCell_Base_ID.h:45
CaloCell_Base_ID::TILE
@ TILE
Definition
CaloCell_Base_ID.h:45
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition
CaloCell_Base_ID.h:45
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition
CaloCell_Base_ID.h:45
CaloCondUtils::EMBZPOS
@ EMBZPOS
Definition
CaloCondUtils.h:21
CaloCondUtils::FCAL
@ FCAL
Definition
CaloCondUtils.h:24
CaloCondUtils::EMECZNEG
@ EMECZNEG
Definition
CaloCondUtils.h:19
CaloCondUtils::HEC
@ HEC
Definition
CaloCondUtils.h:23
CaloCondUtils::EMECZPOS
@ EMECZPOS
Definition
CaloCondUtils.h:22
CaloCondUtils::EMBZNEG
@ EMBZNEG
Definition
CaloCondUtils.h:20
CaloCondUtils::TILE
@ TILE
Definition
CaloCondUtils.h:25
CaloCoolIdTool::~CaloCoolIdTool
virtual ~CaloCoolIdTool()
Dtor.
CaloCoolIdTool::initialize
StatusCode initialize()
Initializes the tool.
Definition
CaloCoolIdTool.cxx:30
CaloCoolIdTool::getCoolChannelId
unsigned int getCoolChannelId(unsigned int cellHash, unsigned int &subHash) const
Returns the cool channel id and subHash for a given calorimter cell.
Definition
CaloCoolIdTool.cxx:44
CaloCoolIdTool::m_calo_id
const CaloCell_ID * m_calo_id
Definition
CaloCoolIdTool.h:46
CaloCoolIdTool::CaloCoolIdTool
CaloCoolIdTool(const std::string &type, const std::string &name, const IInterface *parent)
Ctor.
Definition
CaloCoolIdTool.cxx:13
type
Generated on
for ATLAS Offline Software by
1.17.0