10 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalADCToGeVHandler")) {
12 std::cout <<
"EcalADCToGeV Source handler constructor\n" << std::endl;
26 std::cout <<
m_sid<<
"/"<<m_user<<
"/"<<m_location<<
"/"<<m_gentag << std::endl;
38 std::cout <<
"------- Ecal - > getNewObjects\n";
40 std::ostringstream ss;
43 unsigned int max_since=0;
45 std::cout <<
"max_since : " << max_since << std::endl;
46 bool magnet_high =
false;
47 bool something_to_transfer =
false;
53 std::cout <<
"retrieved last payload " << std::endl;
73 float the_value_low_ee=0.0590975;
74 if( adc_ee > the_value_low_ee ) magnet_high=
true;
76 else something_to_transfer =
true;
79 std::cout <<
"Connecting to ONLINE DB ... " << std::endl;
81 std::cout <<
"Connection done" << std::endl;
90 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
91 std::map<EcalLogicID, RunDat> rundat;
97 unsigned long long irun=(
unsigned long long) rp.
getRunNumber();
99 std::cout<<
"retrieved run number "<< irun <<std::endl;
105 std::map<EcalLogicID, RunDCSMagnetDat>
dataset;
109 if (!dataset.size()) {
110 throw(std::runtime_error(
"Zero rows read back"));
112 std::cout<<
"retrieved magnet current"<<std::endl;
118 std::map< EcalLogicID, RunDCSMagnetDat >::iterator it;
119 for (it=dataset.begin(); it!=dataset.end(); ++it){
129 if(mag_cur>7000. && magnet_high ) {
131 std::cout <<
" the magnet is ON and the constants are for magnet ON " << std::endl;
133 }
else if(mag_cur>7000. && !magnet_high ) {
134 something_to_transfer=
true;
135 std::cout <<
" the magnet is ON and the constants are for magnet OFF " << std::endl;
136 std::cout <<
" I transfer the ON constants "<< std::endl;
139 }
else if(mag_cur<6000. && magnet_high ) {
140 something_to_transfer=
true;
141 std::cout <<
" the magnet is OFF and the constants are for magnet ON "<< std::endl;
142 std::cout <<
" I transfer the OFF constants "<< std::endl;
145 }
else if( mag_cur<6000. && !magnet_high ){
147 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
152 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
158 std::cout <<
" first payload, the magnet is ON " << std::endl;
159 else if( mag_cur<6000.) {
160 std::cout <<
" first payload, the magnet is OFF " << std::endl;
164 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
167 if(something_to_transfer) {
169 std::cout <<
"Generating popcon record for run " << irun <<
"..." << std::flush;
170 std::cout <<
"going to open file "<<file_ << std::flush;
181 std::make_pair(payload,snc));
183 ss <<
"Run=" << irun <<
"_Magnet_changed_"<<std::endl;
187 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
189 ss<<
"Run=" << irun <<
"_Magnet_NOT_changed_"<<std::endl;
196 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
197 ss<<
"Run=" << irun <<
"_no_new_runs_"<<std::endl;
203 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
T getParameter(std::string const &) const
std::string m_userTextLog
edm::Ref< Container > Ref
static int readXML(const std::string &filename, EcalCondHeader &header, EcalADCToGeVConstant &record)
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
std::string m_locationsource
float getMagnetCurrent() const
cond::ValidityInterval lastInterval
payload
payload postfix for testing
std::string m_file_highfield
std::string m_file_lowfield
run_t getRunNumber() const
EcalADCToGeVHandler(edm::ParameterSet const &)
EcalCondDBInterface * econn
void fetchValidDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *fillIOV, RunTag *tag, run_t run=(unsigned int)-1) noexcept(false)
cond::TagInfo_t const & tagInfo() const