23 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGLinConstHandler")) {
24 edm::LogInfo(
"EcalTPGLinConstHandler") <<
"EcalTPGLinConst Source handler constructor";
41 edm::LogInfo(
"EcalTPGLinConstHandler") <<
"Started getNewObjects";
45 std::cout <<
"got offlineInfo = " << std::endl;
49 std::cout <<
" First object for this tag " << std::endl;
52 unsigned int max_since = 0;
53 max_since = static_cast<unsigned int>(
tagInfo().lastInterval.since);
54 edm::LogInfo(
"EcalTPGLinConstHandler") <<
"max_since = " << max_since;
55 edm::LogInfo(
"EcalTPGLinConstHandler") <<
"Retrieved last payload ";
58 edm::LogInfo(
"EcalTPGLinConstHandler") <<
"Retrieving run list from ONLINE DB ... " << std::endl;
60 edm::LogInfo(
"EcalTPGLinConstHandler") <<
"Making connection..." << std::flush;
62 edm::LogInfo(
"EcalTPGLinConstHandler") <<
"Done." << std::endl;
65 std::cout <<
" connection parameters " << m_sid <<
"/" << m_user << std::endl;
83 unsigned int min_run = m_i_run_number + 1;
85 if (m_firstRun < m_i_run_number) {
86 min_run = m_i_run_number + 1;
91 if (min_run < max_since) {
92 min_run = max_since + 1;
95 std::cout <<
"m_i_run_number" << m_i_run_number <<
"m_firstRun " << m_firstRun <<
"max_since " << max_since
98 unsigned int max_run = m_lastRun;
99 edm::LogInfo(
"EcalTPGLinConstHandler") <<
"min_run= " << min_run <<
"max_run = " << max_run;
102 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;
110 unsigned int irun = 0;
112 for (
size_t kr = 0; kr < run_vec.size(); kr++) {
113 irun = static_cast<unsigned int>(run_vec[kr].
getRunNumber());
114 std::cout <<
" **************** " << std::endl;
115 std::cout <<
" **************** " << std::endl;
116 std::cout <<
" run= " << irun << std::endl;
119 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
123 int the_config_version = 0;
125 std::map<EcalLogicID, RunTPGConfigDat>::const_iterator it;
139 std::cout <<
" run= " << irun <<
" tag " << the_config_tag <<
" version=" << the_config_version << std::endl;
143 if ((the_config_tag != m_i_tag || the_config_version != m_i_version) &&
nr > 0) {
144 std::cout <<
"the tag is different from last transferred run ... retrieving last config set from DB"
152 std::cout <<
" before fetch config set" << std::endl;
153 econn->fetchConfigSet(&fe_main_info);
154 std::cout <<
" after fetch config set" << std::endl;
157 int linId = fe_main_info.
getLinId();
159 if (linId != m_i_lin) {
161 fe_lin_info.
setId(linId);
162 econn->fetchConfigSet(&fe_lin_info);
163 std::map<EcalLogicID, FEConfigLinDat> dataset_TpgLin;
164 econn->fetchDataSet(&dataset_TpgLin, &fe_lin_info);
167 typedef std::map<EcalLogicID, FEConfigLinDat>::const_iterator CIfelin;
172 for (CIfelin
p = dataset_TpgLin.begin();
p != dataset_TpgLin.end();
p++) {
178 if (ecid_name ==
"EB_crystal_number") {
179 int sm_num = ecid_xt.
getID1();
180 int xt_num = ecid_xt.
getID2();
217 m_i_run_number = irun;
218 m_i_tag = the_config_tag;
219 m_i_version = the_config_version;
222 writeFile(
"last_tpg_lin_settings.txt");
225 m_i_run_number = irun;
226 m_i_tag = the_config_tag;
227 m_i_version = the_config_version;
229 writeFile(
"last_tpg_lin_settings.txt");
231 std::cout <<
" even if the tag/version is not the same, the linearization constants id is the same -> no "
236 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag <<
" version=" << the_config_version
239 m_i_run_number = irun;
241 std::cout <<
" **************** " << std::endl;
243 }
else if (
nr == 0) {
244 m_i_run_number = irun;
245 std::cout <<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl;
246 std::cout <<
" **************** " << std::endl;
248 m_i_run_number = irun;
249 m_i_tag = the_config_tag;
250 m_i_version = the_config_version;
251 std::cout <<
" the tag/version is the same -> no transfer needed " << std::endl;
252 std::cout <<
" **************** " << std::endl;
253 writeFile(
"last_tpg_lin_settings.txt");
260 edm::LogInfo(
"EcalTPGLinConstHandler") <<
"Ecal - > end of getNewObjects -----------";
280 std::ostringstream
str;
282 fgets(
line, 255, inpFile);
283 m_i_tag = to_string(
line);
284 str <<
"gen tag " << m_i_tag << std::endl;
286 fgets(
line, 255, inpFile);
287 m_i_version = atoi(
line);
288 str <<
"version= " << m_i_version << std::endl;
290 fgets(
line, 255, inpFile);
291 m_i_run_number = atoi(
line);
292 str <<
"run_number= " << m_i_run_number << std::endl;
294 fgets(
line, 255, inpFile);
295 m_i_lin = atoi(
line);
296 str <<
"lin_config= " << m_i_lin << std::endl;
304 std::ofstream myfile;
306 myfile << m_i_tag << std::endl;
307 myfile << m_i_version << std::endl;
308 myfile << m_i_run_number << std::endl;
309 myfile << m_i_lin << std::endl;