CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
ODFEDAQConfig Class Reference

#include <ODFEDAQConfig.h>

Inheritance diagram for ODFEDAQConfig:
IODConfig IDBObject

Public Member Functions

int fetchNextId () noexcept(false)
 
int getBadTTId () const
 
int getBadXtId () const
 
std::string getComment () const
 
int getDelayId () const
 
int getId () const
 
int getPedestalId () const
 
std::string getTable () override
 
int getTriggerBadTTId () const
 
int getTriggerBadXtId () const
 
int getVersion () const
 
int getWeightId () const
 
 ODFEDAQConfig ()
 
void setBadTTId (int x)
 
void setBadXtId (int x)
 
void setComment (std::string x)
 
void setDelayId (int x)
 
void setId (int id)
 
void setParameters (const std::map< std::string, std::string > &my_keys_map)
 
void setPedestalId (int x)
 
void setTriggerBadTTId (int x)
 
void setTriggerBadXtId (int x)
 
void setVersion (int id)
 
void setWeightId (int x)
 
 ~ODFEDAQConfig () override
 
- Public Member Functions inherited from IODConfig
std::string getConfigTag ()
 
void setConfigTag (std::string x)
 
- Public Member Functions inherited from IDBObject
oracle::occi::Connection * getConn () const
 
oracle::occi::Environment * getEnv () const
 
void setConnection (oracle::occi::Environment *env, oracle::occi::Connection *conn)
 
virtual ~IDBObject ()
 

Private Member Functions

void clear ()
 
void fetchData (ODFEDAQConfig *result) noexcept(false)
 
int fetchID () noexcept(false)
 
void prepareWrite () noexcept(false) override
 
void writeDB () noexcept(false)
 

Private Attributes

int m_btt
 
int m_bxt
 
std::string m_com
 
int m_del
 
int m_ID
 
int m_ped
 
int m_tbtt
 
int m_tbxt
 
int m_version
 
int m_wei
 

Friends

class EcalCondDBInterface
 

Additional Inherited Members

- Public Types inherited from IODConfig
typedef oracle::occi::Clob Clob
 
typedef oracle::occi::SQLException SQLException
 
typedef oracle::occi::Statement Statement
 
typedef oracle::occi::Stream Stream
 
- Public Attributes inherited from IODConfig
std::string m_config_tag
 
- Static Public Attributes inherited from IDBObject
static const int ECALDB_NROWS = 1024
 
- Protected Member Functions inherited from IODConfig
void checkPrepare () noexcept(false)
 
void createReadStatement () noexcept(false)
 
void populateClob (Clob &clob, std::string fname, unsigned int bufsize) noexcept(false)
 
unsigned char * readClob (Clob &clob, int size) noexcept(false)
 
void setPrefetchRowCount (int ncount) noexcept(false)
 
void terminateReadStatement () noexcept(false)
 
void terminateWriteStatement () noexcept(false)
 
- Protected Member Functions inherited from IDBObject
void checkConnection () const noexcept(false)
 
- Protected Attributes inherited from IODConfig
Statementm_readStmt
 
Statementm_writeStmt
 
- Protected Attributes inherited from IDBObject
oracle::occi::Connection * m_conn
 
oracle::occi::Environment * m_env
 

Detailed Description

Definition at line 9 of file ODFEDAQConfig.h.

Constructor & Destructor Documentation

◆ ODFEDAQConfig()

ODFEDAQConfig::ODFEDAQConfig ( )

Definition at line 28 of file ODFEDAQConfig.cc.

28  {
29  m_env = nullptr;
30  m_conn = nullptr;
31  m_writeStmt = nullptr;
32  m_readStmt = nullptr;
33  m_config_tag = "";
34  m_ID = 0;
35  clear();
36 }

References clear().

◆ ~ODFEDAQConfig()

ODFEDAQConfig::~ODFEDAQConfig ( )
override

Definition at line 52 of file ODFEDAQConfig.cc.

52 {}

Member Function Documentation

◆ clear()

void ODFEDAQConfig::clear ( void  )
private

Definition at line 38 of file ODFEDAQConfig.cc.

