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 bool something_to_transfer =
false;
50 bool magnet_high =
true;
52 Ref ped_db = lastPayload();
56 std::cout <<
"retrieved last payload " << std::endl;
69 float the_value_high=(float)m_value_highfield;
70 std::cout <<
"The value for high field at EE x/y/z= 50/5/-1 is " << the_value_high << std::endl;
83 if(the_cal!= the_value_high) magnet_high=
false;
85 else something_to_transfer =
true;
88 std::cout <<
"Connecting to ONLINE DB ... " << std::endl;
90 std::cout <<
"Connection done" << std::endl;
94 std::cout <<
" Problem with OMDS: connection parameters " <<m_sid <<
"/"<<m_user<<
"/"<<m_pass<<std::endl;
99 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
100 std::map<EcalLogicID, RunDat> rundat;
102 run_t runmax=10000000;
104 econn->fetchValidDataSet(&rundat , &rp, location_p5 ,runmax);
106 unsigned long long irun=(
unsigned long long) rp.
getRunNumber();
108 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){
139 if(mag_cur>7000. && magnet_high ) {
141 std::cout <<
" the magnet is ON and the constants are for magnet ON " << std::endl;
143 }
else if(mag_cur>7000. && !magnet_high ) {
144 something_to_transfer=
true;
145 std::cout <<
" the magnet is ON and the constants are for magnet OFF " << std::endl;
146 std::cout <<
" I transfer the ON constants "<< std::endl;
147 file_=m_file_highfield;
149 }
else if(mag_cur<6000. && magnet_high ) {
150 something_to_transfer=
true;
151 std::cout <<
" the magnet is OFF and the constants are for magnet ON "<< std::endl;
152 std::cout <<
" I transfer the OFF constants "<< std::endl;
153 file_=m_file_lowfield;
155 }
else if( mag_cur<6000. && !magnet_high ){
157 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
158 file_=m_file_lowfield;
162 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
168 std::cout <<
" first payload, the magnet is ON " << std::endl;
169 else if( mag_cur<6000.) {
170 std::cout <<
" first payload, the magnet is OFF " << std::endl;
171 file_=m_file_lowfield;
174 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
177 if(something_to_transfer){
179 std::cout <<
"Generating popcon record for run " << irun <<
"..." << std::flush;
180 std::cout <<
"going to open file "<<file_ << std::flush;
191 std::make_pair(payload,snc));
193 ss <<
"Run=" << irun <<
"_Magnet_changed_"<<std::endl;
194 m_userTextLog = ss.str()+
";";
197 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
199 ss<<
"Run=" << irun <<
"_Magnet_NOT_changed_"<<std::endl;
200 m_userTextLog = ss.str()+
";";
206 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
207 ss<<
"Run=" << irun <<
"_no_new_runs_"<<std::endl;
208 m_userTextLog = ss.str()+
";";
210 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
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
tuple size
Write out results.
float EcalIntercalibConstant