57 B2FATAL(
"The no. of alpha bins > limit !");
70 B2FATAL(
"The no. of theta bins > limit !");
79 return lhs[0] < rhs[0];
103 unsigned short nSigmaPars = params.size();
107 m_sigmas.insert(std::pair<
SigmaID, std::vector<float>>(sigmaID, params));
110 B2FATAL(
"The no. of sigma params. > limit !");
117 void setSigmaParams(
unsigned short iCLayer,
unsigned short iLR,
unsigned short iAlpha,
unsigned short iTheta,
118 const std::vector<float>& params)
129 std::map<SigmaID, std::vector<float>>::iterator it =
m_sigmas.find(sigmaID);
133 (it->second)[i] += delta[i];
136 B2FATAL(
"Specified params not found in addSigmaParams !");
143 void addSigmaParams(
unsigned short iCLayer,
unsigned short iLR,
unsigned short iAlpha,
unsigned short iTheta,
144 const std::vector<float>& delta)
222 SigmaID getSigmaID(
unsigned short iCLayer,
unsigned short iLR,
unsigned short iAlpha,
unsigned short iTheta)
const
224 SigmaID id = iCLayer + 64 * iLR + 128 * iAlpha + 4096 * iTheta;
244 unsigned short iTheta = 999;
245 unsigned short ibin = 0;
247 if (it[0] <= theta && theta <= it[1]) {
253 if (iTheta == 999) B2FATAL(
"Theta bin not found !");
266 unsigned short iAlpha = 999;
269 if (it[0] <= alpha && alpha <= it[1]) {
275 if (iAlpha == 999) B2FATAL(
"Alpha bin not found !");
277 return getSigmaID(iCLayer, iLR, iAlpha, iTheta);
285 std::map<SigmaID, std::vector<float>>::const_iterator it =
m_sigmas.find(sigmaID);
289 B2FATAL(
"Specified params. not found in getSigmaParams !");
296 const std::vector<float>&
getSigmaParams(
unsigned short iCLayer,
unsigned short iLR,
unsigned short iAlpha,
297 unsigned short iTheta)
const
309 std::cout <<
" " << std::endl;
310 std::cout <<
"Contents of sigma db" << std::endl;
311 std::cout <<
"alpha bins" << std::endl;
313 const double deg = 180. / M_PI;
316 for (
unsigned short i = 0; i < nAlphaBins; ++i) {
320 std::cout <<
" " << std::endl;
321 std::cout <<
"theta bins" << std::endl;
324 for (
unsigned short i = 0; i < nThetaBins; ++i) {
328 std::cout <<
" " << std::endl;
329 std::cout <<
"coefficients for sigma" << std::endl;
331 for (
unsigned short iT = 0; iT < nThetaBins; ++iT) {
332 for (
unsigned short iA = 0; iA < nAlphaBins; ++iA) {
333 for (
unsigned short iCL = 0; iCL <
c_nSLayers; ++iCL) {
334 for (
unsigned short iLR = 0; iLR < 2; ++iLR) {
335 unsigned short iLRp = abs(iLR - 1);
337 const std::vector<float> params =
getSigmaParams(iCL, iLRp, iA, iT);
339 std::cout <<
" " << params[i];
341 std::cout <<
" " << std::endl;
353 std::ofstream fout(fileName);
356 B2ERROR(
"Specified output file could not be opened!");
358 const double deg = 180. / M_PI;
361 fout << nAlphaBins << std::endl;
363 for (
unsigned short i = 0; i < nAlphaBins; ++i) {
368 fout << nThetaBins << std::endl;
370 for (
unsigned short i = 0; i < nThetaBins; ++i) {
378 for (
unsigned short iT = 0; iT < nThetaBins; ++iT) {
379 for (
unsigned short iA = 0; iA < nAlphaBins; ++iA) {
380 for (
unsigned short iCL = 0; iCL <
c_nSLayers; ++iCL) {
381 for (
unsigned short iLR = 0; iLR < 2; ++iLR) {
382 unsigned short iLRp = abs(iLR - 1);
383 fout << std::setw(2) << std::right << std::fixed << iCL <<
" " << std::setw(5) << std::setprecision(
384 1) << deg*
m_thetaBins[iT][2] <<
" " << std::setw(5) << std::right << deg*
m_alphaBins[iA][2] <<
" " << std::setw(1) << iLRp;
385 const std::vector<float> params =
getSigmaParams(iCL, iLRp, iA, iT);
387 fout <<
" " << std::setw(15) << std::scientific << std::setprecision(8) << params[i];
404 std::map<SigmaID, std::vector<float>>
Database object for space resolutions.
void setMaxSpaceResol(float sigma)
Set max.
static bool comp(const array3 &lhs, const array3 &rhs)
Static function for sorting.
void setSigmaParams(const SigmaID sigmaID, const std::vector< float > ¶ms)
Set sigma parameters for the specified id.
void setThetaBin(const array3 &theta)
Set theta-angle bin (rad)
void outputToFile(std::string fileName) const
Output the contents in text file format.
std::map< SigmaID, std::vector< float > > m_sigmas
Sigma coefficients for each layer, Left/Right, entrance angle and polar angle.
unsigned short m_nSigmaParams
no.
const array3 & getThetaBin(unsigned short i) const
Get i-th theta-angle bin info.
const array3 & getAlphaBin(unsigned short i) const
Get i-th alpha-angle bin info.
unsigned short getNoOfAlphaBins() const
Get no.
unsigned short SigmaID
id.
unsigned short m_sigmaParamMode
Mode for sigma parameterization.
SigmaID getSigmaID(unsigned short iCLayer, unsigned short iLR, float alpha, float theta) const
Get id.
const std::vector< float > & getSigmaParams(unsigned short iCLayer, unsigned short iLR, unsigned short iAlpha, unsigned short iTheta) const
Get sigma parameters for the specified id.
void setSigmaParams(unsigned short iCLayer, unsigned short iLR, unsigned short iAlpha, unsigned short iTheta, const std::vector< float > ¶ms)
Set sigma parameters for the specified id.
void addSigmaParams(const SigmaID sigmaID, const std::vector< float > &delta)
Update parameters for the specified id.
float getAlphaPoint(unsigned short i) const
Get i-th alpha-angle point (rad)
void addSigmaParams(unsigned short iCLayer, unsigned short iLR, unsigned short iAlpha, unsigned short iTheta, const std::vector< float > &delta)
Update parameters for the specified id.
const std::vector< float > & getSigmaParams(const SigmaID sigmaID) const
Get sigma parameters for the specified id.
unsigned short getNoOfThetaBins() const
Get no.
SigmaID getSigmaID(unsigned short iCLayer, unsigned short iLR, unsigned short iAlpha, unsigned short iTheta) const
Get id.
float getMaxSpaceResol() const
Get max.
ClassDef(CDCSpaceResols, 2)
ClassDef.
unsigned short getSigmaParamMode() const
Get parameterization mode.
float m_maxSpaceResol
max.
std::vector< array3 > m_alphaBins
alpha bins for sigma (rad)
std::vector< array3 > m_thetaBins
theta bins for sigma (rad)
float getThetaPoint(unsigned short i) const
Get i-th theta-angle point (rad)
void setAlphaBin(const array3 &alpha)
Set alpha-angle bin (rad)
CDCSpaceResols()
Default constructor.
void setSigmaParamMode(unsigned short mode)
Set sigma parameterization mode.
std::array< float, 3 > array3
angle bin info.
void dump() const
Print all contents.
Abstract base class for different kinds of events.