10 #include "DataFormats/Common/interface/Timestamp.h"
11 #include "CondCore/IOVService/interface/IOV.h"
12 #include "CondTools/Hcal/interface/HcalDbTool.h"
27 typedef std::pair<IOVRun,IOVRun> IntervalOV;
33 void defineOption (
const std::string& fOption,
const std::string& fComment =
"");
34 void defineParameter (
const std::string& fParameter,
const std::string& fComment =
"");
35 void parse (
int nArgs,
char* fArgs []);
38 std::vector<std::string>
arguments ()
const;
39 bool optionIsSet (
const std::string& fOption)
const;
45 std::vector <std::string>
mArgs;
46 std::map <std::string, std::string>
mParsed;
47 std::map <std::string, std::string>
mComments;
52 std::cout <<
"Initialize POOL DB with dummy HCAL data" << std::endl;
53 std::cout <<
" feedback -> ratnikov@fnal.gov" << std::endl;
55 sprintf (buffer,
" %s <parameters>\n", args.
command ().c_str());
61 HcalDbTool
db (inputdb, verbose);
62 if (inputdb.find (
"sqlite") != std::string::npos) {
63 unsigned pos = inputdb.find (
':');
64 if (pos != std::string::npos) {
65 std::string
filename (inputdb, pos+1);
72 std::cout <<
"initDb-> initializing metadata" << std::endl;
73 db.metadataSetTag (
"dummy_tag",
"dummy_token");
75 std::cout <<
"initDb-> initializing pedestals" << std::endl;
77 db.putObject (peds,
"dummy_pedestals", 1);
78 std::cout <<
"initDb-> initializing pedestal widths" << std::endl;
80 db.putObject (pedws,
"dummy_pedestalwidths", 1);
81 std::cout <<
"initDb-> initializing gains" << std::endl;
83 db.putObject (gains,
"dummy_gains", 1);
84 std::cout <<
"initDb-> initializing gain widths" << std::endl;
86 db.putObject (gainws,
"dummy_gainwidths", 1);
87 std::cout <<
"initDb-> initializing qie" << std::endl;
89 db.putObject (qie,
"dummy_qie", 1);
90 std::cout <<
"initDb-> initializing electronics map" << std::endl;
92 db.putObject (map,
"dummy_map", 1);
93 std::cout <<
"initDb-> initializing channel quality" << std::endl;
95 db.putObject (quality,
"dummy_quality", 1);
103 args.
defineParameter (
"-db",
"DB connection string, POOL format, i.e. oracle://devdb10/CMS_COND_HCAL");
107 args.
parse (argn, argv);
109 std::vector<std::string> arguments = args.
arguments ();
119 initDb (inputdb, verbose);
136 if (nArgs <= 0)
return;
139 while (++iarg < nArgs) {
140 std::string
arg (fArgs [iarg]);
148 std::cerr <<
"ERROR: Parameter " <<
arg <<
" has no value specified. Ignore parameter." << std::endl;
164 sprintf (buffer,
" %-8s <value> : %s", (
mParameters [i]).c_str(), comment.c_str());
168 for (
unsigned i = 0; i <
mOptions.size (); i++) {
169 std::map<std::string, std::string>::const_iterator it =
mComments.find (
mOptions [i]);
170 std::string comment = it !=
mComments.end () ? it->second :
"uncommented";
171 sprintf (buffer,
" %-8s : %s", (
mOptions [i]).c_str(), comment.c_str());
void defineOption(const std::string &fOption, const std::string &fComment="")
std::map< std::string, std::string > mComments
std::vector< std::string > arguments() const
std::vector< std::string > mOptions
std::map< IOVRun, std::string > IOVCollection
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int main(int argc, char **argv)
std::vector< std::string > mParameters
std::vector< std::string > mArgs
void printOptionsHelp() const
void parse(int nArgs, char *fArgs[])
HcalDbTool::IOVRun IOVRun
std::string command() const
void printHelp(const Args &args)
std::map< std::string, std::string > mParsed
void defineParameter(const std::string &fParameter, const std::string &fComment="")
bool optionIsSet(const std::string &fOption) const
std::string getParameter(const std::string &fKey)