ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LumiBlock
LumiBlockComps
src
LumiBlockTester.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LumiBlockTester.h
"
6
#include "
StoreGate/ReadCondHandle.h
"
7
#include "
AthenaKernel/errorcheck.h
"
8
9
//--------------------------------------------------
10
LumiBlockTester::LumiBlockTester
(
const
std::string& name, ISvcLocator* pSvcLocator):
11
AthReentrantAlgorithm
(name,pSvcLocator),
12
m_muTool
(
"LumiBlockMuTool"
)
13
{
14
declareProperty
(
"LumiBlockMuTool"
,
m_muTool
);
15
}
16
17
StatusCode
18
LumiBlockTester::initialize
()
19
{
20
ATH_MSG_INFO
(
"LumiBlockTester::initialize()"
);
21
22
ATH_CHECK
(
m_eventInfoKey
.initialize());
23
24
ATH_CHECK
(
m_luminosityCondDataKey
.initialize() );
25
ATH_CHECK
(
m_trigLiveFractionCondDataKey
.initialize() );
26
27
// Get the mu tool
28
CHECK
(
m_muTool
.retrieve());
29
30
ATH_MSG_INFO
(
"LumiBlockTester::initialize() done"
);
31
32
return
StatusCode::SUCCESS;
33
}
34
35
StatusCode
36
LumiBlockTester::execute
(
const
EventContext& ctx)
const
37
{
38
ATH_MSG_DEBUG
(
"LumiBlockTester::execute()"
);
39
40
SG::ReadHandle<xAOD::EventInfo>
eventInfo(
m_eventInfoKey
, ctx);
41
42
// only there for serial running; remove when only doing MT
43
if
(!eventInfo.
isValid
()) {
44
ATH_MSG_FATAL
(
"Failed to retrieve "
<<
m_eventInfoKey
.key());
45
return
StatusCode::FAILURE;
46
}
47
48
unsigned
int
lumiblock = eventInfo->lumiBlock();
49
unsigned
int
bcid = eventInfo->bcid();
50
51
ATH_MSG_DEBUG
(
" lumiblock "
<< lumiblock <<
" BCID "
<< bcid);
52
53
SG::ReadCondHandle<LuminosityCondData>
lumiData (
m_luminosityCondDataKey
, ctx);
54
float
avgmu = lumiData->lbAverageInteractionsPerCrossing();
55
float
instmu = 0.;
56
57
if
(lumiData->muToLumi() > 0.)
58
instmu = lumiData->lbLuminosityPerBCIDVector().at(bcid)/lumiData->muToLumi();
59
else
60
ATH_MSG_DEBUG
(
" Lumi: "
<< lumiData->lbLuminosityPerBCIDVector().at(bcid) <<
" muToLumi: "
<< lumiData->muToLumi() <<
"!"
);
61
62
SG::ReadCondHandle<TrigLiveFractionCondData>
liveData (
m_trigLiveFractionCondDataKey
, ctx);
63
float
live = liveData->l1LiveFractionVector().at(bcid);
64
float
lumilive = liveData->lbAverageLiveFraction();
65
66
ATH_MSG_INFO
(
"LB: "
<< lumiblock <<
" BCID: "
<< bcid <<
" <mu>: "
<< avgmu <<
" mu: "
<< instmu <<
" livefraction: "
<< live <<
" lumiavg livefraction: "
<< lumilive );
67
68
avgmu =
m_muTool
->averageInteractionsPerCrossing(ctx);
69
instmu =
m_muTool
->actualInteractionsPerCrossing(ctx);
70
ATH_MSG_INFO
(
"From muTool - <mu>: "
<< avgmu <<
" mu: "
<< instmu);
71
72
instmu = eventInfo->actualInteractionsPerCrossing();
73
avgmu = eventInfo->averageInteractionsPerCrossing();
74
ATH_MSG_INFO
(
"From EvInfo - <mu>: "
<< avgmu <<
" mu: "
<< instmu);
75
76
ATH_MSG_DEBUG
(
"LumiBlockTester::execute() done"
);
77
return
StatusCode::SUCCESS;
78
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
LumiBlockTester.h
ReadCondHandle.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
LumiBlockTester::LumiBlockTester
LumiBlockTester(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LumiBlockTester.cxx:10
LumiBlockTester::m_muTool
ToolHandle< ILumiBlockMuTool > m_muTool
Definition
LumiBlockTester.h:34
LumiBlockTester::m_luminosityCondDataKey
SG::ReadCondHandleKey< LuminosityCondData > m_luminosityCondDataKey
Definition
LumiBlockTester.h:39
LumiBlockTester::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
LumiBlockTester.cxx:36
LumiBlockTester::initialize
virtual StatusCode initialize() override
Definition
LumiBlockTester.cxx:18
LumiBlockTester::m_trigLiveFractionCondDataKey
SG::ReadCondHandleKey< TrigLiveFractionCondData > m_trigLiveFractionCondDataKey
Definition
LumiBlockTester.h:41
LumiBlockTester::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition
LumiBlockTester.h:36
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?
Generated on
for ATLAS Offline Software by
1.17.0