ATLAS Offline Software
Loading...
Searching...
No Matches
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"
8#include "TFile.h"
9
10//#define DONTDO
11
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
25 return StatusCode::SUCCESS;
26}
27
28//----------------------------------------------------------------------------------------
29
30StatusCode CaloBCIDAvgAlg::execute(const EventContext& ctx) const
31{
32 auto timer = Monitored::Timer("TIME_exec");
33 auto monitoring = Monitored::Group( m_monTool, timer);
34
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) {
45 mcSym=*mcSymHdl;
46 }
47
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
66 ATH_CHECK(writeHdl.record(std::move(result)));
67
68 return StatusCode::SUCCESS;
69}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
Header file to be included by clients of the Monitored infrastructure.
std::vector with extra alignment.
SG::ReadCondHandleKey< CaloBCIDLumi > m_bcidLumiKey
virtual StatusCode finalize() override
ToolHandle< GenericMonitoringTool > m_monTool
virtual StatusCode initialize() override
SG::ReadCondHandleKey< LArMCSym > m_mcSym
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< bool > m_isSC
Property: m_isSC.
SG::WriteHandleKey< CaloBCIDAverage > m_bcidAvgKey
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Helper class to handle z-phi symmetry of calibration constants in MC.
Definition LArMCSym.h:19
const std::vector< HWIdentifier > & symIds() const
Return the list of symmetric hashes.
Definition LArMCSym.h:132
Group of local monitoring quantities and retain correlation when filling histograms
A monitored timer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
@ IS_SIMULATION
true: simulation, false: data
aligned_vector< T, 64 > vec_aligned_vector
A std::vector with alignment sufficient for any vector instructions on this platform.