ATLAS Offline Software
Loading...
Searching...
No Matches
Rec::MuonMeanMDTdADCFillerTool Class Reference

return mean Number of ADC counts for MDT tubes on the track More...

#include <MuonMeanMDTdADCFillerTool.h>

Inheritance diagram for Rec::MuonMeanMDTdADCFillerTool:
Collaboration diagram for Rec::MuonMeanMDTdADCFillerTool:

Public Member Functions

virtual ~MuonMeanMDTdADCFillerTool ()=default
StatusCode initialize () override
double meanMDTdADCFiller (const xAOD::Muon &muon) const override
 return mean Number of ADC counts for MDT tubes on the track of muon (method will simply step down to the relevant track)
double meanMDTdADCFiller (const Trk::Track &track) const override
 return mean Number of ADC counts for MDT tubes on the track

Private Attributes

ServiceHandle< Muon::IMuonEDMHelperSvcm_edmHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
SG::ReadHandleKey< xAOD::EventInfom_eventInfo {this, "EventInfo", "EventInfo", "event info"}

Detailed Description

return mean Number of ADC counts for MDT tubes on the track

Definition at line 25 of file MuonMeanMDTdADCFillerTool.h.

Constructor & Destructor Documentation

◆ ~MuonMeanMDTdADCFillerTool()

virtual Rec::MuonMeanMDTdADCFillerTool::~MuonMeanMDTdADCFillerTool ( )
virtualdefault

Member Function Documentation

◆ initialize()

StatusCode Rec::MuonMeanMDTdADCFillerTool::initialize ( )
override

Definition at line 26 of file MuonMeanMDTdADCFillerTool.cxx.

