27 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGTPModeHandler")) {
28 edm::LogInfo(
"EcalTPGTPModeHandler") <<
"Ecal TPG TPMode Source handler constructor.";
47 if (m_file_type ==
"txt") {
54 edm::LogInfo(
"EcalTPGTPModeHandler") <<
"Started GetNewObjects!!!";
59 std::cout <<
"got offlineInfo = " << std::endl;
63 std::cout <<
" First object for this tag " << std::endl;
66 unsigned int max_since = 0;
67 max_since = static_cast<unsigned int>(
tagInfo().lastInterval.since);
68 edm::LogInfo(
"EcalTPGTPModeHandler") <<
"max_since : " << max_since;
70 edm::LogInfo(
"EcalTPGTPModeHandler") <<
"retrieved last payload ";
74 edm::LogInfo(
"EcalTPGTPModeHandler") <<
"Retrieving run list from ONLINE DB ... ";
76 edm::LogInfo(
"EcalTPGTPModeHandler") <<
"Making connection...";
81 std::cout <<
" connection parameters " << m_sid <<
"/" << m_user << std::endl;
99 unsigned int min_run = m_i_run_number + 1;
101 if (m_firstRun < m_i_run_number) {
102 min_run = m_i_run_number + 1;
104 min_run = m_firstRun;
107 if (min_run < max_since) {
108 min_run = max_since + 1;
111 std::cout <<
"m_i_run_number" << m_i_run_number <<
"m_firstRun " << m_firstRun <<
"max_since " << max_since
114 unsigned int max_run = m_lastRun;
115 edm::LogInfo(
"EcalTPGTPModeHandler") <<
"min_run= " << min_run <<
" max_run= " << max_run;
118 my_list =
econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run,
my_locdef);
121 std::vector<RunIOV> run_vec = my_list.
getRuns();
122 size_t num_runs = run_vec.size();
124 std::cout <<
"number of runs is : " << num_runs << std::endl;
126 unsigned int irun = 0;
128 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;
133 std::cout <<
" run= " << irun << std::endl;
136 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
140 int the_config_version = 0;
142 std::map<EcalLogicID, RunTPGConfigDat>::const_iterator it;
155 std::cout <<
" run= " << irun <<
" tag " << the_config_tag <<
" version=" << the_config_version << std::endl;
159 if ((the_config_tag != m_i_tag || the_config_version != m_i_version) &&
nr > 0) {
160 std::cout <<
"the tag is different from last transferred run ... retrieving last config set from DB"
168 std::cout <<
" before fetch config set" << std::endl;
169 econn->fetchConfigSet(&fe_main_info);
170 std::cout <<
" after fetch config set" << std::endl;
174 if (wId != m_i_TPMode) {
176 fe_odd_weight_info.
setId(wId);
177 econn->fetchConfigSet(&fe_odd_weight_info);
178 std::map<EcalLogicID, FEConfigOddWeightModeDat> dataset_mode;
179 econn->fetchDataSet(&dataset_mode, &fe_odd_weight_info);
181 typedef std::map<EcalLogicID, FEConfigOddWeightModeDat>::const_iterator CIfem;
184 int rd_modev[19] = {0};
186 for (CIfem
p = dataset_mode.begin();
p != dataset_mode.end();
p++) {
203 std::cout <<
"here is the value for the weight mode: " << std::endl
204 <<
" EnableEBOddFilter:" << rd_modev[0] << std::endl
205 <<
" EnableEEOddFilter:" << rd_modev[1] << std::endl
206 <<
" EnableEBOddPeakFinder:" << rd_modev[2] << std::endl
207 <<
" EnableEEOddPeakFinder:" << rd_modev[3] << std::endl
208 <<
" DisableEBEvenPeakFinder:" << rd_modev[4] << std::endl
209 <<
" DisableEEEvenPeakFinder:" << rd_modev[5] << std::endl
210 <<
" FenixEBStripOutput:" << rd_modev[6] << std::endl
211 <<
" FenixEEStripOutput:" << rd_modev[7] << std::endl
212 <<
" FenixEBStripInfobit2:" << rd_modev[8] << std::endl
213 <<
" FenixEEStripInfobit2:" << rd_modev[9] << std::endl
214 <<
" FenixEBTcpOutput:" << rd_modev[10] << std::endl
215 <<
" FenixEBTcpinfobit1:" << rd_modev[11] << std::endl
216 <<
" FenixEETcpOutput:" << rd_modev[12] << std::endl
217 <<
" FenixEETcpinfobit1:" << rd_modev[13] << std::endl;
221 std::cout <<
"*****************************************" << std::endl;
222 std::cout <<
"read done " << wId << std::endl;
223 std::cout <<
"*****************************************" << std::endl;
245 m_to_transfer.push_back(std::make_pair((
EcalTPGTPMode*)tpMode, snc));
247 m_i_run_number = irun;
248 m_i_tag = the_config_tag;
249 m_i_version = the_config_version;
252 writeFile(
"last_tpg_TPMode_settings.txt");
255 m_i_run_number = irun;
256 m_i_tag = the_config_tag;
257 m_i_version = the_config_version;
259 writeFile(
"last_tpg_TPMode_settings.txt");
262 <<
" even if the tag/version is not the same, the weight group id is the same -> no transfer needed "
269 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag
270 <<
" version=" << the_config_version << std::endl;
272 m_i_run_number = irun;
274 std::cout <<
" **************** " << std::endl;
276 }
else if (
nr == 0) {
277 m_i_run_number = irun;
278 std::cout <<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl;
279 std::cout <<
" **************** " << std::endl;
281 m_i_run_number = irun;
282 m_i_tag = the_config_tag;
283 m_i_version = the_config_version;
284 std::cout <<
" the tag/version is the same -> no transfer needed " << std::endl;
285 std::cout <<
" **************** " << std::endl;
286 writeFile(
"last_tpg_TPMode_settings.txt");
293 edm::LogInfo(
"EcalTPGTPModeHandler") <<
"Ecal - > end of getNewObjects -----------";
297 std::cout <<
" reading the input file " << m_file_name << std::endl;
298 std::ifstream fInput;
299 fInput.open(m_file_name);
300 if (!fInput.is_open()) {
301 std::cout <<
"ERROR : cannot open file " << m_file_name << std::endl;
304 std::map<std::string, int>
values;
309 while (fInput.good()) {
331 m_to_transfer.push_back(std::make_pair((
EcalTPGTPMode*)tpMode, snc));
334 std::cout <<
"EcalTPGTPModeHandler::readtxtFile error : " <<
e.what() << std::endl;
336 std::cout <<
" **************** " << std::endl;
356 std::ostringstream
str;
358 fgets(
line, 255, inpFile);
359 m_i_tag = to_string(
line);
360 str <<
"gen tag " << m_i_tag << std::endl;
362 fgets(
line, 255, inpFile);
363 m_i_version = atoi(
line);
364 str <<
"version= " << m_i_version << std::endl;
366 fgets(
line, 255, inpFile);
367 m_i_run_number = atoi(
line);
368 str <<
"run_number= " << m_i_run_number << std::endl;
370 fgets(
line, 255, inpFile);
371 m_i_TPMode = atoi(
line);
372 str <<
"TPMode_config= " << m_i_TPMode << std::endl;
380 std::ofstream myfile;
382 myfile << m_i_tag << std::endl;
383 myfile << m_i_version << std::endl;
384 myfile << m_i_run_number << std::endl;
385 myfile << m_i_TPMode << std::endl;