CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
WriteDQMSummaryIntoOMDS Class Reference

#include <WriteDQMSummaryIntoOMDS.h>

Inheritance diagram for WriteDQMSummaryIntoOMDS:
TestBase

Public Member Functions

void dropTable (const std::string &table)
 
void dropView (const std::string &view)
 
std::vector< ItemreadData (const std::string &file)
 
void run ()
 
void writeData (const std::string &tableToRead)
 
 WriteDQMSummaryIntoOMDS (const std::string &connectionString, const std::string &user, const std::string &pass)
 
virtual ~WriteDQMSummaryIntoOMDS ()
 
- Public Member Functions inherited from TestBase
void setVerbosityLevel (coral::MsgLevel level)
 
void setVerbosityLevel (coral::MsgLevel level)
 
void setVerbosityLevel (coral::MsgLevel level)
 
 TestBase ()
 
 TestBase ()
 
 TestBase ()
 
virtual ~TestBase ()
 
virtual ~TestBase ()
 
virtual ~TestBase ()
 

Private Attributes

std::string m_connectionString
 
std::string m_file
 
std::vector< Itemm_itemvec
 
std::string m_pass
 
std::string m_tableToAppend
 
std::string m_tableToDrop
 
std::string m_user
 
std::string m_viewToDrop
 

Additional Inherited Members

- Protected Member Functions inherited from TestBase
coral::ISession * connect (const std::string &connectionString, const std::string &user, const std::string &password)
 
coral::ISession * connect (const std::string &connectionString, const std::string &user, const std::string &password)
 
coral::ISession * connect (const std::string &connectionString, const std::string &user, const std::string &password)
 

Detailed Description

Definition at line 31 of file WriteDQMSummaryIntoOMDS.h.

Constructor & Destructor Documentation

WriteDQMSummaryIntoOMDS::WriteDQMSummaryIntoOMDS ( const std::string &  connectionString,
const std::string &  user,
const std::string &  pass 
)

Definition at line 22 of file WriteDQMSummaryIntoOMDS.cc.

References m_file, m_tableToAppend, m_tableToDrop, and m_viewToDrop.

WriteDQMSummaryIntoOMDS::~WriteDQMSummaryIntoOMDS ( )
virtual

Definition at line 40 of file WriteDQMSummaryIntoOMDS.cc.

41 {}

Member Function Documentation

void WriteDQMSummaryIntoOMDS::dropTable ( const std::string &  table)

Definition at line 50 of file WriteDQMSummaryIntoOMDS.cc.

References TestBase::connect(), gather_cfg::cout, m_connectionString, m_pass, m_tableToDrop, m_user, python.IdGenerator::schema, python.CommonUtils::session, and table.

50  {
52 coral::ISession* session = this->connect( m_connectionString,m_user, m_pass );
53  session->transaction().start( );
54  std::cout << "connected succesfully to omds" <<std::endl;
55  coral::ISchema& schema = session->nominalSchema();
56  schema.dropIfExistsTable(m_tableToDrop);
57 
58 
59 }
#define table(NAME)
Definition: DbCore.h:49
tuple cout
Definition: gather_cfg.py:121
coral::ISession * connect(const std::string &connectionString, const std::string &user, const std::string &password)
Definition: TestBase.cc:24
void WriteDQMSummaryIntoOMDS::dropView ( const std::string &  view)

Definition at line 61 of file WriteDQMSummaryIntoOMDS.cc.

References TestBase::connect(), gather_cfg::cout, m_connectionString, m_pass, m_user, m_viewToDrop, python.IdGenerator::schema, and python.CommonUtils::session.

61  {
62  m_viewToDrop = view;
63  coral::ISession* session = this->connect( m_connectionString,m_user, m_pass );
64  session->transaction().start( );
65  std::cout << "connected succesfully to omds" <<std::endl;
66  coral::ISchema& schema = session->nominalSchema();
67  schema.dropIfExistsView(m_viewToDrop);
68 }
tuple cout
Definition: gather_cfg.py:121
coral::ISession * connect(const std::string &connectionString, const std::string &user, const std::string &password)
Definition: TestBase.cc:24
std::vector< Item > WriteDQMSummaryIntoOMDS::readData ( const std::string &  file)

Definition at line 72 of file WriteDQMSummaryIntoOMDS.cc.

References dtNoiseDBValidation_cfg::cerr, AlCaHLTBitMon_QueryRunRegistry::comp, cmsRelvalreport::exit, mergeVDriftHistosByStation::file, recoMuon::in, gen::k, prof2calltree::l, geometryCSVtoXML::line, m_file, m_itemvec, Item::m_reportcontent, Item::m_run, Item::m_status, Item::m_subsystem, AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

