CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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,
WbMTriggerXSecFit
getWbMAlgoXsecFits (int &error)
 
std::map< std::string,
WbMTriggerXSecFit
getWbMTechXsecFits (int &error)
 
std::map< std::string,
WbMTriggerXSecFit
getWbMTriggerXsecFits (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 52 of file L1TOMDSHelper.h.

Member Enumeration Documentation

Enumerator
NO_ERROR 
WARNING_DB_CONN_FAILED 
WARNING_DB_QUERY_FAILED 
WARNING_DB_INCORRECT_NBUNCHES 

Definition at line 56 of file L1TOMDSHelper.h.

Constructor & Destructor Documentation

L1TOMDSHelper::L1TOMDSHelper ( )

Definition at line 10 of file L1TOMDSHelper.cc.

10  {
11 
12  m_omdsReader = 0;
13 
14 }
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:86
L1TOMDSHelper::~L1TOMDSHelper ( )

Definition at line 17 of file L1TOMDSHelper.cc.

17  {
18 
19  delete m_omdsReader;
20 
21 }
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:86

Member Function Documentation

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

Definition at line 24 of file L1TOMDSHelper.cc.

References GenerateHcalLaserBadRunList::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(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::updateViewMenu().

24  {
25 
26  // Handeling inputs
27  m_oracleDB = iOracleDB;
28  m_pathCondDB = iPathCondDB;
29  error = NO_ERROR;
30 
31  // Initializing variables
32  bool SessionOpen = false;
33  bool out = false;
34 
37 
38  // Testing session
39  if(!m_omdsReader->dbSession().connectionString().empty()){SessionOpen = true;}
40 
41  // Defining output and error message if needed
42  if (SessionOpen){out = true;}
44 
45  return out;
46 
47 }
std::string m_oracleDB
Definition: L1TOMDSHelper.h:83
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:86
std::string connectionString()
Definition: Session.cc:203
void connect(const std::string &connectString, const std::string &authenticationPath)
Definition: OMDSReader.cc:49
std::string m_pathCondDB
Definition: L1TOMDSHelper.h:84
cond::persistency::Session dbSession()
Definition: DataManager.h:32
string L1TOMDSHelper::enumToStringError ( int  iObject)

Definition at line 339 of file L1TOMDSHelper.cc.

References GenerateHcalLaserBadRunList::out.

339  {
340 
341  string out;
342 
343  switch(iObject){
344  case NO_ERROR: out = "NO_ERROR"; break;
345  case WARNING_DB_CONN_FAILED: out = "WARNING_DB_CONN_FAILED"; break;
346  case WARNING_DB_QUERY_FAILED: out = "WARNING_DB_QUERY_FAILED"; break;
347  case WARNING_DB_INCORRECT_NBUNCHES: out = "WARNING_DB_INCORRECT_NBUNCHES"; break;
348  default: out = "UNKNOWN"; break;
349  };
350 
351  return out;
352 
353 }
BeamConfiguration L1TOMDSHelper::getBeamConfiguration ( int  lhcFillNumber,
int &  error 
)

Definition at line 153 of file L1TOMDSHelper.cc.

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

153  {
154 
155  BeamConfiguration bConfig;
156  error = NO_ERROR;
157 
158  // Fields to retrive in the query
159  string rtlSchema = "CMS_RUNTIME_LOGGER";
160  string table = "FILL_INITLUMIPERBUNCH";
161  string atribute1 = "LHCFILL";
162 
163  // Setting the strings we want to recover from OMDS
164  vector<std::string> qStrings ;
165  qStrings.push_back("BUNCH");
166  qStrings.push_back("BEAM1CONFIG");
167  qStrings.push_back("BEAM2CONFIG");
168 
169  l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
170 
171  if(qResults.queryFailed()){error = WARNING_DB_QUERY_FAILED;}
172  else{
173 
174  if(qResults.numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
175  else{
176 
177  bConfig.m_valid = true;
178 
179  int nCollidingBunches = 0;
180 
181  for(int i=0; i<qResults.numberRows();++i){
182  int bunch;
183  bool beam1config,beam2config;
184  qResults.fillVariableFromRow("BUNCH" ,i,bunch);
185  qResults.fillVariableFromRow("BEAM1CONFIG",i,beam1config);
186  qResults.fillVariableFromRow("BEAM2CONFIG",i,beam2config);
187 
188  if(beam1config){bConfig.beam1.push_back(true);}
189  else {bConfig.beam1.push_back(false);}
190 
191  if(beam2config){bConfig.beam2.push_back(true);}
192  else {bConfig.beam2.push_back(false);}
193 
194  if(beam1config && beam2config){nCollidingBunches++;}
195  }
196 
197  bConfig.nCollidingBunches = nCollidingBunches;
198 
199  }
200  }
201 
202  return bConfig;
203 
204 }
int i
Definition: DBlmapReader.cc:9
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:296
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:86
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:320
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:86
std::vector< bool > beam2
Definition: L1TOMDSHelper.h:38
std::vector< bool > beam1
Definition: L1TOMDSHelper.h:37
vector< bool > L1TOMDSHelper::getBunchStructure ( int  lhcFillNumber,
int &  error 
)

Definition at line 208 of file L1TOMDSHelper.cc.

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

208  {
209 
210  vector<bool> BunchStructure;
211  error = NO_ERROR;
212 
213  // Fields to retrive in the query
214  string rtlSchema = "CMS_RUNTIME_LOGGER";
215  string table = "FILL_INITLUMIPERBUNCH";
216  string atribute1 = "LHCFILL";
217 
218  // Setting the strings we want to recover from OMDS
219  vector<std::string> qStrings ;
220  qStrings.push_back("BUNCH");
221  qStrings.push_back("BEAM1CONFIG");
222  qStrings.push_back("BEAM2CONFIG");
223 
224  l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
225 
226  if(qResults.queryFailed()){error = WARNING_DB_QUERY_FAILED;}
227  else{
228 
229  if(qResults.numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
230  else{
231 
232  for(int i=0; i<qResults.numberRows();++i){
233  int bunch;
234  bool beam1config,beam2config;
235  qResults.fillVariableFromRow("BUNCH" ,i,bunch);
236  qResults.fillVariableFromRow("BEAM1CONFIG",i,beam1config);
237  qResults.fillVariableFromRow("BEAM2CONFIG",i,beam2config);
238 
239  if(beam1config && beam2config){BunchStructure.push_back(true);}
240  else {BunchStructure.push_back(false);}
241 
242  }
243  }
244  }
245 
246  return BunchStructure;
247 
248 }
int i
Definition: DBlmapReader.cc:9
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:296
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:86
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:320
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:86
vector< float > L1TOMDSHelper::getInitBunchLumi ( int  lhcFillNumber,
int &  error 
)

Definition at line 251 of file L1TOMDSHelper.cc.

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

251  {
252 
253  vector<float> InitBunchLumi;
254  error = NO_ERROR;
255 
256  // Fields to retrive in the query
257  string rtlSchema = "CMS_RUNTIME_LOGGER";
258  string table = "FILL_INITLUMIPERBUNCH";
259  string atribute1 = "LHCFILL";
260 
261  // Setting the strings we want to recover from OMDS
262  vector<std::string> qStrings ;
263  qStrings.push_back("BUNCH");
264  qStrings.push_back("INITBUNCHLUMI");
265 
266  l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
267 
268  if(qResults.queryFailed()){error = WARNING_DB_QUERY_FAILED;}
269  else{
270 
271  if(qResults.numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
272  else{
273 
274  for(int i=0; i<qResults.numberRows();++i){
275  int bunch;
276  float initbunchlumi;
277  qResults.fillVariableFromRow("BUNCH" ,i,bunch);
278  qResults.fillVariableFromRow("INITBUNCHLUMI",i,initbunchlumi);
279 
280  InitBunchLumi.push_back(initbunchlumi);
281  }
282  }
283  }
284 
285  return InitBunchLumi;
286 
287 }
int i
Definition: DBlmapReader.cc:9
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:296
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:86
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:320
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:86
int L1TOMDSHelper::getNumberCollidingBunches ( int  lhcFillNumber,
int &  error 
)

Definition at line 110 of file L1TOMDSHelper.cc.

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

110  {
111 
112  int nCollidingBunches = 0;
113  error = NO_ERROR;
114 
115  // Parameters
116  string rtlSchema = "CMS_RUNTIME_LOGGER";
117  string table = "FILL_INITLUMIPERBUNCH";
118  string atribute1 = "LHCFILL";
119 
120  // Fields to retrive in the query
121  vector<std::string> qStrings ;
122  qStrings.push_back("BUNCH");
123  qStrings.push_back("BEAM1CONFIG");
124  qStrings.push_back("BEAM2CONFIG");
125 
126  l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
127 
128  // Check query successful
129  if(qResults.queryFailed()){error = WARNING_DB_QUERY_FAILED;}
130  else{
131 
132  if(qResults.numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
133  else{
134 
135  // Now we count the number of bunches with both beam 1 and 2 configured
136  for(int i=0; i<qResults.numberRows();++i){
137  int bunch;
138  bool beam1config,beam2config;
139  qResults.fillVariableFromRow("BUNCH" ,i,bunch);
140  qResults.fillVariableFromRow("BEAM1CONFIG" ,i,beam1config);
141  qResults.fillVariableFromRow("BEAM2CONFIG" ,i,beam2config);
142 
143  if(beam1config && beam2config){nCollidingBunches++;}
144  }
145  }
146  }
147 
148  return nCollidingBunches;
149 
150 }
int i
Definition: DBlmapReader.cc:9
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:296
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:86
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:320
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:86
vector< double > L1TOMDSHelper::getRelativeBunchLumi ( int  lhcFillNumber,
int &  error 
)

Definition at line 290 of file L1TOMDSHelper.cc.

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

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

Definition at line 100 of file L1TOMDSHelper.cc.

100  {
101  return getWbMTriggerXsecFits("LEVEL1_ALGO_CROSS_SECTION",error);
102 }
std::map< std::string, WbMTriggerXSecFit > getWbMTriggerXsecFits(std::string iTable, int &error)
map< string, WbMTriggerXSecFit > L1TOMDSHelper::getWbMTechXsecFits ( int &  error)

Definition at line 105 of file L1TOMDSHelper.cc.

105  {
106  return getWbMTriggerXsecFits("LEVEL1_TECH_CROSS_SECTION",error);
107 }
std::map< std::string, WbMTriggerXSecFit > getWbMTriggerXsecFits(std::string iTable, int &error)
map< string, WbMTriggerXSecFit > L1TOMDSHelper::getWbMTriggerXsecFits ( std::string  iTable,
int &  error 
)

Definition at line 51 of file L1TOMDSHelper.cc.

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

51  {
52 
53  map<string,WbMTriggerXSecFit> out;
54  const l1t::OMDSReader::QueryResults qresults;
55  error = NO_ERROR;
56 
57  // Parameters
58  string qSchema = "CMS_WBM";
59 
60  // Fields to retrive in the query
61  vector<string> qStrings;
62  qStrings.push_back("BIT");
63  qStrings.push_back("NAME");
64  qStrings.push_back("PM1"); //Inverse
65  qStrings.push_back("P0"); //Constant
66  qStrings.push_back("P1"); //Linear
67  qStrings.push_back("P2"); //Quadratic
68 
69  l1t::OMDSReader::QueryResults paramResults = m_omdsReader->basicQuery(qStrings,qSchema,iTable,"",qresults);
70 
71  if(paramResults.queryFailed()){error = WARNING_DB_QUERY_FAILED;}
72  else{
73 
74  for(int i=0; i<paramResults.numberRows();++i){
75 
76  WbMTriggerXSecFit tFit;
77  tFit.fitFunction = "[0]/x+[1]+[2]*x+[3]*x*x"; // Fitting function hardcoded for now
78 
79  string tBitName;
80 
81  paramResults.fillVariableFromRow("BIT" ,i,tFit.bitNumber);
82  paramResults.fillVariableFromRow("NAME",i,tBitName);
83  paramResults.fillVariableFromRow("PM1" ,i,tFit.pm1);
84  paramResults.fillVariableFromRow("P0" ,i,tFit.p0);
85  paramResults.fillVariableFromRow("P1" ,i,tFit.p1);
86  paramResults.fillVariableFromRow("P2" ,i,tFit.p2);
87 
88  tFit.bitName = tBitName;
89 
90  out[tBitName] = tFit;
91 
92  }
93  }
94 
95  return out;
96 
97 }
int i
Definition: DBlmapReader.cc:9
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:86
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
Definition: OMDSReader.h:320
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:86

Member Data Documentation

l1t::OMDSReader* L1TOMDSHelper::m_omdsReader
private

Definition at line 86 of file L1TOMDSHelper.h.

std::string L1TOMDSHelper::m_oracleDB
private

Definition at line 83 of file L1TOMDSHelper.h.

std::string L1TOMDSHelper::m_pathCondDB
private

Definition at line 84 of file L1TOMDSHelper.h.