34 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalTPGSlidingWindowHandler")) {
36 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"EcalTPGSlidingWindow Source handler constructor";
58 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"Started GetNewObjects!!!";
63 std::cout <<
"got offlineInfo = " << std::endl;
64 std::cout <<
"tag name = " << tagInfo().name << std::endl;
65 std::cout <<
"size = " << tagInfo().size << std::endl;
67 std::cout <<
" First object for this tag " << std::endl;
70 unsigned int max_since=0;
71 max_since=
static_cast<unsigned int>(tagInfo().lastInterval.first);
72 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"max_since : " << max_since;
73 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"retrieved last payload ";
77 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"Retrieving run list from ONLINE DB ... ";
79 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"Making connection...";
85 std::cout <<
" connection parameters " <<m_sid <<
"/"<<m_user<<std::endl;
101 readFromFile(
"last_tpg_sliding_settings.txt");
104 unsigned int min_run=m_i_run_number+1;
105 if(m_firstRun<m_i_run_number) {
106 min_run=m_i_run_number+1;
111 if(min_run<max_since) {
115 std::cout<<
"m_i_run_number"<< m_i_run_number <<
"m_firstRun "<<m_firstRun<<
"max_since " <<max_since<< std::endl;
118 unsigned int max_run=m_lastRun;
120 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
123 my_list=econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run, my_locdef);
126 std::vector<RunIOV> run_vec= my_list.
getRuns();
127 size_t num_runs=run_vec.size();
129 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
135 std::vector<EcalLogicID> my_StripEcalLogicId_EE;
136 my_StripEcalLogicId_EE = econn->getEcalLogicIDSetOrdered(
"ECAL_readout_strip",
140 "EE_offline_stripid",123 );
141 std::cout <<
" GOT the logic ID for the EE trigger strips "<< std::endl;
144 for(
size_t kr=0; kr<run_vec.size(); kr++){
146 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
148 std::cout<<
" **************** "<<std::endl;
149 std::cout<<
" **************** "<<std::endl;
153 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
154 econn->fetchDataSet(&dataset, &run_vec[kr]);
157 int the_config_version=0;
159 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
164 for( it=dataset.begin(); it!=dataset.end(); it++ )
177 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
181 if((the_config_tag != m_i_tag || the_config_version != m_i_version ) && nr>0 ) {
182 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
189 std::cout <<
" before fetch config set" << std::endl;
190 econn-> fetchConfigSet(&fe_main_info);
191 std::cout <<
" after fetch config set" << std::endl;
195 int slidingId=fe_main_info.
getSliId();
197 if( slidingId != m_i_sliding ) {
200 fe_sli_info.
setId(slidingId);
201 econn-> fetchConfigSet(&fe_sli_info);
202 std::map<EcalLogicID, FEConfigSlidingDat> dataset_TpgSli;
203 econn->fetchDataSet(&dataset_TpgSli, &fe_sli_info);
206 typedef std::map<EcalLogicID, FEConfigSlidingDat>::const_iterator CIfesli;
212 for (CIfesli
p = dataset_TpgSli.begin();
p != dataset_TpgSli.end();
p++) {
219 if (ecid_name==
"EB_VFE") {
222 int strip=ecid_xt.
getID3();
224 if(sm>18) tcc=sm+18 ;
228 unsigned int stripEBId = 303176+(tt-1)*64+(strip-1)*8+(tcc-37)*8192;
234 else if (ecid_name==
"ECAL_readout_strip"){
241 bool set_the_strip=
false;
243 for (
size_t istrip=0; istrip<my_StripEcalLogicId_EE.size(); istrip++) {
247 if(my_StripEcalLogicId_EE[istrip].getID1()==id1
248 && my_StripEcalLogicId_EE[istrip].getID2()==id2
249 && my_StripEcalLogicId_EE[istrip].getID3()==id3
251 stripid =my_StripEcalLogicId_EE[istrip].getLogicID();
264 std::cout <<
" these may be the additional towers TCC/TT "
265 << id1<<
"/"<<id2<<std::endl;
278 m_i_tag=the_config_tag;
279 m_i_version=the_config_version;
280 m_i_sliding=slidingId;
282 writeFile(
"last_tpg_sliding_settings.txt");
287 m_i_tag=the_config_tag;
288 m_i_version=the_config_version;
290 writeFile(
"last_tpg_sliding_settings.txt");
292 std::cout<<
" even if the tag/version is not the same, the sliding windows id is the same -> no transfer needed "<< std::endl;
296 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
297 <<
" version="<<the_config_version<< std::endl;
304 std::cout<<
" **************** "<<std::endl;
309 std::cout<<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "<< std::endl;
310 std::cout<<
" **************** "<<std::endl;
313 m_i_tag=the_config_tag;
314 m_i_version=the_config_version;
315 std::cout<<
" the tag/version is the same -> no transfer needed "<< std::endl;
316 std::cout<<
" **************** "<<std::endl;
317 writeFile(
"last_tpg_sliding_settings.txt");
325 edm::LogInfo(
"EcalTPGSlidingWindowHandler") <<
"Ecal - > end of getNewObjects -----------";
338 inpFile = fopen(inputFile,
"r");
345 std::ostringstream str;
347 fgets(line,255,inpFile);
349 str <<
"gen tag " << m_i_tag << std::endl ;
351 fgets(line,255,inpFile);
352 m_i_version=atoi(line);
353 str <<
"version= " << m_i_version << std::endl ;
355 fgets(line,255,inpFile);
356 m_i_run_number=atoi(line);
357 str <<
"run_number= " << m_i_run_number << std::endl ;
359 fgets(line,255,inpFile);
360 m_i_sliding=atoi(line);
361 str <<
"sliding_config= " << m_i_sliding << std::endl ;
372 std::ofstream myfile;
373 myfile.open (inputFile);
374 myfile << m_i_tag <<std::endl;
375 myfile << m_i_version <<std::endl;
376 myfile << m_i_run_number <<std::endl;
377 myfile << m_i_sliding <<std::endl;
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
void readFromFile(const char *inputFile)
std::string getConfigTag() const
~EcalTPGSlidingWindowHandler()
std::string to_string(const T &t)
std::string getName() const
std::string m_locationsource
void writeFile(const char *inputFile)
void setLocationDef(const LocationDef &locDef)
void setValue(const uint32_t &id, const uint32_t &value)
void setRunType(std::string runtype)
void setConfigTag(std::string x)
EcalTPGSlidingWindowHandler(edm::ParameterSet const &)
void setLocation(std::string loc)
void setGeneralTag(std::string tag)
tuple size
Write out results.