12 m_type(type), m_label(label), m_header(header), m_map_id(
"")
14 m_dir_base = gSystem->Getenv(
"E1039_RESOURCE");
15 if (m_dir_base.length() == 0) {
16 m_dir_base =
"/data2/e1039/resource";
17 cout <<
"RunParamBase: E1039_RESOURCE is empty. Use '" << m_dir_base <<
"' as the data directory." << endl;
24 if (! m_range.
Find(map_id)) {
25 cout <<
" !WARNING! SetMapIDbyFile(): This map ID '" << map_id
26 <<
"' is not included in the run-range table. OK?" << endl;
34 if (! m_range.
Find(map_id)) {
35 cout <<
" !WARNING! SetMapIDbyDB(): This map ID '" << map_id
36 <<
"' is not included in the run-range table. OK?" << endl;
44 m_map_id = m_range.
Find(run);
50 m_map_id = m_range.
Find(run);
65 cout <<
" RunParamBase::ReadFromFile(): " << fn_tsv <<
"...";
66 ifstream ifs(fn_tsv.c_str());
68 cerr <<
"\n!!ERROR!! Cannot open the map file '" << fn_tsv <<
"'." << endl;
74 while ( getline(ifs, buffer) ) {
75 if (buffer[0] ==
'#')
continue;
76 lines.push_back(buffer);
80 cout <<
" read " << nn <<
" entries." << endl;
85 cout <<
" RunParamBase::WriteToFile(): " << fn_tsv <<
"...";
86 ofstream ofs(fn_tsv.c_str());
88 cerr <<
"\n!!ERROR!! Cannot open the map file '" << fn_tsv <<
"'." << endl;
91 ofs <<
"#" << m_header <<
"\n";
94 cout <<
" wrote " << nn <<
" entries." << endl;
99 if (m_map_id.length() == 0) {
100 cerr <<
" ERROR: The map ID is not set. Abort." << endl;
105 cout <<
"Read channel map from "
106 << name_schema <<
"." << name_table <<
".\n";
118 cout <<
"RunParamBase::WriteToDB()\n";
119 if (m_map_id.length() == 0) {
120 cerr <<
" ERROR: The map ID is not set. Abort." << endl;
125 cout <<
" Schema = " << name_schema
126 <<
"\n Table = " << name_table <<
"\n";
132 cout <<
" ...done." << endl;
142 cout <<
" virtual function called." << endl;
148 oss << m_dir_base <<
"/" << m_type <<
"/" << m_label <<
"/run_range.tsv";
155 oss << m_dir_base <<
"/" << m_type <<
"/" << m_label <<
"/" << m_map_id <<
"/param.tsv";
162 oss <<
"user_e1039_" << m_type <<
"_" << m_label;
169 oss <<
"param_" << m_map_id;
175 cout <<
" virtual function called." << endl;
181 cout <<
" virtual function called." << endl;
187 cout <<
" virtual function called." << endl;
192 cout <<
" virtual function called." << endl;
virtual void Print(std::ostream &os)
std::string MapTableName()
void UseSchema(const char *name, const bool do_create=false, const bool do_drop=false)
bool Find(const std::string map_id)
void WriteToDB(const std::string schema)
std::string MapFileName()
std::vector< std::string > LineList
void WriteToLocalFile(const std::string fn_tsv)
virtual int ReadFileCont(LineList &lines)
int run(const int nEvents=1)
void SetMapIDbyDB(const std::string map_id)
void SetMapIDbyFile(const std::string map_id)
void ReadFromFile(const std::string fn_tsv)
virtual void ReadDbTable(DbSvc &db)
bool HasTable(const char *name, const bool exit_on_false=false)
RunParamBase(const std::string type, const std::string label, const std::string header)
void DropTable(const char *name)
virtual int WriteFileCont(std::ostream &os)
std::string RangeFileName()
void ReadFromLocalFile(const std::string fn_tsv)
void ReadFromDB(const std::string schema)
virtual void WriteDbTable(DbSvc &db)