26 {
27 ATH_MSG_INFO("Initializing MuonMeanMDTdADCFillerTool");
28
29 ATH_CHECK(m_edmHelperSvc.retrieve());
30 ATH_CHECK(m_idHelperSvc.retrieve());
31 ATH_CHECK(m_eventInfo.initialize());
32
33 return StatusCode::SUCCESS;
34 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

◆ meanMDTdADCFiller() [1/2]

double Rec::MuonMeanMDTdADCFillerTool::meanMDTdADCFiller ( const Trk::Track & track) const
override

return mean Number of ADC counts for MDT tubes on the track

Definition at line 69 of file MuonMeanMDTdADCFillerTool.cxx.

69 {
70 bool doMdtGasGainCorrectionForMc = false; // default value for DATA
71
72 // Event information
73 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfo);
74
75 // check if data or MC
76 if (eventInfo->eventType(xAOD::EventInfo::IS_SIMULATION)) {
77 doMdtGasGainCorrectionForMc = true; // set "true" for MC
78 }
79
80 // return mean Number of ADC counts for MDT tubes on the track
81
82 const Trk::TrackStates* states = track.trackStateOnSurfaces();
83 if (!states) {
84 ATH_MSG_INFO("Cannot get track states on surface for TrackParticle");
85 return -9999.;
86 }
87
88 int nhitsadc = 0;
89 double absR = 0;
90 double datfit = 0;
91 double mcfit = 0;
92 double correction = 0;
93 double testEta = 0;
94 double maxhit = -999.;
95 float PhiFit = 0;
96
97 double meandADC = 0.;
98 std::vector<double> dADCvec;
99 dADCvec.clear();
100 double meanMDTdADC = 0.;
101
102 testEta = asinh(1. / tan(track.perigeeParameters()->parameters()[Trk::theta]));
103 double track_phi = track.perigeeParameters()->parameters()[Trk::phi];
104
105 for (const Trk::TrackStateOnSurface* ts : *states) {
106 // outliers can have type measurement, in Muid
108
109 const Trk::MeasurementBase* measurement = ts->measurementOnTrack();
110 if (!measurement) { continue; }
111 Identifier id = m_edmHelperSvc->getIdentifier(*measurement);
112 if (!(m_idHelperSvc->isMuon(id))) {
113 continue; // MS summary variables - don't need other technologies
114 }
115 if (!id.is_valid()) { continue; }
116 // mdt station counts
117 if (m_idHelperSvc->isMdt(id)) {
118 const Muon::MdtDriftCircleOnTrack* mdtcirc = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(measurement);
119 if (!mdtcirc) {
120 ATH_MSG_WARNING("cannot cast Trk::MeasurementBase to Muon::MdtDriftCircleOnTrack");
121 continue;
122 }
123 const Muon::MdtPrepData* rawdata = mdtcirc->prepRawData();
124 if (rawdata) {
125 // Calculate deltaADC as difference of number of ADC counts for given hit and datfit(Rdrift),
126 // where datfit(Rdrift) is the result of the fit of <ADC> in the given bin of Rdrift dependence on Rdrift
127 absR = fabs(mdtcirc->driftRadius());
128
129 bool isInBme = fabs(testEta) >= 0.644 && fabs(testEta) <= 0.772 && track_phi >= -1.72 && track_phi <= -1.42;
130
131 if ((!isInBme && (absR <= 0.4 || absR >= 14.)) || (isInBme && (absR <= 0.4 || absR >= 6.5))) continue;
132 nhitsadc++;
133
134 if (fabs(testEta) < 1.) {
135 datfit = 105.088 + 27.0638 * pow(absR, 1) - 4.72089 * pow(absR, 2) + 0.110274 * pow(absR, 3) +
136 0.041508 * pow(absR, 4) - 0.00403678 * pow(absR, 5) + 0.000111072 * pow(absR, 6);
137 mcfit = 73.8974 + 12.0642 * pow(absR, 1) + 0.975372 * pow(absR, 2) - 0.922337 * pow(absR, 3) +
138 0.140759 * pow(absR, 4) - 0.00881345 * pow(absR, 5) + 0.000202078 * pow(absR, 6);
139 } else {
140 datfit = 106.329 + 26.5296 * pow(absR, 1) - 4.07423 * pow(absR, 2) - 0.0594686 * pow(absR, 3) +
141 0.0608916 * pow(absR, 4) - 0.00506114 * pow(absR, 5) + 0.000131493 * pow(absR, 6);
142 mcfit = 73.3596 + 12.9939 * pow(absR, 1) + 0.494472 * pow(absR, 2) - 0.812082 * pow(absR, 3) +
143 0.128345 * pow(absR, 4) - 0.00814268 * pow(absR, 5) + 0.000188203 * pow(absR, 6);
144 }
145
146 if (doMdtGasGainCorrectionForMc) {
147 correction = datfit / mcfit; // gas gain correction factor for MC
148 meandADC += (correction * rawdata->adc() - datfit);
149 dADCvec.push_back(correction * rawdata->adc() - datfit);
150
151 maxhit = ((correction * rawdata->adc() - datfit) >= maxhit) ? (correction * rawdata->adc() - datfit) : maxhit;
152 } else {
153 meandADC += (rawdata->adc() - datfit);
154 dADCvec.push_back(rawdata->adc() - datfit);
155
156 maxhit = ((rawdata->adc() - datfit) >= maxhit) ? (rawdata->adc() - datfit) : maxhit;
157 }
158 }
159 }
160 } // end loop over hits
161
162 if (nhitsadc == 0) { meandADC = -9999; }
163
164 if (nhitsadc == 1) { meandADC = meandADC / double(nhitsadc); }
165 if (nhitsadc >= 2) { meandADC = double(meandADC - maxhit) / double(nhitsadc - 1); }
166
167 if (doMdtGasGainCorrectionForMc) {
168 if (track_phi > -3.2 && track_phi <= -2.87) PhiFit = -13.5471 * pow(track_phi, 2) - 39.0001 * track_phi + 4.23613;
169 if (track_phi > -2.87 && track_phi <= -2.13) PhiFit = 53.209 * pow(track_phi, 2) + 272.502 * track_phi + 342.867;
170 if (track_phi > -2.13 && track_phi <= -1.37) PhiFit = 72.4707 * pow(track_phi, 2) + 254.911 * track_phi + 216.811;
171 if (track_phi > -1.37 && track_phi <= -0.57) PhiFit = 77.218 * pow(track_phi, 2) + 149.676 * track_phi + 65.371;
172 if (track_phi > -0.57 && track_phi < 0.21) PhiFit = 86.977 * pow(track_phi, 2) + 29.0558 * track_phi - 6.09313;
173 if (track_phi >= 0.21 && track_phi <= 1.00) PhiFit = 79.203 * pow(track_phi, 2) - 92.9512 * track_phi + 21.6361;
174 if (track_phi > 1.00 && track_phi <= 1.79) PhiFit = 85.5711 * pow(track_phi, 2) - 239.068 * track_phi + 161.918;
175 if (track_phi > 1.79 && track_phi <= 2.60) PhiFit = 82.8996 * pow(track_phi, 2) - 362.665 * track_phi + 391.419;
176 if (track_phi > 2.60 && track_phi < 3.20) PhiFit = 73.8744 * pow(track_phi, 2) - 443.274 * track_phi + 656.926;
177
178 meandADC += PhiFit - 5.01 + 9.46;
179 }
180
181 dADCvec.clear();
182
183 meanMDTdADC = meandADC;
184
185 return meanMDTdADC;
186 }
#define ATH_MSG_WARNING(x)
double driftRadius() const
Returns the value of the drift radius.
virtual const MdtPrepData * prepRawData() const override final
Returns the PrepRawData used to create this corrected measurement.
int adc() const
Returns the ADC (typically range is 0 to 250).
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ IS_SIMULATION
true: simulation, false: data
int ts
Definition globals.cxx:24
DataVector< const Trk::TrackStateOnSurface > TrackStates
@ theta
Definition ParamDefs.h:66
@ phi
Definition ParamDefs.h:75
constexpr int pow(int x)
Definition conifer.h:27
asinh(x)
helper methods ---------------------------------------------------------—
Definition Dumpers.py:88
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4