38  {
39  m_del = MY_NULL;
40  m_wei = MY_NULL;
41  m_ped = MY_NULL;
42 
43  m_bxt = MY_NULL;
44  m_btt = MY_NULL;
45  m_tbtt = MY_NULL;
46  m_tbxt = MY_NULL;
47 
48  m_version = 0;
49  m_com = "";
50 }

References MY_NULL.

◆ fetchData()

void ODFEDAQConfig::fetchData ( ODFEDAQConfig result)
privatenoexcept

Definition at line 149 of file ODFEDAQConfig.cc.

149  {
150  this->checkConnection();
151  result->clear();
152  if (result->getId() == 0 && (result->getConfigTag().empty())) {
153  throw(std::runtime_error("ODFEDAQConfig::fetchData(): no Id defined for this ODFEDAQConfig "));
154  }
155 
156  m_readStmt = m_conn->createStatement();
157  if (!result->getConfigTag().empty() && result->getVersion() == 0) {
158  int new_version = 0;
159  std::cout << "using new method : retrieving last version for this tag " << endl;
160  try {
161  this->checkConnection();
162 
163  m_readStmt->setSQL("select max(version) from " + getTable() + " where tag=:tag ");
164  m_readStmt->setString(1, result->getConfigTag());
165  std::cout << "Getting last ver" << std::endl << std::flush;
166  ResultSet* rset = m_readStmt->executeQuery();
167  while (rset->next()) {
168  new_version = rset->getInt(1);
169  }
170  m_conn->terminateStatement(m_readStmt);
171 
172  // m_readStmt = m_conn->createStatement();
173 
174  result->setVersion(new_version);
175 
176  } catch (SQLException& e) {
177  throw(std::runtime_error(std::string("ODFEDAQConfig::fetchData(): ") + e.getMessage()));
178  }
179  }
180 
181  try {
182  m_readStmt->setSQL("SELECT * FROM " + getTable() + " where ( config_id = :1 or (tag=:2 AND version=:3 ) )");
183  m_readStmt->setInt(1, result->getId());
184  m_readStmt->setString(2, result->getConfigTag());
185  m_readStmt->setInt(3, result->getVersion());
186  ResultSet* rset = m_readStmt->executeQuery();
187 
188  rset->next();
189 
190  // 1 is the id and 2 is the config tag and 3 is the version
191 
192  result->setId(rset->getInt(1));
193  result->setConfigTag(rset->getString(2));
194  result->setVersion(rset->getInt(3));
195 
196  result->setPedestalId(getInt(rset, 4));
197  result->setDelayId(getInt(rset, 5));
198  result->setWeightId(getInt(rset, 6));
199  result->setBadXtId(getInt(rset, 7));
200  result->setBadTTId(getInt(rset, 8));
201  result->setTriggerBadXtId(getInt(rset, 9));
202  result->setTriggerBadTTId(getInt(rset, 10));
203  result->setComment(rset->getString(11));
204 
205  } catch (SQLException& e) {
206  throw(std::runtime_error(std::string("ODFEDAQConfig::fetchData(): ") + e.getMessage()));
207  }
208 }

References gather_cfg::cout, MillePedeFileConverter_cfg::e, getInt(), mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EcalCondDBInterface::fetchFEDelaysForRun().

◆ fetchID()

int ODFEDAQConfig::fetchID ( )
privatenoexcept

Definition at line 210 of file ODFEDAQConfig.cc.

210  {
211  // Return from memory if available
212  if (m_ID != 0) {
213  return m_ID;
214  }
215 
216  this->checkConnection();
217 
218  try {
219  Statement* stmt = m_conn->createStatement();
220  stmt->setSQL("SELECT config_id FROM " + getTable() + "WHERE tag=:1 and version=:2 ");
221 
222  stmt->setString(1, getConfigTag());
223  stmt->setInt(2, getVersion());
224 
225  ResultSet* rset = stmt->executeQuery();
226 
227  if (rset->next()) {
228  m_ID = rset->getInt(1);
229  } else {
230  m_ID = 0;
231  }
232  m_conn->terminateStatement(stmt);
233  } catch (SQLException& e) {
234  throw(std::runtime_error(std::string("ODFEDAQConfig::fetchID: ") + e.getMessage()));
235  }
236 
237  return m_ID;
238 }

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ fetchNextId()

