ATLAS Offline Software
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"

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 24 of file QratCscClusterFitter.cxx.

◆ Result

Definition at line 25 of file QratCscClusterFitter.cxx.

◆ Results

using Results = std::vector<Result>

Definition at line 26 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 29 of file QratCscClusterFitter.cxx.

◆ CscStation

enum CscStation
Enumerator
UNKNOWN_STATION 
CSS 
CSL 
UNKNOWN_STATION 
CSS 
CSL 

Definition at line 28 of file QratCscClusterFitter.cxx.

28 { 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 193 of file QratCscClusterFitter.cxx.

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

◆ qrat_correction()

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

Definition at line 61 of file QratCscClusterFitter.cxx.

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

◆ qrat_interpolation()

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

Definition at line 127 of file QratCscClusterFitter.cxx.

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