23 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGFineGrainEBGroupHandler")) {
24 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"EcalTPGFineGrainEBGroup Source handler constructor.";
41 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Started GetNewObjects!!!";
46 std::cout <<
"got offlineInfo = " << std::endl;
50 std::cout <<
" First object for this tag " << std::endl;
53 unsigned int max_since = 0;
54 max_since = static_cast<unsigned int>(
tagInfo().lastInterval.since);
55 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"max_since : " << max_since;
56 Ref fgrGroup_db = lastPayload();
58 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"retrieved last payload ";
61 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Retrieving run list from ONLINE DB ... ";
63 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Making connection...";
65 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Done.";
68 std::cout <<
" connection parameters " << m_sid <<
"/" << m_user << std::endl;
86 unsigned int min_run = m_i_run_number + 1;
88 if (m_firstRun < m_i_run_number) {
89 min_run = m_i_run_number + 1;
93 if (min_run < max_since) {
94 min_run = max_since + 1;
97 std::cout <<
"m_i_run_number" << m_i_run_number <<
"m_firstRun " << m_firstRun <<
"max_since " << max_since
100 unsigned int max_run = m_lastRun;
101 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"min_run= " << min_run <<
" max_run= " << max_run;
104 my_list =
econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run,
my_locdef);
106 printf(
"after fetchRunList\n");
109 std::vector<RunIOV> run_vec = my_list.
getRuns();
110 size_t num_runs = run_vec.size();
112 std::cout <<
"number of runs is : " << num_runs << std::endl;
116 for (
size_t kr = 0; kr < run_vec.size(); kr++) {
117 irun = static_cast<unsigned int>(run_vec[kr].
getRunNumber());
119 std::cout <<
" **************** " << std::endl;
120 std::cout <<
" **************** " << std::endl;
121 std::cout <<
" run= " << irun << std::endl;
124 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
128 int the_config_version = 0;
130 std::map<EcalLogicID, RunTPGConfigDat>::const_iterator it;
143 std::cout <<
" run= " << irun <<
" tag " << the_config_tag <<
" version=" << the_config_version << std::endl;
147 if ((the_config_tag != m_i_tag || the_config_version != m_i_version) &&
nr > 0) {
148 std::cout <<
"the tag is different from last transferred run ... retrieving last config set from DB"
156 std::cout <<
" before fetch config set" << std::endl;
157 econn->fetchConfigSet(&fe_main_info);
158 std::cout <<
" after fetch config set" << std::endl;
161 int fgrId = fe_main_info.
getFgrId();
163 if (fgrId != m_i_fgrGroup) {
165 fe_fgr_info.
setId(fgrId);
166 econn->fetchConfigSet(&fe_fgr_info);
167 std::map<EcalLogicID, FEConfigFgrDat> dataset_TpgFineGrainEB;
168 econn->fetchDataSet(&dataset_TpgFineGrainEB, &fe_fgr_info);
171 typedef std::map<EcalLogicID, FEConfigFgrDat>::const_iterator CIfefgr;
176 for (CIfefgr
p = dataset_TpgFineGrainEB.begin();
p != dataset_TpgFineGrainEB.end();
p++) {
182 if (ecid_name ==
"EB_trigger_tower") {
184 int smid = ecid_xt.
getID1();
186 int towerid = ecid_xt.
getID2();
200 int tow_eta = (towerid - 1) / 4;
201 int tow_phi = ((towerid - 1) - tow_eta * 4);
203 int axt = (tow_eta * 5) * 20 + tow_phi * 5 + 1;
217 m_i_run_number = irun;
218 m_i_tag = the_config_tag;
219 m_i_version = the_config_version;
220 m_i_fgrGroup = fgrId;
222 writeFile(
"last_tpg_fgrGroup_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_fgrGroup_settings.txt");
231 std::cout <<
" even if the tag/version is not the same, the fgrGroup id is the same -> no transfer needed "
238 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag <<
" version=" << the_config_version
241 m_i_run_number = irun;
243 std::cout <<
" **************** " << std::endl;
245 }
else if (
nr == 0) {
246 m_i_run_number = irun;
247 std::cout <<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl;
248 std::cout <<
" **************** " << std::endl;
250 m_i_run_number = irun;
251 m_i_tag = the_config_tag;
252 m_i_version = the_config_version;
253 std::cout <<
" the tag/version is the same -> no transfer needed " << std::endl;
254 std::cout <<
" **************** " << std::endl;
255 writeFile(
"last_tpg_fgrGroup_settings.txt");
261 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Ecal - > end of getNewObjects -----------";
281 std::ostringstream
str;
283 fgets(
line, 255, inpFile);
284 m_i_tag = to_string(
line);
285 str <<
"gen tag " << m_i_tag << std::endl;
287 fgets(
line, 255, inpFile);
288 m_i_version = atoi(
line);
289 str <<
"version= " << m_i_version << std::endl;
291 fgets(
line, 255, inpFile);
292 m_i_run_number = atoi(
line);
293 str <<
"run_number= " << m_i_run_number << std::endl;
295 fgets(
line, 255, inpFile);
296 m_i_fgrGroup = atoi(
line);
297 str <<
"fgrGroup_config= " << m_i_fgrGroup << std::endl;
305 std::ofstream myfile;
307 myfile << m_i_tag << std::endl;
308 myfile << m_i_version << std::endl;
309 myfile << m_i_run_number << std::endl;
310 myfile << m_i_fgrGroup << std::endl;