73 {
74 
75  m_file = file;
76  std::ifstream indata;
77  indata.open(m_file.c_str(),std::ios::in);
78  if(!indata) {
79  std::cerr <<"Error: no such file!"<< std::endl;
80  exit(1);
81  }
82  Item ItemI_tmp;
83  char line[100];
84  char first_three_char[3];
85  // string of the file relevant
86  std::string spaces="===";
87  std::string Run="Run";
88  // string needed for parsing
89  char subsys[50], comp[50], tmp[3];
90  int l=0;
91  //reading the file and filling the struct
92  while(!indata.eof()) {
93  indata.getline(line,100);
94  l++;
95  for(int k=0; k<3;k++){
96  first_three_char[k]= line[k];
97  }
98  // skipp fist line and when ===
99  if ( l==1 || first_three_char ==spaces) continue;
100  if (first_three_char==Run){
101  // getting run number and subdetector name
102  sscanf( line, "%s%d%s", tmp , &ItemI_tmp.m_run , subsys);
103  ItemI_tmp.m_subsystem = subsys;
104  } else {
105  // getting the string/component between the < .... > and the status
106  sscanf( line, "<%[^>]>%f",comp,&ItemI_tmp.m_status );
107  ItemI_tmp.m_reportcontent=comp;
108  m_itemvec.push_back(ItemI_tmp);
109  }
110  }
111  indata.close();
112  // to avoid inserted last row twice.....
113  m_itemvec.pop_back();
114  return m_itemvec;
115 }
std::string m_reportcontent
std::string m_subsystem
int k[5][pyjets_maxn]
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void WriteDQMSummaryIntoOMDS::run ( )
virtual

Implements TestBase.

Definition at line 46 of file WriteDQMSummaryIntoOMDS.cc.

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

47 {
48 }
void WriteDQMSummaryIntoOMDS::writeData ( const std::string &  tableToRead)

Definition at line 120 of file WriteDQMSummaryIntoOMDS.cc.

References TestBase::connect(), gather_cfg::cout, gen::k, m_connectionString, m_itemvec, m_pass, Item::m_reportcontent, Item::m_run, Item::m_status, Item::m_subsystem, m_tableToAppend, m_user, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, and table.

121  {
122 
123  for (size_t k= 0; k< m_itemvec.size(); k++){
124  Item Itemtemp= m_itemvec[k];
125  // printing to stdout the value to be transferred
126  std::cout<< "read from file, and now transferring these value : " << std::endl;
127  std::cout<< "item run : " << Itemtemp.m_run<<std::endl;
128  std::cout<< "item subsystem : " << Itemtemp.m_subsystem << std::endl;
129  std::cout<< "item reportcontent : " << Itemtemp.m_reportcontent <<std::endl;
130  std::cout<< "item status : " << Itemtemp.m_status<<std::endl;
131 
132  }
133 
134 
135  std::cout<< "starting to write the data in omds : " << std::endl;
136  m_tableToAppend = tableToRead;
137 
138  std::cout << "connecting to omds" <<std::endl;
139  coral::ISession* session = this->connect( m_connectionString,m_user, m_pass );
140  session->transaction().start( );
141  std::cout << "connected succesfully to omds" <<std::endl;
142  coral::ISchema& schema = session->nominalSchema();
143 
144  std::cout << "new table: " << m_tableToAppend <<std::endl;
145  coral::ITable& table = schema.tableHandle(m_tableToAppend);
146  coral::AttributeList rowBuffer;
147  table.dataEditor().rowBuffer( rowBuffer );
148 // appending to the existing table
149  for (size_t k= 0; k< m_itemvec.size(); k++ )
150  {
151  Item Itemtemp= m_itemvec[k];
152 
153  rowBuffer["RUN"].data<long long int>() =Itemtemp.m_run ;
154  rowBuffer["SUBSYSTEM"].data<std::string>() = Itemtemp.m_subsystem;
155  rowBuffer["REPORTCONTENT"].data<std::string>() = Itemtemp.m_reportcontent;
156  rowBuffer["STATUS"].data<double>() = Itemtemp.m_status;
157  table.dataEditor().insertRow( rowBuffer );
158  }
159 
160  session->transaction().commit();
161 delete session;
162 
163 }
std::string m_reportcontent
std::string m_subsystem
int k[5][pyjets_maxn]
#define table(NAME)
Definition: DbCore.h:49
tuple cout
Definition: gather_cfg.py:121
coral::ISession * connect(const std::string &connectionString, const std::string &user, const std::string &password)
Definition: TestBase.cc:24

Member Data Documentation

std::string WriteDQMSummaryIntoOMDS::m_connectionString
private

Definition at line 58 of file WriteDQMSummaryIntoOMDS.h.

Referenced by dropTable(), dropView(), and writeData().

std::string WriteDQMSummaryIntoOMDS::m_file
private

Definition at line 52 of file WriteDQMSummaryIntoOMDS.h.

Referenced by readData(), and WriteDQMSummaryIntoOMDS().

std::vector<Item> WriteDQMSummaryIntoOMDS::m_itemvec
private

Definition at line 50 of file WriteDQMSummaryIntoOMDS.h.

Referenced by readData(), and writeData().

std::string WriteDQMSummaryIntoOMDS::m_pass
private

Definition at line 60 of file WriteDQMSummaryIntoOMDS.h.

Referenced by dropTable(), dropView(), and writeData().

std::string WriteDQMSummaryIntoOMDS::m_tableToAppend
private

Definition at line 56 of file WriteDQMSummaryIntoOMDS.h.

Referenced by writeData(), and WriteDQMSummaryIntoOMDS().

std::string WriteDQMSummaryIntoOMDS::m_tableToDrop
private

Definition at line 53 of file WriteDQMSummaryIntoOMDS.h.

Referenced by dropTable(), and WriteDQMSummaryIntoOMDS().

std::string WriteDQMSummaryIntoOMDS::m_user
private

Definition at line 59 of file WriteDQMSummaryIntoOMDS.h.

Referenced by dropTable(), dropView(), and writeData().

std::string WriteDQMSummaryIntoOMDS::m_viewToDrop
private

Definition at line 54 of file WriteDQMSummaryIntoOMDS.h.

Referenced by dropView(), and WriteDQMSummaryIntoOMDS().