10 : m_name(ps.getUntrackedParameter<std::string>(
"name",
"EcalIntercalibHandler")) {
12 std::cout <<
"EcalIntercalib 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;
59 float the_value_high=0.75585;
72 bool magnet_high=
true;
73 if(the_cal!= the_value_high) magnet_high=
false;
78 std::cout <<
"Connecting to ONLINE DB ... " << std::endl;
80 std::cout <<
"Connection done" << std::endl;
84 std::cout <<
" Problem with OMDS: connection parameters " <<m_sid <<
"/"<<m_user<<
"/"<<m_pass<<std::endl;
89 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
90 std::map<EcalLogicID, RunDat> rundat;
92 run_t runmax=10000000;
93 std::string location_p5=
"P5_Co";
94 econn->fetchValidDataSet(&rundat , &rp, location_p5 ,runmax);
96 unsigned long long irun=(
unsigned long long) rp.
getRunNumber();
98 std::cout<<
"retrieved run number "<< irun <<std::endl;
106 std::map<EcalLogicID, RunDCSMagnetDat>
dataset;
108 econn->fetchDataSet(&dataset, &rp);
110 if (!dataset.size()) {
111 throw(std::runtime_error(
"Zero rows read back"));
113 std::cout<<
"retrieved magnet current"<<std::endl;
119 std::map< EcalLogicID, RunDCSMagnetDat >::iterator it;
120 for (it=dataset.begin(); it!=dataset.end(); ++it){
128 std::string file_=m_file_highfield;
129 bool something_to_transfer=
false;
130 if(mag_cur>5000. && magnet_high ) {
132 std::cout <<
" the magnet is ON and the constants are for magnet ON " << std::endl;
134 }
else if(mag_cur>5000. && !magnet_high ) {
135 something_to_transfer=
true;
136 std::cout <<
" the magnet is ON and the constants are for magnet OFF " << std::endl;
137 std::cout <<
" I transfer the ON constants "<< std::endl;
138 file_=m_file_highfield;
140 }
else if(mag_cur<3000. && magnet_high ) {
141 something_to_transfer=
true;
142 std::cout <<
" the magnet is OFF and the constants are for magnet ON "<< std::endl;
143 std::cout <<
" I transfer the OFF constants "<< std::endl;
144 file_=m_file_lowfield;
146 }
else if( mag_cur<3000. && !magnet_high ){
148 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
149 file_=m_file_lowfield;
153 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
158 if(something_to_transfer){
160 std::cout <<
"Generating popcon record for run " << irun <<
"..." << std::flush;
161 std::cout <<
"going to open file "<<file_ << std::flush;
172 std::make_pair(payload,snc));
174 ss <<
"Run=" << irun <<
"_Magnet_changed_"<<std::endl;
175 m_userTextLog = ss.str()+
";";
179 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
181 ss<<
"Run=" << irun <<
"_Magnet_NOT_changed_"<<std::endl;
182 m_userTextLog = ss.str()+
";";
188 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
189 ss<<
"Run=" << irun <<
"_no_new_runs_"<<std::endl;
190 m_userTextLog = ss.str()+
";";
197 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
T getParameter(std::string const &) const
edm::Ref< Container > Ref
std::string m_locationsource
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
uint32_t rawId() const
get the raw id
float getMagnetCurrent() const
unsigned long long Time_t
EcalIntercalibHandler(edm::ParameterSet const &)
std::string m_file_highfield
std::vector< Item >::const_iterator const_iterator
std::string m_file_lowfield
run_t getRunNumber() const
EcalIntercalibConstantMap EcalIntercalibConstants
float EcalIntercalibConstant