ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
CaloNoiseSigmaDiffCondAlg.cxx
Go to the documentation of this file.
1
2
/*
3
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
4
*/
13
14
15
#include "
CaloNoiseSigmaDiffCondAlg.h
"
16
#include "
StoreGate/ReadCondHandle.h
"
17
#include "
StoreGate/WriteCondHandle.h
"
18
#include "
CaloIdentifier/CaloIdManager.h
"
19
20
21
StatusCode
CaloNoiseSigmaDiffCondAlg::initialize
() {
22
ATH_CHECK
(
m_noiseCDOKey
.initialize() );
23
ATH_CHECK
(
m_noiseSigmaDiff
.initialize() );
24
return
StatusCode::SUCCESS;
25
}
26
27
StatusCode
CaloNoiseSigmaDiffCondAlg::execute
(
const
EventContext& context)
const
{
28
29
// Write Conditions
30
SG::WriteCondHandle<CaloNoiseSigmaDiff>
output(
m_noiseSigmaDiff
, context);
31
if
( output.isValid() ) {
32
ATH_MSG_DEBUG
(
"Already available handle"
);
33
return
StatusCode::SUCCESS;
34
}
35
36
const
CaloIdManager
* calo_id_manager(
nullptr
);
37
CHECK
(
detStore
()->retrieve (calo_id_manager,
"CaloIdManager"
) );
38
const
CaloCell_ID
* calo_cell_id = calo_id_manager->
getCaloCell_ID
();
39
int
hash_max = calo_cell_id->
calo_cell_hash_max
();
40
41
// prepare real output object (not handle)
42
auto
out = std::make_unique<CaloNoiseSigmaDiff>(hash_max,0.0);
43
44
// get Noise Table
45
SG::ReadCondHandle<CaloNoise>
noiseCDO (
m_noiseCDOKey
, context);
46
const
CaloNoise
* nn = noiseCDO.
cptr
();
47
for
(
int
i=0;i<hash_max;++i){
48
IdentifierHash
h
(i);
49
if
(calo_cell_id->
is_tile
(
h
) )
continue
;
50
float
nn1=nn->
getNoise
(
h
,1);
// medium gain
51
float
nn0=nn->
getNoise
(
h
,0);
// high gain
52
float
sigma_diff = nn1*nn1-nn0*nn0;
53
if
( sigma_diff < 0.0 ) { out->at(i)=0;
continue
;}
54
out->at(i)=std::sqrt(sigma_diff);
55
}
56
57
output.addDependency(noiseCDO);
58
ATH_CHECK
(output.record( std::move(out) ) );
59
ATH_MSG_INFO
(
"recorded new "
<< output.key() <<
" with range "
<< output.getRange() );
60
return
StatusCode::SUCCESS;
61
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloIdManager.h
CaloNoiseSigmaDiffCondAlg.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ReadCondHandle.h
WriteCondHandle.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
h
Header file for AthHistogramAlgorithm.
CaloCell_Base_ID::calo_cell_hash_max
size_type calo_cell_hash_max() const
cell 'global' hash table max size
CaloCell_Base_ID::is_tile
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
CaloCell_ID
Helper class for offline cell identifiers.
Definition
CaloCell_ID.h:34
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition
CaloIdManager.h:45
CaloIdManager::getCaloCell_ID
const CaloCell_ID * getCaloCell_ID(void) const
Access to IdHelper.
Definition
CaloIdManager.cxx:63
CaloNoiseSigmaDiffCondAlg::m_noiseCDOKey
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Property: CaloNoise (conditions input).
Definition
CaloNoiseSigmaDiffCondAlg.h:38
CaloNoiseSigmaDiffCondAlg::m_noiseSigmaDiff
SG::WriteCondHandleKey< CaloNoiseSigmaDiff > m_noiseSigmaDiff
Definition
CaloNoiseSigmaDiffCondAlg.h:41
CaloNoiseSigmaDiffCondAlg::initialize
virtual StatusCode initialize() override
Gaudi initialize method.
Definition
CaloNoiseSigmaDiffCondAlg.cxx:21
CaloNoiseSigmaDiffCondAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Execute the algorithm.
Definition
CaloNoiseSigmaDiffCondAlg.cxx:27
CaloNoise
Definition
CaloNoise.h:17
CaloNoise::getNoise
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition
CaloNoise.h:35
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::cptr
const_pointer_type cptr()
Definition
ReadCondHandle.h:67
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
Generated on
for ATLAS Offline Software by
1.17.0