File indexing completed on 2026-08-31 08:24:41
0001 #include <cdbobjects/CDBTTree.h>
0002
0003 #include <TSystem.h>
0004
0005 #include <cmath>
0006 #include <iostream>
0007 #include <sstream>
0008 #include <fstream>
0009
0010 R__LOAD_LIBRARY(libcdbobjects.so)
0011
0012 void FillGemCurrents(const std::string &fname = "tpc_GEM_current_status/run_82516_GEM_BCO.csv")
0013 {
0014 std::ifstream in(fname);
0015 std::string line;
0016 int channel = -1;
0017 CDBTTree *cdbttree = new CDBTTree("cdbttree.root");
0018 while (std::getline(in, line))
0019 {
0020 if (line.empty()) continue;
0021 std::istringstream iss(line);
0022 std::string key;
0023 uint64_t bco;
0024 float current;
0025 iss >> key;
0026 if (key == "bco")
0027 {
0028 channel++;
0029 iss >> bco;
0030 cdbttree->SetUInt64Value(channel,key,bco);
0031 }
0032 else
0033 {
0034 iss >> current;
0035 cdbttree->SetFloatValue(channel,key,current);
0036 }
0037 }
0038 cdbttree->Commit();
0039 cdbttree->Print();
0040 cdbttree->WriteCDBTTree();
0041 delete cdbttree;
0042 gSystem->Exit(0);
0043 }
0044
0045
0046 void Read(const std::string &fname = "cdbttree.root")
0047 {
0048 CDBTTree *cdbttree = new CDBTTree(fname);
0049 cdbttree->LoadCalibrations();
0050
0051
0052 for (unsigned int channel = 0; channel < cdbttree->GetUInt64EntryMap().size(); channel++)
0053 {
0054 std::cout << "BCO: " << cdbttree->GetUInt64Value(channel,"bco",1) << std::endl;
0055 std::cout << "S11R3G4: " << cdbttree->GetFloatValue(channel,"S11R3G4") << std::endl;
0056 }
0057 delete cdbttree;
0058 gSystem->Exit(0);
0059 }