25 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGBadStripHandler")) {
26 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"EcalTPGStripStatus Source handler constructor.";
43 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Started GetNewObjects!!!";
45 unsigned int max_since = 0;
46 max_since = static_cast<unsigned int>(
tagInfo().lastInterval.since);
47 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"max_since : " << max_since;
48 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"retrieved last payload ";
51 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Retrieving run list from ONLINE DB ... ";
53 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Making connection...";
58 std::cout <<
" connection parameters " << m_sid <<
"/" << m_user << std::endl;
75 unsigned int min_run = m_i_run_number + 1;
77 if (m_firstRun < m_i_run_number) {
78 min_run = m_i_run_number + 1;
82 if (min_run < max_since) {
83 min_run = max_since + 1;
86 std::cout <<
"m_i_run_number" << m_i_run_number <<
"m_firstRun " << m_firstRun <<
"max_since " << max_since
89 unsigned int max_run = m_lastRun;
90 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
93 my_list =
econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run,
my_locdef);
96 std::vector<RunIOV> run_vec = my_list.
getRuns();
97 size_t num_runs = run_vec.size();
99 std::cout <<
"number of runs is : " << num_runs << std::endl;
103 unsigned int irun = 0;
107 std::vector<EcalLogicID> my_StripEcalLogicId_EE;
108 my_StripEcalLogicId_EE =
econn->getEcalLogicIDSetOrdered(
"EE_trigger_strip",
115 "EE_offline_stripid",
118 std::cout <<
" GOT the logic ID for the EE trigger strips " << std::endl;
120 for (
size_t kr = 0; kr < run_vec.size(); kr++) {
121 irun = static_cast<unsigned int>(run_vec[kr].
getRunNumber());
123 std::cout <<
" **************** " << std::endl;
124 std::cout <<
" **************** " << std::endl;
125 std::cout <<
" run= " << irun << std::endl;
128 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
132 int the_config_version = 0;
134 std::map<EcalLogicID, RunTPGConfigDat>::const_iterator it;
148 std::cout <<
" run= " << irun <<
" tag " << the_config_tag <<
" version=" << the_config_version << std::endl;
152 if ((the_config_tag != m_i_tag || the_config_version != m_i_version) &&
nr > 0) {
153 std::cout <<
" run= " << irun <<
" tag " << the_config_tag <<
" version=" << the_config_version << std::endl;
154 std::cout <<
"the tag is different from last transferred run ... retrieving last config set from DB"
162 econn->fetchConfigSet(&fe_main_info);
165 int badstripId = fe_main_info.
getBstId();
167 if (badstripId != m_i_badStrip) {
169 fe_badStrip_info.
setId(badstripId);
171 econn->fetchConfigSet(&fe_badStrip_info);
173 std::vector<FEConfigBadStripDat> dataset_TpgBadStrip;
175 econn->fetchConfigDataSet(&dataset_TpgBadStrip, &fe_badStrip_info);
178 typedef std::vector<FEConfigBadStripDat>::const_iterator CIfeped;
186 for (CIfeped
p = dataset_TpgBadStrip.begin();
p != dataset_TpgBadStrip.end();
p++) {
190 int tcc_num = rd_badStrip.
getTCCId();
191 int tt_num = rd_badStrip.
getTTId();
199 bool set_the_strip =
false;
200 for (
size_t istrip = 0; istrip < my_StripEcalLogicId_EE.size(); istrip++) {
201 if (!set_the_strip) {
202 if (my_StripEcalLogicId_EE[istrip].getID1() == tcc_num &&
203 my_StripEcalLogicId_EE[istrip].getID2() == tt_num &&
204 my_StripEcalLogicId_EE[istrip].getID3() == strip_num) {
205 stripid = my_StripEcalLogicId_EE[istrip].getLogicID();
207 set_the_strip =
true;
223 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Finished badStrip reading.";
229 m_i_run_number = irun;
230 m_i_tag = the_config_tag;
231 m_i_version = the_config_version;
232 m_i_badStrip = badstripId;
234 writeFile(
"last_tpg_badStrip_settings.txt");
237 m_i_run_number = irun;
238 m_i_tag = the_config_tag;
239 m_i_version = the_config_version;
241 writeFile(
"last_tpg_badStrip_settings.txt");
249 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag <<
" version=" << the_config_version
252 m_i_run_number = irun;
255 }
else if (
nr == 0) {
256 m_i_run_number = irun;
259 m_i_run_number = irun;
260 m_i_tag = the_config_tag;
261 m_i_version = the_config_version;
263 writeFile(
"last_tpg_badStrip_settings.txt");
270 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Ecal - > end of getNewObjects -----------";
290 std::ostringstream
str;
292 fgets(
line, 255, inpFile);
293 m_i_tag = to_string(
line);
294 str <<
"gen tag " << m_i_tag << std::endl;
296 fgets(
line, 255, inpFile);
297 m_i_version = atoi(
line);
298 str <<
"version= " << m_i_version << std::endl;
300 fgets(
line, 255, inpFile);
301 m_i_run_number = atoi(
line);
302 str <<
"run_number= " << m_i_run_number << std::endl;
304 fgets(
line, 255, inpFile);
305 m_i_badStrip = atoi(
line);
306 str <<
"badTT_config= " << m_i_badStrip << std::endl;
314 std::ofstream myfile;
316 myfile << m_i_tag << std::endl;
317 myfile << m_i_version << std::endl;
318 myfile << m_i_run_number << std::endl;
319 myfile << m_i_badStrip << std::endl;