ATLAS Offline Software
Calorimeter
CaloCondBlobAlgs
src
CaloCoolIdTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 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 retrive 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
}
CaloCondUtils::EMECZPOS
@ EMECZPOS
Definition:
CaloCondUtils.h:22
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition:
CaloCell_Base_ID.h:46
CaloCondUtils::FCAL
@ FCAL
Definition:
CaloCondUtils.h:24
CaloCondUtils::HEC
@ HEC
Definition:
CaloCondUtils.h:23
CaloCondUtils::TILE
@ TILE
Definition:
CaloCondUtils.h:25
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition:
CaloCell_Base_ID.h:46
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
CaloCondUtils.h
AthenaPoolTestRead.sc
sc
Definition:
AthenaPoolTestRead.py:27
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition:
AthCommonDataStore.h:95
CaloCondUtils::EMECZNEG
@ EMECZNEG
Definition:
CaloCondUtils.h:19
CaloCoolIdTool::initialize
StatusCode initialize()
Initializes the tool.
Definition:
CaloCoolIdTool.cxx:30
endmsg
#define endmsg
Definition:
AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
test_pyathena.parent
parent
Definition:
test_pyathena.py:15
CaloCell_Base_ID::subcalo_cell_hash
IdentifierHash subcalo_cell_hash(const Identifier cellId, int &subCalo) const
create hash id from 'global' cell id
CaloCell_Base_ID::TILE
@ TILE
Definition:
CaloCell_Base_ID.h:46
CaloCondUtils::EMBZNEG
@ EMBZNEG
Definition:
CaloCondUtils.h:20
WriteCellNoiseToCool.cellHash
cellHash
Definition:
WriteCellNoiseToCool.py:433
CaloCoolIdTool.h
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
CaloCoolIdTool::CaloCoolIdTool
CaloCoolIdTool(const std::string &type, const std::string &name, const IInterface *parent)
Ctor.
Definition:
CaloCoolIdTool.cxx:13
python.CaloScaleNoiseConfig.type
type
Definition:
CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition:
AthCommonMsg.h:24
CaloCoolIdTool::m_calo_id
const CaloCell_ID * m_calo_id
Definition:
CaloCoolIdTool.h:46
CaloIdManager.h
CaloCoolIdTool::~CaloCoolIdTool
virtual ~CaloCoolIdTool()
Dtor.
AthAlgTool
Definition:
AthAlgTool.h:26
CaloCell_Base_ID::LAREM
@ LAREM
Definition:
CaloCell_Base_ID.h:46
CaloCondUtils::EMBZPOS
@ EMBZPOS
Definition:
CaloCondUtils.h:21
Generated on Mon Dec 23 2024 21:07:53 for ATLAS Offline Software by
1.8.18