ATLAS Offline Software
ALineInjectTestAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "ALineInjectTestAlg.h"
5 
8 #include <GaudiKernel/SystemOfUnits.h>
9 ALineInjectTestAlg::ALineInjectTestAlg(const std::string& name, ISvcLocator* pSvcLocator):
10  AthReentrantAlgorithm{name, pSvcLocator} {}
11 
14  ATH_CHECK(m_idHelperSvc.retrieve());
15  return StatusCode::SUCCESS;
16 }
17 StatusCode ALineInjectTestAlg::execute(const EventContext& ctx) const {
19  if (writeHandle.isValid()){
20  ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid."
21  << ". In theory this should not be called, but may happen"
22  << " if multiple concurrent events are being processed out of order.");
23  return StatusCode::SUCCESS;
24  }
25  writeHandle.addDependency(IOVInfiniteRange::infiniteTime());
26  std::unique_ptr<ALineContainer> writeCdo = std::make_unique<ALineContainer>();
27 
28  unsigned int counter{0};
30  {
31  const MdtIdHelper& idHelper{m_idHelperSvc->mdtIdHelper()};
32  for (auto itr = idHelper.module_begin();
33  itr != idHelper.module_end(); ++itr){
34  ALinePar aline{};
35  aline.setIdentifier(*itr);
36  aline.setParameters((counter+0)*Gaudi::Units::mm,
42  ATH_MSG_INFO("Add "<<aline<<" to move "<<m_idHelperSvc->toStringChamber(*itr));
43  writeCdo->insert(std::move(aline));
44  counter+=6;
45 
46  }
47  }
48 
49  ATH_CHECK(writeHandle.record(std::move(writeCdo)));
50  return StatusCode::SUCCESS;
51 }
52 
ALineInjectTestAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: ALineInjectTestAlg.cxx:17
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ALinePar
Definition: ALinePar.h:15
MuonAlignmentPar::setIdentifier
void setIdentifier(const Identifier &id)
Setters and getters for the Athena Identifier.
Definition: MuonAlignmentPar.cxx:10
ALineInjectTestAlg::ALineInjectTestAlg
ALineInjectTestAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ALineInjectTestAlg.cxx:9
ALineInjectTestAlg::initialize
virtual StatusCode initialize() override
Definition: ALineInjectTestAlg.cxx:12
deg
#define deg
Definition: SbPolyhedron.cxx:17
ALineInjectTestAlg::m_writeKey
SG::WriteCondHandleKey< ALineContainer > m_writeKey
Definition: ALineInjectTestAlg.h:25
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ALineInjectTestAlg.h
MdtIdHelper
Definition: MdtIdHelper.h:61
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthReentrantAlgorithm.h
IOVInfiniteRange.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
ALineInjectTestAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: ALineInjectTestAlg.h:28
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
IOVInfiniteRange::infiniteTime
static EventIDRange infiniteTime()
Produces an EventIDRange that is inifinite in Time and invalid in RunLumi.
Definition: IOVInfiniteRange.h:47
test_pyathena.counter
counter
Definition: test_pyathena.py:15
SG::WriteCondHandle
Definition: WriteCondHandle.h:26