23 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGFineGrainEBIdMapHandler")) {
25 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"EcalTPGFineGrainEBIdMap Source handler constructor.";
47 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"Started GetNewObjects!!!";
52 std::cout <<
"got offlineInfo = " << std::endl;
56 std::cout <<
" First object for this tag " << std::endl;
60 unsigned int max_since=0;
62 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"max_since : " << max_since;
65 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"retrieved last payload ";
67 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"WOW: we just retrieved the last valid record from DB ";
72 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"Retrieving run list from ONLINE DB ... ";
74 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"Making connection...";
76 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"Done.";
107 if(min_run<max_since) {
114 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
119 printf (
"after fetchRunList\n");fflush(
stdout);
121 std::vector<RunIOV> run_vec= my_list.
getRuns();
122 size_t num_runs=run_vec.size();
124 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
129 for(
size_t kr=0; kr<run_vec.size(); kr++){
131 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
133 std::cout<<
" **************** "<<std::endl;
134 std::cout<<
" **************** "<<std::endl;
138 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
142 int the_config_version=0;
144 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
147 for( it=dataset.begin(); it!=dataset.end(); it++ )
159 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"<<std::endl;
172 std::cout <<
" before fetch config set" << std::endl;
173 econn-> fetchConfigSet(&fe_main_info);
174 std::cout <<
" after fetch config set" << std::endl;
181 fe_fgr_info.
setId(fgrId);
182 econn-> fetchConfigSet(&fe_fgr_info);
183 std::map<EcalLogicID, FEConfigFgrGroupDat> dataset_TpgFineGrainEB;
185 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"Got object!";
187 typedef std::map<EcalLogicID, FEConfigFgrGroupDat>::const_iterator CIfefgr;
192 for (CIfefgr
p = dataset_TpgFineGrainEB.begin();
p != dataset_TpgFineGrainEB.end();
p++)
206 f.
setValues(RatioL,RatioH, ThrL,ThrH,LutConfId);
219 writeFile(
"last_tpg_fgrIdMap_settings.txt");
227 writeFile(
"last_tpg_fgrIdMap_settings.txt");
229 std::cout<<
" even if the tag/version is not the same, the fgrIdMap is the same -> no transfer needed "<< std::endl;
236 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
237 <<
" version="<<the_config_version<< std::endl;
242 std::cout<<
" **************** "<<std::endl;
246 std::cout<<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "<< std::endl;
247 std::cout<<
" **************** "<<std::endl;
252 std::cout<<
" the tag/version is the same -> no transfer needed "<< std::endl;
253 std::cout<<
" **************** "<<std::endl;
254 writeFile(
"last_tpg_fgrIdMap_settings.txt");
261 edm::LogInfo(
"EcalTPGFineGrainEBIdMapHandler") <<
"Ecal - > end of getNewObjects -----------";
273 inpFile = fopen(inputFile,
"r");
281 std::ostringstream
str;
283 fgets(line,255,inpFile);
285 str <<
"gen tag " <<
m_i_tag << std::endl ;
287 fgets(line,255,inpFile);
291 fgets(line,255,inpFile);
295 fgets(line,255,inpFile);
297 str <<
"fgrIdMap_config= " <<
m_i_fgrIdMap << std::endl ;
308 std::ofstream myfile;
309 myfile.open (inputFile);
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
void setValue(const uint32_t &id, const EcalTPGFineGrainConstEB &value)
std::vector< RunIOV > getRuns()
edm::Ref< Container > Ref
RunList fetchGlobalRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
std::string getConfigTag() const
unsigned int m_i_run_number
std::string to_string(char value[])
EcalTPGFineGrainEBIdMapHandler(edm::ParameterSet const &)
void setValues(const uint32_t &ThresholdETLow, const uint32_t &ThresholdETHigh, const uint32_t &RatioLow, const uint32_t &RatioHigh, const uint32_t &LUT)
void writeFile(const char *inputFile)
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
OldContainer m_to_transfer
cond::ValidityInterval lastInterval
std::string getName() const
void readFromFile(const char *inputFile)
int getFgrGroupId() const
void getNewObjects() override
std::string m_locationsource
~EcalTPGFineGrainEBIdMapHandler() override
float getRatioLow() const
void setLocationDef(const LocationDef &locDef)
float getThreshLow() const
float getRatioHigh() const
void setRunType(std::string runtype)
void setConfigTag(std::string x)
void setLocation(std::string loc)
float getThreshHigh() const
void setGeneralTag(std::string tag)
EcalCondDBInterface * econn
cond::TagInfo_t const & tagInfo() const