 |
ATLAS Offline Software
|
Go to the documentation of this file.
9 #include "GaudiKernel/SystemOfUnits.h"
18 #include <unordered_map>
22 constexpr
int encodeId(
const int8_t
stName,
const int8_t stEta,
23 const int8_t sector) {
24 return (sector <<16 |stEta << 8|
stName);
26 constexpr
double precCutOff(
const double value,
const double cutOff = 1.
e-15) {
41 return StatusCode::SUCCESS;
46 if (truthHits.size()) {
49 if (
segment.muonSegment().isValid()) {
52 ATH_MSG_WARNING(
"No matching hits were found. Neither the simulated ones or the reconstructed");
57 const EventContext & ctx = Gaudi::Hive::currentContext();
58 std::ofstream
file{std::string(Form(
"event%09zu-",++
m_event))+
"MuonTruthSegment.csv"};
59 constexpr std::string_view delim =
",";
60 file<<
"sectorId"<<delim;
61 file<<
"globalPositionX"<<delim;
62 file<<
"globalPositionY"<<delim;
63 file<<
"globalPositionZ"<<delim;
65 file<<
"globalDirectionX"<<delim;
66 file<<
"globalDirectionY"<<delim;
67 file<<
"globalDirectionZ"<<delim;
70 file<<
"localPositionX"<<delim;
71 file<<
"localPositionY"<<delim;
72 file<<
"localPositionZ"<<delim;
74 file<<
"localDirectionX"<<delim;
75 file<<
"localDirectionY"<<delim;
76 file<<
"localDirectionZ"<<delim;
79 file<<
"timeError"<<delim;
80 file<<
"chiSquared"<<delim;
82 file<<
"precisionHits"<<delim;
83 file<<
"phiLayers"<<delim;
84 file<<
"trigEtaLayers"<<delim;
106 const int secId = encodeId(
static_cast<int8_t
>(sector->
chamberIndex()),
111 float seg_t0error =
segment->t0error();
114 float seg_chiSquared =
segment->chiSquared();
115 float seg_numberDoF =
segment->numberDoF();
118 int seg_PrecisionHits =
segment->nPrecisionHits();
119 int seg_PhiLayers =
segment->nPhiLayers();
120 int seg_TrigEtaLayers =
segment->nTrigEtaLayers();
129 ATH_MSG_VERBOSE(
"chiSquared: "<<seg_chiSquared<<
" numberDoF: "<<seg_numberDoF);
130 ATH_MSG_VERBOSE(
"nPrecisionHits: "<<seg_PrecisionHits<<
" nPhiLayers: "<<seg_PhiLayers<<
" nTrigEtaLayers: "<<seg_TrigEtaLayers);
134 file<<precCutOff(globPos.x())<<delim;
135 file<<precCutOff(globPos.y())<<delim;
136 file<<precCutOff(globPos.z())<<delim;
137 file<<precCutOff(globDir.x())<<delim;
138 file<<precCutOff(globDir.y())<<delim;
139 file<<precCutOff(globDir.z())<<delim;
141 file<<precCutOff(locPos.x())<<delim;
142 file<<precCutOff(locPos.y())<<delim;
143 file<<precCutOff(locPos.z())<<delim;
149 file<<precCutOff(seg_t0)<<delim;
150 file<<precCutOff(seg_t0error)<<delim;
151 file<<precCutOff(seg_chiSquared)<<delim;
152 file<<seg_numberDoF<<delim;
153 file<<seg_PrecisionHits<<delim;
154 file<<seg_PhiLayers<<delim;
155 file<<seg_TrigEtaLayers<<delim;
158 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
int sector() const
Returns the sector of the MS-sector.
int8_t side() const
Returns the side of the MS-sector 1 -> A side ; -1 -> C side.
A spectrometer sector forms the envelope of all chambers that are placed in the same MS sector & laye...
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
const std::string & stName(StIndex index)
convert StIndex into a string
const MuonGMR4::MuonDetectorManager * m_detMgr
Class describing a MuonSegment.
const MuonGMR4::SpectrometerSector * msSector(const xAOD::MuonSegment &segment) const
#define ATH_MSG_VERBOSE(x)
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index scheme.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
StatusCode execute() override
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
::StatusCode StatusCode
StatusCode definition for legacy code.
Amg::Transform3D globalToLocalTrans(const ActsGeometryContext &gctx) const
Returns the global -> local transformation from the ATLAS global.
Eigen::Affine3d Transform3D
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_inSegmentKey
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Include the GeoPrimitives which need to be put first.
Eigen::Matrix< double, 3, 1 > Vector3D
This header ties the generic definitions in this package.
#define ATH_MSG_WARNING(x)
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
StatusCode initialize() override
std::unordered_set< const xAOD::MuonSimHit * > getMatchingSimHits(const xAOD::MuonSegment &segment)
: Returns all sim hits matched to a xAOD::MuonSegment
const SpectrometerSector * getSectorEnvelope(const Identifier &channelId) const
Retrieves the spectrometer envelope enclosing the channel's readout element.
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)