35 std::cout <<
"------- Ecal - > getNewObjects\n";
37 std::ostringstream ss;
40 unsigned int max_since=0;
42 std::cout <<
"max_since : " << max_since << std::endl;
43 bool magnet_high =
false;
44 bool something_to_transfer =
false;
50 std::cout <<
"retrieved last payload " << std::endl;
70 float the_value_low_ee = 0.0590975;
71 if( adc_ee > the_value_low_ee ) magnet_high =
true;
73 else something_to_transfer =
true;
76 std::cout <<
"Connecting to ONLINE DB ... " << std::endl;
78 std::cout <<
"Connection done" << std::endl;
81 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
82 std::map<EcalLogicID, RunDat> rundat;
88 unsigned long long irun=(
unsigned long long) rp.
getRunNumber();
90 std::cout<<
"retrieved run number "<< irun <<std::endl;
96 std::map<EcalLogicID, RunDCSMagnetDat>
dataset;
100 if (!dataset.size()) {
101 throw(std::runtime_error(
"Zero rows read back"));
103 std::cout<<
"retrieved magnet current"<<std::endl;
108 std::map< EcalLogicID, RunDCSMagnetDat >::iterator it;
109 for (it=dataset.begin(); it!=dataset.end(); ++it){
119 if(mag_cur>7000. && magnet_high ) {
121 std::cout <<
" the magnet is ON and the constants are for magnet ON " << std::endl;
123 }
else if(mag_cur>7000. && !magnet_high ) {
124 something_to_transfer=
true;
125 std::cout <<
" the magnet is ON and the constants are for magnet OFF " << std::endl;
126 std::cout <<
" I transfer the ON constants "<< std::endl;
129 }
else if(mag_cur<6000. && magnet_high ) {
130 something_to_transfer=
true;
131 std::cout <<
" the magnet is OFF and the constants are for magnet ON "<< std::endl;
132 std::cout <<
" I transfer the OFF constants "<< std::endl;
135 }
else if( mag_cur<6000. && !magnet_high ){
137 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
142 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
148 std::cout <<
" first payload, the magnet is ON " << std::endl;
149 else if( mag_cur<6000.) {
150 std::cout <<
" first payload, the magnet is OFF " << std::endl;
154 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
157 if(something_to_transfer) {
158 std::cout <<
"Generating popcon record for run " << irun
159 <<
" going to open file " << file_ <<
"\n" << std::flush;
165 fxml.open(file_.c_str());
168 for (
int il = 0; il < 4; il++) {
169 std::getline(fxml, line);
172 for (
int iPart = 0; iPart < 2; iPart++) {
174 std::size_t
begin = bid.find_first_of(
">");
175 std::size_t
end = bid.find_last_of(
"<");
178 std::size_t endmantissa = str2.find(
"e");
179 std::string mantissa = str2.substr(0, endmantissa);
180 std::size_t string_size = str2.size();
182 std::istringstream is(mantissa);
185 std::istringstream ise(exponent);
187 val = val *
pow(10, mult);
188 std::cout <<
" Partition " << iPart <<
" ADCToGeV " << val <<
"\n";
196 ss <<
"Run=" << irun <<
"_Magnet_changed_" << std::endl;
199 std::cout <<
"Run " << irun <<
" nothing sent to the DB" << std::endl;
200 ss<<
"Run=" << irun <<
"_Magnet_NOT_changed_" << std::endl;
207 std::cout <<
"Run " << irun <<
" nothing sent to the DB" << std::endl;
208 ss<<
"Run=" << irun <<
"_no_new_runs_"<<std::endl;
211 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
std::string m_userTextLog
edm::Ref< Container > Ref
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
void setEEValue(const float &value)
float getMagnetCurrent() const
cond::ValidityInterval lastInterval
payload
payload postfix for testing
std::string m_file_highfield
void setEBValue(const float &value)
std::string m_file_lowfield
run_t getRunNumber() const
EcalCondDBInterface * econn
void fetchValidDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *fillIOV, RunTag *tag, run_t run=(unsigned int)-1) noexcept(false)
Power< A, B >::type pow(const A &a, const B &b)
cond::TagInfo_t const & tagInfo() const