14 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalTPGFineGrainTowerEEHandler")) {
16 edm::LogInfo(
"EcalTPGFineGrainTowerEEHandler") <<
"EcalTPGFineGrainTowerEE Source handler constructor.";
38 edm::LogInfo(
"EcalTPGFineGrainTowerEEHandler") <<
"Started GetNewObjects!!!";
43 std::cout <<
"got offlineInfo = " << std::endl;
47 std::cout <<
" First object for this tag " << std::endl;
50 unsigned int max_since=0;
51 max_since=
static_cast<unsigned int>(
tagInfo().lastInterval.first);
52 edm::LogInfo(
"EcalTPGFineGrainTowerEEHandler") <<
"max_since : " << max_since;
53 Ref fgrTTEE_db = lastPayload();
55 edm::LogInfo(
"EcalTPGFineGrainTowerEEHandler") <<
"retrieved last payload ";
58 edm::LogInfo(
"EcalTPGFineGrainTowerEEHandler") <<
"Retrieving run list from ONLINE DB ... ";
60 edm::LogInfo(
"EcalTPGFineGrainTowerEEHandler") <<
"Making connection...";
62 edm::LogInfo(
"EcalTPGFineGrainTowerEEHandler") <<
"Done.";
66 std::cout <<
" connection parameters " <<m_sid <<
"/"<<m_user<<std::endl;
83 readFromFile(
"last_tpg_fgrTTEE_settings.txt");
86 unsigned int min_run=m_i_run_number+1;
88 if(m_firstRun<m_i_run_number) {
89 min_run=m_i_run_number+1;
93 if(min_run<max_since) {
97 std::cout<<
"m_i_run_number"<< m_i_run_number <<
"m_firstRun "<<m_firstRun<<
"max_since " <<max_since<< std::endl;
99 unsigned int max_run=m_lastRun;
100 edm::LogInfo(
"EcalTPGFineGrainTowerEEHandler") <<
"min_run= " << min_run <<
" max_run= " << max_run;
103 my_list=econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run, my_locdef);
106 std::vector<RunIOV> run_vec= my_list.
getRuns();
107 size_t num_runs=run_vec.size();
109 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
114 std::vector<EcalLogicID> my_TTEcalLogicId_EE;
115 my_TTEcalLogicId_EE = econn->getEcalLogicIDSetOrdered(
"EE_trigger_tower",
119 "EE_offline_towerid",12 );
120 std::cout <<
" GOT the logic ID for the EE trigger towers "<< std::endl;
122 for(
size_t kr=0; kr<run_vec.size(); kr++){
124 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
126 std::cout<<
" **************** "<<std::endl;
127 std::cout<<
" **************** "<<std::endl;
131 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
132 econn->fetchDataSet(&dataset, &run_vec[kr]);
135 int the_config_version=0;
137 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
140 for( it=dataset.begin(); it!=dataset.end(); it++ )
151 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
156 if((the_config_tag != m_i_tag || the_config_version != m_i_version ) && nr>0 ) {
157 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
164 std::cout <<
" before fetch config set" << std::endl;
165 econn-> fetchConfigSet(&fe_main_info);
166 std::cout <<
" after fetch config set" << std::endl;
171 if( fgrId != m_i_fgrTTEE ) {
174 fe_fgr_info.
setId(fgrId);
175 econn-> fetchConfigSet(&fe_fgr_info);
176 std::map<EcalLogicID, FEConfigFgrEETowerDat> dataset_TpgFineGrainEE;
177 econn->fetchDataSet(&dataset_TpgFineGrainEE, &fe_fgr_info);
180 typedef std::map<EcalLogicID, FEConfigFgrEETowerDat>::const_iterator CIfefgr;
185 for (CIfefgr
p = dataset_TpgFineGrainEE.begin();
p != dataset_TpgFineGrainEE.end();
p++) {
191 if (ecid_name==
"EE_trigger_tower") {
193 int tccid=ecid_xt.
getID1();
195 int towerid=ecid_xt.
getID2();
197 bool set_the_tower=
false;
199 for (
size_t itower=0; itower<my_TTEcalLogicId_EE.size(); itower++) {
203 if(my_TTEcalLogicId_EE[itower].getID1()==tccid && my_TTEcalLogicId_EE[itower].getID2()==towerid){
204 towid =my_TTEcalLogicId_EE[itower].getLogicID();
216 std::cout <<
" these may be the additional towers TCC/TT "
217 << tccid<<
"/"<<towerid<<std::endl;
229 m_i_tag=the_config_tag;
230 m_i_version=the_config_version;
233 writeFile(
"last_tpg_fgrTTEE_settings.txt");
238 m_i_tag=the_config_tag;
239 m_i_version=the_config_version;
241 writeFile(
"last_tpg_fgrTTEE_settings.txt");
243 std::cout<<
" even if the tag/version is not the same, the fgrTTEE id is the same -> no transfer needed "<< std::endl;
248 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
249 <<
" version="<<the_config_version<< std::endl;
254 std::cout<<
" **************** "<<std::endl;
258 std::cout<<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "<< std::endl;
259 std::cout<<
" **************** "<<std::endl;
262 m_i_tag=the_config_tag;
263 m_i_version=the_config_version;
264 std::cout<<
" the tag/version is the same -> no transfer needed "<< std::endl;
265 std::cout<<
" **************** "<<std::endl;
266 writeFile(
"last_tpg_fgrTTEE_settings.txt");
273 edm::LogInfo(
"EcalTPGFineGrainTowerEEHandler") <<
"Ecal - > end of getNewObjects -----------";
286 inpFile = fopen(inputFile,
"r");
293 std::ostringstream str;
295 fgets(line,255,inpFile);
297 str <<
"gen tag " << m_i_tag << std::endl ;
299 fgets(line,255,inpFile);
300 m_i_version=atoi(line);
301 str <<
"version= " << m_i_version << std::endl ;
303 fgets(line,255,inpFile);
304 m_i_run_number=atoi(line);
305 str <<
"run_number= " << m_i_run_number << std::endl ;
307 fgets(line,255,inpFile);
308 m_i_fgrTTEE=atoi(line);
309 str <<
"fgrTTEE_config= " << m_i_fgrTTEE << std::endl ;
320 std::ofstream myfile;
321 myfile.open (inputFile);
322 myfile << m_i_tag <<std::endl;
323 myfile << m_i_version <<std::endl;
324 myfile << m_i_run_number <<std::endl;
325 myfile << m_i_fgrTTEE <<std::endl;
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
edm::Ref< Container > Ref
std::string getConfigTag() const
void writeFile(const char *inputFile)
EcalTPGFineGrainTowerEEHandler(edm::ParameterSet const &)
void readFromFile(const char *inputFile)
std::string to_string(const T &t)
std::string getName() const
void setValue(const uint32_t &id, const uint32_t &lut)
void setLocationDef(const LocationDef &locDef)
std::string m_locationsource
void setRunType(std::string runtype)
static std::vector< std::string > checklist dat
~EcalTPGFineGrainTowerEEHandler()
void setConfigTag(std::string x)
void setLocation(std::string loc)
void setGeneralTag(std::string tag)
tuple size
Write out results.