26 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalTPGBadStripHandler")) {
28 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"EcalTPGStripStatus Source handler constructor.";
50 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Started GetNewObjects!!!";
52 unsigned int max_since=0;
53 max_since=
static_cast<unsigned int>(
tagInfo().lastInterval.first);
54 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"max_since : " << max_since;
55 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"retrieved last payload ";
58 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Retrieving run list from ONLINE DB ... ";
60 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Making connection...";
66 std::cout <<
" connection parameters " <<m_sid <<
"/"<<m_user<<std::endl;
81 readFromFile(
"last_tpg_badStrip_settings.txt");
84 unsigned int min_run=m_i_run_number+1;
86 if(m_firstRun<m_i_run_number) {
87 min_run=m_i_run_number+1;
91 if(min_run<max_since) {
95 std::cout<<
"m_i_run_number"<< m_i_run_number <<
"m_firstRun "<<m_firstRun<<
"max_since " <<max_since<< std::endl;
97 unsigned int max_run=m_lastRun;
98 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
101 my_list=econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run, my_locdef);
105 std::vector<RunIOV> run_vec= my_list.
getRuns();
106 size_t num_runs=run_vec.size();
108 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
117 std::vector<EcalLogicID> my_StripEcalLogicId_EE;
118 my_StripEcalLogicId_EE = econn->getEcalLogicIDSetOrdered(
"EE_trigger_strip",
122 "EE_offline_stripid",123 );
124 std::cout <<
" GOT the logic ID for the EE trigger strips "<< std::endl;
127 for(
size_t kr=0; kr<run_vec.size(); kr++){
129 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
131 std::cout<<
" **************** "<<std::endl;
132 std::cout<<
" **************** "<<std::endl;
136 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
137 econn->fetchDataSet(&dataset, &run_vec[kr]);
140 int the_config_version=0;
142 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
145 for( it=dataset.begin(); it!=dataset.end(); it++ )
157 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
161 if((the_config_tag != m_i_tag || the_config_version != m_i_version ) && nr>0 ) {
162 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
163 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
171 econn-> fetchConfigSet(&fe_main_info);
174 int badstripId=fe_main_info.
getBstId();
176 if( badstripId != m_i_badStrip ) {
179 fe_badStrip_info.
setId(badstripId);
181 econn-> fetchConfigSet(&fe_badStrip_info);
183 std::vector< FEConfigBadStripDat > dataset_TpgBadStrip;
185 econn->fetchConfigDataSet(&dataset_TpgBadStrip, &fe_badStrip_info);
188 typedef std::vector<FEConfigBadStripDat>::const_iterator CIfeped;
197 for (CIfeped
p = dataset_TpgBadStrip.begin();
p != dataset_TpgBadStrip.end();
p++) {
203 int tt_num=rd_badStrip.
getTTId();
211 bool set_the_strip=
false;
212 for (
size_t istrip=0; istrip<my_StripEcalLogicId_EE.size(); istrip++) {
216 if(my_StripEcalLogicId_EE[istrip].getID1()==tcc_num
217 && my_StripEcalLogicId_EE[istrip].getID2()==tt_num
218 && my_StripEcalLogicId_EE[istrip].getID3()==strip_num
220 stripid =my_StripEcalLogicId_EE[istrip].getLogicID();
240 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Finished badStrip reading.";
247 m_i_tag=the_config_tag;
248 m_i_version=the_config_version;
249 m_i_badStrip=badstripId;
251 writeFile(
"last_tpg_badStrip_settings.txt");
256 m_i_tag=the_config_tag;
257 m_i_version=the_config_version;
259 writeFile(
"last_tpg_badStrip_settings.txt");
268 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
269 <<
" version="<<the_config_version<< std::endl;
281 m_i_tag=the_config_tag;
282 m_i_version=the_config_version;
284 writeFile(
"last_tpg_badStrip_settings.txt");
291 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Ecal - > end of getNewObjects -----------";
304 inpFile = fopen(inputFile,
"r");
312 std::ostringstream str;
314 fgets(line,255,inpFile);
315 m_i_tag=to_string(line);
316 str <<
"gen tag " << m_i_tag << std::endl ;
318 fgets(line,255,inpFile);
319 m_i_version=atoi(line);
320 str <<
"version= " << m_i_version << std::endl ;
322 fgets(line,255,inpFile);
323 m_i_run_number=atoi(line);
324 str <<
"run_number= " << m_i_run_number << std::endl ;
326 fgets(line,255,inpFile);
327 m_i_badStrip=atoi(line);
328 str <<
"badTT_config= " << m_i_badStrip << std::endl ;
340 std::ofstream myfile;
341 myfile.open (inputFile);
342 myfile << m_i_tag <<std::endl;
343 myfile << m_i_version <<std::endl;
344 myfile << m_i_run_number <<std::endl;
345 myfile << m_i_badStrip <<std::endl;
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
std::string getConfigTag() const
void writeFile(const char *inputFile)
~EcalTPGBadStripHandler()
std::string m_locationsource
EcalTPGBadStripHandler(edm::ParameterSet const &)
void setLocationDef(const LocationDef &locDef)
void readFromFile(const char *inputFile)
void setRunType(std::string runtype)
void setConfigTag(std::string x)
void setLocation(std::string loc)
void setGeneralTag(std::string tag)
void setValue(const uint32_t &id, const uint16_t &val)