ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSPCalibrationTest.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GaudiKernel/PhysicalConstants.h"
7
8
9using namespace MuonValR4;
11
13 ATH_MSG_VERBOSE("Initializing MdtCalibDbAlgTest");
14 ATH_CHECK(m_geoCtxKey.initialize());
15 ATH_CHECK(m_idHelperSvc.retrieve());
16 ATH_CHECK(m_calibTool.retrieve());
17 ATH_CHECK(m_spKeyArray.initialize());
18 return StatusCode::SUCCESS;
19}
20
22 const EventContext& ctx = Gaudi::Hive::currentContext();
23 SG::ReadHandle geoCtx{m_geoCtxKey, ctx};
24 ATH_CHECK(geoCtx.isPresent());
25
26 for (const auto& spContainer : m_spKeyArray) {
27 SG::ReadHandle<MuonR4::SpacePointContainer> spHandle{spContainer, ctx};
28 ATH_CHECK(spHandle.isValid());
29
30 for (const MuonR4::SpacePointBucket* spBucket : *spHandle) {
31 if (!spBucket) continue;
32 for(const auto& sp : *spBucket) {
33 if (!sp) continue;
34 ATH_MSG_ALWAYS("Processing SpacePoint " << m_idHelperSvc->toString(sp->identify()) << " with dimension " << sp->dimension()
35 << " and position " << Amg::toString(sp->localPosition())
36 << " and direction " << Amg::toString(sp->sensorDirection()));
37
38 // Get the seed position and direction in the chamber
39 Amg::Vector3D seedPosInChamb = sp->localPosition();
40 const Amg::Transform3D& locToGlob{sp->msSector()->localToGlobalTransform(*geoCtx)};
41 Amg::Vector3D seedDirInChamb = locToGlob*(sp->localPosition());
42 seedDirInChamb = seedDirInChamb.unit();
43
44 CalibSpacePointPtr calibSP = m_calibTool->calibrate(ctx, sp.get(), seedPosInChamb, seedDirInChamb, 0.0);
45 ATH_MSG_ALWAYS("Calibrated SpacePoint: with position " << Amg::toString(calibSP->localPosition())
46 << " and direction " << Amg::toString(calibSP->sensorDirection()));
47 }
48
49 }
50 }
51 return StatusCode::SUCCESS;
52}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_ALWAYS(x)
static Double_t sp
const Amg::Vector3D & sensorDirection() const
const Amg::Vector3D & localPosition() const
std::unique_ptr< CalibratedSpacePoint > CalibSpacePointPtr
: The muon space point bucket represents a collection of points that will bre processed together in t...
ToolHandle< MuonR4::ISpacePointCalibrator > m_calibTool
virtual StatusCode execute() override
SG::ReadHandleKeyArray< MuonR4::SpacePointContainer > m_spKeyArray
virtual StatusCode initialize() override
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
pointer to MdtCalibSvc
virtual bool isValid() override final
Can the handle be successfully dereferenced?
bool isPresent() const
Is the referenced object present in SG?
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
ISpacePointCalibrator::CalibSpacePointPtr CalibSpacePointPtr
Lightweight algorithm to read xAOD MDT sim hits and (fast-digitised) drift circles from SG and fill a...