33 struct BadChannelScaleFactorTest {
34 BadChannelScaleFactorTest(
int id,
float e,
float scale) : cellID(
id), energy(e), scaleFactor(scale) {}
40 std::vector<float> vecEnergyIntervals = {0., 1., 5., 10., 10000};
41 std::vector<BadChannelScaleFactorTest> vecScaleFactors;
44 for (
int iCell = 0; iCell < geo->GetNCells(); iCell++) {
45 float energy = 100 * ((double)rand() / (RAND_MAX));
46 float scaleFactor = 1.0 + 0.1 * ((double)rand() / (RAND_MAX));
47 vecScaleFactors.push_back(BadChannelScaleFactorTest(iCell, energy, scaleFactor));
50 auto it = std::find_if(vecEnergyIntervals.begin(), vecEnergyIntervals.end(), [&](
float energyInterval) {
51 return energy < energyInterval;
55 scaleFactors.
insertVal(iCell, vecEnergyIntervals[*it], vecEnergyIntervals[*it + 1], scaleFactor);
58 for (
auto& scaleFactor : vecScaleFactors) {
59 float scaleFactorFromMap = scaleFactors.
getScaleVal(scaleFactor.cellID, scaleFactor.energy);
60 BOOST_CHECK_CLOSE(scaleFactor.scaleFactor, scaleFactorFromMap, 0.0001);
static Geometry * GetInstanceFromRunNumber(Int_t runNumber, const std::string_view="", const std::string_view mcname="TGeant3", const std::string_view mctitle="")
Instanciate geometry depending on the run number. Mostly used in analysis and MC anchors.