ATLAS Offline Software
ResidualValidationNtupleHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // ResidualValidationNtupleHelper.h
7 // Header file for ResidualValidationNtupleHelper
9 // (c) ATLAS Detector software
11 // Sebastian.Fleischmann@cern.ch
13 
14 #ifndef TRK_RESIDUALVALIDATIONNTUPLEHELPER_H
15 #define TRK_RESIDUALVALIDATIONNTUPLEHELPER_H
16 
18 #include "GaudiKernel/ToolHandle.h"
19 
23 
24 class AtlasDetectorID;
25 class TTree;
26 
27 namespace Trk {
28 
29 class MeasurementBase;
30 class IResidualPullCalculator;
31 
38 public:
39 
40  // standard AlgToolmethods
41  ResidualValidationNtupleHelper(const std::string&,const std::string&,const IInterface*);
43 
44  // standard Athena methods
47 
50  const Trk::MeasurementBase*,
51  const Trk::TrackParameters*,
52  //const NTuple::Item<long>& numberOfHits,
53  //const std::bitset<8>& detectorType
54  const int& detectorType,
55  const bool& isOutlier );
56 
58  virtual StatusCode fillHoleData (
60  const int&);
61 
62 
65  virtual StatusCode addNtupleItems (
66  TTree* tree,
67  const int& detectorType );
68 
70  virtual StatusCode resetVariables (
71  const int& detectorType );
72 
73 private:
74 
75  double calcPull(
76  const double residual,
77  const double locMesCov,
78  const double locTrkCov ) const;
79  void givePullWarning() const;
80  void fillValues(const int& detectorType, double res1=-1000., double pull1=-1000., double res2=-1000., double pull2=-1000.);
81 
82  bool m_pullWarning = false;
84 
86  ToolHandle<Trk::IResidualPullCalculator> m_residualPullCalculator;
87 
89 
91 
92  // --- ntuple variables, documentation picked up by scripts for wiki tables ---
93  std::vector<float>* m_PixPullPhi;
94  std::vector<float>* m_PixPullEta;
95  std::vector<float>* m_PixResPhi;
96  std::vector<float>* m_PixResEta;
97 
98  std::vector<float>* m_SCTPull;
99  std::vector<float>* m_SCTRes;
100 
101  std::vector<float>* m_TRTPull;
102  std::vector<float>* m_TRTRes;
103 
104  std::vector<float>* m_MDTPull;
105  std::vector<float>* m_MDTRes;
106 
107  std::vector<float>* m_RPCPull;
108  std::vector<float>* m_RPCRes;
109 
110  std::vector<float>* m_TGCPull;
111  std::vector<float>* m_TGCRes;
112 
113  std::vector<float>* m_CSCPull;
114  std::vector<float>* m_CSCRes;
115 
116 };
117 
119  [[maybe_unused]] static const bool pullWarningOnce = [&]() {
120  msg(MSG::WARNING) << "no covariance of the track parameters given, can not calc pull!" << endmsg;
121  msg(MSG::WARNING) << "you may want to use the jobOption 'IgnoreMissingTrackCovariance' to calculate it anyhow." << endmsg;
122  return true;
123  }();
124  }
125  inline void Trk::ResidualValidationNtupleHelper::fillValues(const int& detectorType, double res1, double pull1, double res2, double pull2) {
126  if (detectorType==TrackState::Pixel) {
127  m_PixResPhi->push_back(res1);
128  m_PixResEta->push_back(res2);
129  m_PixPullPhi->push_back(pull1);
130  m_PixPullEta->push_back(pull2);
131  } else if (detectorType==TrackState::SCT) {
132  m_SCTRes->push_back(res1);
133  m_SCTPull->push_back(pull1);
134  } else if (detectorType==TrackState::TRT) {
135  m_TRTRes->push_back(res1);
136  m_TRTPull->push_back(pull1);
137  } else if (detectorType==TrackState::MDT) {
138  m_MDTRes->push_back(res1);
139  m_MDTPull->push_back(pull1);
140  } else if (detectorType==TrackState::RPC) {
141  m_RPCRes->push_back(res1);
142  m_RPCPull->push_back(pull1);
143  } else if (detectorType==TrackState::TGC) {
144  m_TGCRes->push_back(res1);
145  m_TGCPull->push_back(pull1);
146  } else if (detectorType==TrackState::CSC) {
147  m_CSCRes->push_back(res1);
148  m_CSCPull->push_back(pull1);
149  }
150 }
151 
152 } // end of namespace
153 
154 #endif // TRK_RESIDUALVALIDATIONNTUPLEHELPER_H
Trk::ResidualValidationNtupleHelper::m_SCTRes
std::vector< float > * m_SCTRes
hit residual in SCT local strip coord for each SCT meas't (corrects for fan-shaped strip arrangement ...
Definition: ResidualValidationNtupleHelper.h:99
Trk::ResidualValidationNtupleHelper::m_TGCPull
std::vector< float > * m_TGCPull
hit pull in TGC strip coordinate for each TGC meas't (corrects for fan-shaped strip arrangement),...
Definition: ResidualValidationNtupleHelper.h:110
Trk::TrackState::RPC
@ RPC
Definition: TrackStateDefs.h:33
Trk::TrackState::Pixel
@ Pixel
Definition: TrackStateDefs.h:28
TrackParameters.h
Trk::TrackState::TRT
@ TRT
Definition: TrackStateDefs.h:30
Trk::ResidualValidationNtupleHelper::givePullWarning
void givePullWarning() const
Definition: ResidualValidationNtupleHelper.h:118
Trk::ResidualValidationNtupleHelper::fillValues
void fillValues(const int &detectorType, double res1=-1000., double pull1=-1000., double res2=-1000., double pull2=-1000.)
Definition: ResidualValidationNtupleHelper.h:125
ClusterSeg::residual
@ residual
Definition: ClusterNtuple.h:20
TrackStateDefs.h
IValidationNtupleHelperTool.h
Trk::ResidualValidationNtupleHelper::m_MDTPull
std::vector< float > * m_MDTPull
hit pull in MDT drift radius for each MDT meas't, vector of size nMDTHits UNIT:1
Definition: ResidualValidationNtupleHelper.h:104
Trk::TrackState::MDT
@ MDT
Definition: TrackStateDefs.h:31
tree
TChain * tree
Definition: tile_monitor.h:30
Trk::ResidualValidationNtupleHelper::ResidualValidationNtupleHelper
ResidualValidationNtupleHelper(const std::string &, const std::string &, const IInterface *)
Definition: ResidualValidationNtupleHelper.cxx:31
Trk::ResidualValidationNtupleHelper::m_CSCRes
std::vector< float > * m_CSCRes
hit residual in CSC ??? coordinate for each CSC meas't, vector of size nCSCHits UNIT:mm
Definition: ResidualValidationNtupleHelper.h:114
Trk::ResidualValidationNtupleHelper::m_PixResPhi
std::vector< float > * m_PixResPhi
hit residual in pixel local phi for each Pixel meas't, vector of size nPixelHits UNIT:mm
Definition: ResidualValidationNtupleHelper.h:95
Trk::ResidualValidationNtupleHelper::m_PixPullEta
std::vector< float > * m_PixPullEta
hit pull in pixel local eta coord for each Pixel meas't, vector of size nPixelHits UNIT:1
Definition: ResidualValidationNtupleHelper.h:94
Trk::TrackState::TGC
@ TGC
Definition: TrackStateDefs.h:34
Trk::ResidualValidationNtupleHelper::fillMeasurementData
virtual StatusCode fillMeasurementData(const Trk::MeasurementBase *, const Trk::TrackParameters *, const int &detectorType, const bool &isOutlier)
fill residual data
Definition: ResidualValidationNtupleHelper.cxx:200
Trk::ResidualValidationNtupleHelper::initialize
StatusCode initialize()
initialize
Definition: ResidualValidationNtupleHelper.cxx:64
Trk::ResidualValidationNtupleHelper::m_MDTRes
std::vector< float > * m_MDTRes
hit residual in MDT drift radius for each MDT meas't, vector of size nMDTHits UNIT:mm
Definition: ResidualValidationNtupleHelper.h:105
Trk::ResidualValidationNtupleHelper::finalize
StatusCode finalize()
finalize
Definition: ResidualValidationNtupleHelper.cxx:99
Trk::ResidualValidationNtupleHelper::m_residualPullCalculator
ToolHandle< Trk::IResidualPullCalculator > m_residualPullCalculator
The residual and pull calculator tool.
Definition: ResidualValidationNtupleHelper.h:86
Trk::ResidualValidationNtupleHelper::m_PixResEta
std::vector< float > * m_PixResEta
hit residual in pixel local eta for each Pixel meas't, vector of size nPixelHits UNIT:mm
Definition: ResidualValidationNtupleHelper.h:96
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
Trk::ResidualValidationNtupleHelper::m_SCTPull
std::vector< float > * m_SCTPull
hit pull in SCT local strip coord for each SCT meas't (corrects for fan-shaped strip arrangement in e...
Definition: ResidualValidationNtupleHelper.h:98
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::ResidualValidationNtupleHelper::addNtupleItems
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...
Definition: ResidualValidationNtupleHelper.cxx:117
Trk::ResidualValidationNtupleHelper::fillHoleData
virtual StatusCode fillHoleData(const Trk::TrackStateOnSurface &, const int &)
fill special data about holes on track (here: do nothing)
Definition: ResidualValidationNtupleHelper.cxx:306
Trk::ResidualValidationNtupleHelper
Definition: ResidualValidationNtupleHelper.h:37
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
Trk::ResidualValidationNtupleHelper::resetVariables
virtual StatusCode resetVariables(const int &detectorType)
reset ntuple variables
Definition: ResidualValidationNtupleHelper.cxx:276
Trk::ResidualValidationNtupleHelper::m_trkParametersWarning
bool m_trkParametersWarning
warn only once, if no track parameters exist
Definition: ResidualValidationNtupleHelper.h:83
Trk::ResidualValidationNtupleHelper::m_CSCPull
std::vector< float > * m_CSCPull
hit pull in CSC ??? coordinate for each CSC meas't, vector of size nCSCHits UNIT:1
Definition: ResidualValidationNtupleHelper.h:113
Trk::ResidualValidationNtupleHelper::m_isUnbiased
int * m_isUnbiased
Definition: ResidualValidationNtupleHelper.h:90
Trk::ResidualValidationNtupleHelper::m_ignoreMissTrkCov
bool m_ignoreMissTrkCov
Definition: ResidualValidationNtupleHelper.h:88
Trk::ResidualValidationNtupleHelper::m_RPCRes
std::vector< float > * m_RPCRes
hit residual in RPC coordinate for each RPC meas't, vector of size nRPCHits UNIT:mm
Definition: ResidualValidationNtupleHelper.h:108
Trk::ResidualValidationNtupleHelper::calcPull
double calcPull(const double residual, const double locMesCov, const double locTrkCov) const
Trk::ResidualValidationNtupleHelper::~ResidualValidationNtupleHelper
~ResidualValidationNtupleHelper()
Trk::TrackState::CSC
@ CSC
Definition: TrackStateDefs.h:32
Trk::IValidationNtupleHelperTool
provides the interface for validation helper tools which write special information about generated tr...
Definition: IValidationNtupleHelperTool.h:42
Trk::ResidualValidationNtupleHelper::m_pullWarning
bool m_pullWarning
warn only once, if pull cannot be calculated
Definition: ResidualValidationNtupleHelper.h:82
Trk::ResidualValidationNtupleHelper::m_PixPullPhi
std::vector< float > * m_PixPullPhi
hit pull in pixel local phi coord for each Pixel meas't, vector of size nPixelHits UNIT:1
Definition: ResidualValidationNtupleHelper.h:93
Trk::ResidualValidationNtupleHelper::m_TRTPull
std::vector< float > * m_TRTPull
hit pull in TRT drift radius for each TRT meas't, vector of size nTRTHits UNIT:1
Definition: ResidualValidationNtupleHelper.h:101
Trk::TrackState::SCT
@ SCT
Definition: TrackStateDefs.h:29
AthAlgTool
Definition: AthAlgTool.h:26
Trk::ResidualValidationNtupleHelper::m_RPCPull
std::vector< float > * m_RPCPull
hit pull in RPC strip coordinate for each RPC meas't, vector of size nRPCHits UNIT:1
Definition: ResidualValidationNtupleHelper.h:107
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trk::ResidualValidationNtupleHelper::m_TGCRes
std::vector< float > * m_TGCRes
hit residual in TGC strip coordinate for each TGC meas't, vector of size nTGCHits UNIT:mm
Definition: ResidualValidationNtupleHelper.h:111
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:57
Trk::ResidualValidationNtupleHelper::m_TRTRes
std::vector< float > * m_TRTRes
hit residual in TRT drift radius for each TRT meas't, vector of size nTRTHits UNIT:mm
Definition: ResidualValidationNtupleHelper.h:102