Project
Loading...
Searching...
No Matches
ResidualsControllerFast.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
21#include "Framework/Logger.h"
22#include <TString.h>
23#include <TMath.h>
24#include <cstdio>
25
26using namespace TMath;
27
29
30namespace o2
31{
32namespace align
33{
34
35//____________________________________
37 : mNPoints(0), mNMatSol(0), mNBook(0), mChi2(0), mChi2Ini(0), mD0(nullptr), mD1(nullptr), mSig0(nullptr), mSig1(nullptr), mVolID(nullptr), mLabel(nullptr), mSolMat(nullptr), mMatErr(nullptr)
38{
39 // def c-tor
40 for (int i = 0; i < 5; ++i) {
41 mTrCorr[i] = 0;
42 }
43}
44
45//________________________________________________
47{
48 // d-tor
49 delete[] mD0;
50 delete[] mD1;
51 delete[] mSig0;
52 delete[] mSig1;
53 delete[] mVolID;
54 delete[] mLabel;
55 delete[] mSolMat;
56 delete[] mMatErr;
57}
58
59//________________________________________________
61{
62 // resize container
63 if (np > mNBook) {
64 delete[] mD0;
65 delete[] mD1;
66 delete[] mSig0;
67 delete[] mSig1;
68 delete[] mVolID;
69 delete[] mLabel;
70 delete[] mSolMat;
71 delete[] mMatErr;
72 //
73 mNBook = 30 + np;
74 mD0 = new float[mNBook];
75 mD1 = new float[mNBook];
76 mSig0 = new float[mNBook];
77 mSig1 = new float[mNBook];
78 mVolID = new int[mNBook];
79 mLabel = new int[mNBook];
80 mSolMat = new float[mNBook * 4]; // at most 4 material params per point
81 mMatErr = new float[mNBook * 4]; // at most 4 material params per point
82 //
83 memset(mD0, 0, mNBook * sizeof(float));
84 memset(mD1, 0, mNBook * sizeof(float));
85 memset(mSig0, 0, mNBook * sizeof(float));
86 memset(mSig1, 0, mNBook * sizeof(float));
87 memset(mVolID, 0, mNBook * sizeof(int));
88 memset(mLabel, 0, mNBook * sizeof(int));
89 memset(mSolMat, 0, 4 * mNBook * sizeof(int));
90 memset(mMatErr, 0, 4 * mNBook * sizeof(int));
91 }
92 //
93}
94
95//____________________________________________
96void ResidualsControllerFast::Clear(const Option_t*)
97{
98 // reset record
99 mNPoints = 0;
100 mNMatSol = 0;
101 mTrCorr[4] = 0; // rest will be 100% overwritten
102 //
103}
104
105//____________________________________________
106void ResidualsControllerFast::Print(const Option_t* /*opt*/) const
107{
108 // print info
109 printf("%3s:%1s (%9s/%5s) %6s | [ %7s:%7s ]\n", "Pnt", "M", "Label",
110 "VolID", "Sigma", "resid", "pull/LG");
111 for (int irs = 0; irs < mNPoints; irs++) {
112 printf("%3d:%1d (%9d/%5d) %6.4f | [%+.2e:%+7.2f]\n",
113 irs, 0, mLabel[irs], mVolID[irs], mSig0[irs], mD0[irs],
114 mSig0[irs] > 0 ? mD0[irs] / mSig0[irs] : -99);
115 printf("%3d:%1d (%9d/%5d) %6.4f | [%+.2e:%+7.2f]\n",
116 irs, 1, mLabel[irs], mVolID[irs], mSig1[irs], mD1[irs],
117 mSig1[irs] > 0 ? mD1[irs] / mSig1[irs] : -99);
118 }
119 //
120 printf("CorrETP: ");
121 for (int i = 0; i < 5; i++) {
122 printf("%+.3f ", mTrCorr[i]);
123 }
124 printf("\n");
125 printf("MatCorr (corr/sig:pull)\n");
126 int nmp = mNMatSol / 4;
127 int cnt = 0;
128 for (int imp = 0; imp < nmp; imp++) {
129 for (int ic = 0; ic < 4; ic++) {
130 printf("%+.2e/%.2e:%+8.3f|", mSolMat[cnt], mMatErr[cnt],
131 mMatErr[cnt] > 0 ? mSolMat[cnt] / mMatErr[cnt] : -99);
132 cnt++;
133 }
134 printf("\n");
135 }
136 //
137}
138
139//____________________________________________
140void ResidualsControllerFast::setResSigMeas(int ip, int ord, float res, float sig)
141{
142 // assign residual and error for measurement
143 if (ord == 0) {
144 mD0[ip] = res;
145 mSig0[ip] = sig;
146 } else {
147 mD1[ip] = res;
148 mSig1[ip] = sig;
149 }
150}
151
152//____________________________________________
153void ResidualsControllerFast::setMatCorr(int id, float res, float sig)
154{
155 // assign residual and error for material correction
156 mSolMat[id] = res;
157 mMatErr[id] = sig;
158}
159
160//____________________________________________
161void ResidualsControllerFast::setLabel(int ip, int lab, int vol)
162{
163 // set label/volid of measured volume
164 mVolID[ip] = vol;
165 mLabel[ip] = lab;
166}
167
168} // namespace align
169} // namespace o2
End-chain alignment volume in detector branch, where the actual measurement is done.
Meausered point in the sensor.
Track model for the alignment.
int32_t i
uint32_t res
Definition RawData.h:0
ClassImp(o2::align::ResidualsControllerFast)
Container for control fast residuals evaluated via derivatives.
void setLabel(int ip, int lab, int vol)
void setResSigMeas(int ip, int ord, float res, float sig)
void setMatCorr(int id, float res, float sig)
void Clear(const Option_t *opt="") final
void Print(const Option_t *opt="") const final
GLuint id
Definition glcorearb.h:650
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...