◆ meanMDTdADCFiller() [2/2]

double Rec::MuonMeanMDTdADCFillerTool::meanMDTdADCFiller ( const xAOD::Muon & muon) const
override

return mean Number of ADC counts for MDT tubes on the track of muon (method will simply step down to the relevant track)

Definition at line 36 of file MuonMeanMDTdADCFillerTool.cxx.

36 {
37 // exclude statistical combination
38 if (muon.author() == xAOD::Muon::Author::STACO) {
39 return -9999.;
40 }
41 // Trk::Track* for trackParticle
42 using enum xAOD::Muon::TrackParticleType;
43 const Trk::Track* theTrack = muon.trackParticle(CombinedTrackParticle)
44 ? muon.trackParticle(CombinedTrackParticle)->track()
45 : nullptr;
46
47 if (theTrack) { return meanMDTdADCFiller(*theTrack); }
48
49 const Trk::Track* theTrack1 = muon.trackParticle(InnerDetectorTrackParticle)
50 ? muon.trackParticle(InnerDetectorTrackParticle)->track()
51 : nullptr;
52
53 if (theTrack1) { return meanMDTdADCFiller(*theTrack1); }
54
55 const Trk::Track* theTrack2 = muon.trackParticle(MuonSpectrometerTrackParticle)
56 ? muon.trackParticle(MuonSpectrometerTrackParticle)->track()
57 : nullptr;
58
59 if (theTrack2) { return meanMDTdADCFiller(*theTrack2); }
60
61 const Trk::Track* theTrack3 = muon.trackParticle(Primary)->track();
62
63 if (theTrack3) { return meanMDTdADCFiller(*theTrack3); }
64
65 ATH_MSG_DEBUG("No primary author original track for refitted muon, stop calculation...");
66 return -9999.;
67 }
#define ATH_MSG_DEBUG(x)
double meanMDTdADCFiller(const xAOD::Muon &muon) const override
return mean Number of ADC counts for MDT tubes on the track of muon (method will simply step down to ...

Member Data Documentation

◆ m_edmHelperSvc

ServiceHandle<Muon::IMuonEDMHelperSvc> Rec::MuonMeanMDTdADCFillerTool::m_edmHelperSvc
private
Initial value:
{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
"Handle to the service providing the IMuonEDMHelperSvc interface"}

Definition at line 45 of file MuonMeanMDTdADCFillerTool.h.

45 {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
46 "Handle to the service providing the IMuonEDMHelperSvc interface"};

◆ m_eventInfo

SG::ReadHandleKey<xAOD::EventInfo> Rec::MuonMeanMDTdADCFillerTool::m_eventInfo {this, "EventInfo", "EventInfo", "event info"}
private

Definition at line 48 of file MuonMeanMDTdADCFillerTool.h.

48{this, "EventInfo", "EventInfo", "event info"};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Rec::MuonMeanMDTdADCFillerTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 47 of file MuonMeanMDTdADCFillerTool.h.

47{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

The documentation for this class was generated from the following files: