17 #include "CondCore/IOVService/interface/IOV.h"
24 #include "CondTools/Hcal/interface/HcalDbTool.h"
45 void defineOption (
const std::string& fOption,
const std::string& fComment =
"");
46 void defineParameter (
const std::string& fParameter,
const std::string& fComment =
"");
47 void parse (
int nArgs,
char* fArgs []);
50 std::vector<std::string>
arguments ()
const;
51 bool optionIsSet (
const std::string& fOption)
const;
57 std::vector <std::string>
mArgs;
58 std::map <std::string, std::string>
mParsed;
59 std::map <std::string, std::string>
mComments;
64 std::cout <<
"Tool to delete object from Hcal Calibrations" << std::endl;
65 std::cout <<
"CAUTION: Could cause inconsistency for running jobs using DB" << std::endl;
66 std::cout <<
" feedback -> ratnikov@fnal.gov" << std::endl;
68 sprintf (buffer,
" %s <what> <options> <parameters>\n", args.
command ().c_str());
70 std::cout <<
" where <what> is: \n pedestals\n gains\n pwidths\n gwidths\n emap\n qie\n calibqie" << std::endl;
75 const std::string& fInput,
const std::string& fInputTag,
HcalDbTool::IOVRun fInputRun,
bool fVerbose) {
76 HcalDbTool poolDb (fInput, fVerbose);
77 return poolDb.deleteObject (fObject, fInputTag, fInputRun);
84 args.
defineParameter (
"-run",
"run # for which constands should be deleted");
88 args.
parse (argn, argv);
90 std::vector<std::string> arguments = args.
arguments ();
92 if (arguments.size () < 1 || args.
optionIsSet (
"-help")) {
105 std::string what = arguments [0];
107 if (what ==
"pedestals") {
109 deleteObject (
object, input, inputTag, inputRun, verbose);
111 else if (what ==
"gains") {
114 else if (what ==
"pwidths") {
117 else if (what ==
"gwidths") {
120 else if (what ==
"emap") {
123 else if (what ==
"qie") {
126 else if (what ==
"calibqie") {
144 if (nArgs <= 0)
return;
147 while (++iarg < nArgs) {
148 std::string
arg (fArgs [iarg]);
156 std::cerr <<
"ERROR: Parameter " <<
arg <<
" has no value specified. Ignore parameter." << std::endl;
172 sprintf (buffer,
" %-8s <value> : %s", (
mParameters [i]).c_str(), comment.c_str());
176 for (
unsigned i = 0; i <
mOptions.size (); i++) {
177 std::map<std::string, std::string>::const_iterator it =
mComments.find (
mOptions [i]);
178 std::string comment = it !=
mComments.end () ? it->second :
"uncommented";
179 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
bool deleteObject(T *fObject, const std::string &fInput, const std::string &fInputTag, HcalDbTool::IOVRun fInputRun, bool fVerbose)
void defineParameter(const std::string &fParameter, const std::string &fComment="")
bool optionIsSet(const std::string &fOption) const
std::string getParameter(const std::string &fKey)