ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
CscAverage Class Reference

#include <CscAverage.h>

Collaboration diagram for CscAverage:

Public Member Functions

 CscAverage ()
 
void cscaverage (const double *qstr, int &NStrip, double &thr, double &da, int &ncl, double *sig, double *zpos, double &noise)
 

Private Attributes

IMessageSvc * m_msgSvc
 

Detailed Description

Definition at line 19 of file CscAverage.h.

Constructor & Destructor Documentation

◆ CscAverage()

CscAverage::CscAverage ( )

Definition at line 19 of file CscAverage.cxx.

19  {
20  m_msgSvc = nullptr;
21  ISvcLocator* svcLocator = Gaudi::svcLocator();
22  StatusCode sc = svcLocator->service("MessageSvc", m_msgSvc);
23  if (sc.isFailure()) std::cout << "CscAverage::Fail to locate Message Service" << std::endl;
24 }

Member Function Documentation

◆ cscaverage()

void CscAverage::cscaverage ( const double *  qstr,
int &  NStrip,
double &  thr,
double &  da,
int &  ncl,
double *  sig,
double *  zpos,
double &  noise 
)

Find the clusters and calculate the positions and the errors on the positions

The list of strips above the clustering threshold define the cluster - the hole are not treated in the sense that a dead strip in the middle of the cluster will mess up the true definition of the cluster

initialize some parameters

clustering by the weight average method

center of gravity method - weighted average

clustering by just selection the strip with the highest charge as the position of the cluster

the ratio method for clustering the constants are from test beam and may need adjustment

now make a selection between the maxPos, the ratio method and the weight average this selection is made in the CscClustrization algorithm

Definition at line 26 of file CscAverage.cxx.

26  {
27  MsgStream mLog(m_msgSvc, "CscAverage");
28 
30 
31  bool cluster_found = false;
32  std::map<unsigned int, std::vector<int> > clusters;
33  unsigned int NClusters = 1;
34 
35  int L = NStrip;
36 
41  for (int is = 0; is < L; ++is) {
42  if (qstr[is] > thr) {
43  cluster_found = true;
44  clusters[NClusters].push_back(is);
45  } else if (cluster_found) {
46  cluster_found = false;
47  ++NClusters;
48  }
49  }
50 
51  ncl = (int)clusters.size();
52 
53  // Loop on clusters and calculate their position
54  for (std::map<unsigned int, std::vector<int> >::const_iterator ic = clusters.begin(); ic != clusters.end(); ++ic) {
56  double sum = 0.;
57  double tcharge = 0.;
58  double tcharge2 = 0.;
59  int count = 0;
60  int maxStrip = -1;
61  double maxCharge = 0;
62  double maxPos = -1000.0;
63  double avg = maxPos;
64 
66  for (std::vector<int>::const_iterator d = (*ic).second.begin(); d != (*ic).second.end(); ++d) {
67  if (qstr[*d] > maxCharge) {
68  maxStrip = *d;
69  maxCharge = qstr[*d];
70  }
71  }
72 
74  for (int i = maxStrip - 1; i <= maxStrip + 1; ++i) {
75  if (i >= 0 && i < L) {
76  double w = qstr[i];
77  sum += da * (i + 0.5 - L / 2) * w;
78  tcharge += w;
79  count++;
80  tcharge2 += count * count;
81  }
82  }
83  if (tcharge > 0) avg = sum / tcharge;
84 
87  if (maxStrip >= 0) maxPos = da * (maxStrip + 0.5 - L / 2);
88 
91  // MS 07-02-2013: remove this section to fix compiler warning:
92  // warning: variable 'ratio' set but not used [-Wunused-but-set-variable]
93  /*****************************************
94  double ratio = avg;
95  if ( (maxStrip-1)>=0 && (maxStrip+1) < L) {
96  double a = qstr[maxStrip-1];
97  double b = qstr[maxStrip];
98  double c = qstr[maxStrip+1];
99  double r = (c-a)/(a+b+c); // raw value
100  if (fabs(r)<0.4)
101  ratio = maxPos + da*( 1.29209*r -7.84829*std::pow(r, 5) +25.6318*std::pow(r, 7) );
102  else
103  ratio = maxPos + da *( 1.27790*r -20.9485*std::pow(r, 7) );
104  }
105  *************************************/
106 
109  *(zpos + (*ic).first - 1) = avg;
110  if (count > 1 && tcharge > 0)
111  *(sig + (*ic).first - 1) = noise * (da / (tcharge)) * sqrt(2.0 * tcharge2); // page 204 of Muon TDR!
112  else
113  *(sig + (*ic).first - 1) = da / sqrt(12.0);
114  if (L < 92) *(sig + (*ic).first - 1) = da / sqrt(12.0);
115  }
116 }

Member Data Documentation

◆ m_msgSvc

IMessageSvc* CscAverage::m_msgSvc
private

Definition at line 31 of file CscAverage.h.


The documentation for this class was generated from the following files:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
hist_file_dump.d
d
Definition: hist_file_dump.py:137
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Recovery.avg
def avg(a, b)
Definition: Recovery.py:79
python.BuildSignatureFlags.sig
sig
Definition: BuildSignatureFlags.py:215
grepfile.ic
int ic
Definition: grepfile.py:33
CscAverage::m_msgSvc
IMessageSvc * m_msgSvc
Definition: CscAverage.h:31
dumpNswErrorDb.maxStrip
tuple maxStrip
Definition: dumpNswErrorDb.py:27
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380