38 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGSpikeThresholdHandler")) {
39 edm::LogInfo(
"EcalTPGSpikeThresholdHandler") <<
"EcalTPGSpike Source handler constructor";
59 edm::LogInfo(
"EcalTPGSpikeThresholdHandler") <<
"Started GetNewObjects!!!";
64 std::cout <<
"got offlineInfo = " << std::endl;
68 std::cout <<
" First object for this tag " << std::endl;
71 unsigned int max_since = 0;
73 edm::LogInfo(
"EcalTPGSpikeThresholdHandler") <<
"max_since : " << max_since;
74 edm::LogInfo(
"EcalTPGSpikeThresholdHandler") <<
"retrieved last payload ";
77 edm::LogInfo(
"EcalTPGSpikeThresholdHandler") <<
"Retrieving run list from ONLINE DB ... ";
79 edm::LogInfo(
"EcalTPGSpikeThresholdHandler") <<
"Making connection...";
110 if (min_run < max_since) {
111 min_run = max_since + 1;
118 edm::LogInfo(
"EcalTPGSpikeThresholdHandler") <<
"min_run= " << min_run <<
" max_run= " << max_run;
124 std::vector<RunIOV> run_vec = my_list.
getRuns();
125 size_t num_runs = run_vec.size();
127 std::cout <<
"number of runs is : " << num_runs << std::endl;
133 for (
size_t kr = 0; kr < run_vec.size(); kr++) {
134 irun =
static_cast<unsigned int>(run_vec[kr].getRunNumber());
136 std::cout <<
" **************** " << std::endl;
137 std::cout <<
" run= " << irun << std::endl;
140 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
144 int the_config_version = 0;
146 std::map<EcalLogicID, RunTPGConfigDat>::const_iterator it;
149 for (it = dataset.begin(); it != dataset.end(); it++) {
160 std::cout <<
" run= " << irun <<
" tag " << the_config_tag <<
" version=" << the_config_version << std::endl;
165 std::cout <<
"the tag is different from last transferred run ... retrieving last config set from DB" 173 std::cout <<
" before fetch config set" << std::endl;
175 std::cout <<
" after fetch config set" << std::endl;
178 int spikeId = fe_main_info.
getSpiId();
182 fe_spike_info.
setId(spikeId);
184 std::map<EcalLogicID, FEConfigSpikeDat> dataset_TpgSpike;
188 typedef std::map<EcalLogicID, FEConfigSpikeDat>::const_iterator CIfelut;
193 for (CIfelut
p = dataset_TpgSpike.begin();
p != dataset_TpgSpike.end();
p++) {
195 rd_spike =
p->second;
199 if (ecid_name ==
"EB_trigger_tower") {
201 int smid = ecid_xt.
getID1();
203 int towerid = ecid_xt.
getID2();
205 int tow_eta = (towerid - 1) / 4;
206 int tow_phi = ((towerid - 1) - tow_eta * 4);
208 int axt = (tow_eta * 5) * 20 + tow_phi * 5 + 1;
221 std::cout <<
" The number of towers is = " << itowers << std::endl;
232 writeFile(
"last_tpg_spikeThreshold_settings.txt");
239 writeFile(
"last_tpg_spikeThreshold_settings.txt");
241 std::cout <<
" even if the tag/version is not the same, the lutGroup id is the same -> no transfer needed " 248 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" << the_config_tag <<
" version=" << the_config_version
253 std::cout <<
" **************** " << std::endl;
255 }
else if (nr == 0) {
257 std::cout <<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed " << std::endl;
258 std::cout <<
" **************** " << std::endl;
263 std::cout <<
" the tag/version is the same -> no transfer needed " << std::endl;
264 std::cout <<
" **************** " << std::endl;
265 writeFile(
"last_tpg_spikeThreshold_settings.txt");
272 edm::LogInfo(
"EcalTPGSpikeThresholdHandler") <<
"Ecal - > end of getNewObjects -----------";
284 inpFile = fopen(inputFile,
"r");
292 std::ostringstream
str;
294 fgets(line, 255, inpFile);
296 str <<
"gen tag " <<
m_i_tag << std::endl;
298 fgets(line, 255, inpFile);
302 fgets(line, 255, inpFile);
306 fgets(line, 255, inpFile);
308 str <<
"spikeTh_config= " <<
m_i_spikeTh << std::endl;
316 std::ofstream myfile;
317 myfile.open(inputFile);
318 myfile <<
m_i_tag << std::endl;
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
RunList fetchGlobalRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
std::string getConfigTag() const
~EcalTPGSpikeThresholdHandler() override
void getNewObjects() override
void readFromFile(const char *inputFile)
std::string m_locationsource
EcalTPGSpikeThresholdHandler(edm::ParameterSet const &)
constexpr uint32_t rawId() const
get the raw id
void fetchConfigSet(ICONF *iconf) noexcept(false)
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
void setValue(const uint32_t &id, const uint16_t &val)
OldContainer m_to_transfer
cond::ValidityInterval lastInterval
std::string getName() const
EcalCondDBInterface * econn
void setLocationDef(const LocationDef &locDef)
std::string id() const override
void setRunType(std::string runtype)
void writeFile(const char *inputFile)
std::string to_string(char value[])
unsigned int m_i_run_number
void setConfigTag(std::string x)
void setLocation(std::string loc)
int getSpikeThreshold() const
void setGeneralTag(std::string tag)
static const int SMCRYSTALMODE
cond::TagInfo_t const & tagInfo() const