24 : m_name(ps.getUntrackedParameter<std::
string>(
"name",
"EcalTPGFineGrainEBGroupHandler")) {
26 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"EcalTPGFineGrainEBGroup Source handler constructor.";
48 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Started GetNewObjects!!!";
53 std::cout <<
"got offlineInfo = " << std::endl;
54 std::cout <<
"tag name = " << tagInfo().name << std::endl;
55 std::cout <<
"size = " << tagInfo().size << std::endl;
57 std::cout <<
" First object for this tag " << std::endl;
60 unsigned int max_since=0;
61 max_since=
static_cast<unsigned int>(tagInfo().lastInterval.first);
62 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"max_since : " << max_since;
63 Ref fgrGroup_db = lastPayload();
65 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"retrieved last payload ";
68 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Retrieving run list from ONLINE DB ... ";
70 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Making connection...";
72 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Done.";
76 std::cout <<
" connection parameters " <<m_sid <<
"/"<<m_user<<std::endl;
93 readFromFile(
"last_tpg_fgrGroup_settings.txt");
96 unsigned int min_run=m_i_run_number+1;
98 if(m_firstRun<m_i_run_number) {
99 min_run=m_i_run_number+1;
103 if(min_run<max_since) {
107 std::cout<<
"m_i_run_number"<< m_i_run_number <<
"m_firstRun "<<m_firstRun<<
"max_since " <<max_since<< std::endl;
109 unsigned int max_run=m_lastRun;
110 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"min_run= " << min_run <<
" max_run= " << max_run;
113 my_list=econn->fetchGlobalRunListByLocation(my_runtag, min_run, max_run, my_locdef);
115 printf (
"after fetchRunList\n");fflush(stdout);
117 std::vector<RunIOV> run_vec= my_list.
getRuns();
118 size_t num_runs=run_vec.size();
120 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
125 for(
size_t kr=0; kr<run_vec.size(); kr++){
127 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
129 std::cout<<
" **************** "<<std::endl;
130 std::cout<<
" **************** "<<std::endl;
134 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
135 econn->fetchDataSet(&dataset, &run_vec[kr]);
138 int the_config_version=0;
140 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
143 for( it=dataset.begin(); it!=dataset.end(); it++ )
155 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
160 if((the_config_tag != m_i_tag || the_config_version != m_i_version ) && nr>0 ) {
161 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
168 std::cout <<
" before fetch config set" << std::endl;
169 econn-> fetchConfigSet(&fe_main_info);
170 std::cout <<
" after fetch config set" << std::endl;
176 if( fgrId != m_i_fgrGroup ) {
179 fe_fgr_info.
setId(fgrId);
180 econn-> fetchConfigSet(&fe_fgr_info);
181 std::map<EcalLogicID, FEConfigFgrDat> dataset_TpgFineGrainEB;
182 econn->fetchDataSet(&dataset_TpgFineGrainEB, &fe_fgr_info);
185 typedef std::map<EcalLogicID, FEConfigFgrDat>::const_iterator CIfefgr;
190 for (CIfefgr
p = dataset_TpgFineGrainEB.begin();
p != dataset_TpgFineGrainEB.end();
p++) {
196 if (ecid_name==
"EB_trigger_tower") {
198 int smid=ecid_xt.
getID1();
200 int towerid=ecid_xt.
getID2();
214 int tow_eta=(towerid-1)/4;
215 int tow_phi=((towerid-1)-tow_eta*4);
217 int axt=(tow_eta*5)*20 + tow_phi*5 +1 ;
233 m_i_tag=the_config_tag;
234 m_i_version=the_config_version;
237 writeFile(
"last_tpg_fgrGroup_settings.txt");
242 m_i_tag=the_config_tag;
243 m_i_version=the_config_version;
245 writeFile(
"last_tpg_fgrGroup_settings.txt");
247 std::cout<<
" even if the tag/version is not the same, the fgrGroup id is the same -> no transfer needed "<< std::endl;
254 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
255 <<
" version="<<the_config_version<< std::endl;
260 std::cout<<
" **************** "<<std::endl;
264 std::cout<<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "<< std::endl;
265 std::cout<<
" **************** "<<std::endl;
268 m_i_tag=the_config_tag;
269 m_i_version=the_config_version;
270 std::cout<<
" the tag/version is the same -> no transfer needed "<< std::endl;
271 std::cout<<
" **************** "<<std::endl;
272 writeFile(
"last_tpg_fgrGroup_settings.txt");
280 edm::LogInfo(
"EcalTPGFineGrainEBGroupHandler") <<
"Ecal - > end of getNewObjects -----------";
293 inpFile = fopen(inputFile,
"r");
300 std::ostringstream str;
302 fgets(line,255,inpFile);
304 str <<
"gen tag " << m_i_tag << std::endl ;
306 fgets(line,255,inpFile);
307 m_i_version=atoi(line);
308 str <<
"version= " << m_i_version << std::endl ;
310 fgets(line,255,inpFile);
311 m_i_run_number=atoi(line);
312 str <<
"run_number= " << m_i_run_number << std::endl ;
314 fgets(line,255,inpFile);
315 m_i_fgrGroup=atoi(line);
316 str <<
"fgrGroup_config= " << m_i_fgrGroup << std::endl ;
327 std::ofstream myfile;
328 myfile.open (inputFile);
329 myfile << m_i_tag <<std::endl;
330 myfile << m_i_version <<std::endl;
331 myfile << m_i_run_number <<std::endl;
332 myfile << m_i_fgrGroup <<std::endl;
T getParameter(std::string const &) const
std::vector< RunIOV > getRuns()
edm::Ref< Container > Ref
void setLocationDef(const LocationDef locDef)
std::string getConfigTag() const
void writeFile(const char *inputFile)
void readFromFile(const char *inputFile)
uint32_t rawId() const
get the raw id
std::string to_string(const T &t)
std::string getName() const
unsigned long long Time_t
void setRunTypeDef(const RunTypeDef runTypeDef)
void setValue(const uint32_t &rawId, const uint32_t &ObjectId)
~EcalTPGFineGrainEBGroupHandler()
void setRunType(std::string runtype)
std::string m_locationsource
EcalTPGFineGrainEBGroupHandler(edm::ParameterSet const &)
void setConfigTag(std::string x)
void setLocation(std::string loc)
void setGeneralTag(std::string tag)
int getFgrGroupId() const
static const int SMCRYSTALMODE
tuple size
Write out results.