#include "CoolKernel/DatabaseId.h"
#include "CoolKernel/Exception.h"
#include "CoolKernel/IDatabaseSvc.h"
#include "CoolKernel/IDatabase.h"
#include "CoolApplication/Application.h"
#include "CoolKernel/IFolder.h"
#include "CoolKernel/FolderSpecification.h"
#include "CoolKernel/RecordSpecification.h"
#include "CoolKernel/Record.h"
#include "CoolKernel/FieldSpecification.h"
#include "CoolKernel/IObject.h"
#include "CoolKernel/IObjectIterator.h"
#include "CoolKernel/IRecordIterator.h"
#include "CoolKernel/StorageType.h"
#include "CoolKernel/ChannelSelection.h"
#include "RelationalAccess/ConnectionService.h"
#include <iostream>
#include <fstream>
#include <string>
#include <string_view>
#include <stdexcept>
#include <ctime>
#include <sstream>
#include <unordered_map>
Go to the source code of this file.
|
using | iovNamePair = std::pair< std::string, std::string > |
|
◆ iovNamePair
using iovNamePair = std::pair<std::string, std::string > |
◆ iovToString()
std::string iovToString |
( |
const cool::IObject & |
obj, |
|
|
bool |
runLumi = true |
|
) |
| |
Definition at line 248 of file MakeReferenceFile.cxx.
250 std::string sinceStr =
timeRep(
obj.since(),
false, runLumi);
251 std::string untilStr =
timeRep(
obj.until(),
true, runLumi);
252 return sinceStr +
" - " + untilStr;
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 274 of file MakeReferenceFile.cxx.
277 std::string tagName{
"PixelChargeCalibration-DATA-RUN2-UPD4-27"};
278 std::string
folderName{
"/PIXEL/ChargeCalibration"};
280 std::string
dbName{
"COOLOFL_PIXEL/CONDBR2"};
281 std::string useIOV{
"latest"};
282 bool useLastIOV{
true};
285 std::string aux(
argv[
i]);
286 std::string
variable(aux.substr(0,aux.find(
"=")));
287 std::string
value(aux.substr(aux.find(
"=")+1));
288 if (
variable.compare(
"tagName") == 0) {
294 else if(
variable.compare(
"IOV") == 0){
298 useIOV = std::move(
value);
302 std::cout<<
"ERROR - Option not found:"<< aux <<
"\n";
312 else if (useIOV.compare(
"all") == 0){
320 printf(
"%-11s: %s\n",
"Tag Name" ,tagName.c_str());
321 printf(
"%-11s: %s\n",
"Folder Name",
folderName.c_str()) ;
322 printf(
"%-11s: %s\n",
"DB Name" ,
dbName.c_str()) ;
324 printf(
"%-11s: %s\n",
"Last IOV" ,useLastIOV ?
"True" :
"False");
325 printf(
"%-11s: %s\n",
"IOV used" ,useIOV.c_str()) ;
332 cool::IObjectIteratorPtr objectsIterator =
f.objectIterator(useLastIOV);
333 std::vector< iovNamePair > myIOVs;
334 while (objectsIterator->goToNext())
336 const cool::IObject &thisObject = objectsIterator->currentRef();
337 std::size_t posPar =
iovToString(thisObject).find(
"]");
338 std::size_t posCom =
iovToString(thisObject).find(
",");
339 std::string
name =
iovToString(thisObject).substr(1,posPar-1).replace(posCom-1,1,
"_");
348 for(
const auto & [IOVname,
iov]:myIOVs){
349 if(IOVname.compare(useIOV)!=0 && useIOV.compare(
"all") != 0){
353 std::cout<<IOVname<<
"\n";
354 const std::string
filename= IOVname +
"_"+tagName+
".log";
360 std::cout<<
"IOV not found - Choose between one of the following:\n";
361 for(
const auto & [IOVname,
iov]:myIOVs){
362 std::cout<<IOVname<<
" ";
369 const std::string
fileName = tagName +
".log";
371 printf(
"%-11s: %s\n",
"RunNumber" ,(myIOVs.back().first).c_str()) ;
372 opFile << myIOVs.back().second <<
"\n";
◆ payloadToString()
std::string payloadToString |
( |
const cool::IObject & |
obj | ) |
|
Definition at line 256 of file MakeReferenceFile.cxx.
259 const cool::IRecord &record =
obj.payload();
260 const auto &thisSpec = record.specification();
261 for (cool::UInt32
i = 0;
i != thisSpec.size(); ++
i)
263 const std::string
delimiter = (
i == 0) ? (
"") : (
",");
264 std::string
typeName = thisSpec[
i].storageType().name();
266 std::ostringstream
os;
267 record[
i].printValue(
os);
◆ timeRep()
std::string timeRep |
( |
const cool::ValidityKey & |
t, |
|
|
bool |
isEnd = false , |
|
|
bool |
runLumi = true |
|
) |
| |
Definition at line 217 of file MakeReferenceFile.cxx.
220 const std::string trail = isEnd ? (
")") : (
"]");
223 if (
t == cool::ValidityKeyMin)
225 result =
"ValidityKeyMin";
227 else if (
t == cool::ValidityKeyMax)
229 result =
"ValidityKeyMax";
233 long int seconds =
static_cast<long int>(
t / 1000000000);
234 std::string timeStr{std::asctime(std::gmtime(&
seconds))};
235 result = timeStr +
" UTC";