ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArROD
src
LArSuperCellBCIDAlg.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*
4
* Name : LArSuperCellBCIDAlg.cxx
5
* PACKAGE : LArCalorimeter/LArROD/LArSuperCellBCIDAlg
6
*
7
* AUTHOR : Denis Oliveira Damazio
8
*
9
* PURPOSE : prepares SuperCellContainer to have the offset BCID-dependent correction. Special version for emulated cells
10
*
11
* **/
12
13
#include "
LArSuperCellBCIDAlg.h
"
14
#include "
CaloEvent/CaloCellContainer.h
"
15
#include "
LArIdentifier/LArOnline_SuperCellID.h
"
16
#include "
LArCabling/LArOnOffIdMapping.h
"
17
#include "
xAODEventInfo/EventInfo.h
"
18
19
LArSuperCellBCIDAlg::LArSuperCellBCIDAlg
(
const
std::string& name, ISvcLocator* pSvcLocator)
20
:
AthReentrantAlgorithm
( name, pSvcLocator)
21
{
22
}
23
24
StatusCode
25
LArSuperCellBCIDAlg::initialize
()
26
{
27
28
ATH_CHECK
(
m_sCellContainerInKey
.initialize() );
29
ATH_CHECK
(
m_sCellContainerOutKey
.initialize() );
30
ATH_CHECK
(
m_bcidAvgKey
.initialize() );
31
ATH_CHECK
(
m_cablingKey
.initialize() );
32
ATH_CHECK
(
detStore
()->retrieve(
m_laronline_id
,
"LArOnline_SuperCellID"
));
33
return
StatusCode::SUCCESS;
34
}
35
36
StatusCode
37
LArSuperCellBCIDAlg::execute
(
const
EventContext& context)
const
38
{
39
40
SG::ReadCondHandle<LArOnOffIdMapping>
cabling(
m_cablingKey
,context);
41
42
// Not really a condition, but almost
43
SG::ReadHandle<CaloBCIDAverage>
caloLumiBCIDHandle(
m_bcidAvgKey
, context);
44
if
( not caloLumiBCIDHandle.
isValid
() ) {
45
ATH_MSG_DEBUG
(
"Found invalid read handle for CaloBCIDAverage"
);
46
return
StatusCode::FAILURE;
47
}
48
const
CaloBCIDAverage
* caloLumiBCID = caloLumiBCIDHandle.
cptr
();
49
50
auto
cellsHandle =
SG::makeHandle
(
m_sCellContainerInKey
, context );
51
if
( not cellsHandle.isValid() ) {
52
ATH_MSG_ERROR
(
"Did not get CaloCellContainer input"
);
53
return
StatusCode::FAILURE;
54
}
55
56
57
const
CaloCellContainer
* scells_from_sg = cellsHandle.cptr();
58
ATH_MSG_DEBUG
(
"Got a CaloCellContainer input with size : "
<<scells_from_sg->
size
());
59
60
SG::WriteHandle<CaloCellContainer>
scellContainerHandle(
m_sCellContainerOutKey
, context);
61
auto
new_scell_cont = std::make_unique<CaloCellContainer> ();
62
63
new_scell_cont->reserve(scells_from_sg->
size
());
64
65
for
(
const
auto
*
sc
: *scells_from_sg){
66
if
( !
sc
)
continue
;
67
std::unique_ptr<CaloCell> cell =
sc
->clone();
68
// calculate the BCID for all the cells associated to the SC
69
// since this is emulation
70
float
correction(0.0);
71
HWIdentifier
hwid = cabling->createSignalChannelID(
sc
->ID());
72
IdentifierHash
hash_id =
m_laronline_id
->channel_Hash(hwid);
73
correction=caloLumiBCID->
average
((
size_t
)hash_id);
// Accesses the internal cache of CaloBCIDAverage directly, no phi-symmetry use.
74
cell->setEnergy(
sc
->energy() - correction );
75
new_scell_cont->push_back( std::move(cell) );
76
}
77
ATH_CHECK
( scellContainerHandle.
record
( std::move(new_scell_cont) ) );
78
79
return
StatusCode::SUCCESS;
80
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCellContainer.h
LArOnOffIdMapping.h
LArOnline_SuperCellID.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
LArSuperCellBCIDAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CaloBCIDAverage
Definition
CaloBCIDAverage.h:16
CaloBCIDAverage::average
float average(const Identifier &id) const
Definition
CaloBCIDAverage.h:27
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
HWIdentifier
Definition
HWIdentifier.h:13
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
LArSuperCellBCIDAlg::initialize
StatusCode initialize()
Definition
LArSuperCellBCIDAlg.cxx:25
LArSuperCellBCIDAlg::execute
StatusCode execute(const EventContext &context) const
Definition
LArSuperCellBCIDAlg.cxx:37
LArSuperCellBCIDAlg::m_sCellContainerOutKey
SG::WriteHandleKey< CaloCellContainer > m_sCellContainerOutKey
Property: SG key for the output supercell LAr channel container.
Definition
LArSuperCellBCIDAlg.h:49
LArSuperCellBCIDAlg::LArSuperCellBCIDAlg
LArSuperCellBCIDAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArSuperCellBCIDAlg.cxx:19
LArSuperCellBCIDAlg::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Property SG Key for the OnOffMapping.
Definition
LArSuperCellBCIDAlg.h:58
LArSuperCellBCIDAlg::m_bcidAvgKey
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey
Property SG Key for the CaloLumiBCID.
Definition
LArSuperCellBCIDAlg.h:54
LArSuperCellBCIDAlg::m_sCellContainerInKey
SG::ReadHandleKey< CaloCellContainer > m_sCellContainerInKey
Property: SG key for the input calorimeter cell container.
Definition
LArSuperCellBCIDAlg.h:44
LArSuperCellBCIDAlg::m_laronline_id
const LArOnline_SuperCellID * m_laronline_id
Definition
LArSuperCellBCIDAlg.h:61
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0