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 Ref ped_db = lastPayload();
51 std::cout <<
"retrieved last payload " << std::endl;
57 float adc_ee=ped_db->getEEValue();
59 float the_value_high_eb=0.03894;
60 float the_value_high_ee=0.06285;
63 bool magnet_high=
true;
64 if(adc_eb!= the_value_high_eb || adc_ee!= the_value_high_ee ) magnet_high=
false;
69 std::cout <<
"Connecting to ONLINE DB ... " << std::endl;
71 std::cout <<
"Connection done" << std::endl;
75 std::cout <<
" Problem with OMDS: connection parameters " <<m_sid <<
"/"<<m_user<<
"/"<<m_pass<<std::endl;
80 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
81 std::map<EcalLogicID, RunDat> rundat;
83 run_t runmax=10000000;
85 econn->fetchValidDataSet(&rundat , &rp, location_p5 ,runmax);
87 unsigned long long irun=(
unsigned long long) rp.
getRunNumber();
89 std::cout<<
"retrieved run number "<< irun <<std::endl;
97 std::map<EcalLogicID, RunDCSMagnetDat>
dataset;
99 econn->fetchDataSet(&dataset, &rp);
101 if (!dataset.size()) {
102 throw(std::runtime_error(
"Zero rows read back"));
104 std::cout<<
"retrieved magnet current"<<std::endl;
110 std::map< EcalLogicID, RunDCSMagnetDat >::iterator it;
111 for (it=dataset.begin(); it!=dataset.end(); ++it){
120 bool something_to_transfer=
false;
121 if(mag_cur>7000. && magnet_high ) {
123 std::cout <<
" the magnet is ON and the constants are for magnet ON " << std::endl;
125 }
else if(mag_cur>7000. && !magnet_high ) {
126 something_to_transfer=
true;
127 std::cout <<
" the magnet is ON and the constants are for magnet OFF " << std::endl;
128 std::cout <<
" I transfer the ON constants "<< std::endl;
129 file_=m_file_highfield;
131 }
else if(mag_cur<6000. && magnet_high ) {
132 something_to_transfer=
true;
133 std::cout <<
" the magnet is OFF and the constants are for magnet ON "<< std::endl;
134 std::cout <<
" I transfer the OFF constants "<< std::endl;
135 file_=m_file_lowfield;
137 }
else if( mag_cur<6000. && !magnet_high ){
139 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
140 file_=m_file_lowfield;
144 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
149 if(something_to_transfer){
151 std::cout <<
"Generating popcon record for run " << irun <<
"..." << std::flush;
152 std::cout <<
"going to open file "<<file_ << std::flush;
163 std::make_pair(payload,snc));
165 ss <<
"Run=" << irun <<
"_Magnet_changed_"<<std::endl;
166 m_userTextLog = ss.str()+
";";
170 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
172 ss<<
"Run=" << irun <<
"_Magnet_NOT_changed_"<<std::endl;
173 m_userTextLog = ss.str()+
";";
179 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
180 ss<<
"Run=" << irun <<
"_no_new_runs_"<<std::endl;
181 m_userTextLog = ss.str()+
";";
188 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 &)