int ODFEDAQConfig::fetchNextId ( )
noexcept

Definition at line 54 of file ODFEDAQConfig.cc.

54  {
55  int result = 0;
56  try {
57  this->checkConnection();
58 
59  m_readStmt = m_conn->createStatement();
60  m_readStmt->setSQL("select fe_daq_conDfig_sq.nextVal from dual");
61  ResultSet* rset = m_readStmt->executeQuery();
62  while (rset->next()) {
63  result = rset->getInt(1);
64  }
65  m_conn->terminateStatement(m_readStmt);
66  return result;
67 
68  } catch (SQLException& e) {
69  throw(std::runtime_error(std::string("ODFEDAQConfig::fetchNextId(): ") + e.getMessage()));
70  }
71 }

References MillePedeFileConverter_cfg::e, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ getBadTTId()

int ODFEDAQConfig::getBadTTId ( ) const
inline

Definition at line 36 of file ODFEDAQConfig.h.

36 { return m_btt; }

References m_btt.

Referenced by popcon::EcalChannelStatusHandler::daqOut(), and popcon::EcalDAQHandler::getNewObjects().

◆ getBadXtId()

int ODFEDAQConfig::getBadXtId ( ) const
inline

Definition at line 34 of file ODFEDAQConfig.h.

34 { return m_bxt; }

References m_bxt.

◆ getComment()

std::string ODFEDAQConfig::getComment ( ) const
inline

Definition at line 43 of file ODFEDAQConfig.h.

43 { return m_com; }

References m_com.

◆ getDelayId()

int ODFEDAQConfig::getDelayId ( ) const
inline

Definition at line 29 of file ODFEDAQConfig.h.

29 { return m_del; }

References m_del.

◆ getId()

int ODFEDAQConfig::getId ( void  ) const
inline

Definition at line 19 of file ODFEDAQConfig.h.

19 { return m_ID; }

References m_ID.

◆ getPedestalId()

int ODFEDAQConfig::getPedestalId ( ) const
inline

Definition at line 27 of file ODFEDAQConfig.h.

27 { return m_ped; }

References m_ped.

◆ getTable()

std::string ODFEDAQConfig::getTable ( )
inlineoverridevirtual

Implements IODConfig.

Definition at line 16 of file ODFEDAQConfig.h.

16 { return "FE_DAQ_CONFIG"; }

◆ getTriggerBadTTId()

int ODFEDAQConfig::getTriggerBadTTId ( ) const
inline

Definition at line 40 of file ODFEDAQConfig.h.

40 { return m_tbtt; }

References m_tbtt.

◆ getTriggerBadXtId()

int ODFEDAQConfig::getTriggerBadXtId ( ) const
inline

Definition at line 38 of file ODFEDAQConfig.h.

38 { return m_tbxt; }

References m_tbxt.

◆ getVersion()

int ODFEDAQConfig::getVersion ( ) const
inline

Definition at line 24 of file ODFEDAQConfig.h.

24 { return m_version; }

References m_version.

◆ getWeightId()

int ODFEDAQConfig::getWeightId ( ) const
inline

Definition at line 31 of file ODFEDAQConfig.h.

31 { return m_wei; }

References m_wei.

Referenced by popcon::EcalSRPHandler::getNewObjects().

◆ prepareWrite()

void ODFEDAQConfig::prepareWrite ( )
overrideprivatevirtualnoexcept

Implements IODConfig.

Definition at line 73 of file ODFEDAQConfig.cc.

73  {
74  this->checkConnection();
75  int next_id = fetchNextId();
76 
77  try {
78  m_writeStmt = m_conn->createStatement();
79  m_writeStmt->setSQL(
80  "INSERT INTO FE_DAQ_CONFIG ( config_id, tag, version, ped_id, "
81  " del_id, wei_id,bxt_id, btt_id, tr_bxt_id, tr_btt_id, user_comment ) "
82  "VALUES ( :1, :2, :3, :4, :5, :6, :7 ,:8, :9, :10, :11 )");
83 
84  m_writeStmt->setInt(1, next_id);
85  m_ID = next_id;
86 
87  } catch (SQLException& e) {
88  throw(std::runtime_error(std::string("ODFEDAQConfig::prepareWrite(): ") + e.getMessage()));
89  }
90 }

