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 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 9 of file L1TOMDSHelper.cc.

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

Definition at line 16 of file L1TOMDSHelper.cc.

16  {
17 
18  delete m_omdsReader;
19 
20 }
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 23 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().

23  {
24 
25  // Handeling inputs
26  m_oracleDB = iOracleDB;
27  m_pathCondDB = iPathCondDB;
28  error = NO_ERROR;
29 
30  // Initializing variables
31  bool SessionOpen = false;
32  bool out = false;
33 
36 
37  // Testing session
38  if(!m_omdsReader->dbSession().connectionString().empty()){SessionOpen = true;}
39 
40  // Defining output and error message if needed
41  if (SessionOpen){out = true;}
43 
44  return out;
45 
46 }
std::string m_oracleDB
Definition: L1TOMDSHelper.h:83
l1t::OMDSReader * m_omdsReader
Definition: L1TOMDSHelper.h:86
std::string connectionString()
Definition: Session.cc:224
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 338 of file L1TOMDSHelper.cc.

References MillePedeFileConverter_cfg::out.

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

Definition at line 152 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(), and l1t::OMDSReader::QueryResults::queryFailed().

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

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

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

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

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

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

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

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

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

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

Definition at line 104 of file L1TOMDSHelper.cc.

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

Definition at line 50 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().

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