12#define BOOST_TEST_MODULE Test TPC CDBInterface class
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
17#include <boost/range/combine.hpp>
18#include <boost/test/unit_test.hpp>
52const std::string
ccdbUrl =
"file:///tmp/CCDBSnapshot";
60 int iter = dataOffset;
62 for (
auto& calArray :
data.getData()) {
63 for (
auto&
value : calArray.getData()) {
70 std::map<std::string, std::string> metadata;
73 writeObject(
data,
"Calib",
name, run);
82 const auto numberOfPads = mapper.getPadsInSector() * 36;
86 int numberOfPadsROC = 0;
89 for (
auto const&
val : boost::combine(
arrays.get<0>().getData(),
arrays.get<1>().getData())) {
90 sumROC += (
val.get<0>() -
val.get<1>());
96 BOOST_CHECK_CLOSE(sumROC, 0.f, 1.E-12);
104 const int dataOffset = 0;
105 const std::string_view
type =
"Pedestals";
108 auto cdb = o2::ccdb::Manager::Instance();
109 cdb->setDefaultStorage(
"local://O2CDB");
119 auto dataRead = tpcCDB.getPedestals();
129 const int dataOffset = 1;
130 const std::string_view
type =
"Noise";
133 auto cdb = o2::ccdb::Manager::Instance();
134 cdb->setDefaultStorage(
"local://O2CDB");
144 auto dataRead = tpcCDB.getNoise();
154 const int dataOffset = 1;
155 const std::string_view
type =
"Gain";
158 auto cdb = o2::ccdb::Manager::Instance();
159 cdb->setDefaultStorage(
"local://O2CDB");
169 auto dataRead = tpcCDB.getGainMap();
179 const std::string_view
name =
"Detector";
183 auto cdb = o2::ccdb::Manager::Instance();
184 cdb->setDefaultStorage(
"local://O2CDB");
208 const std::string_view
name =
"Electronics";
212 auto cdb = o2::ccdb::Manager::Instance();
213 cdb->setDefaultStorage(
"local://O2CDB");
237 const std::string_view
name =
"Gas";
238 auto value = 1000.9434f;
241 auto cdb = o2::ccdb::Manager::Instance();
242 cdb->setDefaultStorage(
"local://O2CDB");
266 const std::string_view
name =
"GEM";
267 auto value = 1.7382f;
270 auto cdb = o2::ccdb::Manager::Instance();
271 cdb->setDefaultStorage(
"local://O2CDB");
298 tpcCDB.setUseDefaults();
301 auto pedestals = tpcCDB.getPedestals();
302 auto noise = tpcCDB.getNoise();
303 auto gainmap = tpcCDB.getGainMap();
306 tpcCDB.getParameterDetector();
307 tpcCDB.getParameterElectronics();
308 tpcCDB.getParameterGas();
309 tpcCDB.getParameterGEM();
312 auto f = TFile::Open(
"Calibration.root",
"recreate");
313 f->WriteObject(&pedestals,
"Pedestals");
314 f->WriteObject(&noise,
"Noise");
315 f->WriteObject(&gainmap,
"Gain");
319 tpcCDB.setUseDefaults(
false);
320 tpcCDB.resetLocalCalibration();
321 tpcCDB.setPedestalsAndNoiseFromFile(
"Calibration.root");
322 tpcCDB.setGainMapFromFile(
"Calibration.root");
324 auto& pedestalsFromFile = tpcCDB.getPedestals();
325 auto& noiseFromFile = tpcCDB.getNoise();
326 auto& gainmapFromFile = tpcCDB.getGainMap();
Simple interface to the CDB manager.
Definition of the parameter class for the detector.
Definition of the parameter class for the detector electronics.
Definition of the parameter class for the GEM stack.
Definition of the parameter class for the detector gas.
int storeAsTFileAny(const T *obj, std::string const &path, std::map< std::string, std::string > const &metadata, long startValidityTimestamp=-1, long endValidityTimestamp=-1, std::vector< char >::size_type maxSize=0) const
void init(std::string const &hosts)
static const ParameterDetector & Instance()
static CDBInterface & instance()
const std::vector< CalType > & getData() const
const std::string & getName() const
static Mapper & instance(const std::string mappingDir="")
GLuint const GLchar * name
GLsizei const GLfloat * value
GLint GLint GLsizei GLint GLenum GLenum type
BOOST_AUTO_TEST_CASE(ClusterHardware_test1)
const std::string ccdbUrl
void checkCalPadEqual(const CalPad &data, const CalPad &dataRead)
Check equivalence of two CalPad objects.
CalPad writeCalPadObject(const std::string_view name, const int run, const int dataOffset=0)
write a CalPad object to the CCDB
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())