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;}
193 bool beam1config,beam2config;
198 if(beam1config){bConfig.
beam1.push_back(
true);}
199 else {bConfig.
beam1.push_back(
false);}
201 if(beam2config){bConfig.
beam2.push_back(
true);}
202 else {bConfig.
beam2.push_back(
false);}
216 vector<bool> BunchStructure;
220 string rtlSchema =
"CMS_RUNTIME_LOGGER";
221 string table =
"FILL_INITLUMIPERBUNCH";
222 string atribute1 =
"LHCFILL";
225 vector<std::string> qStrings ;
226 qStrings.push_back(
"BUNCH");
227 qStrings.push_back(
"BEAM1CONFIG");
228 qStrings.push_back(
"BEAM2CONFIG");
230 l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
232 if(qResults.
queryFailed()){error = WARNING_DB_QUERY_FAILED;}
235 if(qResults.
numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
240 bool beam1config,beam2config;
245 if(beam1config && beam2config){BunchStructure.push_back(
true);}
246 else {BunchStructure.push_back(
false);}
252 return BunchStructure;
259 vector<float> InitBunchLumi;
263 string rtlSchema =
"CMS_RUNTIME_LOGGER";
264 string table =
"FILL_INITLUMIPERBUNCH";
265 string atribute1 =
"LHCFILL";
268 vector<std::string> qStrings ;
269 qStrings.push_back(
"BUNCH");
270 qStrings.push_back(
"INITBUNCHLUMI");
272 l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
274 if(qResults.
queryFailed()){error = WARNING_DB_QUERY_FAILED;}
277 if(qResults.
numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
286 InitBunchLumi.push_back(initbunchlumi);
291 return InitBunchLumi;
298 vector<double> RelativeBunchLumi;
302 string rtlSchema =
"CMS_RUNTIME_LOGGER";
303 string table =
"FILL_INITLUMIPERBUNCH";
304 string atribute1 =
"LHCFILL";
307 vector<std::string> qStrings ;
308 qStrings.push_back(
"BUNCH");
309 qStrings.push_back(
"INITBUNCHLUMI");
311 l1t::OMDSReader::QueryResults qResults = m_omdsReader->basicQuery(qStrings,rtlSchema,table,atribute1,m_omdsReader->singleAttribute(lhcFillNumber));
313 if(qResults.
queryFailed()){error = WARNING_DB_QUERY_FAILED;}
316 if(qResults.
numberRows() != 3564){error = WARNING_DB_INCORRECT_NBUNCHES;}
320 double InitTotalLumi = 0;
321 vector<float> InitBunchLumi;
329 InitTotalLumi += initbunchlumi;
330 InitBunchLumi.push_back(initbunchlumi);
334 for(
unsigned int i=0 ;
i<InitBunchLumi.size() ;
i++){
335 RelativeBunchLumi.push_back(InitBunchLumi[
i]/InitTotalLumi);
340 return RelativeBunchLumi;
350 case NO_ERROR: out =
"NO_ERROR";
break;
351 case WARNING_DB_CONN_FAILED: out =
"WARNING_DB_CONN_FAILED";
break;
352 case WARNING_DB_QUERY_FAILED: out =
"WARNING_DB_QUERY_FAILED";
break;
353 case WARNING_DB_INCORRECT_NBUNCHES: out =
"WARNING_DB_INCORRECT_NBUNCHES";
break;
354 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)