ATLAS Offline Software
TRTCalibrator.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRT_CALIBTOOLS__TRTCALIBRATOR_H
6 #define TRT_CALIBTOOLS__TRTCALIBRATOR_H
7 
8 /********************************************************************
9 
10  NAME: TRTCalibrator.h
11 PACKAGE: TRTCalibTools
12 
13 AUTHORS: Johan Lundquist
14 CREATED: 27-03-2009
15 
16 PURPOSE: Tool for calibrating the TRT
17 
18 ********************************************************************/
19 
20 
26 #include "GaudiKernel/ToolHandle.h"
27 #include "GaudiKernel/ServiceHandle.h"
28 #include "Gaudi/Property.h"
29 
30 #include <string>
31 #include <vector>
32 #include <map>
33 #include <set>
34 
35 class AtlasDetectorID;
36 class TRT_ID;
37 class TFile;
38 namespace InDetDD{
39  class TRT_DetectorManager;
40 }
41 
45 class TRTCalibrator : virtual public ITRTCalibrator, public AthAlgTool {
46 public:
47 
51  TRTCalibrator(const std::string& type, const std::string& name, const IInterface* parent);
52 
56  virtual ~TRTCalibrator() {}
57 
76  virtual StatusCode initialize() override;
77  virtual StatusCode finalize() override;
78 
79  virtual bool fill(const Trk::Track* aTrack, TRT::TrackInfo* output) override;
80 
81  bool IncludedLevels(std::string, int*);
82 
86  std::string SubLev(std::string, int);
87 
91  bool IsSubLev(const std::string&, int, const std::string&);
92 
96  void DumpStrawData(int);
97 
101  int GetSubLevels(const std::string&, int, std::set<int>*);
102 
106  void MakeBDKeys(int, int, int, int, int, int);
107 
111  virtual bool calibrate ATLAS_NOT_THREAD_SAFE () override;
112 
113 private:
114 
115  ToolHandle<ITRT_CalDbTool> m_trtcaldbTool {this, "TRTCalDbTool", "ITRT_CalDbTool", ""};
116  ToolHandle<ITRT_StrawStatusSummaryTool> m_TRTStrawSummaryTool {this, "TRTStrawSummaryTool", "ITRT_StrawStatusSummaryTool", ""};
117  ServiceHandle<ITRT_StrawNeighbourSvc> m_neighbourSvc {this,"NeighbourSvc","ITRT_StrawNeighbourSvc","retrieve barrel and end-cap straw number" };
118 
119 
120  // Gaudi Properties
121  Gaudi::Property<float> m_maxDistance {this, "maxDistance" , 2.8 , ""};
122  Gaudi::Property<float> m_maxTimeResidual {this, "maxTimeResidual" , 150.0 , ""};
123  Gaudi::Property<float> m_maxTrackChisquarePerDof {this, "maxTrackChisquarePerDof" , 10.0 , ""};
124  Gaudi::Property<float> m_t0offset {this, "T0Offset" , -0.3 , ""};
125 
126  Gaudi::Property<int> m_minTimebinsOverThreshold {this, "minTimebinsOverThreshold" , 2 , ""};
127  Gaudi::Property<int> m_minrt {this, "MinRt" , 10000 , "minimum number of hits required to do R-t calibration" };
128  Gaudi::Property<int> m_mint0 {this, "MinT0" , 200 , "minimum number of hits required to do T0 calibration" };
129  Gaudi::Property<int> m_nevents {this, "Nevents" , -1 , "The number of hits or histograms read from the input file"};
130 
131  Gaudi::Property<bool> m_SplitBarrel {this, "SplitBarrel" , true , ""};
132  Gaudi::Property<bool> m_useP0 {this, "UseP0" , true , ""};
133  Gaudi::Property<bool> m_floatP3 {this, "FloatP3" , true , ""};
134  Gaudi::Property<bool> m_DoArXenonSep {this, "DoArXenonSep" , false , ""};
135  Gaudi::Property<bool> m_DoShortStrawCorrection {this, "DoShortStrawCorrection" , true , ""};
136 
137  Gaudi::Property<std::string> m_selstring {this, "Selstring" , "_*_-_-_-_-_-_-" , ""};
138  Gaudi::Property<std::string> m_calsub {this, "SubPart" , "user" , ""};
139  Gaudi::Property<std::string> m_options {this, "Options" , "" , ""};
140  Gaudi::Property<std::string> m_hittuple {this, "Hittuple" , "merged.root" , ""};
141  Gaudi::Property<std::string> m_rtrel {this, "RtRel" , "basic" , "the rt relation to use"};
142  Gaudi::Property<std::string> m_rtbinning {this, "RtBinning" , "t" , ""};
143  Gaudi::Property<std::string> m_ntrtmanager {this, "TrtManagerLocation" , "TRT" , ""};
144 
145  Gaudi::Property< std::vector<std::string> > m_doRt {this, "CalibrateRt" , {} , ""};
146  Gaudi::Property< std::vector<std::string> > m_doT0 {this, "CalibrateT0" , {} , ""};
147  Gaudi::Property< std::vector<std::string> > m_doRes {this, "FitResidual" , {} , ""};
148  Gaudi::Property< std::vector<std::string> > m_beQuiet {this, "NoHistograms" , {} , ""};
149  Gaudi::Property< std::vector<std::string> > m_useBoardRef {this, "UseBoardRef" , {} , ""};
150  Gaudi::Property< std::vector<std::string> > m_doLogPrint {this, "PrintLog" , {} , ""};
151  Gaudi::Property< std::vector<std::string> > m_doOutPrint {this, "PrintT0Out" , {} , ""};
152  Gaudi::Property< std::vector<std::string> > m_doRtPrint {this, "PrintRtOut" , {} , ""};
153 
155  const TRT_ID* m_TRTID{};
157  unsigned int m_numOfHitsTotal{};
158  unsigned int m_numOfHitsAccepted{} ;
159  unsigned int m_numOfProcessedTracks{} ;
160 
161  std::string m_comTimeName;
163  class BDzero{public: int z;}; class BDstraw{public: std::map<std::string,BDzero> s;}; class BDchip{public: std::map<std::string,BDstraw> c;}; class BDboard{public: std::map<std::string,BDchip> b;}; class BDmodule{public: std::map<std::string,BDboard> m;}; class BDlayer{public: std::map<std::string,BDmodule> l;}; class BDdetector{public: std::map<std::string,BDlayer> d;}; class BDTRT{public: std::map<std::string,BDdetector> t;}; BDTRT m_trt;
173  BDTRT m_trt_acc;
175 
176 
177  class epdata{
178  public:
180  };
181 
182  struct conf {
183  std::string Selstring, Options;
185  std::map< std::string,std::set<int> > selections;//TRTsel, detsel, laysel, modsel, brdsel, chpsel, stwsel;
186  };
187  std::map<std::string,conf> m_config;
188 
189  enum {CALIB_ALL=-3, CALIB_NONE=-4};
190 
191 
192 };
193 
194 #endif // TRT_CALIBTOOLS__TRTCALIBRATOR_H
TRTCalibrator::m_minrt
Gaudi::Property< int > m_minrt
Definition: TRTCalibrator.h:127
TRTCalibrator::m_doT0
Gaudi::Property< std::vector< std::string > > m_doT0
Definition: TRTCalibrator.h:146
TRTCalibrator::epdata
Definition: TRTCalibrator.h:177
TRTCalibrator::m_t0offset
Gaudi::Property< float > m_t0offset
Definition: TRTCalibrator.h:124
TRTCalibrator::BDmodule::m
std::map< std::string, BDboard > m
Definition: TRTCalibrator.h:168
TRTCalibrator::epdata::track
float track
Definition: TRTCalibrator.h:179
TRTCalibrator::m_useP0
Gaudi::Property< bool > m_useP0
Definition: TRTCalibrator.h:132
TRTCalibrator::m_SplitBarrel
Gaudi::Property< bool > m_SplitBarrel
Definition: TRTCalibrator.h:131
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
TRTCalibrator::finalize
virtual StatusCode finalize() override
Definition: TRTCalibrator.cxx:197
TRTCalibrator::m_minTimebinsOverThreshold
Gaudi::Property< int > m_minTimebinsOverThreshold
Definition: TRTCalibrator.h:126
TRTCalibrator::m_hittuple
Gaudi::Property< std::string > m_hittuple
Definition: TRTCalibrator.h:140
TRTCalibrator::epdata::ttrack
float ttrack
Definition: TRTCalibrator.h:179
TRTCalibrator::m_doLogPrint
Gaudi::Property< std::vector< std::string > > m_doLogPrint
Definition: TRTCalibrator.h:150
TRTCalibrator::conf::selections
std::map< std::string, std::set< int > > selections
Definition: TRTCalibrator.h:185
TRTCalibrator::BDTRT::t
std::map< std::string, BDdetector > t
Definition: TRTCalibrator.h:171
TRTCalibrator::m_TRTID
const TRT_ID * m_TRTID
Definition: TRTCalibrator.h:155
TRTCalibrator::BDstraw::s
std::map< std::string, BDzero > s
Definition: TRTCalibrator.h:165
TRTCalibrator::m_floatP3
Gaudi::Property< bool > m_floatP3
Definition: TRTCalibrator.h:133
TRTCalibrator::m_Dkey
std::string m_Dkey
Definition: TRTCalibrator.h:162
TRTCalibrator::m_DoArXenonSep
Gaudi::Property< bool > m_DoArXenonSep
Definition: TRTCalibrator.h:134
TRTCalibrator::m_Dkey_acc
std::string m_Dkey_acc
Definition: TRTCalibrator.h:162
TRTCalibrator::BDdetector::d
std::map< std::string, BDlayer > d
Definition: TRTCalibrator.h:170
TRTCalibrator::BDzero
dummy dictionary class
Definition: TRTCalibrator.h:164
TRTCalibrator::epdata::nhits
float nhits
Definition: TRTCalibrator.h:179
TRTCalibrator::m_trt_acc
BDTRT m_trt_acc
instance if the dictionary class for the full TRT
Definition: TRTCalibrator.h:174
TRTCalibrator::m_DetID
const AtlasDetectorID * m_DetID
Definition: TRTCalibrator.h:154
TRTCalibrator::ATLAS_NOT_THREAD_SAFE
virtual bool calibrate ATLAS_NOT_THREAD_SAFE() override
Method for doing the actual calibration.
TRTCalibrator::epdata::t0
float t0
Definition: TRTCalibrator.h:179
TRTCalibrator::m_config
std::map< std::string, conf > m_config
Definition: TRTCalibrator.h:187
TRTCalibrator::conf::Options
std::string Options
Definition: TRTCalibrator.h:183
TRT::TrackInfo
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:83
TRTCalibrator::BDchip::c
std::map< std::string, BDstraw > c
Definition: TRTCalibrator.h:166
TRTCalibrator::m_doRes
Gaudi::Property< std::vector< std::string > > m_doRes
Definition: TRTCalibrator.h:147
TRTCalibrator::m_doOutPrint
Gaudi::Property< std::vector< std::string > > m_doOutPrint
Definition: TRTCalibrator.h:151
ITRTCalibrator
Definition: ITRTCalibrator.h:32
TRTCalibrator::m_ntrtmanager
Gaudi::Property< std::string > m_ntrtmanager
Definition: TRTCalibrator.h:143
TRTCalibrator::m_options
Gaudi::Property< std::string > m_options
Definition: TRTCalibrator.h:139
TRTCalibrator::m_comTimeName
std::string m_comTimeName
Definition: TRTCalibrator.h:161
TRTCalibrator::m_useBoardRef
Gaudi::Property< std::vector< std::string > > m_useBoardRef
Definition: TRTCalibrator.h:149
ITRT_StrawStatusSummaryTool.h
abstract interface to TRT straw status constants
TRTCalibrator::BDlayer::l
std::map< std::string, BDmodule > l
Definition: TRTCalibrator.h:169
TRTCalibrator::conf::Selstring
std::string Selstring
Definition: TRTCalibrator.h:183
TRTCalibrator::MakeBDKeys
void MakeBDKeys(int, int, int, int, int, int)
makes the key strings for a sub-module
Definition: TRTCalibrator.cxx:292
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRTCalibrator::conf
Definition: TRTCalibrator.h:182
AthAlgTool.h
TRTCalibrator::epdata::ephase1
float ephase1
Definition: TRTCalibrator.h:179
TRTCalibrator::m_TRTStrawSummaryTool
ToolHandle< ITRT_StrawStatusSummaryTool > m_TRTStrawSummaryTool
Definition: TRTCalibrator.h:116
TRTCalibrator::m_Skey
std::string m_Skey
Definition: TRTCalibrator.h:162
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TRTCalibrator::m_doRt
Gaudi::Property< std::vector< std::string > > m_doRt
Definition: TRTCalibrator.h:145
TRTCalibrator::m_DoShortStrawCorrection
Gaudi::Property< bool > m_DoShortStrawCorrection
Definition: TRTCalibrator.h:135
TRTCalibrator::conf::PrintLog
std::vector< std::string > PrintLog
Definition: TRTCalibrator.h:184
TRTCalibrator::BDzero::z
int z
Definition: TRTCalibrator.h:164
TRTCalibrator::SubLev
std::string SubLev(std::string, int)
return sub-level i from a selection string with the form _X_X_X_X_X_X_X
Definition: TRTCalibrator.cxx:203
ITRT_CalDbTool.h
abstract interface to TRT calibration constants
TRTCalibrator::m_rtrel
Gaudi::Property< std::string > m_rtrel
Definition: TRTCalibrator.h:141
TRTCalibrator::m_mint0
Gaudi::Property< int > m_mint0
Definition: TRTCalibrator.h:128
TRTCalibrator::IncludedLevels
bool IncludedLevels(std::string, int *)
TRTCalibrator::m_numOfProcessedTracks
unsigned int m_numOfProcessedTracks
Definition: TRTCalibrator.h:159
TRTCalibrator::m_calsub
Gaudi::Property< std::string > m_calsub
Definition: TRTCalibrator.h:138
merge.output
output
Definition: merge.py:17
TRTCalibrator::conf::FitResidual
std::vector< std::string > FitResidual
Definition: TRTCalibrator.h:184
TRTCalibrator::m_nevents
Gaudi::Property< int > m_nevents
Definition: TRTCalibrator.h:129
TRTCalibrator::CALIB_ALL
@ CALIB_ALL
Definition: TRTCalibrator.h:189
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TRTCalibrator::CALIB_NONE
@ CALIB_NONE
Definition: TRTCalibrator.h:189
TRTCalibrator::m_selstring
Gaudi::Property< std::string > m_selstring
Definition: TRTCalibrator.h:137
TRTCalibrator::conf::CalibrateRt
std::vector< std::string > CalibrateRt
Definition: TRTCalibrator.h:184
TRTCalibrator::conf::PrintRtOut
std::vector< std::string > PrintRtOut
Definition: TRTCalibrator.h:184
TRTCalibrator::m_maxTimeResidual
Gaudi::Property< float > m_maxTimeResidual
Definition: TRTCalibrator.h:122
TRTCalibrator::m_trtmanager
const InDetDD::TRT_DetectorManager * m_trtmanager
Definition: TRTCalibrator.h:156
TRTCalibrator::epdata::event
float event
Definition: TRTCalibrator.h:179
ITRT_StrawNeighbourSvc.h
Abstract interface to information on straws electronic grouping.
TRTCalibrator::m_maxDistance
Gaudi::Property< float > m_maxDistance
Definition: TRTCalibrator.h:121
TRTCalibrator::m_neighbourSvc
ServiceHandle< ITRT_StrawNeighbourSvc > m_neighbourSvc
Definition: TRTCalibrator.h:117
TRTCalibrator::m_numOfHitsAccepted
unsigned int m_numOfHitsAccepted
Definition: TRTCalibrator.h:158
TRTCalibrator::m_maxTrackChisquarePerDof
Gaudi::Property< float > m_maxTrackChisquarePerDof
Definition: TRTCalibrator.h:123
TRT_ID
Definition: TRT_ID.h:84
InDetDD::TRT_DetectorManager
The Detector Manager for all TRT Detector elements, it acts as the interface to the detector elements...
Definition: TRT_DetectorManager.h:69
TRTCalibrator::m_trt
BDTRT m_trt
instance if the dictionary class for the full TRT
Definition: TRTCalibrator.h:172
TRTCalibrator::m_Mkey
std::string m_Mkey
Definition: TRTCalibrator.h:162
TRTCalibrator::epdata::run
float run
Definition: TRTCalibrator.h:179
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
TRTCalibrator::m_Bkey
std::string m_Bkey
Definition: TRTCalibrator.h:162
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TRTCalibrator::m_Tkey
std::string m_Tkey
Definition: TRTCalibrator.h:162
TRTCalibrator::m_Ckey
std::string m_Ckey
Definition: TRTCalibrator.h:162
TRTCalibrator::m_rtbinning
Gaudi::Property< std::string > m_rtbinning
Definition: TRTCalibrator.h:142
TRTCalibrator::~TRTCalibrator
virtual ~TRTCalibrator()
Destructor.
Definition: TRTCalibrator.h:56
TRTCalibrator::m_numOfHitsTotal
unsigned int m_numOfHitsTotal
Definition: TRTCalibrator.h:157
ITRTCalibrator.h
TRTCalibrator::conf::CalibrateT0
std::vector< std::string > CalibrateT0
Definition: TRTCalibrator.h:184
TRTCalibrator::conf::PrintT0Out
std::vector< std::string > PrintT0Out
Definition: TRTCalibrator.h:184
TRTCalibrator::BDboard::b
std::map< std::string, BDchip > b
Definition: TRTCalibrator.h:167
TRTCalibrator::initialize
virtual StatusCode initialize() override
Pre-define standard calibration configuration.
Definition: TRTCalibrator.cxx:54
TRTCalibrator::DumpStrawData
void DumpStrawData(int)
returns true if the ...
Definition: TRTCalibrator.cxx:215
TRTCalibrator::m_beQuiet
Gaudi::Property< std::vector< std::string > > m_beQuiet
Definition: TRTCalibrator.h:148
TRTCalibrator::TRTCalibrator
TRTCalibrator(const std::string &type, const std::string &name, const IInterface *parent)
Constructor.
Definition: TRTCalibrator.cxx:44
TRTCalibrator::fill
virtual bool fill(const Trk::Track *aTrack, TRT::TrackInfo *output) override
Definition: TRTCalibrator.cxx:978
TRTCalibrator::GetSubLevels
int GetSubLevels(const std::string &, int, std::set< int > *)
fills a set of integers with the indexes af the sub-modules that are conatined in a selection
Definition: TRTCalibrator.cxx:247
TRTCalibrator::m_trtcaldbTool
ToolHandle< ITRT_CalDbTool > m_trtcaldbTool
Definition: TRTCalibrator.h:115
TRTCalibrator::m_doRtPrint
Gaudi::Property< std::vector< std::string > > m_doRtPrint
Definition: TRTCalibrator.h:152
AthAlgTool
Definition: AthAlgTool.h:26
TRTCalibrator::m_Lkey
std::string m_Lkey
Definition: TRTCalibrator.h:162
TRTCalibrator::conf::NoHistograms
std::vector< std::string > NoHistograms
Definition: TRTCalibrator.h:184
TRTCalibrator::IsSubLev
bool IsSubLev(const std::string &, int, const std::string &)
returns true if the ...
Definition: TRTCalibrator.cxx:232
TRTCalibrator::epdata::t
float t
Definition: TRTCalibrator.h:179
TRTCalibrator
The TRTCalibrator is called from TRTCalibrationMgr.
Definition: TRTCalibrator.h:45
TRTCalibrator::m_Lkey_acc
std::string m_Lkey_acc
Definition: TRTCalibrator.h:162
AtlasDetectorID
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Definition: AtlasDetectorID.h:57
TRTCalibrator::epdata::ephase2
float ephase2
Definition: TRTCalibrator.h:179
ServiceHandle< ITRT_StrawNeighbourSvc >