5#ifndef _ZDCINJPULSERAMPMAP_H
6#define _ZDCINJPULSERAMPMAP_H
9#include <nlohmann/json.hpp>
51 using json = nlohmann::json;
58 using RunRangeDescr = std::tuple<unsigned int, unsigned int, std::string, float>;
91 throw std::runtime_error(
"Invalid Injected Pulser configuration");
94 throw std::runtime_error(
"Invalid Injected Pulser configuration");
100 unsigned int firstLB = stepsConfig.first;
103 return std::make_pair(firstLB, steps);
114 Token lookupRun(
unsigned int runNumber,
bool allowDefault =
false);
125 return result.second.size();
134 if (lumiBlock < firstLB)
return -1;
135 return std::floor(
float(lumiBlock - firstLB)/
map.size());
146 if (lumiBlock < firstLB)
return -1000.;
147 unsigned int vecIndex = (lumiBlock - firstLB) %
map.size();
This class provides a token that identifies in a unique way objects on the persistent storage.
Token(int index, float scaleFactor)
friend class ZdcInjPulserAmpMap
float scaleFactor() const
std::map< std::string, StepsDescr > m_stepsConfigs
std::vector< const StepsDescr * > m_activeConfigs
bool parseJsonFile(std::ifstream &ifs)
std::pair< unsigned int, StepsVector > getContext(const Token &token) const
std::pair< unsigned int, StepsVector > StepsDescr
float getPulserAmplitude(const Token &token, unsigned int lumiBlock) const
std::tuple< unsigned int, unsigned int, std::string, float > RunRangeDescr
const std::string & getFilePath() const
int getCycleNumber(const Token &token, unsigned int lumiBlock) const
void readPulserSteps(StepsDescr &steps, const json &stepsJson)
static const ZdcInjPulserAmpMap * getInstance()
std::vector< float > StepsVector
std::vector< RunRangeDescr > m_runRangeDescrs
Token lookupRun(unsigned int runNumber, bool allowDefault=false)
unsigned int getFirstLumiBlock(const Token &token) const
void fillVVector(StepsVector &stepVec, const nlohmann::json &entry)
unsigned int getNumSteps(const Token &token) const
Class mimicking the AthMessaging class from the offline software.