ATLAS Offline Software
CscParabola.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // a class to fit CSC strips in a plane into clusters //
7 // //
8 // BNL March 26 2003 --- Ketevi A. Assamagan //
9 // UCI June 6 2006 --- Michael Schernau //
11 
12 #include "CscParabola.h"
13 
14 #include <cmath>
15 
16 #include <algorithm>
17 #include <cassert>
18 
20  m_msgSvc = nullptr;
21  ISvcLocator* svcLocator = Gaudi::svcLocator();
22  StatusCode sc = svcLocator->service("MessageSvc", m_msgSvc);
23  if (sc.isFailure()) std::cout << "CscParabola::Fail to locate Message Service" << std::endl;
24 }
25 
26 void CscParabola::cscParabola(const double* qstr, int& NStrip, double& thr, double& da, int& ncl, double* sig, double* zpos, double&) {
27  MsgStream mLog(m_msgSvc, "CscParabola");
28 
30 
31  int clusters[96]; // stores the peak channel for each hit.
32  ncl = 0; // number of clusters
33 
38 
39  for (int ch = 1; ch < NStrip - 1; ch++) { // loop over channels
40  if (qstr[ch] > thr) { // there is activity above threshold
41  if ((qstr[ch] > qstr[ch - 1]) && (qstr[ch] > qstr[ch + 1])) { // this is a peak
42  clusters[ncl] = ch; // store the peak channel number
43  ncl++; // count clusters
44  }
45  }
46  } // next channel
47 
48  int L = NStrip; // should be 192 or 48, is used for position relative to center of chamber
49 
50  if (L < 96) { // actually L=48 for the transverse strips.
54  if ((qstr[0] > qstr[1]) && (qstr[0] > thr)) {
55  clusters[ncl] = 0; // store the peak channel number
56  ncl++;
57  }
58  if ((qstr[L - 1] > qstr[L - 2]) && (qstr[L - 1] > thr)) {
59  clusters[ncl] = L - 1; // store the peak channel number
60  ncl++;
61  }
62  // Loop over clusters and calculate their position:
63  for (int ic = 0; ic < ncl; ic++) {
64  int maxStrip = clusters[ic]; // strip with the peak charge
65  double maxPos; // position of that strip
66 
69  maxPos = da * (maxStrip + 0.5 - L / 2); // position of peak channel relative to center of chamber
70 
72  *(zpos + ic * 3) = maxPos; // just the peak channel
73  *(zpos + ic * 3 + 1) = maxPos;
74  *(zpos + ic * 3 + 2) = maxPos;
75  *(sig + ic) = da / sqrt(12.0); // independent of charge.
76  } // next cluster
77 
78  } else { // this is the case for the precision strips
79  // Loop over clusters and calculate their position:
80  for (int ic = 0; ic < ncl; ic++) {
81  int maxStrip = clusters[ic]; // strip with the peak charge
82  double maxPos; // position of that strip
83 
86  maxPos = da * (maxStrip + 0.5 - L / 2); // position of peak channel relative to center of chamber
87 
90  double a = qstr[maxStrip - 1]; // left charge
91  double b = qstr[maxStrip]; // center charge
92  double c = qstr[maxStrip + 1]; // right charge
93  double x = 0.5 * (a - c) / (a + c - 2 * b); // peak position of a parabola through the 3 points (-1,a), (0,b), (1,c).
94  double p = 3.24610e-01 * atan(8.19201 * x) + 1.36329e-01 * x; // corrected pos. in strip width from -0.5 to 0.5
95 
98  //*(zpos+ic) = maxPos; // just the peak channel
99  *(zpos + ic) = maxPos + da * p; // parabola interpolation
100  //*(zpos+ic) = maxPos + da* (c-a)/(a+b+c); // uncorrected center of gravity
101  *(sig + ic) = da / 5000 * 75; // 75 micron eror, 5mm strip pitch, independent of charge.
102 
103  // future improvement:
104  // check distance to other hits and increase errors for close hits.
105 
106  /*****************************************
107  The error of maxPos alone would be
108  *(sig+ic) = da/sqrt(12.0);
109  *****************************************/
110  } // next ic
111  } // if L>96
112 }
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
CscParabola::m_msgSvc
IMessageSvc * m_msgSvc
Definition: CscParabola.h:31
x
#define x
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
CscParabola::cscParabola
void cscParabola(const double *qstr, int &NStrip, double &thr, double &da, int &ncl, double *sig, double *zpos, double &noise)
Definition: CscParabola.cxx:26
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
python.BuildSignatureFlags.sig
sig
Definition: BuildSignatureFlags.py:215
grepfile.ic
int ic
Definition: grepfile.py:33
CscParabola::CscParabola
CscParabola()
Definition: CscParabola.cxx:19
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
dumpNswErrorDb.maxStrip
tuple maxStrip
Definition: dumpNswErrorDb.py:27
a
TList * a
Definition: liststreamerinfos.cxx:10
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
CscParabola.h
python.compressB64.c
def c
Definition: compressB64.py:93