ATLAS Offline Software
Loading...
Searching...
No Matches
MuonStationNtupleHelperTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9
10#include "TTree.h"
11
12//================ Constructor =================================================
13
15 const std::string& n,
16 const IInterface* p )
17 :
18 AthAlgTool(t,n,p),
19 m_mdtSectorIx(nullptr),
20 m_mdtStationIx(nullptr),
21 m_rpcSectorIx(nullptr),
22 m_rpcStationIx(nullptr),
23 m_rpcMeasuresPhi(nullptr),
24 m_tgcStationIx(nullptr),
25 m_tgcMeasuresPhi(nullptr)
26{
27 declareInterface<Trk::IValidationNtupleHelperTool>(this);
28}
29
30//================ Initialisation =================================================
31
33{
34 ATH_CHECK(m_idHelperSvc.retrieve());
35
36 m_mdtSectorIx = new std::vector<int>();
37 m_mdtStationIx = new std::vector<int>();
38 m_rpcSectorIx = new std::vector<int>();
39 m_rpcStationIx = new std::vector<int>();
40 m_rpcMeasuresPhi = new std::vector<int>();
41 m_tgcStationIx = new std::vector<int>();
42 m_tgcMeasuresPhi = new std::vector<int>();
43
44 ATH_MSG_INFO ("initialize() successful in " << name());
45 return StatusCode::SUCCESS;
46}
47
48//================ Finalisation =================================================
49
51{
52 delete m_mdtSectorIx; m_mdtSectorIx=nullptr;
53 delete m_mdtStationIx; m_mdtStationIx=nullptr;
54 delete m_rpcSectorIx; m_rpcSectorIx=nullptr;
55 delete m_rpcStationIx; m_rpcStationIx=nullptr;
56 delete m_rpcMeasuresPhi; m_rpcMeasuresPhi=nullptr;
57 delete m_tgcStationIx; m_tgcStationIx=nullptr;
58 delete m_tgcMeasuresPhi; m_tgcMeasuresPhi=nullptr;
59 return StatusCode::SUCCESS;
60}
61
66 TTree* tree,
67 const int& detectorType) {
68
69 // add items to the ntuple
70 if (detectorType==Trk::TrackState::MDT) {
71
72 tree->Branch("MdtSectorIndex", &m_mdtSectorIx);
73 tree->Branch("MdtStationIndex", &m_mdtStationIx);
74 }
75 if (detectorType==Trk::TrackState::RPC) {
76 tree->Branch("RpcSectorIndex", &m_rpcSectorIx);
77 tree->Branch("RpcStationIndex", &m_rpcStationIx);
78 tree->Branch("RpcMeasuresPhi", &m_rpcMeasuresPhi);
79 }
80 if (detectorType==Trk::TrackState::TGC) {
81 // TGC sectors are not defined, will cause warning if tried to compute from helper
82 tree->Branch("TgcStationIndex", &m_tgcStationIx);
83 tree->Branch("TgcMeasuresPhi", &m_tgcMeasuresPhi);
84 }
85
86 ATH_MSG_VERBOSE ("added items to ntuple.");
87 return StatusCode::SUCCESS;
88}
89
94 const Trk::MeasurementBase* hit,
96 const int& detectorType,
97 const bool& /*isOutlier*/) {
98
99 // todo is this actually called for outliers?
100
101 // identify the detector type:
103 using namespace Muon::MuonStationIndex;
104 const int stIdx = toInt(m_idHelperSvc->stationIndex(id));
105 if (detectorType==Trk::TrackState::MDT) {
106 m_mdtSectorIx->push_back(m_idHelperSvc->sector(id));
107 m_mdtStationIx->push_back(stIdx);
108 }
109 if (detectorType==Trk::TrackState::RPC) {
110 m_rpcSectorIx->push_back(m_idHelperSvc->sector(id));
111 m_rpcStationIx->push_back(stIdx);
112 m_rpcMeasuresPhi->push_back(m_idHelperSvc->measuresPhi(id));
113 }
114 if (detectorType==Trk::TrackState::TGC) {
115 m_tgcStationIx->push_back(stIdx);
116 m_tgcMeasuresPhi->push_back(m_idHelperSvc->measuresPhi(id));
117 }
118
119 return StatusCode::SUCCESS;
120}
121
123 const int& detectorType ) {
124 if (detectorType==Trk::TrackState::MDT) {
125 m_mdtSectorIx->clear();
126 m_mdtStationIx->clear();
127 }
128 if (detectorType==Trk::TrackState::RPC) {
129 m_rpcSectorIx->clear();
130 m_rpcStationIx->clear();
131 m_rpcMeasuresPhi->clear();
132 }
133 if (detectorType==Trk::TrackState::TGC) {
134 m_tgcStationIx->clear();
135 m_tgcMeasuresPhi->clear();
136 }
137 return StatusCode::SUCCESS;
138}
139
142 const int&) {
143 // we do nothing with holes
144 return StatusCode::SUCCESS;
145}
146
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
virtual StatusCode fillMeasurementData(const Trk::MeasurementBase *, const Trk::TrackParameters *, const int &detectorType, const bool &isOutlier)
fill hit position data
virtual StatusCode addNtupleItems(TTree *tree, const int &detectorType)
add items to the ntuple and configure the helper tool: should be called once (per detector type) by t...
virtual StatusCode finalize()
standard Athena-Algorithm method
std::vector< int > * m_rpcMeasuresPhi
describe
virtual StatusCode resetVariables(const int &detectorType)
reset ntuple variables
std::vector< int > * m_mdtSectorIx
sector number 1-16, odd=large, even=small
std::vector< int > * m_tgcMeasuresPhi
describe
MuonStationNtupleHelperTool(const std::string &, const std::string &, const IInterface *)
virtual StatusCode fillHoleData(const Trk::TrackStateOnSurface &, const int &)
fill special data about holes on track (here: do nothing)
std::vector< int > * m_rpcSectorIx
sector number 1-16, odd=large, even=small
std::vector< int > * m_mdtStationIx
describe
std::vector< int > * m_tgcStationIx
describe
std::vector< int > * m_rpcStationIx
describe
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
virtual StatusCode initialize()
standard Athena-Algorithm method
static void extract(std::vector< Identifier > &ids, const std::vector< const MeasurementBase * > &measurements)
This class is the pure abstract base class for all fittable tracking measurements.
represents the track state (measurement, material, fit parameters and quality) at a surface.
constexpr int toInt(const EnumType enumVal)
ParametersBase< TrackParametersDim, Charged > TrackParameters
TChain * tree