References MillePedeFileConverter_cfg::e, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ setBadTTId()

void ODFEDAQConfig::setBadTTId ( int  x)
inline

Definition at line 35 of file ODFEDAQConfig.h.

35 { m_btt = x; }

References m_btt, and x.

◆ setBadXtId()

void ODFEDAQConfig::setBadXtId ( int  x)
inline

Definition at line 33 of file ODFEDAQConfig.h.

33 { m_bxt = x; }

References m_bxt, and x.

◆ setComment()

void ODFEDAQConfig::setComment ( std::string  x)
inline

Definition at line 42 of file ODFEDAQConfig.h.

42 { m_com = x; }

References m_com, and x.

Referenced by ConfigToolBase.ConfigToolBase::apply().

◆ setDelayId()

void ODFEDAQConfig::setDelayId ( int  x)
inline

Definition at line 28 of file ODFEDAQConfig.h.

28 { m_del = x; }

References m_del, and x.

◆ setId()

void ODFEDAQConfig::setId ( int  id)
inline

◆ setParameters()

void ODFEDAQConfig::setParameters ( const std::map< std::string, std::string > &  my_keys_map)

Definition at line 92 of file ODFEDAQConfig.cc.

92  {
93  // parses the result of the XML parser that is a map of
94  // string string with variable name variable value
95 
96  for (std::map<std::string, std::string>::const_iterator ci = my_keys_map.begin(); ci != my_keys_map.end(); ci++) {
97  if (ci->first == "VERSION")
98  setVersion(atoi(ci->second.c_str()));
99  if (ci->first == "PED_ID")
100  setPedestalId(atoi(ci->second.c_str()));
101  if (ci->first == "DEL_ID")
102  setDelayId(atoi(ci->second.c_str()));
103  if (ci->first == "WEI_ID")
104  setWeightId(atoi(ci->second.c_str()));
105 
106  if (ci->first == "BXT_ID")
107  setBadXtId(atoi(ci->second.c_str()));
108  if (ci->first == "BTT_ID")
109  setBadTTId(atoi(ci->second.c_str()));
110  if (ci->first == "TRIG_BXT_ID")
111  setTriggerBadXtId(atoi(ci->second.c_str()));
112  if (ci->first == "TRIG_BTT_ID")
113  setTriggerBadTTId(atoi(ci->second.c_str()));
114 
115  if (ci->first == "COMMENT" || ci->first == "USER_COMMENT")
116  setComment(ci->second);
117  }
118 }

◆ setPedestalId()

void ODFEDAQConfig::setPedestalId ( int  x)
inline

Definition at line 26 of file ODFEDAQConfig.h.

26 { m_ped = x; }

References m_ped, and x.

◆ setTriggerBadTTId()

void ODFEDAQConfig::setTriggerBadTTId ( int  x)
inline

Definition at line 39 of file ODFEDAQConfig.h.

39 { m_tbtt = x; }

References m_tbtt, and x.

◆ setTriggerBadXtId()

void ODFEDAQConfig::setTriggerBadXtId ( int  x)
inline

Definition at line 37 of file ODFEDAQConfig.h.

37 { m_tbxt = x; }

References m_tbxt, and x.

◆ setVersion()

void ODFEDAQConfig::setVersion ( int  id)
inline

Definition at line 23 of file ODFEDAQConfig.h.

23 { m_version = id; }

References triggerObjects_cff::id, and m_version.

◆ setWeightId()

void ODFEDAQConfig::setWeightId ( int  x)
inline

Definition at line 30 of file ODFEDAQConfig.h.

30 { m_wei = x; }

References m_wei, and x.

◆ writeDB()

void ODFEDAQConfig::writeDB ( )
privatenoexcept

Definition at line 120 of file ODFEDAQConfig.cc.

