11 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalIntercalibHandler")) {
13 std::cout <<
"EcalIntercalib Source handler constructor\n" << std::endl;
29 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;
48 std::cout <<
"max_since : " << max_since << std::endl;
49 bool something_to_transfer =
false;
50 bool magnet_high =
true;
56 std::cout <<
"retrieved last payload " << std::endl;
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;
99 std::cout <<
"Retrieving last run from ONLINE DB ... " << std::endl;
100 std::map<EcalLogicID, RunDat> rundat;
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;
118 if (dataset.empty()) {
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;
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;
155 }
else if( mag_cur<6000. && !magnet_high ){
157 std::cout <<
" the magnet is OFF and the constants are for magnet OFF "<< std::endl;
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;
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));
192 ss <<
"Run=" << irun <<
"_Magnet_changed_"<<std::endl;
196 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
197 ss<<
"Run=" << irun <<
"_Magnet_NOT_changed_"<<std::endl;
204 std::cout <<
"Run " << irun <<
" nothing sent to the DB"<< std::endl;
205 ss<<
"Run=" << irun <<
"_no_new_runs_"<<std::endl;
208 std::cout <<
"Ecal - > end of getNewObjects -----------\n";
216 if(!fxml.is_open()) {
217 std::cout <<
"ERROR : cannot open file " << file_ << std::endl;
221 for(
int i=0;
i< 6;
i++) {
222 getline(fxml, dummyLine);
228 std::istringstream iEB(stt);
232 std::cout <<
" strange number of EB channels " << nEB << std::endl;
236 for (
int iChannel = 0; iChannel <
kEBChannels; iChannel++) {
239 std::size_t
found = bid.find(
"</");
240 stt = bid.substr(6, found - 6);
241 float val = std::stof(stt);
242 record[myEBDetId] =
val;
244 for(
int i=0;
i< 5;
i++) {
245 getline(fxml, dummyLine);
250 stt = bid.substr(7,5);
251 std::istringstream iEE(stt);
255 std::cout <<
" strange number of EE channels " << nEE << std::endl;
260 for (
int iChannel = 0; iChannel <
kEEChannels; iChannel++) {
263 std::size_t
found = bid.find(
"</");
264 stt = bid.substr(6, found - 6);
265 float val = std::stof(stt);
266 record[myEEDetId] =
val;
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 getNewObjects() override
static EEDetId unhashIndex(int hi)
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
uint32_t rawId() const
get the raw id
float getMagnetCurrent() const
cond::ValidityInterval lastInterval
void readXML(const std::string &filename, EcalFloatCondObjectContainer &record)
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
~EcalIntercalibHandler() override
std::string m_file_lowfield
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
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