Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Typedefs | Enumerations | Functions
QratCscClusterFitter.cxx File Reference
#include "QratCscClusterFitter.h"
#include <iomanip>
#include <sstream>
#include "EventPrimitives/EventPrimitives.h"
#include "EventPrimitives/EventPrimitivesHelpers.h"
#include "MuonPrepRawData/CscClusterStatus.h"
#include "MuonPrepRawData/CscPrepData.h"
#include "MuonPrepRawData/CscStripPrepData.h"
#include "MuonReadoutGeometry/CscReadoutElement.h"
#include "TrkEventPrimitives/LocalDirection.h"
#include "TrkEventPrimitives/ParamDefs.h"
#include "CxxUtils/trapping_fp.h"

Go to the source code of this file.

Typedefs

using DataNames = ICscClusterFitter::DataNames
 
using Result = ICscClusterFitter::Result
 
using Results = std::vector< Result >
 

Enumerations

enum  CscStation {
  UNKNOWN_STATION, CSS, CSL, UNKNOWN_STATION,
  CSS, CSL
}
 
enum  CscPlane {
  CSS_ETA, CSL_ETA, CSS_PHI, CSL_PHI,
  UNKNOWN_PLANE, CSS_ETA, CSL_ETA, CSS_PHI,
  CSL_PHI, UNKNOWN_PLANE
}
 

Functions

int qrat_correction (CscPlane plane, double qrat, double &cor, double &dcordqrat)
 
int qrat_interpolation (double qrmin, const std::vector< double > &corvals, double qrat, double &cor, double &dcordqrat)
 
int qrat_atanh (const double a, const double b, double c, const double x0, double qrat, double &cor, double &dcordqrat)
 Calculate QRAT correction from inverse hyperbolic tangent based on a fit to the plot of pos x vs charge ratio qrat to the function qrat(x) = a + b* tanh(c*(x-x0)) Here we use the inverse of the above function x = atanh((qrat-a)/b)/c+x0 to obtain positions from charge ratios. More...
 

Typedef Documentation

◆ DataNames

Definition at line 25 of file QratCscClusterFitter.cxx.

◆ Result

Definition at line 26 of file QratCscClusterFitter.cxx.

◆ Results

using Results = std::vector<Result>

Definition at line 27 of file QratCscClusterFitter.cxx.

Enumeration Type Documentation

◆ CscPlane

enum CscPlane
Enumerator
CSS_ETA 
CSL_ETA 
CSS_PHI 
CSL_PHI 
UNKNOWN_PLANE 
CSS_ETA 
CSL_ETA 
CSS_PHI 
CSL_PHI 
UNKNOWN_PLANE 

Definition at line 30 of file QratCscClusterFitter.cxx.

◆ CscStation

enum CscStation
Enumerator
UNKNOWN_STATION 
CSS 
CSL 
UNKNOWN_STATION 
CSS 
CSL 

Definition at line 29 of file QratCscClusterFitter.cxx.

29 { UNKNOWN_STATION, CSS, CSL };

Function Documentation

◆ qrat_atanh()

int qrat_atanh ( const double  a,
const double  b,
double  c,
const double  x0,
double  qrat,
double &  cor,
double &  dcordqrat 
)

Calculate QRAT correction from inverse hyperbolic tangent based on a fit to the plot of pos x vs charge ratio qrat to the function qrat(x) = a + b* tanh(c*(x-x0)) Here we use the inverse of the above function x = atanh((qrat-a)/b)/c+x0 to obtain positions from charge ratios.

Output is shifted by 0.5, so the center of the strip is at x=0.

Parameters
a= parameter of correction function
b= parameter of correction function
c= parameter of correction function
x0= parameter of correction function
qrat= input value of qrat = Q_right/Q_peak
cor= output of corrected position in the range -0.5 to 0.5
dcordqrat= derivative of cor w.r.t. qrat for error estimates
Returns
0 if no error, 1 if qrat is negative

Definition at line 194 of file QratCscClusterFitter.cxx.

194  {
195  if (qrat <= 0) return 1; // avoid trouble in error calculation
196  // minimum qrat value (at pos=-1) or use pos = -0.5?
197  double qrmin = a + b * tanh(c * (-1 - x0));
198 
199  // Treat any QRAT below the minimum as if it were at the minumum.
200  if (qrat < qrmin) qrat = qrmin;
201  double z = (qrat - a) / b;
202  cor = atanh(z) / c + x0;
203  dcordqrat = 1.0 / (1.0 - z * z) / b / c;
204 
205  return 0;
206 }

◆ qrat_correction()

int qrat_correction ( CscPlane  plane,
double  qrat,
double &  cor,
double &  dcordqrat 
)

Definition at line 62 of file QratCscClusterFitter.cxx.

