28 std::cout <<
"------- Ecal - > getNewObjects\n";
30 std::ostringstream
ss;
33 unsigned int max_since = 0;
35 std::cout <<
"max_since : " << max_since << std::endl;
36 bool magnet_high =
false;
37 bool something_to_transfer =
false;
43 std::cout <<
"retrieved last payload " << std::endl;
60 float the_value_low_ee = 0.0590975;
61 if (adc_ee > the_value_low_ee)
65 something_to_transfer =
true;
68 std::cout <<
"Connecting to ONLINE DB ... " << std::endl;
70 std::cout <<
"Connection done" << std::endl;
72 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
73 std::map<EcalLogicID, RunDat> rundat;
75 run_t runmax = 10000000;
79 unsigned long long irun = (
unsigned long long)rp.
getRunNumber();
81 std::cout <<
"retrieved run number " << irun << std::endl;
83 if (irun > max_since) {
87 std::map<EcalLogicID, RunDCSMagnetDat>
dataset;
92 throw(std::runtime_error(
"Zero rows read back"));
94 std::cout <<
"retrieved magnet current" << std::endl;
99 std::map<EcalLogicID, RunDCSMagnetDat>::iterator it;
107 if (mag_cur > 7000. && magnet_high) {
108 std::cout <<
" the magnet is ON and the constants are for magnet ON " << std::endl;
110 }
else if (mag_cur > 7000. && !magnet_high) {
111 something_to_transfer =
true;
112 std::cout <<
" the magnet is ON and the constants are for magnet OFF " << std::endl;
113 std::cout <<
" I transfer the ON constants " << std::endl;
116 }
else if (mag_cur < 6000. && magnet_high) {
117 something_to_transfer =
true;
118 std::cout <<
" the magnet is OFF and the constants are for magnet ON " << std::endl;
119 std::cout <<
" I transfer the OFF constants " << std::endl;
122 }
else if (mag_cur < 6000. && !magnet_high) {
123 std::cout <<
" the magnet is OFF and the constants are for magnet OFF " << std::endl;
127 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient " << std::endl;
131 std::cout <<
" first payload, the magnet is ON " << std::endl;
132 else if (mag_cur < 6000.) {
133 std::cout <<
" first payload, the magnet is OFF " << std::endl;
136 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient " << std::endl;
139 if (something_to_transfer) {
140 std::cout <<
"Generating popcon record for run " << irun <<
" going to open file " << file_ <<
"\n" 147 fxml.open(file_.c_str());
150 for (
int il = 0; il < 4; il++) {
151 std::getline(fxml,
line);
154 for (
int iPart = 0; iPart < 2; iPart++) {
156 std::size_t
begin = bid.find_first_of(
'>');
157 std::size_t
end = bid.find_last_of(
'<');
160 std::size_t endmantissa = str2.find(
'e');
161 std::string mantissa = str2.substr(0, endmantissa);
162 std::size_t string_size = str2.size();
164 std::istringstream is(mantissa);
170 std::cout <<
" Partition " << iPart <<
" ADCToGeV " <<
val <<
"\n";
180 ss <<
"Run=" << irun <<
"_Magnet_changed_" << std::endl;
183 std::cout <<
"Run " << irun <<
" nothing sent to the DB" << std::endl;
184 ss <<
"Run=" << irun <<
"_Magnet_NOT_changed_" << std::endl;
191 std::cout <<
"Run " << irun <<
" nothing sent to the DB" << std::endl;
192 ss <<
"Run=" << irun <<
"_no_new_runs_" << std::endl;
195 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
std::string m_userTextLog
float getMagnetCurrent() const
run_t getRunNumber() const
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
cond::TagInfo_t const & tagInfo() const
std::string m_file_highfield
std::string m_file_lowfield
std::unique_ptr< EcalADCToGeVConstant > Ref
void fetchValidDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *fillIOV, RunTag *tag, run_t run=(unsigned int) -1) noexcept(false)
EcalCondDBInterface * econn