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;
39 std::cout <<
"------- Ecal - > getNewObjects\n";
41 std::ostringstream
ss;
44 unsigned int max_since=0;
45 max_since=
static_cast<unsigned int>(
tagInfo().lastInterval.first);
46 std::cout <<
"max_since : " << max_since << std::endl;
47 bool magnet_high =
false;
48 bool something_to_transfer =
false;
50 Ref ped_db = lastPayload();
54 std::cout <<
"retrieved last payload " << std::endl;
73 float the_value_low_ee=0.05678;
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;
85 std::cout <<
" Problem with OMDS: connection parameters " <<m_sid <<
"/"<<m_user<<
"/"<<m_pass<<std::endl;
90 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
91 std::map<EcalLogicID, RunDat> rundat;
93 run_t runmax=10000000;
95 econn->fetchValidDataSet(&rundat , &rp, location_p5 ,runmax);
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;
107 econn->fetchDataSet(&dataset, &rp);
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;
137 file_=m_file_highfield;
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;
143 file_=m_file_lowfield;
145 }
else if( mag_cur<6000. && !magnet_high ){
147 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
148 file_=m_file_lowfield;
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;
161 file_=m_file_lowfield;
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;
184 m_userTextLog = ss.str()+
";";
187 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
189 ss<<
"Run=" << irun <<
"_Magnet_NOT_changed_"<<std::endl;
190 m_userTextLog = ss.str()+
";";
196 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
197 ss<<
"Run=" << irun <<
"_no_new_runs_"<<std::endl;
198 m_userTextLog = ss.str()+
";";
203 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
T getParameter(std::string const &) const
edm::Ref< Container > Ref
static int readXML(const std::string &filename, EcalCondHeader &header, EcalADCToGeVConstant &record)
std::string m_locationsource
float getMagnetCurrent() const
std::string m_file_highfield
std::string m_file_lowfield
run_t getRunNumber() const
EcalADCToGeVHandler(edm::ParameterSet const &)
tuple size
Write out results.