29 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalTPGFineGrainStripEEHandler")) {
31 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"EcalTPGFineGrainStripEEHandler Source handler constructor";
53 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Started GetNewObjects!!!";
58 std::cout <<
"got offlineInfo = " << std::endl;
62 std::cout <<
" First object for this tag " << std::endl;
65 unsigned int max_since=0;
66 max_since=
static_cast<unsigned int>(
tagInfo().lastInterval.first);
67 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"max_since : " << max_since;
68 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"retrieved last payload ";
72 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Retrieving run list from ONLINE DB ... ";
74 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Making connection...";
76 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Done.";
80 std::cout <<
" connection parameters " <<m_sid <<
"/"<<m_user<<std::endl;
96 readFromFile(
"last_tpg_fgrStripEE_settings.txt");
99 unsigned int min_run=m_i_run_number+1;
101 if(m_firstRun<m_i_run_number) {
102 min_run=m_i_run_number+1;
106 if(min_run<max_since) {
110 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(
"EcalTPGFineGrainStripEEHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
116 my_list=econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run, my_locdef);
120 std::vector<RunIOV> run_vec= my_list.
getRuns();
121 size_t num_runs=run_vec.size();
123 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
129 std::vector<EcalLogicID> my_StripEcalLogicId_EE;
130 my_StripEcalLogicId_EE = econn->getEcalLogicIDSetOrdered(
"ECAL_readout_strip",
134 "EE_offline_stripid",123 );
135 std::cout <<
" GOT the logic ID for the EE trigger strips "<< std::endl;
138 for(
size_t kr=0; kr<run_vec.size(); kr++){
140 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
142 std::cout<<
" **************** "<<std::endl;
143 std::cout<<
" **************** "<<std::endl;
147 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
148 econn->fetchDataSet(&dataset, &run_vec[kr]);
151 int the_config_version=0;
153 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
156 for( it=dataset.begin(); it!=dataset.end(); it++ )
168 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
173 if((the_config_tag != m_i_tag || the_config_version != m_i_version ) && nr>0 ) {
174 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
181 std::cout <<
" before fetch config set" << std::endl;
182 econn-> fetchConfigSet(&fe_main_info);
183 std::cout <<
" after fetch config set" << std::endl;
189 if( fgrId != m_i_fgrStripEE ) {
192 fe_fgr_info.
setId(fgrId);
193 econn-> fetchConfigSet(&fe_fgr_info);
194 std::map<EcalLogicID, FEConfigFgrEEStripDat> dataset_TpgFineGrainStripEE;
195 econn->fetchDataSet(&dataset_TpgFineGrainStripEE, &fe_fgr_info);
198 typedef std::map<EcalLogicID, FEConfigFgrEEStripDat>::const_iterator CIfefgr;
204 for (CIfefgr
p = dataset_TpgFineGrainStripEE.begin();
p != dataset_TpgFineGrainStripEE.end();
p++) {
212 if (ecid_name==
"EB_VFE") {
215 int strip=ecid_xt.
getID3();
217 if(sm>18) tcc=sm+18 ;
221 unsigned int stripEBId = 303176+(tt-1)*64+(strip-1)*8+(tcc-37)*8192;
227 fgrStripEE->
setValue(stripEBId,item);
231 }
else if (ecid_name==
"ECAL_readout_strip"){
240 bool set_the_strip=
false;
242 for (
size_t istrip=0; istrip<my_StripEcalLogicId_EE.size(); istrip++) {
246 if(my_StripEcalLogicId_EE[istrip].getID1()==id1
247 && my_StripEcalLogicId_EE[istrip].getID2()==id2
248 && my_StripEcalLogicId_EE[istrip].getID3()==id3
250 stripEEId =my_StripEcalLogicId_EE[istrip].getLogicID();
263 fgrStripEE->
setValue(stripEEId,item);
265 std::cout <<
" these may be the additional towers TCC/TT "
266 << id1<<
"/"<<id2<<std::endl;
278 m_i_tag=the_config_tag;
279 m_i_version=the_config_version;
280 m_i_fgrStripEE=fgrId;
282 writeFile(
"last_tpg_fgrStripEE_settings.txt");
287 m_i_tag=the_config_tag;
288 m_i_version=the_config_version;
290 writeFile(
"last_tpg_fgrStripEE_settings.txt");
292 std::cout<<
" even if the tag/version is not the same, the fgrStripEEestals id is the same -> no transfer needed "<< std::endl;
299 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
300 <<
" version="<<the_config_version<< std::endl;
305 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_fgrStripEE_settings.txt");
325 edm::LogInfo(
"EcalTPGFineGrainStripEEHandler") <<
"Ecal - > end of getNewObjects -----------";
339 inpFile = fopen(inputFile,
"r");
347 std::ostringstream str;
349 fgets(line,255,inpFile);
350 m_i_tag=to_string(line);
351 str <<
"gen tag " << m_i_tag << std::endl ;
353 fgets(line,255,inpFile);
354 m_i_version=atoi(line);
355 str <<
"version= " << m_i_version << std::endl ;
357 fgets(line,255,inpFile);
358 m_i_run_number=atoi(line);
359 str <<
"run_number= " << m_i_run_number << std::endl ;
361 fgets(line,255,inpFile);
362 m_i_fgrStripEE=atoi(line);
363 str <<
"fgrStripEE_config= " << m_i_fgrStripEE << std::endl ;
374 std::ofstream myfile;
375 myfile.open (inputFile);
376 myfile << m_i_tag <<std::endl;
377 myfile << m_i_version <<std::endl;
378 myfile << m_i_run_number <<std::endl;
379 myfile << m_i_fgrStripEE <<std::endl;
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
void writeFile(const char *inputFile)
std::string getConfigTag() const
unsigned int getThreshold() const
void readFromFile(const char *inputFile)
void setValue(const uint32_t &id, const Item &value)
std::string m_locationsource
unsigned int getLUTFgr() const
std::string getName() const
EcalTPGFineGrainStripEEHandler(edm::ParameterSet const &)
~EcalTPGFineGrainStripEEHandler()
void setLocationDef(const LocationDef &locDef)
void setRunType(std::string runtype)
void setConfigTag(std::string x)
void setLocation(std::string loc)
void setGeneralTag(std::string tag)
tuple size
Write out results.