Belle II Software development
CDCCorrToThresholds.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <array>
11#include <iostream>
12#include <fstream>
13#include <iomanip>
14#include <TObject.h>
15
16#include <cdc/geometry/CDCGeometryParConstants.h>
17
18namespace Belle2 {
27 class CDCCorrToThresholds: public TObject {
28 public:
29
34
40 void setParam(unsigned short id, double param)
41 {
42 m_crs[id] = param;
43 }
44
48 unsigned short getEntries() const
49 {
50 return m_crs.size();
51 }
52
56 std::array<float, c_maxNSenseLayers> getParams() const
57 {
58 return m_crs;
59 }
60
66 float getParam(unsigned short id) const
67 {
68 return m_crs[id];
69 }
70
74 void dump() const
75 {
76 std::cout << " " << std::endl;
77 std::cout << "Correction parametres" << std::endl;
78 std::cout << "#entries= " << m_crs.size() << std::endl;
79 std::cout << "in order of id and parameter" << std::endl;
80
81 for (unsigned id = 0; id < c_maxNSenseLayers; ++id) {
82 std::cout << id << " " << m_crs[id] << std::endl;
83 }
84 }
85
90 void outputToFile(std::string fileName) const
91 {
92 std::ofstream fout(fileName);
93
94 if (fout.bad()) {
95 B2ERROR("Specified output file could not be opened!");
96 } else {
97 for (unsigned id = 0; id < c_maxNSenseLayers; ++id) {
98 fout << id << " " << m_crs[id] << std::endl;
99 }
100 }
101 fout.close();
102 }
103
104 private:
105 std::array<float, c_maxNSenseLayers> m_crs;
108 // Version histroy:
109 // v2: original.
110 };
111
113} // end namespace Belle2
Database object for correcting a simple threshold model in MC.
std::array< float, c_maxNSenseLayers > m_crs
cr array
void outputToFile(std::string fileName) const
Output the contents in text file format.
ClassDef(CDCCorrToThresholds, 2)
ClassDef.
float getParam(unsigned short id) const
Get the parameter for the id.
void setParam(unsigned short id, double param)
Set the paramseter in the array.
std::array< float, c_maxNSenseLayers > getParams() const
Get the whole array.
unsigned short getEntries() const
Get the no.
CDCCorrToThresholds()
Default constructor.
void dump() const
Print all contents.
Abstract base class for different kinds of events.