27 m_oracleDB = iOracleDB;
28 m_pathCondDB = iPathCondDB;
32 bool SessionExists =
false;
33 bool SessionOpen =
false;
34 bool ConnectionExists =
false;
35 bool ConnectionOpen =
false;
39 m_omdsReader->connect(m_oracleDB,m_pathCondDB);
42 if(m_omdsReader->dbSession()){
44 if(m_omdsReader->dbSession()->isOpen()){SessionOpen =
true;}
48 if(m_omdsReader->dbConnection()){
49 ConnectionExists =
true;
50 if(m_omdsReader->dbSession()->isOpen()){ConnectionOpen =
true;}
54 if (SessionExists && SessionOpen && ConnectionExists && ConnectionOpen){out =
true;}
55 else if(!SessionExists || !ConnectionExists) {error = WARNING_DB_CONN_FAILED;}
65 map<string,WbMTriggerXSecFit>
out;
70 string qSchema =
"CMS_WBM";
73 vector<string> qStrings;
74 qStrings.push_back(
"BIT");
75 qStrings.push_back(
"NAME");
76 qStrings.push_back(
"PM1");
77 qStrings.push_back(
"P0");
78 qStrings.push_back(
"P1");
79 qStrings.push_back(
"P2");
83 if(paramResults.
queryFailed()){error = WARNING_DB_QUERY_FAILED;}
102 out[tBitName] = tFit;
113 return getWbMTriggerXsecFits(
"LEVEL1_ALGO_CROSS_SECTION",error);
118 return getWbMTriggerXsecFits(
"LEVEL1_TECH_CROSS_SECTION",error);
124 int nCollidingBunches = 0;
128 string rtlSchema =
"CMS_RUNTIME_LOGGER";
129 string table =
"FILL_INITLUMIPERBUNCH";
130 string atribute1 =
"LHCFILL";
133 vector<std::string> qStrings ;
134 qStrings.push_back(
"BUNCH");
135 qStrings.push_back(
"BEAM1CONFIG");
136 qStrings.push_back(
"BEAM2CONFIG");
138 l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
141 if(qResults.
queryFailed()){error = WARNING_DB_QUERY_FAILED;}
144 if(qResults.
numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
150 bool beam1config,beam2config;
155 if(beam1config && beam2config){nCollidingBunches++;}
160 return nCollidingBunches;
171 string rtlSchema =
"CMS_RUNTIME_LOGGER";
172 string table =
"FILL_INITLUMIPERBUNCH";
173 string atribute1 =
"LHCFILL";
176 vector<std::string> qStrings ;
177 qStrings.push_back(
"BUNCH");
178 qStrings.push_back(
"BEAM1CONFIG");
179 qStrings.push_back(
"BEAM2CONFIG");
181 l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
183 if(qResults.
queryFailed()){error = WARNING_DB_QUERY_FAILED;}
186 if(qResults.
numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
191 int nCollidingBunches = 0;
195 bool beam1config,beam2config;
200 if(beam1config){bConfig.
beam1.push_back(
true);}
201 else {bConfig.
beam1.push_back(
false);}
203 if(beam2config){bConfig.
beam2.push_back(
true);}
204 else {bConfig.
beam2.push_back(
false);}
206 if(beam1config && beam2config){nCollidingBunches++;}
222 vector<bool> BunchStructure;
226 string rtlSchema =
"CMS_RUNTIME_LOGGER";
227 string table =
"FILL_INITLUMIPERBUNCH";
228 string atribute1 =
"LHCFILL";
231 vector<std::string> qStrings ;
232 qStrings.push_back(
"BUNCH");
233 qStrings.push_back(
"BEAM1CONFIG");
234 qStrings.push_back(
"BEAM2CONFIG");
236 l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
238 if(qResults.
queryFailed()){error = WARNING_DB_QUERY_FAILED;}
241 if(qResults.
numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
246 bool beam1config,beam2config;
251 if(beam1config && beam2config){BunchStructure.push_back(
true);}
252 else {BunchStructure.push_back(
false);}
258 return BunchStructure;
265 vector<float> InitBunchLumi;
269 string rtlSchema =
"CMS_RUNTIME_LOGGER";
270 string table =
"FILL_INITLUMIPERBUNCH";
271 string atribute1 =
"LHCFILL";
274 vector<std::string> qStrings ;
275 qStrings.push_back(
"BUNCH");
276 qStrings.push_back(
"INITBUNCHLUMI");
278 l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
280 if(qResults.
queryFailed()){error = WARNING_DB_QUERY_FAILED;}
283 if(qResults.
numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
292 InitBunchLumi.push_back(initbunchlumi);
297 return InitBunchLumi;
304 vector<double> RelativeBunchLumi;
308 string rtlSchema =
"CMS_RUNTIME_LOGGER";
309 string table =
"FILL_INITLUMIPERBUNCH";
310 string atribute1 =
"LHCFILL";
313 vector<std::string> qStrings ;
314 qStrings.push_back(
"BUNCH");
315 qStrings.push_back(
"INITBUNCHLUMI");
317 l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
319 if(qResults.
queryFailed()){error = WARNING_DB_QUERY_FAILED;}
322 if(qResults.
numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
326 double InitTotalLumi = 0;
327 vector<float> InitBunchLumi;
335 InitTotalLumi += initbunchlumi;
336 InitBunchLumi.push_back(initbunchlumi);
340 for(
unsigned int i=0 ;
i<InitBunchLumi.size() ;
i++){
341 RelativeBunchLumi.push_back(InitBunchLumi[
i]/InitTotalLumi);
346 return RelativeBunchLumi;
356 case NO_ERROR: out =
"NO_ERROR";
break;
357 case WARNING_DB_CONN_FAILED: out =
"WARNING_DB_CONN_FAILED";
break;
358 case WARNING_DB_QUERY_FAILED: out =
"WARNING_DB_QUERY_FAILED";
break;
359 case WARNING_DB_INCORRECT_NBUNCHES: out =
"WARNING_DB_INCORRECT_NBUNCHES";
break;
360 default: out =
"UNKNOWN";
break;
std::vector< float > getInitBunchLumi(int lhcFillNumber, int &error)
bool connect(std::string iOracleDB, std::string iPathCondDB, int &error)
std::vector< bool > getBunchStructure(int lhcFillNumber, int &error)
std::map< std::string, WbMTriggerXSecFit > getWbMTechXsecFits(int &error)
BeamConfiguration getBeamConfiguration(int lhcFillNumber, int &error)
std::map< std::string, WbMTriggerXSecFit > getWbMTriggerXsecFits(std::string iTable, int &error)
bool fillVariableFromRow(const std::string &columnName, int rowNumber, T &outputVariable) const
int getNumberCollidingBunches(int lhcFillNumber, int &error)
std::map< std::string, WbMTriggerXSecFit > getWbMAlgoXsecFits(int &error)
std::vector< bool > beam2
std::string enumToStringError(int)
std::vector< bool > beam1
std::vector< double > getRelativeBunchLumi(int lhcFillNumber, int &error)