120  {
121  this->checkConnection();
122  this->checkPrepare();
123 
124  try {
125  // number 1 is the id
126  m_writeStmt->setString(2, this->getConfigTag());
127  m_writeStmt->setInt(3, this->getVersion());
128  SET_INT(m_writeStmt, 4, this->getPedestalId());
129  SET_INT(m_writeStmt, 5, this->getDelayId());
130  SET_INT(m_writeStmt, 6, this->getWeightId());
131  SET_INT(m_writeStmt, 7, this->getBadXtId());
132  SET_INT(m_writeStmt, 8, this->getBadTTId());
134  SET_INT(m_writeStmt, 10, this->getTriggerBadTTId());
135 
136  m_writeStmt->setString(11, this->getComment());
137 
138  m_writeStmt->executeUpdate();
139 
140  } catch (SQLException& e) {
141  throw(std::runtime_error(std::string("ODFEDAQConfig::writeDB(): ") + e.getMessage()));
142  }
143  // Now get the ID
144  if (!this->fetchID()) {
145  throw(std::runtime_error("ODFEDAQConfig::writeDB: Failed to write"));
146  }
147 }

References MillePedeFileConverter_cfg::e, SET_INT, and AlCaHLTBitMon_QueryRunRegistry::string.

Friends And Related Function Documentation

◆ EcalCondDBInterface

friend class EcalCondDBInterface
friend

Definition at line 11 of file ODFEDAQConfig.h.

Member Data Documentation

◆ m_btt

int ODFEDAQConfig::m_btt
private

Definition at line 66 of file ODFEDAQConfig.h.

Referenced by getBadTTId(), and setBadTTId().

◆ m_bxt

int ODFEDAQConfig::m_bxt
private

Definition at line 65 of file ODFEDAQConfig.h.

Referenced by getBadXtId(), and setBadXtId().

◆ m_com

std::string ODFEDAQConfig::m_com
private

Definition at line 70 of file ODFEDAQConfig.h.

Referenced by getComment(), and setComment().

◆ m_del

int ODFEDAQConfig::m_del
private

Definition at line 62 of file ODFEDAQConfig.h.

Referenced by getDelayId(), and setDelayId().

◆ m_ID

int ODFEDAQConfig::m_ID
private

Definition at line 60 of file ODFEDAQConfig.h.

Referenced by getId(), and setId().

◆ m_ped

int ODFEDAQConfig::m_ped
private

Definition at line 61 of file ODFEDAQConfig.h.

Referenced by getPedestalId(), and setPedestalId().

◆ m_tbtt

int ODFEDAQConfig::m_tbtt
private

Definition at line 68 of file ODFEDAQConfig.h.

Referenced by getTriggerBadTTId(), and setTriggerBadTTId().

◆ m_tbxt

int ODFEDAQConfig::m_tbxt
private

Definition at line 67 of file ODFEDAQConfig.h.

Referenced by getTriggerBadXtId(), and setTriggerBadXtId().

◆ m_version

int ODFEDAQConfig::m_version
private

Definition at line 69 of file ODFEDAQConfig.h.

Referenced by getVersion(), and setVersion().

◆ m_wei

int ODFEDAQConfig::m_wei
private

Definition at line 63 of file ODFEDAQConfig.h.

Referenced by getWeightId(), and setWeightId().

