25 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalTPGLutIdMapHandler")) {
27 edm::LogInfo(
"EcalTPGLutIdMapHandler") <<
"EcalTPGLutIdMap Source handler constructor";
50 edm::LogInfo(
"EcalTPGLutIdMapHandler") <<
"Started GetNewObjects!!!";
55 std::cout <<
"got offlineInfo = " << std::endl;
59 std::cout <<
" First object for this tag " << std::endl;
62 unsigned int max_since=0;
63 max_since=
static_cast<unsigned int>(
tagInfo().lastInterval.first);
64 edm::LogInfo(
"EcalTPGLutIdMapHandler") <<
"max_since : " << max_since;
65 edm::LogInfo(
"EcalTPGLutIdMapHandler") <<
"retrieved last payload ";
68 edm::LogInfo(
"EcalTPGLutIdMapHandler") <<
"Retrieving run list from ONLINE DB ... ";
70 edm::LogInfo(
"EcalTPGLutIdMapHandler") <<
"Making connection...";
76 std::cout <<
" connection parameters " <<m_sid <<
"/"<<m_user<<std::endl;
94 readFromFile(
"last_tpg_lutIdMap_settings.txt");
97 unsigned int min_run=m_i_run_number+1;
99 if(m_firstRun<m_i_run_number) {
100 min_run=m_i_run_number+1;
105 if(min_run<max_since) {
109 std::cout<<
"m_i_run_number"<< m_i_run_number <<
"m_firstRun "<<m_firstRun<<
"max_since " <<max_since<< std::endl;
112 unsigned int max_run=m_lastRun;
113 edm::LogInfo(
"EcalTPGLutIdMapHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
116 my_list=econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run, my_locdef);
119 std::vector<RunIOV> run_vec= my_list.
getRuns();
120 size_t num_runs=run_vec.size();
122 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
127 for(
size_t kr=0; kr<run_vec.size(); kr++){
129 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
131 std::cout<<
" **************** "<<std::endl;
132 std::cout<<
" **************** "<<std::endl;
136 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
137 econn->fetchDataSet(&dataset, &run_vec[kr]);
140 int the_config_version=0;
142 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
145 for( it=dataset.begin(); it!=dataset.end(); it++ )
158 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
163 if((the_config_tag != m_i_tag || the_config_version != m_i_version ) && nr>0 ) {
164 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
171 std::cout <<
" before fetch config set" << std::endl;
172 econn-> fetchConfigSet(&fe_main_info);
173 std::cout <<
" after fetch config set" << std::endl;
179 if( lutId != m_i_lutIdMap ) {
182 fe_lut_info.
setId(lutId);
183 econn-> fetchConfigSet(&fe_lut_info);
184 std::map<EcalLogicID, FEConfigLUTGroupDat> dataset_TpgLut;
186 econn->fetchDataSet(&dataset_TpgLut, &fe_lut_info);
187 edm::LogInfo(
"EcalTPGLutIdMapHandler") <<
"Got object!";
191 typedef std::map<EcalLogicID, FEConfigLUTGroupDat>::const_iterator CIfelut;
196 for (CIfelut
p = dataset_TpgLut.begin();
p != dataset_TpgLut.end();
p++)
203 unsigned int lutArray[1024] ;
204 for (
int ilut=0;ilut<1024;++ilut) {
220 m_i_tag=the_config_tag;
221 m_i_version=the_config_version;
224 writeFile(
"last_tpg_lutIdMap_settings.txt");
229 m_i_tag=the_config_tag;
230 m_i_version=the_config_version;
232 writeFile(
"last_tpg_lutIdMap_settings.txt");
234 std::cout<<
" even if the tag/version is not the same, the lutIdMap id is the same -> no transfer needed "<< std::endl;
241 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
242 <<
" version="<<the_config_version<< std::endl;
247 std::cout<<
" **************** "<<std::endl;
251 std::cout<<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "<< std::endl;
252 std::cout<<
" **************** "<<std::endl;
255 m_i_tag=the_config_tag;
256 m_i_version=the_config_version;
257 std::cout<<
" the tag/version is the same -> no transfer needed "<< std::endl;
258 std::cout<<
" **************** "<<std::endl;
259 writeFile(
"last_tpg_lutIdMap_settings.txt");
267 edm::LogInfo(
"EcalTPGLutIdMapHandler") <<
"Ecal - > end of getNewObjects -----------";
281 inpFile = fopen(inputFile,
"r");
289 std::ostringstream str;
291 fgets(line,255,inpFile);
293 str <<
"gen tag " << m_i_tag << std::endl ;
295 fgets(line,255,inpFile);
296 m_i_version=atoi(line);
297 str <<
"version= " << m_i_version << std::endl ;
299 fgets(line,255,inpFile);
300 m_i_run_number=atoi(line);
301 str <<
"run_number= " << m_i_run_number << std::endl ;
303 fgets(line,255,inpFile);
304 m_i_lutIdMap=atoi(line);
305 str <<
"lutIdMap_config= " << m_i_lutIdMap << std::endl ;
316 std::ofstream myfile;
317 myfile.open (inputFile);
318 myfile << m_i_tag <<std::endl;
319 myfile << m_i_version <<std::endl;
320 myfile << m_i_run_number <<std::endl;
321 myfile << m_i_lutIdMap <<std::endl;
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
std::string getConfigTag() const
int getLUTGroupId() const
void writeFile(const char *inputFile)
EcalTPGLutIdMapHandler(edm::ParameterSet const &)
void setLut(const unsigned int *lut)
std::string to_string(const T &t)
int getLUTValue(int i) const
void setValue(const uint32_t &id, const EcalTPGLut &value)
void setLocationDef(const LocationDef &locDef)
void setRunType(std::string runtype)
void readFromFile(const char *inputFile)
void setConfigTag(std::string x)
std::string m_locationsource
void setLocation(std::string loc)
~EcalTPGLutIdMapHandler()
void setGeneralTag(std::string tag)
tuple size
Write out results.