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>
51const std::string
ccdbUrl =
"file:///tmp/CCDBSnapshot";
59 int iter = dataOffset;
61 for (
auto& calArray :
data.getData()) {
62 for (
auto&
value : calArray.getData()) {
69 std::map<std::string, std::string> metadata;
72 writeObject(
data,
"Calib",
name, run);
81 const auto numberOfPads = mapper.getPadsInSector() * 36;
85 int numberOfPadsROC = 0;
88 for (
auto const&
val : boost::combine(
arrays.get<0>().getData(),
arrays.get<1>().getData())) {
89 sumROC += (
val.get<0>() -
val.get<1>());
95 BOOST_CHECK_CLOSE(sumROC, 0.f, 1.E-12);
103 const int dataOffset = 0;
104 const std::string_view
type =
"Pedestals";
107 auto cdb = o2::ccdb::Manager::Instance();
108 cdb->setDefaultStorage(
"local://O2CDB");
118 auto dataRead = tpcCDB.getPedestals();
128 const int dataOffset = 1;
129 const std::string_view
type =
"Noise";
132 auto cdb = o2::ccdb::Manager::Instance();
133 cdb->setDefaultStorage(
"local://O2CDB");
143 auto dataRead = tpcCDB.getNoise();
153 const int dataOffset = 1;
154 const std::string_view
type =
"Gain";
157 auto cdb = o2::ccdb::Manager::Instance();
158 cdb->setDefaultStorage(
"local://O2CDB");
168 auto dataRead = tpcCDB.getGainMap();
178 const std::string_view
name =
"Detector";
182 auto cdb = o2::ccdb::Manager::Instance();
183 cdb->setDefaultStorage(
"local://O2CDB");
207 const std::string_view
name =
"Electronics";
211 auto cdb = o2::ccdb::Manager::Instance();
212 cdb->setDefaultStorage(
"local://O2CDB");
236 const std::string_view
name =
"Gas";
237 auto value = 1000.9434f;
240 auto cdb = o2::ccdb::Manager::Instance();
241 cdb->setDefaultStorage(
"local://O2CDB");
265 const std::string_view
name =
"GEM";
266 auto value = 1.7382f;
269 auto cdb = o2::ccdb::Manager::Instance();
270 cdb->setDefaultStorage(
"local://O2CDB");
297 tpcCDB.setUseDefaults();
300 auto pedestals = tpcCDB.getPedestals();
301 auto noise = tpcCDB.getNoise();
302 auto gainmap = tpcCDB.getGainMap();
305 tpcCDB.getParameterDetector();
306 tpcCDB.getParameterElectronics();
307 tpcCDB.getParameterGas();
308 tpcCDB.getParameterGEM();
311 auto f = TFile::Open(
"Calibration.root",
"recreate");
312 f->WriteObject(&pedestals,
"Pedestals");
313 f->WriteObject(&noise,
"Noise");
314 f->WriteObject(&gainmap,
"Gain");
318 tpcCDB.setUseDefaults(
false);
319 tpcCDB.resetLocalCalibration();
320 tpcCDB.setPedestalsAndNoiseFromFile(
"Calibration.root");
321 tpcCDB.setGainMapFromFile(
"Calibration.root");
323 auto& pedestalsFromFile = tpcCDB.getPedestals();
324 auto& noiseFromFile = tpcCDB.getNoise();
325 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())