ATLAS Offline Software
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 
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 
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 
36  const int bcid = ei->bcid();
37  float avgInteractionsPerCrossingMC = 1;
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 }
CaloBCIDAvgAlg::m_isSC
Gaudi::Property< bool > m_isSC
Property: m_isSC.
Definition: CaloBCIDAvgAlg.h:43
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
TrigDefs::Group
Group
Properties of a chain group.
Definition: GroupProperties.h:13
get_generator_info.result
result
Definition: get_generator_info.py:21
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
CaloBCIDAvgAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: CaloBCIDAvgAlg.h:47
CaloBCIDAvgAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: CaloBCIDAvgAlg.cxx:30
CaloBCIDAvgAlg::m_bcidAvgKey
SG::WriteHandleKey< CaloBCIDAverage > m_bcidAvgKey
Definition: CaloBCIDAvgAlg.h:35
HWIdentifier
Definition: HWIdentifier.h:13
xAOD::EventInfo_v1::IS_SIMULATION
@ IS_SIMULATION
true: simulation, false: data
Definition: EventInfo_v1.h:151
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
CaloBCIDAvgAlg::initialize
virtual StatusCode initialize() override
Definition: CaloBCIDAvgAlg.cxx:12
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
LArMCSym
Helper class to handle z-phi symmetry of calibration constants in MC.
Definition: LArMCSym.h:19
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CaloBCIDAvgAlg::finalize
virtual StatusCode finalize() override
Definition: CaloBCIDAvgAlg.cxx:24
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
CaloBCIDAvgAlg::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: CaloBCIDAvgAlg.h:32
CaloBCIDAvgAlg.h
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
xAOD::EventInfo_v1::averageInteractionsPerCrossing
float averageInteractionsPerCrossing() const
Average interactions per crossing for all BCIDs - for out-of-time pile-up.
Definition: EventInfo_v1.cxx:397
CaloBCIDAvgAlg::m_bcidLumiKey
SG::ReadCondHandleKey< CaloBCIDLumi > m_bcidLumiKey
Definition: CaloBCIDAvgAlg.h:40
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
xAOD::bcid
setEventNumber setTimeStamp bcid
Definition: EventInfo_v1.cxx:133
CaloBCIDLumi::calc
void calc(const size_t bcid, const float averageInteractionsPerCrossing, CxxUtils::vec_aligned_vector< float > &out) const
Perform the calculation for a given BCID.
Definition: CaloBCIDLumi.cxx:94
aligned_vector.h
std::vector with extra alignment.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
LArMCSym::symIds
const std::vector< HWIdentifier > & symIds() const
Return the list of symmetric hashes.
Definition: LArMCSym.h:132
xAOD::EventInfo_v1::bcid
uint32_t bcid() const
The bunch crossing ID of the event.
Monitored::Timer
A monitored timer.
Definition: MonitoredTimer.h:32
CaloBCIDAvgAlg::m_mcSym
SG::ReadCondHandleKey< LArMCSym > m_mcSym
Definition: CaloBCIDAvgAlg.h:38
xAOD::EventInfo_v1::eventType
bool eventType(EventType type) const
Check for one particular bitmask value.