28 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGFineGrainStripEEHandler")) {
29 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"EcalTPGFineGrainStripEEHandler Source handler constructor";
46 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Started GetNewObjects!!!";
51 std::cout <<
"got offlineInfo = " << std::endl;
55 std::cout <<
" First object for this tag " << std::endl;
58 unsigned int max_since = 0;
59 max_since =
static_cast<unsigned int>(
tagInfo().lastInterval.since);
60 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"max_since : " << max_since;
61 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"retrieved last payload ";
65 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Retrieving run list from ONLINE DB ... ";
67 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Making connection...";
69 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Done.";
72 std::cout <<
" connection parameters " << m_sid <<
"/" << m_user << std::endl;
87 readFromFile(
"last_tpg_fgrStripEE_settings.txt");
91 if (m_firstRun < m_i_run_number) {
92 min_run = m_i_run_number + 1;
96 if (min_run < max_since) {
97 min_run = max_since + 1;
100 std::cout <<
"m_i_run_number" << m_i_run_number <<
"m_firstRun " << m_firstRun <<
"max_since " << max_since
103 unsigned int max_run = m_lastRun;
104 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
107 my_list =
econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run,
my_locdef);
110 std::vector<RunIOV> run_vec = my_list.
getRuns();
111 size_t num_runs = run_vec.size();
113 std::cout <<
"number of runs is : " << num_runs << std::endl;
115 unsigned int irun = 0;
118 std::vector<EcalLogicID> my_StripEcalLogicId_EE;
119 my_StripEcalLogicId_EE =
120 econn->getEcalLogicIDSetOrdered(
"ECAL_readout_strip", 1, 1000, 1, 100, 0, 5,
"EE_offline_stripid", 123);
121 std::cout <<
" GOT the logic ID for the EE trigger strips " << std::endl;
123 for (
size_t kr = 0; kr < run_vec.size(); kr++) {
124 irun =
static_cast<unsigned int>(run_vec[kr].getRunNumber());
126 std::cout <<
" **************** " << std::endl;
127 std::cout <<
" **************** " << std::endl;
128 std::cout <<
" run= " << irun << std::endl;
131 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
135 int the_config_version = 0;
137 std::map<EcalLogicID, RunTPGConfigDat>::const_iterator it;
150 std::cout <<
" run= " << irun <<
" tag " << the_config_tag <<
" version=" << the_config_version << std::endl;
154 if ((the_config_tag != m_i_tag || the_config_version != m_i_version) &&
nr > 0) {
155 std::cout <<
"the tag is different from last transferred run ... retrieving last config set from DB" 163 std::cout <<
" before fetch config set" << std::endl;
164 econn->fetchConfigSet(&fe_main_info);
165 std::cout <<
" after fetch config set" << std::endl;
168 int fgrId = fe_main_info.
getFgrId();
170 if (fgrId != m_i_fgrStripEE) {
172 fe_fgr_info.
setId(fgrId);
173 econn->fetchConfigSet(&fe_fgr_info);
174 std::map<EcalLogicID, FEConfigFgrEEStripDat> dataset_TpgFineGrainStripEE;
175 econn->fetchDataSet(&dataset_TpgFineGrainStripEE, &fe_fgr_info);
178 typedef std::map<EcalLogicID, FEConfigFgrEEStripDat>::const_iterator CIfefgr;
182 for (CIfefgr
p = dataset_TpgFineGrainStripEE.begin();
p != dataset_TpgFineGrainStripEE.end();
p++) {
189 if (ecid_name ==
"EB_VFE") {
190 int sm = ecid_xt.
getID1();
199 unsigned int stripEBId = 303176 + (
tt - 1) * 64 + (
strip - 1) * 8 + (tcc - 37) * 8192;
207 }
else if (ecid_name ==
"ECAL_readout_strip") {
214 int id3 = ecid_xt.
getID3();
216 bool set_the_strip =
false;
218 for (
size_t istrip = 0; istrip < my_StripEcalLogicId_EE.size(); istrip++) {
219 if (!set_the_strip) {
220 if (my_StripEcalLogicId_EE[istrip].getID1() ==
id1 &&
221 my_StripEcalLogicId_EE[istrip].getID2() ==
id2 &&
222 my_StripEcalLogicId_EE[istrip].getID3() == id3) {
223 stripEEId = my_StripEcalLogicId_EE[istrip].getLogicID();
224 set_the_strip =
true;
237 std::cout <<
" these may be the additional towers TCC/TT " <<
id1 <<
"/" <<
id2 << std::endl;
245 m_i_run_number = irun;
246 m_i_tag = the_config_tag;
247 m_i_version = the_config_version;
248 m_i_fgrStripEE = fgrId;
250 writeFile(
"last_tpg_fgrStripEE_settings.txt");
253 m_i_run_number = irun;
254 m_i_tag = the_config_tag;
255 m_i_version = the_config_version;
257 writeFile(
"last_tpg_fgrStripEE_settings.txt");
259 std::cout <<
" even if the tag/version is not the same, the fgrStripEEestals id is the same -> no transfer " 267 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag <<
" version=" << the_config_version
270 m_i_run_number = irun;
272 std::cout <<
" **************** " << std::endl;
274 }
else if (
nr == 0) {
275 m_i_run_number = irun;
276 std::cout <<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl;
277 std::cout <<
" **************** " << std::endl;
279 m_i_run_number = irun;
280 m_i_tag = the_config_tag;
281 m_i_version = the_config_version;
282 std::cout <<
" the tag/version is the same -> no transfer needed " << std::endl;
283 std::cout <<
" **************** " << std::endl;
284 writeFile(
"last_tpg_fgrStripEE_settings.txt");
291 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Ecal - > end of getNewObjects -----------";
311 std::ostringstream
str;
313 fgets(
line, 255, inpFile);
315 str <<
"gen tag " << m_i_tag << std::endl;
317 fgets(
line, 255, inpFile);
318 m_i_version = atoi(
line);
319 str <<
"version= " << m_i_version << std::endl;
321 fgets(
line, 255, inpFile);
322 m_i_run_number = atoi(
line);
323 str <<
"run_number= " << m_i_run_number << std::endl;
325 fgets(
line, 255, inpFile);
326 m_i_fgrStripEE = atoi(
line);
327 str <<
"fgrStripEE_config= " << m_i_fgrStripEE << std::endl;
335 std::ofstream myfile;
337 myfile << m_i_tag << std::endl;
338 myfile << m_i_version << std::endl;
339 myfile << m_i_run_number << std::endl;
340 myfile << m_i_fgrStripEE << std::endl;
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
T getParameter(std::string const &) const
unsigned int getLUTFgr() const
unsigned int getThreshold() const
void writeFile(const char *inputFile)
std::string getName() const
void readFromFile(const char *inputFile)
Log< level::Error, false > LogError
static std::string to_string(const XMLCh *ch)
void setValue(const uint32_t &id, const Item &value)
std::string m_locationsource
EcalTPGFineGrainStripEEHandler(edm::ParameterSet const &)
void getNewObjects() override
void setLocationDef(const LocationDef &locDef)
Log< level::Info, false > LogInfo
~EcalTPGFineGrainStripEEHandler() override
std::string getConfigTag() const
void setConfigTag(std::string x)
void setGeneralTag(std::string tag)