10 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalIntercalibHandler")) {
12 std::cout <<
"EcalIntercalib Source handler constructor\n" << std::endl;
28 std::cout <<
m_sid<<
"/"<<m_user<<
"/"<<m_location<<
"/"<<m_gentag << std::endl;
41 std::cout <<
"------- Ecal - > getNewObjects\n";
43 std::ostringstream ss;
46 unsigned int max_since=0;
47 max_since=
static_cast<unsigned int>(tagInfo().lastInterval.first);
48 std::cout <<
"max_since : " << max_since << std::endl;
49 Ref ped_db = lastPayload();
53 std::cout <<
"retrieved last payload " << std::endl;
66 float the_value_high=(float)m_value_highfield;
67 std::cout <<
"The value for high field at EE x/y/z= 50/5/-1 is " << the_value_high << std::endl;
80 bool magnet_high=
true;
81 if(the_cal!= the_value_high) magnet_high=
false;
86 std::cout <<
"Connecting to ONLINE DB ... " << std::endl;
88 std::cout <<
"Connection done" << std::endl;
92 std::cout <<
" Problem with OMDS: connection parameters " <<m_sid <<
"/"<<m_user<<
"/"<<m_pass<<std::endl;
97 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
98 std::map<EcalLogicID, RunDat> rundat;
100 run_t runmax=10000000;
102 econn->fetchValidDataSet(&rundat , &rp, location_p5 ,runmax);
104 unsigned long long irun=(
unsigned long long) rp.
getRunNumber();
106 std::cout<<
"retrieved run number "<< irun <<std::endl;
114 std::map<EcalLogicID, RunDCSMagnetDat>
dataset;
116 econn->fetchDataSet(&dataset, &rp);
118 if (!dataset.size()) {
119 throw(std::runtime_error(
"Zero rows read back"));
121 std::cout<<
"retrieved magnet current"<<std::endl;
127 std::map< EcalLogicID, RunDCSMagnetDat >::iterator it;
128 for (it=dataset.begin(); it!=dataset.end(); ++it){
137 bool something_to_transfer=
false;
138 if(mag_cur>7000. && magnet_high ) {
140 std::cout <<
" the magnet is ON and the constants are for magnet ON " << std::endl;
142 }
else if(mag_cur>7000. && !magnet_high ) {
143 something_to_transfer=
true;
144 std::cout <<
" the magnet is ON and the constants are for magnet OFF " << std::endl;
145 std::cout <<
" I transfer the ON constants "<< std::endl;
146 file_=m_file_highfield;
148 }
else if(mag_cur<6000. && magnet_high ) {
149 something_to_transfer=
true;
150 std::cout <<
" the magnet is OFF and the constants are for magnet ON "<< std::endl;
151 std::cout <<
" I transfer the OFF constants "<< std::endl;
152 file_=m_file_lowfield;
154 }
else if( mag_cur<6000. && !magnet_high ){
156 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
157 file_=m_file_lowfield;
161 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
166 if(something_to_transfer){
168 std::cout <<
"Generating popcon record for run " << irun <<
"..." << std::flush;
169 std::cout <<
"going to open file "<<file_ << std::flush;
180 std::make_pair(payload,snc));
182 ss <<
"Run=" << irun <<
"_Magnet_changed_"<<std::endl;
183 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()+
";";
205 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::Ref< Container > Ref
std::string m_locationsource
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
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
std::vector< Item >::const_iterator const_iterator
std::string m_file_lowfield
run_t getRunNumber() const
EcalIntercalibConstantMap EcalIntercalibConstants
float EcalIntercalibConstant