CbmRoot
CbmFlesHistosTools.cxx
Go to the documentation of this file.
1 #include "CbmFlesHistosTools.h"
2 
3 #include <cmath>
4 //#include <vector>
5 
6 std::vector<double> GenerateLogBinArray(uint32_t uNbDecadesLog,
7  uint32_t uNbStepsDecade,
8  uint32_t uNbSubStepsInStep,
9  uint32_t& uNbBinsLog) {
15  uNbBinsLog =
16  uNbStepsDecade + uNbStepsDecade * uNbSubStepsInStep * uNbDecadesLog;
17 
19  uint32_t uArrayLength = uNbBinsLog + 1;
20  double dBinsLog[uArrayLength];
22  for (uint32_t uSubU = 0; uSubU < uNbStepsDecade; uSubU++) {
23  dBinsLog[uSubU] = 0.1 * (1 + uSubU);
24  }
25 
27  double dSubstepSize = 1.0 / uNbSubStepsInStep;
28  for (uint32_t uDecade = 0; uDecade < uNbDecadesLog; uDecade++) {
29  double dBase = std::pow(10, uDecade);
30  uint32_t uDecadeIdx =
31  uNbStepsDecade + uDecade * uNbStepsDecade * uNbSubStepsInStep;
32  for (uint32_t uStep = 0; uStep < uNbStepsDecade; uStep++) {
33  uint32_t uStepIdx = uDecadeIdx + uStep * uNbSubStepsInStep;
34  for (uint32_t uSubStep = 0; uSubStep < uNbSubStepsInStep; uSubStep++) {
35  dBinsLog[uStepIdx + uSubStep] =
36  dBase * (1 + uStep) + dBase * dSubstepSize * uSubStep;
37  } // for( uint32_t uSubStep = 0; uSubStep < uNbSubStepsInStep; uSubStep++ )
38  } // for( uint32_t uStep = 0; uStep < uNbStepsDecade; uStep++ )
39  } // for( uint32_t uDecade = 0; uDecade < uNbDecadesLog; uDecade ++)
40  dBinsLog[uNbBinsLog] = std::pow(10, uNbDecadesLog);
41 
43  std::vector<double> dBinsLogVect;
44 
45  for (uint32_t i = 0; i < uArrayLength; ++i) {
46  dBinsLogVect.push_back(dBinsLog[i]);
47  } // for( uint32_t i = 0; i < uArrayLength; ++i )
48 
49  return dBinsLogVect;
50 }
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
GenerateLogBinArray
std::vector< double > GenerateLogBinArray(uint32_t uNbDecadesLog, uint32_t uNbStepsDecade, uint32_t uNbSubStepsInStep, uint32_t &uNbBinsLog)
Definition: CbmFlesHistosTools.cxx:6
CbmFlesHistosTools.h