ODFEDAQConfig::m_version
int m_version
Definition: ODFEDAQConfig.h:69
ODFEDAQConfig::getBadXtId
int getBadXtId() const
Definition: ODFEDAQConfig.h:34
ODFEDAQConfig::m_btt
int m_btt
Definition: ODFEDAQConfig.h:66
ODFEDAQConfig::fetchID
int fetchID() noexcept(false)
Definition: ODFEDAQConfig.cc:210
ODFEDAQConfig::getTriggerBadXtId
int getTriggerBadXtId() const
Definition: ODFEDAQConfig.h:38
ODFEDAQConfig::getTable
std::string getTable() override
Definition: ODFEDAQConfig.h:16
ODFEDAQConfig::setComment
void setComment(std::string x)
Definition: ODFEDAQConfig.h:42
IODConfig::Statement
oracle::occi::Statement Statement
Definition: IODConfig.h:21
gather_cfg.cout
cout
Definition: gather_cfg.py:144
getInt
int getInt(ResultSet *rset, int ipar)
Definition: ODFEDAQConfig.cc:26
ODFEDAQConfig::setTriggerBadXtId
void setTriggerBadXtId(int x)
Definition: ODFEDAQConfig.h:37
ODFEDAQConfig::m_del
int m_del
Definition: ODFEDAQConfig.h:62
DDAxes::x
ODFEDAQConfig::setBadXtId
void setBadXtId(int x)
Definition: ODFEDAQConfig.h:33
ODFEDAQConfig::setVersion
void setVersion(int id)
Definition: ODFEDAQConfig.h:23
IODConfig::SQLException
oracle::occi::SQLException SQLException
Definition: IODConfig.h:20
ODFEDAQConfig::getWeightId
int getWeightId() const
Definition: ODFEDAQConfig.h:31
ODFEDAQConfig::setTriggerBadTTId
void setTriggerBadTTId(int x)
Definition: ODFEDAQConfig.h:39
ODFEDAQConfig::getVersion
int getVersion() const
Definition: ODFEDAQConfig.h:24
IDBObject::m_conn
oracle::occi::Connection * m_conn
Definition: IDBObject.h:34
ODFEDAQConfig::getBadTTId
int getBadTTId() const
Definition: ODFEDAQConfig.h:36
ODFEDAQConfig::m_wei
int m_wei
Definition: ODFEDAQConfig.h:63
MY_NULL
#define MY_NULL
Definition: ODFEDAQConfig.cc:12
IODConfig::checkPrepare
void checkPrepare() noexcept(false)
Definition: IODConfig.h:36
ODFEDAQConfig::setWeightId
void setWeightId(int x)
Definition: ODFEDAQConfig.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
IODConfig::getConfigTag
std::string getConfigTag()
Definition: IODConfig.h:30
IDBObject::checkConnection
void checkConnection() const noexcept(false)
Definition: IDBObject.h:36
ODFEDAQConfig::clear
void clear()
Definition: ODFEDAQConfig.cc:38
IODConfig::m_readStmt
Statement * m_readStmt
Definition: IODConfig.h:34
ODFEDAQConfig::getComment
std::string getComment() const
Definition: ODFEDAQConfig.h:43
ODFEDAQConfig::m_ID
int m_ID
Definition: ODFEDAQConfig.h:60
ODFEDAQConfig::m_ped
int m_ped
Definition: ODFEDAQConfig.h:61
ODFEDAQConfig::m_tbtt
int m_tbtt
Definition: ODFEDAQConfig.h:68
ODFEDAQConfig::setPedestalId
void setPedestalId(int x)
Definition: ODFEDAQConfig.h:26
ODFEDAQConfig::getDelayId
int getDelayId() const
Definition: ODFEDAQConfig.h:29
ODFEDAQConfig::getPedestalId
int getPedestalId() const
Definition: ODFEDAQConfig.h:27
IODConfig::m_writeStmt
Statement * m_writeStmt
Definition: IODConfig.h:33
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
IODConfig::m_config_tag
std::string m_config_tag
Definition: IODConfig.h:25
ODFEDAQConfig::fetchNextId
int fetchNextId() noexcept(false)
Definition: ODFEDAQConfig.cc:54
ODFEDAQConfig::m_com
std::string m_com
Definition: ODFEDAQConfig.h:70
ODFEDAQConfig::getTriggerBadTTId
int getTriggerBadTTId() const
Definition: ODFEDAQConfig.h:40
ODFEDAQConfig::m_bxt
int m_bxt
Definition: ODFEDAQConfig.h:65
IDBObject::m_env
oracle::occi::Environment * m_env
Definition: IDBObject.h:33
mps_fire.result
result
Definition: mps_fire.py:311
ODFEDAQConfig::setBadTTId
void setBadTTId(int x)
Definition: ODFEDAQConfig.h:35
ODFEDAQConfig::m_tbxt
int m_tbxt
Definition: ODFEDAQConfig.h:67
SET_INT
#define SET_INT(statement, paramNum, paramVal)
Definition: ODFEDAQConfig.cc:13
ODFEDAQConfig::setDelayId
void setDelayId(int x)
Definition: ODFEDAQConfig.h:28
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37