ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
CaloBCIDAvgAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CaloBCIDAvgAlg.h
"
6
#include "
AthenaMonitoringKernel/Monitored.h
"
7
#include "
CxxUtils/aligned_vector.h
"
8
#include "TFile.h"
9
10
//#define DONTDO
11
12
StatusCode
CaloBCIDAvgAlg::initialize
() {
13
ATH_MSG_INFO
(
" initialize "
);
14
15
ATH_CHECK
(
m_eventInfoKey
.initialize());
16
ATH_CHECK
(
m_bcidAvgKey
.initialize());
17
ATH_CHECK
(
m_mcSym
.initialize(!
m_isSC
));
18
ATH_CHECK
(
m_bcidLumiKey
.initialize());
19
if
(!
m_monTool
.empty() )
ATH_CHECK
(
m_monTool
.retrieve() );
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
CaloBCIDAvgAlg::finalize
() {
25
return
StatusCode::SUCCESS;
26
}
27
28
//----------------------------------------------------------------------------------------
29
30
StatusCode
CaloBCIDAvgAlg::execute
(
const
EventContext& ctx)
const
31
{
32
auto
timer =
Monitored::Timer
(
"TIME_exec"
);
33
auto
monitoring =
Monitored::Group
(
m_monTool
, timer);
34
35
SG::ReadHandle<xAOD::EventInfo>
ei(
m_eventInfoKey
,ctx);
36
const
int
bcid = ei->bcid();
37
float
avgInteractionsPerCrossingMC = 1;
38
if
(ei->eventType (
xAOD::EventInfo::IS_SIMULATION
)) {
39
avgInteractionsPerCrossingMC = ei->averageInteractionsPerCrossing();
40
}
41
42
const
LArMCSym
* mcSym=
nullptr
;
43
if
( !
m_isSC
) {
44
SG::ReadCondHandle<LArMCSym>
mcSymHdl(
m_mcSym
,ctx);
45
mcSym=*mcSymHdl;
46
}
47
48
SG::ReadCondHandle<CaloBCIDLumi>
bcidLumi (
m_bcidLumiKey
, ctx);
49
CxxUtils::vec_aligned_vector<float>
avgEshift;
50
bcidLumi->calc (bcid, avgInteractionsPerCrossingMC, avgEshift);
51
auto
result = std::make_unique<CaloBCIDAverage>(mcSym, std::move(avgEshift));
52
53
#ifdef DONTDO
// some debug code, please, ignore
54
std::cout <<
"BCIDAlg corrections for BCID : "
<< bcid << std::endl;
55
for
(
size_t
i = 0; i < mcSym->
symIds
().
size
(); i++) {
56
const
HWIdentifier
hwid = mcSym->
symIds
()[i];
57
float
eshift=avgEshift[i];
58
if
( fabsf(1e9*(eshift)) > 0.001 ){
59
unsigned
id32=hwid.
get_identifier32
().
get_compact
();
60
std::cout <<
"Alg BCID "
<< bcid <<
", cell ["
<< id32 <<
"] = "
<<(double)eshift << std::endl;
61
}
62
}
63
#endif
64
65
SG::WriteHandle<CaloBCIDAverage>
writeHdl(
m_bcidAvgKey
,ctx);
66
ATH_CHECK
(writeHdl.
record
(std::move(result)));
67
68
return
StatusCode::SUCCESS;
69
}
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
CaloBCIDAvgAlg.h
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
size
size_t size() const
Number of registered mappings.
aligned_vector.h
std::vector with extra alignment.
CaloBCIDAvgAlg::m_bcidLumiKey
SG::ReadCondHandleKey< CaloBCIDLumi > m_bcidLumiKey
Definition
CaloBCIDAvgAlg.h:40
CaloBCIDAvgAlg::finalize
virtual StatusCode finalize() override
Definition
CaloBCIDAvgAlg.cxx:24
CaloBCIDAvgAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition
CaloBCIDAvgAlg.h:47
CaloBCIDAvgAlg::initialize
virtual StatusCode initialize() override
Definition
CaloBCIDAvgAlg.cxx:12
CaloBCIDAvgAlg::m_mcSym
SG::ReadCondHandleKey< LArMCSym > m_mcSym
Definition
CaloBCIDAvgAlg.h:38
CaloBCIDAvgAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition
CaloBCIDAvgAlg.h:32
CaloBCIDAvgAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CaloBCIDAvgAlg.cxx:30
CaloBCIDAvgAlg::m_isSC
Gaudi::Property< bool > m_isSC
Property: m_isSC.
Definition
CaloBCIDAvgAlg.h:43
CaloBCIDAvgAlg::m_bcidAvgKey
SG::WriteHandleKey< CaloBCIDAverage > m_bcidAvgKey
Definition
CaloBCIDAvgAlg.h:35
HWIdentifier
Definition
HWIdentifier.h:13
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition
Identifier32.h:47
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
LArMCSym
Helper class to handle z-phi symmetry of calibration constants in MC.
Definition
LArMCSym.h:19
LArMCSym::symIds
const std::vector< HWIdentifier > & symIds() const
Return the list of symmetric hashes.
Definition
LArMCSym.h:132
Monitored::Group
Group of local monitoring quantities and retain correlation when filling histograms
Definition
MonitoredGroup.h:53
Monitored::Timer
A monitored timer.
Definition
MonitoredTimer.h:32
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
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.
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition
EventInfo_v1.h:151
CxxUtils::vec_aligned_vector
aligned_vector< T, 64 > vec_aligned_vector
A std::vector with alignment sufficient for any vector instructions on this platform.
Definition
aligned_vector.h:51
Generated on
for ATLAS Offline Software by
1.17.0