275{
276
277 std::string tagName{"PixelChargeCalibration-DATA-RUN2-UPD4-28"};
278 std::string
folderName{
"/PIXEL/ChargeCalibration"};
280 std::string
dbName{
"COOLOFL_PIXEL/CONDBR2"};
281 std::string useIOV{"latest"};
282 bool useLastIOV{true};
283
284 for(
int i=1;
i<
argc;
i++){
285 std::string
aux(argv[i]);
288 if (
variable.compare(
"tagName") == 0) {
289 tagName = std::move(value);
290 }
293 else if(
variable.compare(
"dbName") == 0)
dbName = std::move(value);
294 else if(
variable.compare(
"IOV") == 0){
295
296
297
298 useIOV = std::move(value);
299 useLastIOV = false;
300 }
301 else{
302 std::cout<<
"ERROR - Option not found:"<<
aux <<
"\n";
303 return 1;
304 }
305
306 }
307
309 if(useLastIOV){
311 }
312 else if (useIOV.compare("all") == 0){
314 }
315 else{
317 }
318 }
319
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()) ;
326
327 int returnCode = 0;
331
332 cool::IObjectIteratorPtr objectsIterator =
f.objectIterator(useLastIOV);
333 std::vector< iovNamePair > myIOVs;
334 while (objectsIterator->goToNext())
335 {
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,
"_");
340 std::string
display =
iovToString(thisObject) +
" (" + std::to_string(thisObject.channelId()) +
")\n";
342 myIOVs.push_back(std::make_pair(name,display));
343 }
344
345 if(!useLastIOV){
347
348 for(const auto & [IOVname,iov]:myIOVs){
349 if(IOVname.compare(useIOV)!=0 && useIOV.compare("all") != 0){
350 continue;
351 }
353 std::cout<<IOVname<<"\n";
354 const std::string
filename= IOVname +
"_"+tagName+
".log";
355 std::ofstream opFile(filename);
357 opFile.close();
358 }
359 if(!found){
360 std::cout<< "IOV not found - Choose between one of the following:\n";
361 for(const auto & [IOVname,iov]:myIOVs){
362 std::cout<<IOVname<<" ";
363 }
364 std::cout << "\n";
365 }
366
367 }
368 else{
369 const std::string
fileName = tagName +
".log";
370 std::ofstream opFile(fileName);
371 printf("%-11s: %s\n", "RunNumber" ,(myIOVs.back().first).c_str()) ;
372 opFile << myIOVs.back().second << "\n";
373 opFile.close();
374 }
375
376 return returnCode;
377}
std::string iovToString(const cool::IObject &obj, bool runLumi=true)
std::string payloadToString(const cool::IObject &obj)
static const std::string outputFileName