27 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGTPModeHandler")) {
28 edm::LogInfo(
"EcalTPGTPModeHandler") <<
"Ecal TPG TPMode Source handler constructor.";
47 if (m_file_type ==
"txt") {
62 unsigned int max_since = 0;
63 max_since =
static_cast<unsigned int>(
tagInfo().lastInterval.since);
70 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
"Retrieving run list from ONLINE DB ... ";
73 auto econn = std::make_shared<EcalCondDBInterface>(m_sid, m_user, m_pass);
77 throw cms::Exception(
"OMDS not available") <<
" connection parameters " << m_sid <<
"/" << m_user;
91 readFromFile(
"last_tpg_TPMode_settings.txt");
95 if (m_firstRun < m_i_run_number) {
96 min_run = m_i_run_number + 1;
101 if (min_run < max_since) {
102 min_run = max_since + 1;
106 <<
"m_i_run_number" << m_i_run_number <<
"m_firstRun " << m_firstRun <<
"max_since " << max_since;
108 unsigned int max_run = m_lastRun;
109 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
"min_run= " << min_run <<
" max_run= " << max_run;
112 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 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
"number of runs is : " << num_runs;
119 unsigned int irun = 0;
121 for (
size_t kr = 0; kr < run_vec.size(); kr++) {
122 irun =
static_cast<unsigned int>(run_vec[kr].getRunNumber());
128 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
132 int the_config_version = 0;
134 std::map<EcalLogicID, RunTPGConfigDat>::const_iterator
it;
147 <<
" run= " << irun <<
" tag " << the_config_tag <<
" version=" << the_config_version;
151 if ((the_config_tag != m_i_tag || the_config_version != m_i_version) &&
nr > 0) {
153 <<
"the tag is different from last transferred run ... retrieving last config set from DB";
161 econn->fetchConfigSet(&fe_main_info);
166 if (wId != m_i_TPMode) {
168 fe_odd_weight_info.
setId(wId);
169 econn->fetchConfigSet(&fe_odd_weight_info);
170 std::map<EcalLogicID, FEConfigOddWeightModeDat> dataset_mode;
171 econn->fetchDataSet(&dataset_mode, &fe_odd_weight_info);
173 typedef std::map<EcalLogicID, FEConfigOddWeightModeDat>::const_iterator CIfem;
176 int rd_modev[19] = {0};
178 for (CIfem
p = dataset_mode.begin();
p != dataset_mode.end();
p++) {
195 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
"here is the value for the weight mode: ";
196 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" EnableEBOddFilter:" << rd_modev[0];
197 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" EnableEEOddFilter:" << rd_modev[1];
198 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" EnableEBOddPeakFinder:" << rd_modev[2];
199 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" EnableEEOddPeakFinder:" << rd_modev[3];
200 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" DisableEBEvenPeakFinder:" << rd_modev[4];
201 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" DisableEEEvenPeakFinder:" << rd_modev[5];
202 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" FenixEBStripOutput:" << rd_modev[6];
203 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" FenixEEStripOutput:" << rd_modev[7];
204 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" FenixEBStripInfobit2:" << rd_modev[8];
205 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" FenixEEStripInfobit2:" << rd_modev[9];
206 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" FenixEBTcpOutput:" << rd_modev[10];
207 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" FenixEBTcpinfobit1:" << rd_modev[11];
208 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" FenixEETcpOutput:" << rd_modev[12];
209 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" FenixEETcpinfobit1:" << rd_modev[13];
213 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
"*****************************************";
215 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
"*****************************************";
237 m_to_transfer.push_back(std::make_pair((
EcalTPGTPMode*)tpMode, snc));
239 m_i_run_number = irun;
240 m_i_tag = the_config_tag;
241 m_i_version = the_config_version;
244 writeFile(
"last_tpg_TPMode_settings.txt");
247 m_i_run_number = irun;
248 m_i_tag = the_config_tag;
249 m_i_version = the_config_version;
251 writeFile(
"last_tpg_TPMode_settings.txt");
254 <<
" even if the tag/version is not the same, the weight group id is the same -> no transfer needed ";
260 throw cms::Exception(
"FileReadError") <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag
261 <<
" version=" << the_config_version <<
"\n" 266 }
else if (
nr == 0) {
267 m_i_run_number = irun;
269 <<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed ";
272 m_i_run_number = irun;
273 m_i_tag = the_config_tag;
274 m_i_version = the_config_version;
275 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" the tag/version is the same -> no transfer needed ";
277 writeFile(
"last_tpg_TPMode_settings.txt");
283 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
"Ecal - > end of getNewObjects -----------";
287 edm::LogVerbatim(
"EcalTPGTPModeHandler") <<
" reading the input file " << m_file_name;
288 std::ifstream fInput;
289 fInput.open(m_file_name);
290 if (!fInput.is_open()) {
291 throw cms::Exception(
"FileOpenError") <<
"ERROR : cannot open file " << m_file_name;
293 std::map<std::string, int>
values;
298 while (fInput.good()) {
320 m_to_transfer.push_back(std::make_pair((
EcalTPGTPMode*)tpMode, snc));
323 throw cms::Exception(
"FileReadError") <<
"EcalTPGTPModeHandler::readtxtFile error : " <<
e.what();
343 std::ostringstream
str;
345 fgets(
line, 255, inpFile);
347 str <<
"gen tag " << m_i_tag << std::endl;
349 fgets(
line, 255, inpFile);
350 m_i_version = atoi(
line);
351 str <<
"version= " << m_i_version << std::endl;
353 fgets(
line, 255, inpFile);
354 m_i_run_number = atoi(
line);
355 str <<
"run_number= " << m_i_run_number << std::endl;
357 fgets(
line, 255, inpFile);
358 m_i_TPMode = atoi(
line);
359 str <<
"TPMode_config= " << m_i_TPMode << std::endl;
365 std::ofstream myfile;
367 myfile << m_i_tag << std::endl;
368 myfile << m_i_version << std::endl;
369 myfile << m_i_run_number << std::endl;
370 myfile << m_i_TPMode << std::endl;
float getFenixEETcpOutput() const
Log< level::Info, true > LogVerbatim
void setRunTypeDef(const RunTypeDef &runTypeDef)
void readFromFile(const char *inputFile)
uint16_t EBFenixTcpInfobit1
std::vector< RunIOV > getRuns()
T getParameter(std::string const &) const
float getEnableEEOddFilter() const
float getFenixEBStripInfobit2() const
uint16_t FenixEBStripOutput
float getEnableEBOddFilter() const
uint16_t FenixEEStripInfobit2
uint16_t EBFenixTcpOutput
float getFenixEETcpInfobit1() const
uint16_t EEFenixTcpInfobit1
float getFenixEEStripOutput() const
uint16_t FenixEBStripInfobit2
float getFenixEEStripInfobit2() const
void getNewObjects() override
float getEnableEBOddPeakFinder() const
Log< level::Error, false > LogError
float getDisableEBEvenPeakFinder() const
static std::string to_string(const XMLCh *ch)
float getFenixEBStripOutput() const
uint16_t EEFenixTcpOutput
uint16_t FenixEEStripOutput
float getEnableEEOddPeakFinder() const
bool DisableEBEvenPeakFinder
EcalTPGTPModeHandler(edm::ParameterSet const &)
bool EnableEBOddPeakFinder
bool EnableEEOddPeakFinder
key
prepare the HTCondor submission files and eventually submit them
void setLocationDef(const LocationDef &locDef)
void writeFile(const char *inputFile)
Log< level::Info, false > LogInfo
bool DisableEEEvenPeakFinder
std::string m_locationsource
std::string getConfigTag() const
void setConfigTag(std::string x)
float getFenixEBTcpOutput() const
void setGeneralTag(std::string tag)
float getFenixEBTcpInfobit1() const
float getDisableEEEvenPeakFinder() const
~EcalTPGTPModeHandler() override