#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include "CondCore/IOVService/interface/IOV.h"
#include "CondTools/Hcal/interface/HcalDbTool.h"
#include "CondTools/Hcal/interface/HcalDbOnline.h"
Go to the source code of this file.
Classes | |
class | Args |
Typedefs | |
typedef std::pair< IOVRun, IOVRun > | IntervalOV |
typedef std::map< IOVRun, std::string > | IOVCollection |
typedef HcalDbTool::IOVRun | IOVRun |
Functions | |
std::vector< IntervalOV > | allIOV (const cond::IOV &fIOV) |
bool | dbFile (const std::string fParam) |
int | main (int argn, char *argv[]) |
bool | onlineFile (const std::string fParam) |
void | printHelp (const Args &args) |
void | printRuns (const std::string &fDb, const std::string fTag, bool fVerbose) |
void | printTags (const std::string &fDb, bool fVerbose) |
typedef std::pair<IOVRun,IOVRun> IntervalOV [static] |
Definition at line 17 of file hcalIovTool.cc.
typedef std::map<IOVRun,std::string> IOVCollection [static] |
Definition at line 16 of file hcalIovTool.cc.
typedef HcalDbTool::IOVRun IOVRun [static] |
Definition at line 15 of file hcalIovTool.cc.
std::vector<IntervalOV> @3072::allIOV | ( | const cond::IOV & | fIOV | ) | [static] |
Definition at line 19 of file hcalIovTool.cc.
References cond::IOV::iov, and HLT_VtxMuL3::result.
Referenced by printRuns(), and publishObjects().
00019 { 00020 std::vector <IntervalOV> result; 00021 IOVRun iovMin = 0; 00022 for (IOVCollection::const_iterator iovi = fIOV.iov.begin (); iovi != fIOV.iov.end (); iovi++) { 00023 IOVRun iovMax = iovi->first; 00024 result.push_back (std::make_pair (iovMin, iovMax)); 00025 iovMin = iovMax; 00026 } 00027 return result; 00028 }
bool @3072::dbFile | ( | const std::string | fParam | ) | [static] |
Definition at line 112 of file hcalIovTool.cc.
References Args::arguments(), GenMuonPlsPt100GeV_cfg::cout, archive::db, Args::defineOption(), Args::defineParameter(), lat::endl(), Args::getParameter(), Args::optionIsSet(), Args::parse(), printHelp(), printRuns(), printTags(), and ecalRecalibSequence_cff::tag.
00112 { 00113 00114 Args args; 00115 args.defineParameter ("-db", "DB connection string, POOL format, or online format"); 00116 args.defineParameter ("-tag", "tag specifyer"); 00117 args.defineOption ("-help", "this help"); 00118 args.defineOption ("-verbose", "this help"); 00119 00120 args.parse (argn, argv); 00121 00122 std::vector<std::string> arguments = args.arguments (); 00123 00124 if (arguments.size () < 1 || args.optionIsSet ("-help")) { 00125 printHelp (args); 00126 return -1; 00127 } 00128 00129 std::string db = args.getParameter ("-db"); 00130 std::string tag = args.getParameter ("-tag"); 00131 bool verbose = args.optionIsSet ("-verbose"); 00132 00133 std::string what = arguments [0]; 00134 00135 if (what == "tag") { 00136 printTags (db, verbose); 00137 } 00138 else if (what == "iov") { 00139 printRuns (db, tag, verbose); 00140 } 00141 std::cout << "Program has completed successfully" << std::endl; 00142 return 0; 00143 }
bool @3072::onlineFile | ( | const std::string | fParam | ) | [static] |
Definition at line 34 of file hcalIovTool.cc.
00034 { 00035 return fParam.find ('@') != std::string::npos && 00036 fParam.find ("cms_val_lb") == std::string::npos; 00037 }
Definition at line 62 of file hcalIovTool.cc.
References Args::command(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and Args::printOptionsHelp().
00062 { 00063 char buffer [1024]; 00064 std::cout << "Tool to manipulate by IOV of Hcal Calibrations" << std::endl; 00065 std::cout << " feedback -> ratnikov@fnal.gov" << std::endl; 00066 std::cout << "Use:" << std::endl; 00067 sprintf (buffer, " %s <what> <options> <parameters>\n", args.command ().c_str()); 00068 std::cout << buffer; 00069 std::cout << " where <what> is: \n tag\n iov" << std::endl; 00070 args.printOptionsHelp (); 00071 }
Definition at line 90 of file hcalIovTool.cc.
References allIOV(), TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, dbFile(), lat::endl(), HcalDbOnline::getIOVs(), i, and onlineFile().
Referenced by main().
00090 { 00091 std::vector <IntervalOV> allIOVs; 00092 if (dbFile (fDb)) { 00093 HcalDbTool poolDb (fDb, fVerbose); 00094 cond::IOV iov; 00095 if (poolDb.getObject (&iov, fTag)) { 00096 allIOVs = allIOV (iov); 00097 std::cout << "IOVs available for tag " << fTag << " in CMS POOL DB instance: " << fDb << std::endl; 00098 } 00099 else { 00100 std::cerr << "printRuns-> can not find IOV for tag " << fTag << std::endl; 00101 } 00102 } 00103 if (onlineFile (fDb)) { 00104 HcalDbOnline onlineDb (fDb, fVerbose); 00105 allIOVs = onlineDb.getIOVs (fTag); 00106 } 00107 for (unsigned i = 0; i < allIOVs.size(); i++) { 00108 std::cout << "[ " << allIOVs[i].first << " ... " << allIOVs[i].second << " )" << std::endl; 00109 } 00110 }
Definition at line 73 of file hcalIovTool.cc.
References GenMuonPlsPt100GeV_cfg::cout, dbFile(), lat::endl(), i, HcalDbOnline::metadataAllTags(), and onlineFile().
Referenced by main().
00073 { 00074 std::vector<std::string> allTags; 00075 if (dbFile (fDb)) { 00076 HcalDbTool poolDb (fDb, fVerbose); 00077 allTags = poolDb.metadataAllTags (); 00078 std::cout << "Tags available in CMS POOL DB instance: " << fDb << std::endl; 00079 } 00080 if (onlineFile (fDb)) { 00081 HcalDbOnline onlineDb (fDb, fVerbose); 00082 allTags = onlineDb.metadataAllTags (); 00083 std::cout << "Tags available in HCAL master DB instance: " << fDb << std::endl; 00084 } 00085 for (unsigned i = 0; i < allTags.size(); i++) { 00086 std::cout << allTags[i] << std::endl; 00087 } 00088 }