25 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGWeightIdMapHandler")) {
27 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"EcalTPGWeightIdMap Source handler constructor";
50 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"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;
64 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"max_since : " << max_since;
67 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"retrieved last payload ";
70 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"Retrieving run list from ONLINE DB ... ";
72 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"Making connection...";
106 if(min_run<max_since) {
113 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
119 std::vector<RunIOV> run_vec= my_list.
getRuns();
120 size_t num_runs=run_vec.size();
121 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"number of Mon runs is : "<< num_runs;
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;
138 int the_config_version=0;
140 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
143 for( it=dataset.begin(); it!=dataset.end(); it++ )
156 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
162 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
169 std::cout <<
" before fetch config set" << std::endl;
170 econn-> fetchConfigSet(&fe_main_info);
171 std::cout <<
" after fetch config set" << std::endl;
175 int weightId=fe_main_info.
getWeiId();
180 fe_weight_info.
setId(weightId);
181 econn-> fetchConfigSet(&fe_weight_info);
182 std::map<EcalLogicID, FEConfigWeightGroupDat> dataset_TpgWeight;
184 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"Got object!";
186 typedef std::map<EcalLogicID, FEConfigWeightGroupDat>::const_iterator CIfeweight;
191 for (CIfeweight
p = dataset_TpgWeight.begin();
p != dataset_TpgWeight.end();
p++) {
196 unsigned int weight0 =
static_cast<unsigned int>(rd_w.
getWeight4());
197 unsigned int weight1 =
static_cast<unsigned int>(rd_w.
getWeight3());
198 unsigned int weight2 =
static_cast<unsigned int>(rd_w.
getWeight2());
199 unsigned int weight3 =
static_cast<unsigned int>(rd_w.
getWeight1()- 0x80);
200 unsigned int weight4 =
static_cast<unsigned int>(rd_w.
getWeight0());
202 w.
setValues(weight0,weight1,weight2,weight3,weight4);
208 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"found " << igroups <<
"Weight groups";
218 writeFile(
"last_tpg_weightIdMap_settings.txt");
226 writeFile(
"last_tpg_weightIdMap_settings.txt");
228 std::cout<<
" even if the tag/version is not the same, the weightIdMap id is the same -> no transfer needed "<< std::endl;
233 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
234 <<
" version="<<the_config_version<< std::endl;
239 std::cout<<
" **************** "<<std::endl;
243 std::cout<<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "<< std::endl;
244 std::cout<<
" **************** "<<std::endl;
249 std::cout<<
" the tag/version is the same -> no transfer needed "<< std::endl;
250 std::cout<<
" **************** "<<std::endl;
251 writeFile(
"last_tpg_weightIdMap_settings.txt");
259 edm::LogInfo(
"EcalTPGWeightIdMapHandler") <<
"Ecal - > end of getNewObjects -----------";
272 inpFile = fopen(inputFile,
"r");
280 std::ostringstream
str;
282 fgets(line,255,inpFile);
284 str <<
"gen tag " <<
m_i_tag << std::endl ;
286 fgets(line,255,inpFile);
290 fgets(line,255,inpFile);
294 fgets(line,255,inpFile);
307 std::ofstream myfile;
308 myfile.open (inputFile);
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
edm::Ref< Container > Ref
RunList fetchGlobalRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
std::string getConfigTag() const
void readFromFile(const char *inputFile)
void writeFile(const char *inputFile)
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
int getWeightGroupId() const
OldContainer m_to_transfer
cond::ValidityInterval lastInterval
std::string to_string(char value[])
void setLocationDef(const LocationDef &locDef)
EcalCondDBInterface * econn
void setValue(const uint32_t &id, const EcalTPGWeights &value)
~EcalTPGWeightIdMapHandler()
EcalTPGWeightIdMapHandler(edm::ParameterSet const &)
unsigned int m_i_run_number
void setRunType(std::string runtype)
void setConfigTag(std::string x)
void setLocation(std::string loc)
void setGeneralTag(std::string tag)
void setValues(const uint32_t &w0, const uint32_t &w1, const uint32_t &w2, const uint32_t &w3, const uint32_t &w4)
std::string m_locationsource
cond::TagInfo_t const & tagInfo() const