ATLAS Offline Software
Loading...
Searching...
No Matches
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"
8
9//--------------------------------------------------
10LumiBlockTester::LumiBlockTester(const std::string& name, ISvcLocator* pSvcLocator):
11 AthReentrantAlgorithm(name,pSvcLocator),
12 m_muTool("LumiBlockMuTool")
13{
14 declareProperty("LumiBlockMuTool", m_muTool);
15}
16
17StatusCode
19{
20 ATH_MSG_INFO("LumiBlockTester::initialize()");
21
22 ATH_CHECK(m_eventInfoKey.initialize());
23
24 ATH_CHECK( m_luminosityCondDataKey.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
35StatusCode
36LumiBlockTester::execute (const EventContext& ctx) const
37{
38 ATH_MSG_DEBUG("LumiBlockTester::execute()");
39
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
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
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
An algorithm that can be simultaneously executed in multiple threads.
LumiBlockTester(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< ILumiBlockMuTool > m_muTool
SG::ReadCondHandleKey< LuminosityCondData > m_luminosityCondDataKey
virtual StatusCode execute(const EventContext &ctx) const override
virtual StatusCode initialize() override
SG::ReadCondHandleKey< TrigLiveFractionCondData > m_trigLiveFractionCondDataKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?