37 m_trkParametersWarning(false),
38 m_residualPullCalculator(
"Trk::ResidualPullCalculator/ResidualPullCalculator"),
39 m_isUnbiased(nullptr),
40 m_PixPullPhi(nullptr), m_PixPullEta(nullptr), m_PixResPhi(nullptr), m_PixResEta(nullptr),
41 m_SCTPull(nullptr), m_SCTRes(nullptr),
42 m_TRTPull(nullptr), m_TRTRes(nullptr),
43 m_MDTPull(nullptr), m_MDTRes(nullptr),
44 m_RPCPull(nullptr), m_RPCRes(nullptr),
45 m_TGCPull(nullptr), m_TGCRes(nullptr),
46 m_CSCPull(nullptr), m_CSCRes(nullptr)
48 declareInterface<IValidationNtupleHelperTool>(
this);
68 if (
sc.isFailure())
return sc;
71 sc = m_residualPullCalculator.retrieve();
73 ATH_MSG_ERROR (
"Could not retrieve "<< m_residualPullCalculator <<
" (to calculate residuals,pulls) ");
76 m_PixPullPhi =
new std::vector<float>();
77 m_PixPullEta =
new std::vector<float>();
78 m_PixResPhi =
new std::vector<float>();
79 m_PixResEta =
new std::vector<float>();
80 m_SCTPull =
new std::vector<float>();
81 m_SCTRes =
new std::vector<float>();
82 m_TRTPull =
new std::vector<float>();
83 m_TRTRes =
new std::vector<float>();
84 m_MDTPull =
new std::vector<float>();
85 m_MDTRes =
new std::vector<float>();
86 m_RPCPull =
new std::vector<float>();
87 m_RPCRes =
new std::vector<float>();
88 m_TGCPull =
new std::vector<float>();
89 m_TGCRes =
new std::vector<float>();
90 m_CSCPull =
new std::vector<float>();
91 m_CSCRes =
new std::vector<float>();
101 delete m_PixPullPhi;
delete m_PixPullEta;
102 delete m_PixResPhi;
delete m_PixResEta;
103 delete m_SCTPull;
delete m_SCTRes;
104 delete m_TRTPull;
delete m_TRTRes;
105 delete m_MDTPull;
delete m_MDTRes;
106 delete m_RPCPull;
delete m_RPCRes;
107 delete m_TGCPull;
delete m_TGCRes;
108 delete m_CSCPull;
delete m_CSCRes;
111 return StatusCode::SUCCESS;
119 const int& detectorType ) {
121 TBranch* trackStatesUnbiasedBranch =
tree->GetBranch(
"TrackStatesUnbiased");
122 if (!trackStatesUnbiasedBranch) {
123 ATH_MSG_ERROR (
"Unable to get Branch TrackStatesUnbiased in ntuple" );
124 return StatusCode::FAILURE;
126 void* variableAdr =
static_cast<void*
>(trackStatesUnbiasedBranch->GetAddress());
128 ATH_MSG_ERROR (
"Unable to get variable address of Branch TrackStatesUnbiased");
129 return StatusCode::FAILURE;
131 ATH_MSG_VERBOSE (
"Address of unbiasedState tree variable: " << variableAdr );
132 m_isUnbiased =
static_cast<int*
>(variableAdr);
142 ATH_MSG_INFO (
"adding Pixel residual/pull variables to ntuple ");
144 tree->Branch(
"PixPullPhi", &m_PixPullPhi);
145 tree->Branch(
"PixPullEta", &m_PixPullEta);
146 tree->Branch(
"PixResPhi", &m_PixResPhi);
147 tree->Branch(
"PixResEta", &m_PixResEta);
152 ATH_MSG_INFO (
"adding TRT residual/pull variables to ntuple ");
153 tree->Branch(
"TRTPull", &m_TRTPull);
154 tree->Branch(
"TRTRes", &m_TRTRes);
157 ATH_MSG_INFO (
"adding SCT residual/pull variables to ntuple ");
158 tree->Branch(
"SCTPull", &m_SCTPull);
159 tree->Branch(
"SCTRes", &m_SCTRes);
163 ATH_MSG_INFO (
"adding MDT residual/pull variables to ntuple ");
165 tree->Branch(
"MDTPull", &m_MDTPull);
166 tree->Branch(
"MDTRes", &m_MDTRes);
170 ATH_MSG_INFO (
"adding RPC residual/pull variables to ntuple ");
171 ATH_MSG_INFO (
"Reminder: these variables do not distinguish RPC phi from eta hits.");
173 tree->Branch(
"RPCPull", &m_RPCPull);
174 tree->Branch(
"RPCRes", &m_RPCRes);
178 ATH_MSG_INFO (
"adding TGC residual/pull variables to ntuple ");
179 ATH_MSG_INFO (
"Reminder: these variables do not distinguish TGC phi from eta hits.");
181 tree->Branch(
"TGCPull", &m_TGCPull);
182 tree->Branch(
"TGCRes", &m_TGCRes);
186 ATH_MSG_INFO (
"adding CSC residual/pull variables to ntuple ");
187 ATH_MSG_INFO (
"Reminder: these variables do not distinguish CSC phi from eta hits.");
189 tree->Branch(
"CSCPull", &m_CSCPull);
190 tree->Branch(
"CSCRes", &m_CSCRes);
194 return StatusCode::SUCCESS;
205 const int& detectorType,
206 const bool& isOutlier ) {
209 if (!trkParameters) {
212 if(!m_trkParametersWarning) {
214 ATH_MSG_WARNING (
"No TrackParameters: Residuals cannot be filled (filling dummy values).");
215 ATH_MSG_WARNING (
" This is possible for slimmed tracks; if residuals are needed choose another track collection");
217 m_trkParametersWarning =
true;
220 fillValues(detectorType);
221 return StatusCode::SUCCESS;
230 std::optional<Trk::ResidualPull> residualPull=std::nullopt;
232 residualPull = m_residualPullCalculator->residualPull(measurement, trkParameters,
235 ATH_MSG_WARNING (
"Detector type could not be identified, can not calculate residuals!");
236 fillValues(detectorType);
237 return StatusCode::FAILURE;
241 fillValues(detectorType);
242 return StatusCode::FAILURE;
246 if ((residualPull->isPullValid()) || m_ignoreMissTrkCov ) {
247 fillValues( detectorType,
254 fillValues( detectorType,
261 if ((residualPull->isPullValid()) || m_ignoreMissTrkCov ) {
262 fillValues( detectorType,
267 fillValues( detectorType,
273 return StatusCode::SUCCESS;
277 const int& detectorType ) {
279 m_PixPullPhi->clear();
280 m_PixPullEta->clear();
281 m_PixResPhi->clear();
282 m_PixResEta->clear();
302 return StatusCode::SUCCESS;
310 return StatusCode::SUCCESS;