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;
40 std::cout <<
"------- Ecal - > getNewObjects\n";
42 std::ostringstream ss;
45 unsigned int max_since=0;
47 std::cout <<
"max_since : " << max_since << std::endl;
48 bool something_to_transfer =
false;
49 bool magnet_high =
true;
55 std::cout <<
"retrieved last payload " << std::endl;
69 std::cout <<
"The value for high field at EE x/y/z= 50/5/-1 is " << the_value_high << std::endl;
82 if(the_cal!= the_value_high) magnet_high=
false;
84 else something_to_transfer =
true;
87 std::cout <<
"Connecting to ONLINE DB ... " << std::endl;
89 std::cout <<
"Connection done" << std::endl;
98 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
99 std::map<EcalLogicID, RunDat> rundat;
105 unsigned long long irun=(
unsigned long long) rp.
getRunNumber();
107 std::cout<<
"retrieved run number "<< irun <<std::endl;
113 std::map<EcalLogicID, RunDCSMagnetDat>
dataset;
117 if (!dataset.size()) {
118 throw(std::runtime_error(
"Zero rows read back"));
120 std::cout<<
"retrieved magnet current"<<std::endl;
126 std::map< EcalLogicID, RunDCSMagnetDat >::iterator it;
127 for (it=dataset.begin(); it!=dataset.end(); ++it){
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;
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;
154 }
else if( mag_cur<6000. && !magnet_high ){
156 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
161 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
167 std::cout <<
" first payload, the magnet is ON " << std::endl;
168 else if( mag_cur<6000.) {
169 std::cout <<
" first payload, the magnet is OFF " << std::endl;
173 std::cout <<
" the magnet is in a strange situation I do nothing ... just be patient "<< std::endl;
176 if(something_to_transfer){
178 std::cout <<
"Generating popcon record for run " << irun <<
"..." << std::flush;
179 std::cout <<
"going to open file "<<file_ << std::flush;
190 std::make_pair(payload,snc));
192 ss <<
"Run=" << irun <<
"_Magnet_changed_"<<std::endl;
196 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
198 ss<<
"Run=" << irun <<
"_Magnet_NOT_changed_"<<std::endl;
205 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
206 ss<<
"Run=" << irun <<
"_no_new_runs_"<<std::endl;
209 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string m_userTextLog
edm::Ref< Container > Ref
std::string m_locationsource
EcalCondDBInterface * econn
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
static int readXML(const std::string &filename, EcalCondHeader &header, EcalFloatCondObjectContainer &record)
uint32_t rawId() const
get the raw id
float getMagnetCurrent() const
cond::ValidityInterval lastInterval
payload
payload postfix for testing
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
void fetchValidDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *fillIOV, RunTag *tag, run_t run=(unsigned int)-1) noexcept(false)
float EcalIntercalibConstant
cond::TagInfo_t const & tagInfo() const