CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
L1TOMDSHelper Class Reference

#include <L1TOMDSHelper.h>

Public Types

enum  Error { NO_ERROR = 0, WARNING_DB_CONN_FAILED, WARNING_DB_QUERY_FAILED, WARNING_DB_INCORRECT_NBUNCHES }
 

Public Member Functions

bool connect (std::string iOracleDB, std::string iPathCondDB, int &error)
 
std::string enumToStringError (int)
 
BeamConfiguration getBeamConfiguration (int lhcFillNumber, int &error)
 
std::vector< bool > getBunchStructure (int lhcFillNumber, int &error)
 
std::vector< float > getInitBunchLumi (int lhcFillNumber, int &error)
 
int getNumberCollidingBunches (int lhcFillNumber, int &error)
 
std::vector< double > getRelativeBunchLumi (int lhcFillNumber, int &error)
 
std::map< std::string, WbMTriggerXSecFitgetWbMAlgoXsecFits (int &error)
 
std::map< std::string, WbMTriggerXSecFitgetWbMTechXsecFits (int &error)
 
std::map< std::string, WbMTriggerXSecFitgetWbMTriggerXsecFits (std::string iTable, int &error)
 
 L1TOMDSHelper ()
 
 ~L1TOMDSHelper ()
 

Private Attributes

l1t::OMDSReaderm_omdsReader
 
std::string m_oracleDB
 
std::string m_pathCondDB
 

Detailed Description

Definition at line 50 of file L1TOMDSHelper.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

L1TOMDSHelper::L1TOMDSHelper ( )

Definition at line 9 of file L1TOMDSHelper.cc.

9 { m_omdsReader = nullptr; }
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:74
L1TOMDSHelper::~L1TOMDSHelper ( )

Definition at line 12 of file L1TOMDSHelper.cc.

12 { delete m_omdsReader; }
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:74

Member Function Documentation

bool L1TOMDSHelper::connect ( std::string  iOracleDB,
std::string  iPathCondDB,
int &  error 
)

Definition at line 15 of file L1TOMDSHelper.cc.

References MillePedeFileConverter_cfg::out.

