Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InsertCalib.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file InsertCalib.cc
1 #include "InsertCalib.h"
2 
3 #include <phool/recoConsts.h>
4 
5 #include <sphenixnpc.hpp>
6 
7 #include <nlohmann/json.hpp> // every method returns a json object
8 
9 #include <iostream>
10 #include <stdexcept> // for out_of_range
11 #include <string>
12 
14 {
15  std::cout << sphenixnpc::createGlobalTag(tag) << std::endl;
16  return 0;
17 }
19 {
20  std::cout << sphenixnpc::getGlobalTags() << std::endl;
21  nlohmann::json result = sphenixnpc::getGlobalTags();
22 
23  std::cout << "code:" << result.at("code") << std::endl;
24  return 0;
25 }
27 {
28  std::cout << sphenixnpc::deleteGlobalTag(tag) << std::endl;
29  return 0;
30 }
31 
33 {
34  std::cout << sphenixnpc::createPayloadType(payloadtype) << std::endl;
35  return 0;
36 }
37 
39 {
40  std::cout << sphenixnpc::getPayloadTypes() << std::endl;
41  return 0;
42 }
43 
44 int InsertCalib::insertcalib(const std::string &fname, const std::string &payloadtype, uint64_t iov_start)
45 {
47  std::string globaltag;
48  if (rc->FlagExist("CDB_GLOBALTAG"))
49  {
50  globaltag = rc->get_StringFlag("CDB_GLOBALTAG");
51  }
52  std::cout << sphenixnpc::createGlobalTag(globaltag) << std::endl;
53  std::cout << sphenixnpc::createPayloadType(payloadtype) << std::endl;
54  ;
55  std::cout << "inserting " << fname << std::endl;
56  std::cout << sphenixnpc::insertPayload(globaltag, payloadtype, fname, iov_start) << std::endl;
57  return 0;
58 }
59 
60 int InsertCalib::insertcalib(const std::string &fname, const std::string &payloadtype, uint64_t iov_start, uint64_t iov_end)
61 {
63  std::string globaltag;
64  if (rc->FlagExist("CDB_GLOBALTAG"))
65  {
66  globaltag = rc->get_StringFlag("CDB_GLOBALTAG");
67  }
68  std::cout << sphenixnpc::createGlobalTag(globaltag) << std::endl;
69  std::cout << sphenixnpc::createPayloadType(payloadtype) << std::endl;
70  ;
71  std::cout << "inserting " << fname << std::endl;
72  std::cout << sphenixnpc::insertPayload(globaltag, payloadtype, fname, iov_start, iov_end) << std::endl;
73  return 0;
74 }