9 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalIntercalibHandler")) {
11 std::cout <<
"EcalIntercalib Source handler constructor\n" << std::endl;
27 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 something_to_transfer =
false;
48 bool magnet_high =
true;
50 Ref ped_db = lastPayload();
54 std::cout <<
"retrieved last payload " << std::endl;
67 float the_value_high=(float)m_value_highfield;
68 std::cout <<
"The value for high field at EE x/y/z= 50/5/-1 is " << the_value_high << std::endl;
81 if(the_cal!= the_value_high) magnet_high=
false;
83 else something_to_transfer =
true;
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;
112 std::map<EcalLogicID, RunDCSMagnetDat>
dataset;
114 econn->fetchDataSet(&dataset, &rp);
116 if (!dataset.size()) {
117 throw(std::runtime_error(
"Zero rows read back"));
119 std::cout<<
"retrieved magnet current"<<std::endl;
125 std::map< EcalLogicID, RunDCSMagnetDat >::iterator it;
126 for (it=dataset.begin(); it!=dataset.end(); ++it){
137 if(mag_cur>7000. && magnet_high ) {
139 std::cout <<
" the magnet is ON and the constants are for magnet ON " << std::endl;
141 }
else if(mag_cur>7000. && !magnet_high ) {
142 something_to_transfer=
true;
143 std::cout <<
" the magnet is ON and the constants are for magnet OFF " << std::endl;
144 std::cout <<
" I transfer the ON constants "<< std::endl;
145 file_=m_file_highfield;
147 }
else if(mag_cur<6000. && magnet_high ) {
148 something_to_transfer=
true;
149 std::cout <<
" the magnet is OFF and the constants are for magnet ON "<< std::endl;
150 std::cout <<
" I transfer the OFF constants "<< std::endl;
151 file_=m_file_lowfield;
153 }
else if( mag_cur<6000. && !magnet_high ){
155 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
156 file_=m_file_lowfield;
160 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
166 std::cout <<
" first payload, the magnet is ON " << std::endl;
167 else if( mag_cur<6000.) {
168 std::cout <<
" first payload, the magnet is OFF " << std::endl;
169 file_=m_file_lowfield;
172 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
175 if(something_to_transfer){
177 std::cout <<
"Generating popcon record for run " << irun <<
"..." << std::flush;
178 std::cout <<
"going to open file "<<file_ << std::flush;
189 std::make_pair(payload,snc));
191 ss <<
"Run=" << irun <<
"_Magnet_changed_"<<std::endl;
192 m_userTextLog = ss.str()+
";";
195 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
197 ss<<
"Run=" << irun <<
"_Magnet_NOT_changed_"<<std::endl;
198 m_userTextLog = ss.str()+
";";
204 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
205 ss<<
"Run=" << irun <<
"_no_new_runs_"<<std::endl;
206 m_userTextLog = ss.str()+
";";
208 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