31 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGSlidingWindowHandler")) {
32 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"EcalTPGSlidingWindow Source handler constructor";
49 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"Started GetNewObjects!!!";
54 std::cout <<
"got offlineInfo = " << std::endl;
58 std::cout <<
" First object for this tag " << std::endl;
61 unsigned int max_since = 0;
62 max_since =
static_cast<unsigned int>(
tagInfo().lastInterval.since);
63 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"max_since : " << max_since;
64 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"retrieved last payload ";
68 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"Retrieving run list from ONLINE DB ... ";
70 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"Making connection...";
75 std::cout <<
" connection parameters " << m_sid <<
"/" << m_user << std::endl;
90 readFromFile(
"last_tpg_sliding_settings.txt");
93 if (m_firstRun < m_i_run_number) {
94 min_run = m_i_run_number + 1;
99 if (min_run < max_since) {
100 min_run = max_since + 1;
103 std::cout <<
"m_i_run_number" << m_i_run_number <<
"m_firstRun " << m_firstRun <<
"max_since " << max_since
106 unsigned int max_run = m_lastRun;
108 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
111 my_list =
econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run,
my_locdef);
114 std::vector<RunIOV> run_vec = my_list.
getRuns();
115 size_t num_runs = run_vec.size();
117 std::cout <<
"number of runs is : " << num_runs << std::endl;
119 unsigned int irun = 0;
122 std::vector<EcalLogicID> my_StripEcalLogicId_EE;
123 my_StripEcalLogicId_EE =
124 econn->getEcalLogicIDSetOrdered(
"ECAL_readout_strip", 1, 1000, 1, 70, 0, 5,
"EE_offline_stripid", 123);
125 std::cout <<
" GOT the logic ID for the EE trigger strips " << std::endl;
127 for (
size_t kr = 0; kr < run_vec.size(); kr++) {
128 irun =
static_cast<unsigned int>(run_vec[kr].getRunNumber());
130 std::cout <<
" **************** " << std::endl;
131 std::cout <<
" **************** " << std::endl;
132 std::cout <<
" run= " << irun << std::endl;
135 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
139 int the_config_version = 0;
141 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;
173 int slidingId = fe_main_info.
getSliId();
175 if (slidingId != m_i_sliding) {
177 fe_sli_info.
setId(slidingId);
178 econn->fetchConfigSet(&fe_sli_info);
179 std::map<EcalLogicID, FEConfigSlidingDat> dataset_TpgSli;
180 econn->fetchDataSet(&dataset_TpgSli, &fe_sli_info);
183 typedef std::map<EcalLogicID, FEConfigSlidingDat>::const_iterator CIfesli;
187 for (CIfesli
p = dataset_TpgSli.begin();
p != dataset_TpgSli.end();
p++) {
194 if (ecid_name ==
"EB_VFE") {
204 unsigned int stripEBId = 303176 + (
tt - 1) * 64 + (
strip - 1) * 8 + (tcc - 37) * 8192;
208 }
else if (ecid_name ==
"ECAL_readout_strip") {
212 int id3 = ecid_xt.
getID3();
214 bool set_the_strip =
false;
216 for (
size_t istrip = 0; istrip < my_StripEcalLogicId_EE.size(); istrip++) {
217 if (!set_the_strip) {
218 if (my_StripEcalLogicId_EE[istrip].getID1() ==
id1 &&
219 my_StripEcalLogicId_EE[istrip].getID2() ==
id2 &&
220 my_StripEcalLogicId_EE[istrip].getID3() == id3) {
221 stripid = my_StripEcalLogicId_EE[istrip].getLogicID();
222 set_the_strip =
true;
232 std::cout <<
" these may be the additional towers TCC/TT " <<
id1 <<
"/" <<
id2 << std::endl;
240 m_i_run_number = irun;
241 m_i_tag = the_config_tag;
242 m_i_version = the_config_version;
243 m_i_sliding = slidingId;
245 writeFile(
"last_tpg_sliding_settings.txt");
248 m_i_run_number = irun;
249 m_i_tag = the_config_tag;
250 m_i_version = the_config_version;
252 writeFile(
"last_tpg_sliding_settings.txt");
255 <<
" even if the tag/version is not the same, the sliding windows id is the same -> no transfer needed " 259 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag <<
" version=" << the_config_version
263 m_i_run_number = irun;
266 std::cout <<
" **************** " << std::endl;
268 }
else if (
nr == 0) {
269 m_i_run_number = irun;
270 std::cout <<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl;
271 std::cout <<
" **************** " << std::endl;
273 m_i_run_number = irun;
274 m_i_tag = the_config_tag;
275 m_i_version = the_config_version;
276 std::cout <<
" the tag/version is the same -> no transfer needed " << std::endl;
277 std::cout <<
" **************** " << std::endl;
278 writeFile(
"last_tpg_sliding_settings.txt");
285 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"Ecal - > end of getNewObjects -----------";
305 std::ostringstream
str;
307 fgets(
line, 255, inpFile);
309 str <<
"gen tag " << m_i_tag << std::endl;
311 fgets(
line, 255, inpFile);
312 m_i_version = atoi(
line);
313 str <<
"version= " << m_i_version << std::endl;
315 fgets(
line, 255, inpFile);
316 m_i_run_number = atoi(
line);
317 str <<
"run_number= " << m_i_run_number << std::endl;
319 fgets(
line, 255, inpFile);
320 m_i_sliding = atoi(
line);
321 str <<
"sliding_config= " << m_i_sliding << std::endl;
329 std::ofstream myfile;
331 myfile << m_i_tag << std::endl;
332 myfile << m_i_version << std::endl;
333 myfile << m_i_run_number << std::endl;
334 myfile << m_i_sliding << std::endl;
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
T getParameter(std::string const &) const
void getNewObjects() override
void readFromFile(const char *inputFile)
std::string getName() const
Log< level::Error, false > LogError
static std::string to_string(const XMLCh *ch)
std::string m_locationsource
void writeFile(const char *inputFile)
void setLocationDef(const LocationDef &locDef)
void setValue(const uint32_t &id, const uint32_t &value)
Log< level::Info, false > LogInfo
std::string getConfigTag() const
~EcalTPGSlidingWindowHandler() override
void setConfigTag(std::string x)
ALPAKA_FN_ACC int sm(int ieta, int iphi)
EcalTPGSlidingWindowHandler(edm::ParameterSet const &)
void setGeneralTag(std::string tag)