9 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalADCToGeVHandler")) {
10 std::cout <<
"EcalADCToGeV Source handler constructor\n" << std::endl;
28 std::cout <<
"------- Ecal - > getNewObjects\n";
30 std::ostringstream
ss;
33 unsigned int max_since = 0;
34 max_since = static_cast<unsigned int>(
tagInfo().lastInterval.since);
35 std::cout <<
"max_since : " << max_since << std::endl;
36 bool magnet_high =
false;
37 bool something_to_transfer =
false;
39 Ref ped_db = lastPayload();
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;
77 econn->fetchValidDataSet(&rundat, &rp, location_p5, runmax);
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;
114 file_ = m_file_highfield;
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;
120 file_ = m_file_lowfield;
122 }
else if (mag_cur < 6000. && !magnet_high) {
123 std::cout <<
" the magnet is OFF and the constants are for magnet OFF " << std::endl;
124 file_ = m_file_lowfield;
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;
134 file_ = m_file_lowfield;
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;
181 m_userTextLog =
ss.str() +
";";
183 std::cout <<
"Run " << irun <<
" nothing sent to the DB" << std::endl;
184 ss <<
"Run=" << irun <<
"_Magnet_NOT_changed_" << std::endl;
185 m_userTextLog =
ss.str() +
";";
191 std::cout <<
"Run " << irun <<
" nothing sent to the DB" << std::endl;
192 ss <<
"Run=" << irun <<
"_no_new_runs_" << std::endl;
193 m_userTextLog =
ss.str() +
";";
195 std::cout <<
"Ecal - > end of getNewObjects -----------\n";