38 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGLutGroupHandler")) {
39 edm::LogInfo(
"EcalTPGLutGroupHandler") <<
"EcalTPGLutGroup Source handler constructor";
59 edm::LogInfo(
"EcalTPGLutGroupHandler") <<
"Started GetNewObjects!!!";
84 std::cout <<
"got offlineInfo = " << std::endl;
88 std::cout <<
" First object for this tag " << std::endl;
91 unsigned int max_since = 0;
92 max_since =
static_cast<unsigned int>(
tagInfo().lastInterval.since);
93 edm::LogInfo(
"EcalTPGLutGroupHandler") <<
"max_since : " << max_since;
94 edm::LogInfo(
"EcalTPGLutGroupHandler") <<
"retrieved last payload ";
97 edm::LogInfo(
"EcalTPGLutGroupHandler") <<
"Retrieving run list from ONLINE DB ... ";
99 edm::LogInfo(
"EcalTPGLutGroupHandler") <<
"Making connection...";
104 std::cout <<
" connection parameters " << m_sid <<
"/" << m_user << std::endl;
120 readFromFile(
"last_tpg_lutGroup_settings.txt");
122 unsigned int min_run;
124 if (m_firstRun < m_i_run_number) {
125 min_run = m_i_run_number + 1;
127 min_run = m_firstRun;
130 if (min_run < max_since) {
131 min_run = max_since + 1;
134 std::cout <<
"m_i_run_number" << m_i_run_number <<
"m_firstRun " << m_firstRun <<
"max_since " << max_since
137 unsigned int max_run = m_lastRun;
138 edm::LogInfo(
"EcalTPGLutGroupHandler") <<
"min_run= " << min_run <<
" max_run= " << max_run;
141 my_list =
econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run,
my_locdef);
144 std::vector<RunIOV> run_vec = my_list.
getRuns();
145 size_t num_runs = run_vec.size();
147 std::cout <<
"number of runs is : " << num_runs << std::endl;
154 std::vector<EcalLogicID> my_TTEcalLogicId_EE;
155 my_TTEcalLogicId_EE =
econn->getEcalLogicIDSetOrdered(
157 std::cout <<
" GOT the logic ID for the EE trigger towers " << std::endl;
159 for (
size_t kr = 0; kr < run_vec.size(); kr++) {
160 irun =
static_cast<unsigned int>(run_vec[kr].getRunNumber());
162 std::cout <<
" **************** " << std::endl;
163 std::cout <<
" run= " << irun << std::endl;
166 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
170 int the_config_version = 0;
172 std::map<EcalLogicID, RunTPGConfigDat>::const_iterator it;
186 std::cout <<
" run= " << irun <<
" tag " << the_config_tag <<
" version=" << the_config_version << std::endl;
190 if ((the_config_tag != m_i_tag || the_config_version != m_i_version) &&
nr > 0) {
191 std::cout <<
"the tag is different from last transferred run ... retrieving last config set from DB" 199 std::cout <<
" before fetch config set" << std::endl;
200 econn->fetchConfigSet(&fe_main_info);
201 std::cout <<
" after fetch config set" << std::endl;
204 int lutId = fe_main_info.
getLUTId();
206 if (lutId != m_i_lutGroup) {
208 fe_lut_info.
setId(lutId);
209 econn->fetchConfigSet(&fe_lut_info);
210 std::map<EcalLogicID, FEConfigLUTDat> dataset_TpgLut;
211 econn->fetchDataSet(&dataset_TpgLut, &fe_lut_info);
214 typedef std::map<EcalLogicID, FEConfigLUTDat>::const_iterator CIfelut;
218 for (CIfelut
p = dataset_TpgLut.begin();
p != dataset_TpgLut.end();
p++) {
224 if (ecid_name ==
"EB_trigger_tower") {
226 int smid = ecid_xt.
getID1();
228 int towerid = ecid_xt.
getID2();
230 int tow_eta = (towerid - 1) / 4;
231 int tow_phi = ((towerid - 1) - tow_eta * 4);
233 int axt = (tow_eta * 5) * 20 + tow_phi * 5 + 1;
249 }
else if (ecid_name ==
"EE_trigger_tower") {
252 int tccid = ecid_xt.
getID1();
254 int towerid = ecid_xt.
getID2();
256 bool set_the_tower =
false;
258 for (
size_t itower = 0; itower < my_TTEcalLogicId_EE.size(); itower++) {
259 if (!set_the_tower) {
260 if (my_TTEcalLogicId_EE[itower].getID1() == tccid &&
261 my_TTEcalLogicId_EE[itower].getID2() == towerid) {
262 towid = my_TTEcalLogicId_EE[itower].getLogicID();
263 set_the_tower =
true;
272 std::cout <<
" these may be the additional towers TCC/TT " << tccid <<
"/" << towerid << std::endl;
281 m_i_run_number = irun;
282 m_i_tag = the_config_tag;
283 m_i_version = the_config_version;
284 m_i_lutGroup = lutId;
286 writeFile(
"last_tpg_lutGroup_settings.txt");
289 m_i_run_number = irun;
290 m_i_tag = the_config_tag;
291 m_i_version = the_config_version;
293 writeFile(
"last_tpg_lutGroup_settings.txt");
295 std::cout <<
" even if the tag/version is not the same, the lutGroup id is the same -> no transfer needed " 302 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag <<
" version=" << the_config_version
305 m_i_run_number = irun;
307 std::cout <<
" **************** " << std::endl;
309 }
else if (
nr == 0) {
310 m_i_run_number = irun;
311 std::cout <<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl;
312 std::cout <<
" **************** " << std::endl;
314 m_i_run_number = irun;
315 m_i_tag = the_config_tag;
316 m_i_version = the_config_version;
317 std::cout <<
" the tag/version is the same -> no transfer needed " << std::endl;
318 std::cout <<
" **************** " << std::endl;
319 writeFile(
"last_tpg_lutGroup_settings.txt");
326 edm::LogInfo(
"EcalTPGLutGroupHandler") <<
"Ecal - > end of getNewObjects -----------";
346 std::ostringstream
str;
348 fgets(
line, 255, inpFile);
350 str <<
"gen tag " << m_i_tag << std::endl;
352 fgets(
line, 255, inpFile);
353 m_i_version = atoi(
line);
354 str <<
"version= " << m_i_version << std::endl;
356 fgets(
line, 255, inpFile);
357 m_i_run_number = atoi(
line);
358 str <<
"run_number= " << m_i_run_number << std::endl;
360 fgets(
line, 255, inpFile);
361 m_i_lutGroup = atoi(
line);
362 str <<
"lutGroup_config= " << m_i_lutGroup << std::endl;
370 std::ofstream myfile;
372 myfile << m_i_tag << std::endl;
373 myfile << m_i_version << std::endl;
374 myfile << m_i_run_number << std::endl;
375 myfile << m_i_lutGroup << std::endl;
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
int getLUTGroupId() const
T getParameter(std::string const &) const
void readFromFile(const char *inputFile)
std::string getName() const
~EcalTPGLutGroupHandler() override
Log< level::Error, false > LogError
static std::string to_string(const XMLCh *ch)
void writeFile(const char *inputFile)
void setValue(const uint32_t &rawId, const uint32_t &ObjectId)
void setLocationDef(const LocationDef &locDef)
void getNewObjects() override
Log< level::Info, false > LogInfo
constexpr uint32_t rawId() const
get the raw id
std::string getConfigTag() const
std::string m_locationsource
void setConfigTag(std::string x)
void setGeneralTag(std::string tag)
static const int SMCRYSTALMODE
EcalTPGLutGroupHandler(edm::ParameterSet const &)