28 class CDCSpaceResols:
public TObject {
30 typedef std::array<float, 3>
array3;
59 B2FATAL(
"The no. of alpha bins > limit !");
72 B2FATAL(
"The no. of theta bins > limit !");
79 static bool comp(
const array3& lhs,
const array3& rhs)
81 return lhs[0] < rhs[0];
97 unsigned short nSigmaPars = params.size();
101 m_sigmas.insert(std::pair<
SigmaID, std::vector<float>>(sigmaID, params));
104 B2FATAL(
"The no. of sigma params. > limit !");
111 void setSigmaParams(
unsigned short iCLayer,
unsigned short iLR,
unsigned short iAlpha,
unsigned short iTheta,
112 const std::vector<float>& params)
123 std::map<SigmaID, std::vector<float>>::iterator it =
m_sigmas.find(sigmaID);
127 (it->second)[i] += delta[i];
130 B2FATAL(
"Specified params not found in addSigmaParams !");
137 void addSigmaParams(
unsigned short iCLayer,
unsigned short iLR,
unsigned short iAlpha,
unsigned short iTheta,
138 const std::vector<float>& delta)
208 SigmaID getSigmaID(
unsigned short iCLayer,
unsigned short iLR,
unsigned short iAlpha,
unsigned short iTheta)
const
210 SigmaID id = iCLayer + 64 * iLR + 128 * iAlpha + 4096 * iTheta;
217 SigmaID getSigmaID(
unsigned short iCLayer,
unsigned short iLR,
float alpha,
float theta)
const
230 unsigned short iTheta = 999;
231 unsigned short ibin = 0;
233 if (it[0] <= theta && theta <= it[1]) {
239 if (iTheta == 999) B2FATAL(
"Theta bin not found !");
252 unsigned short iAlpha = 999;
255 if (it[0] <= alpha && alpha <= it[1]) {
261 if (iAlpha == 999) B2FATAL(
"Alpha bin not found !");
263 return getSigmaID(iCLayer, iLR, iAlpha, iTheta);
271 std::map<SigmaID, std::vector<float>>::const_iterator it =
m_sigmas.find(sigmaID);
275 B2FATAL(
"Specified params. not found in getSigmaParams !");
282 const std::vector<float>&
getSigmaParams(
unsigned short iCLayer,
unsigned short iLR,
unsigned short iAlpha,
283 unsigned short iTheta)
const
295 std::cout <<
" " << std::endl;
296 std::cout <<
"Contents of sigma db" << std::endl;
297 std::cout <<
"alpha bins" << std::endl;
299 const double deg = 180. / M_PI;
302 for (
unsigned short i = 0; i < nAlphaBins; ++i) {
306 std::cout <<
" " << std::endl;
307 std::cout <<
"theta bins" << std::endl;
310 for (
unsigned short i = 0; i < nThetaBins; ++i) {
314 std::cout <<
" " << std::endl;
315 std::cout <<
"coefficients for sigma" << std::endl;
317 for (
unsigned short iT = 0; iT < nThetaBins; ++iT) {
318 for (
unsigned short iA = 0; iA < nAlphaBins; ++iA) {
319 for (
unsigned short iCL = 0; iCL <
c_nSLayers; ++iCL) {
320 for (
unsigned short iLR = 0; iLR < 2; ++iLR) {
321 unsigned short iLRp = abs(iLR - 1);
323 const std::vector<float> params =
getSigmaParams(iCL, iLRp, iA, iT);
325 std::cout <<
" " << params[i];
327 std::cout <<
" " << std::endl;
339 std::ofstream fout(fileName);
342 B2ERROR(
"Specified output file could not be opened!");
344 const double deg = 180. / M_PI;
347 fout << nAlphaBins << std::endl;
349 for (
unsigned short i = 0; i < nAlphaBins; ++i) {
354 fout << nThetaBins << std::endl;
356 for (
unsigned short i = 0; i < nThetaBins; ++i) {
362 for (
unsigned short iT = 0; iT < nThetaBins; ++iT) {
363 for (
unsigned short iA = 0; iA < nAlphaBins; ++iA) {
364 for (
unsigned short iCL = 0; iCL <
c_nSLayers; ++iCL) {
365 for (
unsigned short iLR = 0; iLR < 2; ++iLR) {
366 unsigned short iLRp = abs(iLR - 1);
367 fout << std::setw(2) << std::right << std::fixed << iCL <<
" " << std::setw(5) << std::setprecision(
368 1) << deg*
m_thetaBins[iT][2] <<
" " << std::setw(5) << std::right << deg*
m_alphaBins[iA][2] <<
" " << std::setw(1) << iLRp;
369 const std::vector<float> params =
getSigmaParams(iCL, iLRp, iA, iT);
371 fout <<
" " << std::setw(15) << std::scientific << std::setprecision(8) << params[i];
387 std::map<SigmaID, std::vector<float>>