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;
73 readFromFile(
"last_tpg_badStrip_settings.txt");
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;
184 for (CIfeped
p = dataset_TpgBadStrip.begin();
p != dataset_TpgBadStrip.end();
p++) {
188 int tcc_num = rd_badStrip.
getTCCId();
189 int tt_num = rd_badStrip.
getTTId();
197 bool set_the_strip =
false;
198 for (
size_t istrip = 0; istrip < my_StripEcalLogicId_EE.size(); istrip++) {
199 if (!set_the_strip) {
200 if (my_StripEcalLogicId_EE[istrip].getID1() == tcc_num &&
201 my_StripEcalLogicId_EE[istrip].getID2() == tt_num &&
202 my_StripEcalLogicId_EE[istrip].getID3() == strip_num) {
203 stripid = my_StripEcalLogicId_EE[istrip].getLogicID();
205 set_the_strip =
true;
216 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Finished badStrip reading.";
222 m_i_run_number = irun;
223 m_i_tag = the_config_tag;
224 m_i_version = the_config_version;
225 m_i_badStrip = badstripId;
227 writeFile(
"last_tpg_badStrip_settings.txt");
230 m_i_run_number = irun;
231 m_i_tag = the_config_tag;
232 m_i_version = the_config_version;
234 writeFile(
"last_tpg_badStrip_settings.txt");
242 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag <<
" version=" << the_config_version
245 m_i_run_number = irun;
248 }
else if (
nr == 0) {
249 m_i_run_number = irun;
252 m_i_run_number = irun;
253 m_i_tag = the_config_tag;
254 m_i_version = the_config_version;
256 writeFile(
"last_tpg_badStrip_settings.txt");
263 edm::LogInfo(
"EcalTPGBadStripHandler") <<
"Ecal - > end of getNewObjects -----------";
283 std::ostringstream
str;
285 fgets(
line, 255, inpFile);
287 str <<
"gen tag " << m_i_tag << std::endl;
289 fgets(
line, 255, inpFile);
290 m_i_version = atoi(
line);
291 str <<
"version= " << m_i_version << std::endl;
293 fgets(
line, 255, inpFile);
294 m_i_run_number = atoi(
line);
295 str <<
"run_number= " << m_i_run_number << std::endl;
297 fgets(
line, 255, inpFile);
298 m_i_badStrip = atoi(
line);
299 str <<
"badTT_config= " << m_i_badStrip << std::endl;
307 std::ofstream myfile;
309 myfile << m_i_tag << std::endl;
310 myfile << m_i_version << std::endl;
311 myfile << m_i_run_number << std::endl;
312 myfile << m_i_badStrip << std::endl;
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
T getParameter(std::string const &) const
void writeFile(const char *inputFile)
Log< level::Error, false > LogError
std::string m_locationsource
static std::string to_string(const XMLCh *ch)
EcalTPGBadStripHandler(edm::ParameterSet const &)
~EcalTPGBadStripHandler() override
void setLocationDef(const LocationDef &locDef)
Log< level::Info, false > LogInfo
void readFromFile(const char *inputFile)
std::string getConfigTag() const
void setConfigTag(std::string x)
void getNewObjects() override
void setGeneralTag(std::string tag)
void setValue(const uint32_t &id, const uint16_t &val)