Referenced by Vispa.Gui.ZoomableScrollArea.ZoomableScrollArea::__init__(), Vispa.Views.PropertyView.BooleanProperty::__init__(), Vispa.Gui.FindDialog.FindDialog::_addScript(), Vispa.Gui.FindDialog.FindDialog::_addStringProperty(), Vispa.Main.Application.Application::_connectSignals(), Vispa.Plugins.ConfigEditor.CodeTableView.CodeTableView::_createItem(), Vispa.Gui.BoxContentDialog.BoxContentDialog::addButton(), Vispa.Gui.ToolBoxContainer.ToolBoxContainer::addWidget(), Vispa.Views.PropertyView.PropertyView::append(), Vispa.Views.PropertyView.PropertyView::appendAddRow(), Vispa.Main.Application.Application::createAction(), Vispa.Views.PropertyView.TextEditWithButtonProperty::createButton(), Vispa.Views.LineDecayView.LineDecayView::createLineDecayContainer(), Vispa.Views.PropertyView.TextEditWithButtonProperty::createLineEdit(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.PropertyView.TextEditWithButtonProperty::createTextEdit(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filterDialog(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), L1TRate::getXSexFitsOMDS(), Vispa.Gui.PortWidget.PortWidget::mouseMoveEvent(), Vispa.Views.PropertyView.BooleanProperty::setChecked(), Vispa.Main.SplitterTab.SplitterTab::setController(), Vispa.Plugins.Browser.BrowserTab.BrowserTab::setController(), Vispa.Views.PropertyView.BooleanProperty::setReadOnly(), Vispa.Views.PropertyView.DropDownProperty::setReadOnly(), Vispa.Views.PropertyView.TextEditWithButtonProperty::setReadOnly(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setTab(), Vispa.Views.PropertyView.IntegerProperty::setValue(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView(), o2o_db_cfgmap.DbManagerDAQ::update_hashmap(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::updateViewMenu().

15  {
16  // Handeling inputs
17  m_oracleDB = iOracleDB;
18  m_pathCondDB = iPathCondDB;
19  error = NO_ERROR;
20 
21  // Initializing variables
22  bool SessionOpen = false;
23  bool out = false;
24 
27 
28  // Testing session
29  if (!m_omdsReader->dbSession().connectionString().empty()) {
30  SessionOpen = true;
31  }
32 
33  // Defining output and error message if needed
34  if (SessionOpen) {
35  out = true;
36  } else {
38  }
39 
40  return out;
41 }
std::string m_oracleDB
Definition: L1TOMDSHelper.h:71
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:74
std::string connectionString()
Definition: Session.cc:216
void connect(const std::string &connectString, const std::string &authenticationPath)
Definition: OMDSReader.cc:43
std::string m_pathCondDB
Definition: L1TOMDSHelper.h:72
cond::persistency::Session dbSession()
Definition: DataManager.h:26
string L1TOMDSHelper::enumToStringError ( int  iObject)

Definition at line 333 of file L1TOMDSHelper.cc.

References MillePedeFileConverter_cfg::out.

333  {
334  string out;
335 
336  switch (iObject) {
337  case NO_ERROR:
338  out = "NO_ERROR";
339  break;
341  out = "WARNING_DB_CONN_FAILED";
342  break;
344  out = "WARNING_DB_QUERY_FAILED";
345  break;
347  out = "WARNING_DB_INCORRECT_NBUNCHES";
348  break;
349  default:
350  out = "UNKNOWN";
351  break;
352  };
353 
354  return out;
355 }
BeamConfiguration L1TOMDSHelper::getBeamConfiguration ( int  lhcFillNumber,
int &  error 
)

Definition at line 143 of file L1TOMDSHelper.cc.

References BeamConfiguration::beam1, BeamConfiguration::beam2, l1t::OMDSReader::QueryResults::fillVariableFromRow(), mps_fire::i, BeamConfiguration::m_valid, BeamConfiguration::nCollidingBunches, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), and TableParser::table.

143  {
144  BeamConfiguration bConfig;
145  error = NO_ERROR;
146 
147  // Fields to retrive in the query
148  string rtlSchema = "CMS_RUNTIME_LOGGER";
149  string table = "FILL_INITLUMIPERBUNCH";
150  string atribute1 = "LHCFILL";
151 
152  // Setting the strings we want to recover from OMDS
153  vector<std::string> qStrings;
154  qStrings.push_back("BUNCH");
155  qStrings.push_back("BEAM1CONFIG");
156  qStrings.push_back("BEAM2CONFIG");
157 
159  m_omdsReader->basicQuery(qStrings, rtlSchema, table, atribute1, m_omdsReader->singleAttribute(lhcFillNumber));
160 
161  if (qResults.queryFailed()) {
163  } else {
164  if (qResults.numberRows() != 3564) {
166  } else {
167  bConfig.m_valid = true;
168 
169  int nCollidingBunches = 0;
170 
171  for (int i = 0; i < qResults.numberRows(); ++i) {
172  int bunch;
173  bool beam1config, beam2config;
174  qResults.fillVariableFromRow("BUNCH", i, bunch);
175  qResults.fillVariableFromRow("BEAM1CONFIG", i, beam1config);
176  qResults.fillVariableFromRow("BEAM2CONFIG", i, beam2config);
177 
178  if (beam1config) {
179  bConfig.beam1.push_back(true);
180  } else {
181  bConfig.beam1.push_back(false);
182  }
183 
184  if (beam2config) {
185  bConfig.beam2.push_back(true);
186  } else {
187  bConfig.beam2.push_back(false);
188  }
189 
190  if (beam1config && beam2config) {
191  nCollidingBunches++;
192  }
193  }
194 
195  bConfig.nCollidingBunches = nCollidingBunches;
196  }
197  }
198 
199  return bConfig;
200 }
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:74
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:279
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:75
std::vector< bool > beam2
Definition: L1TOMDSHelper.h:39
std::vector< bool > beam1
Definition: L1TOMDSHelper.h:38
vector< bool > L1TOMDSHelper::getBunchStructure ( int  lhcFillNumber,
int &  error 
)

Definition at line 203 of file L1TOMDSHelper.cc.

References l1t::OMDSReader::QueryResults::fillVariableFromRow(), mps_fire::i, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), and TableParser::table.

203  {
204  vector<bool> BunchStructure;
205  error = NO_ERROR;
206 
207  // Fields to retrive in the query
208  string rtlSchema = "CMS_RUNTIME_LOGGER";
209  string table = "FILL_INITLUMIPERBUNCH";
210  string atribute1 = "LHCFILL";
211 
212  // Setting the strings we want to recover from OMDS
213  vector<std::string> qStrings;
214  qStrings.push_back("BUNCH");
215  qStrings.push_back("BEAM1CONFIG");
216  qStrings.push_back("BEAM2CONFIG");
217 
219  m_omdsReader->basicQuery(qStrings, rtlSchema, table, atribute1, m_omdsReader->singleAttribute(lhcFillNumber));
220 
221  if (qResults.queryFailed()) {
223  } else {
224  if (qResults.numberRows() != 3564) {
226  } else {
227  for (int i = 0; i < qResults.numberRows(); ++i) {
228  int bunch;
229  bool beam1config, beam2config;
230  qResults.fillVariableFromRow("BUNCH", i, bunch);
231  qResults.fillVariableFromRow("BEAM1CONFIG", i, beam1config);
232  qResults.fillVariableFromRow("BEAM2CONFIG", i, beam2config);
233 
234  if (beam1config && beam2config) {
235  BunchStructure.push_back(true);
236  } else {
237  BunchStructure.push_back(false);
238  }
239  }
240  }
241  }
242 
243  return BunchStructure;
244 }
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:74
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:279
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:75
vector< float > L1TOMDSHelper::getInitBunchLumi ( int  lhcFillNumber,
int &  error 
)

Definition at line 247 of file L1TOMDSHelper.cc.

References l1t::OMDSReader::QueryResults::fillVariableFromRow(), mps_fire::i, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), and TableParser::table.

247  {
248  vector<float> InitBunchLumi;
249  error = NO_ERROR;
250 
251  // Fields to retrive in the query
252  string rtlSchema = "CMS_RUNTIME_LOGGER";
253  string table = "FILL_INITLUMIPERBUNCH";
254  string atribute1 = "LHCFILL";
255 
256  // Setting the strings we want to recover from OMDS
257  vector<std::string> qStrings;
258  qStrings.push_back("BUNCH");
259  qStrings.push_back("INITBUNCHLUMI");
260 
262  m_omdsReader->basicQuery(qStrings, rtlSchema, table, atribute1, m_omdsReader->singleAttribute(lhcFillNumber));
263 
264  if (qResults.queryFailed()) {
266  } else {
267  if (qResults.numberRows() != 3564) {
269  } else {
270  for (int i = 0; i < qResults.numberRows(); ++i) {
271  int bunch;
272  float initbunchlumi;
273  qResults.fillVariableFromRow("BUNCH", i, bunch);
274  qResults.fillVariableFromRow("INITBUNCHLUMI", i, initbunchlumi);
275 
276  InitBunchLumi.push_back(initbunchlumi);
277  }
278  }
279  }
280 
281  return InitBunchLumi;
282 }
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:74
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:279
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:75
int L1TOMDSHelper::getNumberCollidingBunches ( int  lhcFillNumber,
int &  error 
)

Definition at line 99 of file L1TOMDSHelper.cc.

References l1t::OMDSReader::QueryResults::fillVariableFromRow(), mps_fire::i, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), and TableParser::table.

99  {
100  int nCollidingBunches = 0;
101  error = NO_ERROR;
102 
103  // Parameters
104  string rtlSchema = "CMS_RUNTIME_LOGGER";
105  string table = "FILL_INITLUMIPERBUNCH";
106  string atribute1 = "LHCFILL";
107 
108  // Fields to retrive in the query
109  vector<std::string> qStrings;
110  qStrings.push_back("BUNCH");
111  qStrings.push_back("BEAM1CONFIG");
112  qStrings.push_back("BEAM2CONFIG");
113 
115  m_omdsReader->basicQuery(qStrings, rtlSchema, table, atribute1, m_omdsReader->singleAttribute(lhcFillNumber));
116 
117  // Check query successful
118  if (qResults.queryFailed()) {
120  } else {
121  if (qResults.numberRows() != 3564) {
123  } else {
124  // Now we count the number of bunches with both beam 1 and 2 configured
125  for (int i = 0; i < qResults.numberRows(); ++i) {
126  int bunch;
127  bool beam1config, beam2config;
128  qResults.fillVariableFromRow("BUNCH", i, bunch);
129  qResults.fillVariableFromRow("BEAM1CONFIG", i, beam1config);
130  qResults.fillVariableFromRow("BEAM2CONFIG", i, beam2config);
131 
132  if (beam1config && beam2config) {
133  nCollidingBunches++;
134  }
135  }
136  }
137  }
138 
139  return nCollidingBunches;
140 }
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:74
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:279
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:75
vector< double > L1TOMDSHelper::getRelativeBunchLumi ( int  lhcFillNumber,
int &  error 
)

Definition at line 285 of file L1TOMDSHelper.cc.

References l1t::OMDSReader::QueryResults::fillVariableFromRow(), mps_fire::i, l1t::OMDSReader::QueryResults::numberRows(), l1t::OMDSReader::QueryResults::queryFailed(), and TableParser::table.

285  {
286  vector<double> RelativeBunchLumi;
287  error = NO_ERROR;
288 
289  // Fields to retrive in the query
290  string rtlSchema = "CMS_RUNTIME_LOGGER";
291  string table = "FILL_INITLUMIPERBUNCH";
292  string atribute1 = "LHCFILL";
293 
294  // Setting the strings we want to recover from OMDS
295  vector<std::string> qStrings;
296  qStrings.push_back("BUNCH");
297  qStrings.push_back("INITBUNCHLUMI");
298 
300  m_omdsReader->basicQuery(qStrings, rtlSchema, table, atribute1, m_omdsReader->singleAttribute(lhcFillNumber));
301 
302  if (qResults.queryFailed()) {
304  } else {
305  if (qResults.numberRows() != 3564) {
307  } else {
308  //-> Get the inicial bunch luminosity add calculate the total luminosity of the fill
309  double InitTotalLumi = 0;
310  vector<float> InitBunchLumi;
311 
312  for (int i = 0; i < qResults.numberRows(); ++i) {
313  int bunch;
314  float initbunchlumi;
315  qResults.fillVariableFromRow("BUNCH", i, bunch);
316  qResults.fillVariableFromRow("INITBUNCHLUMI", i, initbunchlumi);
317 
318  InitTotalLumi += initbunchlumi;
319  InitBunchLumi.push_back(initbunchlumi);
320  }
321 
322  //-> We calculate the relative luminosity for each bunch
323  for (unsigned int i = 0; i < InitBunchLumi.size(); i++) {
324  RelativeBunchLumi.push_back(InitBunchLumi[i] / InitTotalLumi);
325  }
326  }
327  }
328 
329  return RelativeBunchLumi;
330 }
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:74
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:279
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:75
map< string, WbMTriggerXSecFit > L1TOMDSHelper::getWbMAlgoXsecFits ( int &  error)

Definition at line 89 of file L1TOMDSHelper.cc.

89  {
90  return getWbMTriggerXsecFits("LEVEL1_ALGO_CROSS_SECTION", error);
91 }
std::map< std::string, WbMTriggerXSecFit > getWbMTriggerXsecFits(std::string iTable, int &error)
map< string, WbMTriggerXSecFit > L1TOMDSHelper::getWbMTechXsecFits ( int &  error)

Definition at line 94 of file L1TOMDSHelper.cc.

94  {
95  return getWbMTriggerXsecFits("LEVEL1_TECH_CROSS_SECTION", error);
96 }
std::map< std::string, WbMTriggerXSecFit > getWbMTriggerXsecFits(std::string iTable, int &error)
map< string, WbMTriggerXSecFit > L1TOMDSHelper::getWbMTriggerXsecFits ( std::string  iTable,
int &  error 
)

Definition at line 44 of file L1TOMDSHelper.cc.

References WbMTriggerXSecFit::bitName, WbMTriggerXSecFit::bitNumber, l1t::OMDSReader::QueryResults::fillVariableFromRow(), WbMTriggerXSecFit::fitFunction, mps_fire::i, l1t::OMDSReader::QueryResults::numberRows(), MillePedeFileConverter_cfg::out, WbMTriggerXSecFit::p0, WbMTriggerXSecFit::p1, WbMTriggerXSecFit::p2, WbMTriggerXSecFit::pm1, and l1t::OMDSReader::QueryResults::queryFailed().

44  {
45  map<string, WbMTriggerXSecFit> out;
46  const l1t::OMDSReader::QueryResults qresults;
47  error = NO_ERROR;
48 
49  // Parameters
50  string qSchema = "CMS_WBM";
51 
52  // Fields to retrive in the query
53  vector<string> qStrings;
54  qStrings.push_back("BIT");
55  qStrings.push_back("NAME");
56  qStrings.push_back("PM1"); //Inverse
57  qStrings.push_back("P0"); //Constant
58  qStrings.push_back("P1"); //Linear
59  qStrings.push_back("P2"); //Quadratic
60 
61  l1t::OMDSReader::QueryResults paramResults = m_omdsReader->basicQuery(qStrings, qSchema, iTable, "", qresults);
62 
63  if (paramResults.queryFailed()) {
65  } else {
66  for (int i = 0; i < paramResults.numberRows(); ++i) {
67  WbMTriggerXSecFit tFit;
68  tFit.fitFunction = "[0]/x+[1]+[2]*x+[3]*x*x"; // Fitting function hardcoded for now
69 
70  string tBitName;
71 
72  paramResults.fillVariableFromRow("BIT", i, tFit.bitNumber);
73  paramResults.fillVariableFromRow("NAME", i, tBitName);
74  paramResults.fillVariableFromRow("PM1", i, tFit.pm1);
75  paramResults.fillVariableFromRow("P0", i, tFit.p0);
76  paramResults.fillVariableFromRow("P1", i, tFit.p1);
77  paramResults.fillVariableFromRow("P2", i, tFit.p2);
78 
79  tFit.bitName = tBitName;
80 
81  out[tBitName] = tFit;
82  }
83  }
84 
85  return out;
86 }
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:74
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:279
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:75

Member Data Documentation

l1t::OMDSReader* L1TOMDSHelper::m_omdsReader
private

Definition at line 74 of file L1TOMDSHelper.h.

std::string L1TOMDSHelper::m_oracleDB
private

Definition at line 71 of file L1TOMDSHelper.h.

std::string L1TOMDSHelper::m_pathCondDB
private

Definition at line 72 of file L1TOMDSHelper.h.