67 HcalDbTool
db (fInputDb, fVerbose);
70 std::vector<std::string> allTags =
db.metadataAllTags ();
71 for (
unsigned i = 0;
i < allTags.size();
i++) {
72 if (allTags[
i] == fInputTag) {
73 if (!
db.getObject (&inputIov, fInputTag)) {
74 std::cerr <<
"copyObject-> Can not get IOV for input tags " << fInputTag << std::endl;
78 if (allTags[
i] == fOutputTag) {
79 if (!
db.getObject (&outputIov, fOutputTag)) {
80 std::cerr <<
"copyObject-> Can not get IOV for output tags " << fOutputTag << std::endl;
86 std::vector <IntervalOV> allIOVs = allIOV (inputIov);
87 std::cout <<
" all IOVs available for input tag " << fInputTag <<
" in CMS POOL DB instance: " << fInputDb << std::endl;
88 for (
unsigned i = 0;
i < allIOVs.size();
i++) {
89 std::cout <<
"[ " << allIOVs[
i].first <<
" .. " << allIOVs[
i].second <<
" ) " << inputIov.iov [allIOVs[
i].second] << std::endl;
91 allIOVs = allIOV (outputIov);
92 std::cout <<
"\n all IOVs available for output tag " << fOutputTag <<
" in CMS POOL DB instance: " << fInputDb << std::endl;
93 for (
unsigned i = 0;
i < allIOVs.size();
i++) {
94 std::cout <<
"[ " << allIOVs[
i].first <<
" .. " << allIOVs[
i].second <<
" ) " << outputIov.iov [allIOVs[
i].second] << std::endl;
99 IOVCollection::const_iterator iovIn = inputIov.iov.begin ();
100 if (iovIn == inputIov.iov.end ()) {
101 std::cerr <<
"Input IOV is empty - nothing to do" << std::endl;
106 IOVCollection::const_iterator iovOut = outputIov.iov.begin ();
107 for (; ; iovOut++, iovIn++) {
108 if (iovIn == inputIov.iov.end ()) {
109 if (++iovOut == outputIov.iov.end ()) {
110 std::cerr <<
"Nothing to update" << std::endl;
114 std::cerr <<
"List of input IOV is too short" << std::endl;
118 if (iovOut == outputIov.iov.end ()) {
119 outputIov.iov [iovIn->first] = inputToken;
120 inputToken = iovIn->second;
123 if (inputToken != iovOut->second) {
124 std::cerr <<
"Mismatched tokens: \n in: " << iovIn->second <<
"\n out: " << iovOut->second << std::endl;
129 IOVCollection::const_iterator iovOut2 = iovOut;
130 if (++iovOut2 == outputIov.iov.end ()) {
131 outputIov.iov.erase (iovOut->first);
132 outputIov.iov [iovIn->first] = inputToken;
133 inputToken = iovIn->second;
136 if (iovIn->first != iovOut->first) {
137 std::cerr <<
"Mismatched runs: in: " << iovIn->first <<
", out: " << iovOut->first << std::endl;
141 inputToken = iovIn->second;
143 std::cout <<
"Good! Input and output does match" << std::endl;
145 for (iovIn++; iovIn != inputIov.iov.end (); iovIn++) {
146 IOVRun
run = iovIn->first;
147 outputIov.iov [
run] = inputToken;
148 inputToken = iovIn->second;
154 std::vector <IntervalOV> allIOVs = allIOV (outputIov);
155 std::cout <<
"\n Done! All IOVs available for output tag " << fOutputTag <<
" in CMS POOL DB instance: " << fInputDb << std::endl;
156 for (
unsigned i = 0;
i < allIOVs.size();
i++) {
157 std::cout <<
"[ " << allIOVs[
i].first <<
" ... " << allIOVs[
i].second <<
" ) " << outputIov.iov [allIOVs[
i].second] << std::endl;
160 return db.putObject (&outputIov, fOutputTag);
static Timestamp endOfTime()
TimeValue_t value() const