62  {
63  std::vector<double> pfac;
64  if (plane == CSS_ETA) {
65  if (qrat < 0.095) return 1;
66  if (qrat > 1.01) return 1;
67  if (qrat < 0.15) {
68  pfac.push_back(-5.483);
69  pfac.push_back(130.6);
70  pfac.push_back(-1296.);
71  pfac.push_back(5994.);
72  pfac.push_back(-10580.);
73  } else if (qrat < 0.30) {
74  pfac.push_back(-0.9225);
75  pfac.push_back(5.569);
76  pfac.push_back(2.908);
77  pfac.push_back(-66.19);
78  pfac.push_back(108.5);
79  } else {
80  pfac.push_back(-0.4246);
81  pfac.push_back(2.619);
82  pfac.push_back(-3.642);
83  pfac.push_back(2.837);
84  pfac.push_back(-0.8916);
85  }
86  } else if (plane == CSL_ETA) {
87  if (qrat < 0.105) return 1;
88  if (qrat > 1.01) return 1;
89  if (qrat < 0.25) {
90  pfac.push_back(-2.823);
91  pfac.push_back(42.71);
92  pfac.push_back(-279.1);
93  pfac.push_back(879.2);
94  pfac.push_back(-1062.);
95  } else {
96  pfac.push_back(-0.5409);
97  pfac.push_back(3.110);
98  pfac.push_back(-4.630);
99  pfac.push_back(3.800);
100  pfac.push_back(-1.241);
101  }
102  } else {
103  return 3;
104  }
105  cor = 0.0;
106  dcordqrat = 0.0;
107  double term = 1.0;
108  for (unsigned int ipow = 0; ipow < pfac.size(); ++ipow) {
109  dcordqrat += ipow * pfac[ipow] * term;
110  if (ipow) term *= qrat;
111  cor += pfac[ipow] * term;
112  }
113  return 0;
114 }

◆ qrat_interpolation()

int qrat_interpolation ( double  qrmin,
const std::vector< double > &  corvals,
double  qrat,
double &  cor,
double &  dcordqrat 
)

Definition at line 128 of file QratCscClusterFitter.cxx.

128  {
129  int nbin = corvals.size();
130  if (!nbin) return 1;
131  // Treat any QRAT below the minimum as if it were at the minumum.
132  if (qrat < qrmin) qrat = qrmin;
133  // Find the bin holding dqrat.
134  double dqrat = 1.0 / nbin;
135  int bin = int(qrat / dqrat);
136  // Extract the value for this bin (x1) and the preceding (x0)
137  // and the following (x2).
138  double x1 = corvals[bin];
139  if (x1 == 0.0) return 2;
140  double x0 = bin == 0 ? 0.0 : corvals[bin - 1];
141  double x2 = bin == nbin - 1 ? 1.0 : corvals[bin + 1];
142  // Assign the qrat values for these bins. If this is the first
143  // bin with data, then use the input qrmin.
144  double qrat0 = dqrat * bin;
145  double qrat1 = qrat0 + dqrat;
146 
147  if (x0 == 0.0) {
148  if (qrmin > qrat0 && qrmin < qrat1) { qrat0 = qrmin; }
149  }
150  // Calculate correction and derivative.
151  // Use quadratic interpolation with the high edge of this bin,
152  // the preceding and the following. For the last bin, use linear
153  // interpolation.
154  if (bin == nbin - 1) {
155  double a = x0;
156  double b = (x1 - x0) / dqrat;
157  cor = a + b * (qrat - qrat0);
158  dcordqrat = b;
159  } else {
160  double d0 = qrat1 - qrat0;
161  double d = dqrat;
162  double w = 1.0 / (d0 * d * d + d0 * d0 * d);
163  double a = x1;
164  double b = w * d * d * (x1 - x0) + w * d0 * d0 * (x2 - x1);
165  double c = w * d0 * (x2 - x1) - w * d * (x1 - x0);
166  cor = a + b * (qrat - qrat1) + c * (qrat - qrat1) * (qrat - qrat1);
167  dcordqrat = b + 2.0 * c * (qrat - qrat1);
168  }
169  if (cor < 0.0) cor = 0.0;
170  // Shift correction to center of bin.
171  cor -= 0.50;
172  return 0;
173 }
CSS_ETA
@ CSS_ETA
Definition: QratCscClusterFitter.cxx:30
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
CSL_ETA
@ CSL_ETA
Definition: QratCscClusterFitter.cxx:30
CSS
@ CSS
Definition: QratCscClusterFitter.cxx:29
hist_file_dump.d
d
Definition: hist_file_dump.py:143
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
CSS_PHI
@ CSS_PHI
Definition: QratCscClusterFitter.cxx:30
bin
Definition: BinsDiffFromStripMedian.h:43
CSL_PHI
@ CSL_PHI
Definition: QratCscClusterFitter.cxx:30
z
#define z
python.LArMinBiasAlgConfig.int
int
Definition: LArMinBiasAlgConfig.py:59
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
MuonR4::SegmentFit::ParamDefs::x0
@ x0
CSL
@ CSL
Definition: QratCscClusterFitter.cxx:29
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
a
TList * a
Definition: liststreamerinfos.cxx:10
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
UNKNOWN_PLANE
@ UNKNOWN_PLANE
Definition: QratCscClusterFitter.cxx:30
UNKNOWN_STATION
@ UNKNOWN_STATION
Definition: QratCscClusterFitter.cxx:29
python.compressB64.c
def c
Definition: compressB64.py:93