24 return fParam ==
"defaults";
27 bool asciiFile (
const std::string fParam) {
28 return fParam.find (
':') == std::string::npos && std::string (fParam, fParam.length () - 4) ==
".txt";
31 bool xmlFile (
const std::string fParam) {
32 return fParam.find (
':') == std::string::npos && std::string (fParam, fParam.length () - 4) ==
".xml";
35 bool dbFile (
const std::string fParam) {
36 return fParam.find (
':') != std::string::npos;
39 bool masterDb (
const std::string fParam) {
40 return fParam.find (
'@') != std::string::npos;
44 bool getObject (
T* fObject,
const std::string& fDb,
const std::string& fTag,
int fRun) {
45 if (!fObject)
return false;
46 if (fDb.empty ())
return false;
48 std::cout <<
"HcalPedestalAnalyzer-> USE INPUT: ASCII " << std::endl;
49 std::ifstream stream (fDb.c_str ());
54 std::cout <<
"HcalPedestalAnalyzer-> USE INPUT: Pool " << fDb << std::endl;
55 std::cout <<
"HcalPedestalAnalyzer-> Pool interface is not supportet since 1.3.0" << fDb << std::endl;
60 else if (masterDb (fDb)) {
61 std::cout <<
"HcalPedestalAnalyzer-> USE INPUT: MasterDB " << fDb << std::endl;
63 return masterDb.getObject (fObject, fTag, fRun);
66 std::cerr <<
"HcalPedestalAnalyzer-> Unknown input type " << fDb << std::endl;
72 std::cout <<
"HcalPedestalAnalyzer-> USE OUTPUT: XML" << std::endl;
73 std::ofstream stream (fXml.c_str ());
80 bool putObject (
T** fObject,
const std::string& fDb,
const std::string& fTag,
int fRun) {
81 if (!fObject || !*fObject)
return false;
82 if (fDb.empty ())
return false;
84 std::cout <<
"HcalPedestalAnalyzer-> USE OUTPUT: ASCII " << std::endl;
85 std::ofstream stream (fDb.c_str ());
90 std::cout <<
"HcalPedestalAnalyzer-> USE OUTPUT: Pool " << fDb << std::endl;
91 std::cout <<
"HcalPedestalAnalyzer-> Pool interface is not supportet since 1.3.0" << fDb << std::endl;
99 std::cerr <<
"HcalPedestalAnalyzer-> Unknown output type " << fDb << std::endl;
126 const char* foo1 =
"CORAL_AUTH_USER=blaaah";
127 const char* foo2 =
"CORAL_AUTH_PASSWORD=blaaah";
128 if (!::getenv(
"CORAL_AUTH_USER")) ::putenv(const_cast<char*>(foo1));
129 if (!::getenv(
"CORAL_AUTH_PASSWORD")) ::putenv(const_cast<char*>(foo2));
147 std::cerr <<
"HcalPedestalAnalyzer-> Failed to get input Pedestals" << std::endl;
154 std::cerr <<
"HcalPedestalAnalyzer-> Failed to get input PedestalWidths" << std::endl;
163 int Flag=
m_pedAnal->
done(inputPeds, inputPedWids, outputPeds, outputPedWids);
174 std::cerr <<
"HcalPedestalAnalyzer-> Failed to put output Pedestals & Widths" << std::endl;
180 std::cerr <<
"HcalPedestalAnalyzer-> Failed to put output Pedestals" << std::endl;
185 std::cerr <<
"HcalPedestalAnalyzer-> Failed to put output PedestalWidths" << std::endl;
191 delete outputPedWids;
210 std::cout <<
"HcalPedestalAnalyzer: analyzed " <<
m_ievt <<
" events" << std::endl;
std::string m_outputPedestalWidths_tag
T getUntrackedParameter(std::string const &, T const &) const
~HcalPedestalAnalyzer()
Destructor.
TObject * getObject(TDirectory *fDir, const std::vector< std::string > &fObjectName)
bool defaultsFile(const std::string fParam)
bool dumpObject(std::ostream &fOutput, unsigned fRun, unsigned long fGMTIOVBegin, unsigned long fGMTIOVEnd, const std::string &fTag, unsigned fVersion, const HcalPedestals &fObject, const HcalPedestalWidths &fError)
bool getByType(Handle< PROD > &result) const
int m_outputPedestalWidths_run
void processEvent(const HBHEDigiCollection &hbhe, const HODigiCollection &ho, const HFDigiCollection &hf, const HcalDbService &cond)
std::string m_outputPedestalWidths_dest
int done(const HcalPedestals *fInputPedestals, const HcalPedestalWidths *fInputWidths, HcalPedestals *fOutputPedestals, HcalPedestalWidths *fOutputWidths)
int m_outputPedestals_run
void setup(const std::string &m_outputFileROOT)
std::string m_inputPedestalWidths_source
std::string m_inputPedestals_tag
Gather conditions data from online DB.
std::string m_outputPedestals_dest
bool dbFile(const std::string fParam)
std::string m_inputPedestalWidths_tag
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
bool xmlFile(const std::string fParam)
bool getObject(std::istream &fInput, HcalPedestals *fObject)
std::string m_outputPedestals_tag
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
bool asciiFile(const std::string fParam)
std::string m_inputPedestals_source
HcalPedestalAnalyzer(const edm::ParameterSet &ps)
Constructor.
HcalPedestalAnalysis * m_pedAnal
int m_inputPedestalWidths_run