18 return fParam ==
"defaults";
22 return fParam.find (
':') == std::string::npos &&
std::string (fParam, fParam.length () - 4) ==
".txt";
26 return fParam.find (
':') == std::string::npos &&
std::string (fParam, fParam.length () - 4) ==
".xml";
30 return fParam.find (
':') != std::string::npos;
34 return fParam.find (
'@') != std::string::npos;
39 if (!fObject)
return false;
40 if (fDb.empty ())
return false;
42 std::ifstream stream (fDb.c_str ());
46 else if (masterDb (fDb)) {
47 std::cout <<
"HcalPedestalValidator-> Use input: MasterDB " << fDb << std::endl;
49 return masterDb.getObject (fObject, fTag, fRun);
58 if (!fObject || !*fObject)
return false;
59 if (fDb.empty ())
return false;
61 std::ofstream stream (fDb.c_str ());
78 void parse (
int nArgs,
char* fArgs []);
81 std::vector<std::string>
arguments ()
const;
88 std::vector <std::string>
mArgs;
89 std::map <std::string, std::string>
mParsed;
96 const char* foo1 =
"CORAL_AUTH_USER=blaaah";
97 const char* foo2 =
"CORAL_AUTH_PASSWORD=blaaah";
98 if (!::getenv(
"CORAL_AUTH_USER")) ::putenv(const_cast<char*>(foo1));
99 if (!::getenv(
"CORAL_AUTH_PASSWORD")) ::putenv(const_cast<char*>(foo2));
115 args.
parse (argn, argv);
116 std::vector<std::string> arguments = args.
arguments ();
128 int RawPedWidRun = RawPedRun;
133 int RefPedRun = RawPedRun;
134 int RefPedWidRun = RefPedRun;
139 int outputPedRun = RawPedRun;
140 int outputPedWidRun = outputPedRun;
148 if (!
getObject (RefPeds, RefPedSource, RefPedTag, RefPedRun)) {
149 std::cerr <<
"HcalPedestalValidator-> Failed to get reference Pedestals" << std::endl;
154 if (!
getObject (RefPedWids, RefPedWidSource, RefPedWidTag, RefPedWidRun)) {
155 std::cerr <<
"HcalPedestalValidator-> Failed to get reference PedestalWidths" << std::endl;
162 if (!
getObject (RawPeds, RawPedSource, RawPedTag, RawPedRun)) {
163 std::cerr <<
"HcalPedestalValidator-> Failed to get raw Pedestals" << std::endl;
168 if (!
getObject (RawPedWids, RawPedWidSource, RawPedWidTag, RawPedWidRun)) {
169 std::cerr <<
"HcalPedestalValidator-> Failed to get raw PedestalWidths" << std::endl;
180 int nstat[4]={2500,2500,2500,2500};
192 if (!putObject (&outputPeds, outputPedDest, outputPedTag, outputPedRun)) {
193 std::cerr <<
"HcalPedestalAnalyzer-> Failed to put output Pedestals" << std::endl;
198 if (!putObject (&outputPedWids, outputPedWidDest, outputPedWidTag, outputPedWidRun)) {
199 std::cerr <<
"HcalPedestalAnalyzer-> Failed to put output PedestalWidths" << std::endl;
205 delete outputPedWids;
221 if (nArgs <= 0)
return;
224 while (++iarg < nArgs) {
226 if (arg [0] !=
'-')
mArgs.push_back (arg);
233 std::cerr <<
"ERROR: Parameter " << arg <<
" has no value specified. Ignore parameter." << std::endl;
249 sprintf (buffer,
" %-8s <value> : %s", (
mParameters [i]).c_str(), comment.c_str());
254 std::map<std::string, std::string>::const_iterator it =
mComments.find (
mOptions [
i]);
256 sprintf (buffer,
" %-8s : %s", (
mOptions [i]).c_str(), comment.c_str());
void defineOption(const std::string &fOption, const std::string &fComment="")
TObject * getObject(TDirectory *fDir, const std::vector< std::string > &fObjectName)
std::map< std::string, std::string > mComments
bool defaultsFile(const std::string fParam)
std::vector< std::string > arguments() const
std::vector< std::string > mOptions
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[])
Gather conditions data from online DB.
bool dbFile(const std::string fParam)
std::string command() const
bool xmlFile(const std::string fParam)
bool getObject(std::istream &fInput, HcalPedestals *fObject)
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
bool asciiFile(const std::string fParam)
std::map< std::string, std::string > mParsed
static int HcalPedVal(int nstat[4], const HcalPedestals *fRefPedestals, const HcalPedestalWidths *fRefPedestalWidths, HcalPedestals *fRawPedestals, HcalPedestalWidths *fRawPedestalWidths, HcalPedestals *fValPedestals, HcalPedestalWidths *fValPedestalWidths)
void defineParameter(const std::string &fParameter, const std::string &fComment="")
bool optionIsSet(const std::string &fOption) const
std::string getParameter(const std::string &fKey)