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;
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;
132 econn->fetchDataSet(&dataset, &run_vec[kr]);
135 int the_config_version = 0;
137 std::map<EcalLogicID, RunTPGConfigDat>::const_iterator it;
140 for (it = dataset.begin(); it != dataset.end(); 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;
184 for (CIfefgr
p = dataset_TpgFineGrainStripEE.begin();
p != dataset_TpgFineGrainStripEE.end();
p++) {
191 if (ecid_name ==
"EB_VFE") {
192 int sm = ecid_xt.
getID1();
201 unsigned int stripEBId = 303176 + (tt - 1) * 64 + (strip - 1) * 8 + (tcc - 37) * 8192;
207 fgrStripEE->
setValue(stripEBId, item);
210 }
else if (ecid_name ==
"ECAL_readout_strip") {
213 int id1 = ecid_xt.
getID1();
215 int id2 = ecid_xt.
getID2();
217 int id3 = ecid_xt.
getID3();
219 bool set_the_strip =
false;
221 for (
size_t istrip = 0; istrip < my_StripEcalLogicId_EE.size(); istrip++) {
222 if (!set_the_strip) {
223 if (my_StripEcalLogicId_EE[istrip].getID1() == id1 &&
224 my_StripEcalLogicId_EE[istrip].getID2() == id2 &&
225 my_StripEcalLogicId_EE[istrip].getID3() == id3) {
226 stripEEId = my_StripEcalLogicId_EE[istrip].getLogicID();
227 set_the_strip =
true;
238 fgrStripEE->
setValue(stripEEId, item);
240 std::cout <<
" these may be the additional towers TCC/TT " << id1 <<
"/" << id2 << std::endl;
250 m_i_run_number = irun;
251 m_i_tag = the_config_tag;
252 m_i_version = the_config_version;
253 m_i_fgrStripEE = fgrId;
255 writeFile(
"last_tpg_fgrStripEE_settings.txt");
258 m_i_run_number = irun;
259 m_i_tag = the_config_tag;
260 m_i_version = the_config_version;
262 writeFile(
"last_tpg_fgrStripEE_settings.txt");
264 std::cout <<
" even if the tag/version is not the same, the fgrStripEEestals id is the same -> no transfer "
272 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag <<
" version=" << the_config_version
275 m_i_run_number = irun;
277 std::cout <<
" **************** " << std::endl;
279 }
else if (nr == 0) {
280 m_i_run_number = irun;
281 std::cout <<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl;
282 std::cout <<
" **************** " << std::endl;
284 m_i_run_number = irun;
285 m_i_tag = the_config_tag;
286 m_i_version = the_config_version;
287 std::cout <<
" the tag/version is the same -> no transfer needed " << std::endl;
288 std::cout <<
" **************** " << std::endl;
289 writeFile(
"last_tpg_fgrStripEE_settings.txt");
296 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Ecal - > end of getNewObjects -----------";
308 inpFile = fopen(inputFile,
"r");
316 std::ostringstream
str;
318 fgets(line, 255, inpFile);
319 m_i_tag = to_string(line);
320 str <<
"gen tag " << m_i_tag << std::endl;
322 fgets(line, 255, inpFile);
323 m_i_version = atoi(line);
324 str <<
"version= " << m_i_version << std::endl;
326 fgets(line, 255, inpFile);
327 m_i_run_number = atoi(line);
328 str <<
"run_number= " << m_i_run_number << std::endl;
330 fgets(line, 255, inpFile);
331 m_i_fgrStripEE = atoi(line);
332 str <<
"fgrStripEE_config= " << m_i_fgrStripEE << std::endl;
340 std::ofstream myfile;
341 myfile.open(inputFile);
342 myfile << m_i_tag << std::endl;
343 myfile << m_i_version << std::endl;
344 myfile << m_i_run_number << std::endl;
345 myfile << m_i_fgrStripEE << std::endl;
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
void writeFile(const char *inputFile)
std::string getConfigTag() const
unsigned int getThreshold() const
void readFromFile(const char *inputFile)
Log< level::Error, false > LogError
void readFromFile(CaloCluster &c, FILE *file)
void setValue(const uint32_t &id, const Item &value)
std::string m_locationsource
unsigned int getLUTFgr() const
std::string getName() const
EcalTPGFineGrainStripEEHandler(edm::ParameterSet const &)
void getNewObjects() override
void setLocationDef(const LocationDef &locDef)
Log< level::Info, false > LogInfo
~EcalTPGFineGrainStripEEHandler() override
void setRunType(std::string runtype)
T getParameter(std::string const &) const
static std::vector< std::string > checklist dat
void setConfigTag(std::string x)
void setLocation(std::string loc)
void setGeneralTag(std::string tag)
tuple size
Write out results.