32 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGWeightGroupHandler")) {
34 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"EcalTPGWeightGroup Source handler constructor.";
61 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"Started GetNewObjects!!!";
73 unsigned int max_since=0;
75 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"max_since : " << max_since;
77 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"retrieved last payload ";
81 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"Retrieving run list from ONLINE DB ... ";
83 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"Making connection...";
116 if(min_run<max_since) {
123 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"min_run= " << min_run <<
" max_run= " << max_run;
129 std::vector<RunIOV> run_vec= my_list.
getRuns();
130 size_t num_runs=run_vec.size();
138 std::vector<EcalLogicID> my_StripEcalLogicId_EE;
143 "EE_offline_stripid",123 );
145 edm::LogInfo(
" GOT the logic ID for the EE trigger strips ");
147 for(
size_t kr=0; kr<run_vec.size(); kr++){
149 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
156 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
160 int the_config_version=0;
162 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
165 for( it=dataset.begin(); it!=dataset.end(); it++ )
178 edm::LogInfo(
" run= ")<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version;
184 edm::LogInfo(
"the tag is different from last transferred run ... retrieving last config set from DB");
192 econn-> fetchConfigSet(&fe_main_info);
202 fe_w_info.
setId(wId);
203 econn-> fetchConfigSet(&fe_w_info);
204 std::map<EcalLogicID, FEConfigWeightDat> dataset_TpgW;
209 typedef std::map<EcalLogicID, FEConfigWeightDat>::const_iterator CIfesli;
214 std::map<std::string,int>
map;
217 for (CIfesli
p = dataset_TpgW.begin();
p != dataset_TpgW.end();
p++) {
219 weightGroup =
p->second.getWeightGroupId();
224 if (ecid_name==
"EB_VFE") {
229 if(sm>18) tcc=sm+18 ;
233 unsigned int stripEBId = 303176+(tt-1)*64+(strip-1)*8+(tcc-37)*8192;
235 weightG->
setValue(stripEBId,weightGroup);
238 else if (ecid_name==
"ECAL_readout_strip"){
244 bool set_the_strip=
false;
246 for (
size_t istrip=0; istrip<my_StripEcalLogicId_EE.size(); istrip++) {
250 if(my_StripEcalLogicId_EE[istrip].getID1()==id1
251 && my_StripEcalLogicId_EE[istrip].getID2()==id2
252 && my_StripEcalLogicId_EE[istrip].getID3()==id3
254 stripEEId =my_StripEcalLogicId_EE[istrip].getLogicID();
264 weightG->
setValue(stripEEId,weightGroup);
267 edm::LogInfo(
" these may be the additional towers TCC/TT ")
284 writeFile(
"last_tpg_weightGroup_settings.txt");
292 writeFile(
"last_tpg_weightGroup_settings.txt");
294 edm::LogInfo(
" even if the tag/version is not the same, the weight group id is the same -> no transfer needed ");
301 edm::LogInfo(
"ERROR: THIS CONFIG DOES NOT EXIST: tag=") <<the_config_tag
302 <<
" version="<<the_config_version;
311 edm::LogInfo(
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed ");
317 edm::LogInfo(
" the tag/version is the same -> no transfer needed ");
319 writeFile(
"last_tpg_weightGroup_settings.txt");
327 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"Ecal - > end of getNewObjects -----------";
332 std::ifstream fInput;
334 if(!fInput.is_open()) {
338 int weightGroup, stripEBId, stripEEId;
341 fInput >> stripEBId >> weightGroup;
342 weightG->
setValue(stripEBId,weightGroup);
345 fInput >> stripEEId >> weightGroup;
346 weightG->
setValue(stripEEId,weightGroup);
352 edm::LogInfo(
"EcalTPGWeightGroupHandler::readtxtFile error : ") << e.what();
361 if(!fxml.is_open()) {
366 int weightGroup, stripEBId, stripEEId;
368 for(
int i = 0;
i < 6;
i++) std::getline(fxml, dummyLine);
370 std::size_t
found = bid.find(
"</");
372 for(
int i = 0;
i < 2;
i++) std::getline(fxml, dummyLine);
374 std::getline(fxml, dummyLine);
376 found = bid.find(
"</");
377 stt = bid.substr(7, found - 7);
378 std::istringstream sg1(stt);
380 std::getline(fxml, dummyLine);
382 found = bid.find(
"</");
383 stt = bid.substr(8, found - 8);
384 std::istringstream sg2(stt);
386 weightG->
setValue(stripEBId,weightGroup);
387 for(
int i = 0;
i < 2;
i++) std::getline(fxml, dummyLine);
390 std::getline(fxml, dummyLine);
392 found = bid.find(
"</");
393 stt = bid.substr(7, found - 7);
394 std::istringstream sg1(stt);
396 std::getline(fxml, dummyLine);
398 found = bid.find(
"</");
399 stt = bid.substr(8, found - 8);
400 std::istringstream sg2(stt);
402 weightG->
setValue(stripEEId,weightGroup);
403 for(
int i = 0;
i < 2;
i++) std::getline(fxml, dummyLine);
409 edm::LogInfo(
"EcalTPGWeightGroupHandler::readtxtFile error : ") << e.what();
423 inpFile = fopen(inputFile,
"r");
431 std::ostringstream
str;
433 fgets(line,255,inpFile);
435 str <<
"gen tag " <<
m_i_tag << std::endl ;
437 fgets(line,255,inpFile);
441 fgets(line,255,inpFile);
445 fgets(line,255,inpFile);
458 std::ofstream myfile;
459 myfile.open (inputFile);
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
std::vector< RunIOV > getRuns()
RunList fetchGlobalRunListByLocation(const RunTag &tag, int min_run, int max_run, const LocationDef &locDef) noexcept(false)
void getNewObjects() override
std::string getConfigTag() const
EcalCondDBInterface * econn
~EcalTPGWeightGroupHandler() override
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
void readFromFile(const char *inputFile)
OldContainer m_to_transfer
cond::ValidityInterval lastInterval
std::string getName() const
EcalTPGWeightGroupHandler(edm::ParameterSet const &)
std::vector< EcalLogicID > getEcalLogicIDSetOrdered(std::string name, int fromId1, int toId1, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="", int orderedBy=EcalLogicID::NULLID) noexcept(false)
std::string m_locationsource
void setValue(const uint32_t &rawId, const uint32_t &ObjectId)
unsigned int m_i_run_number
void setLocationDef(const LocationDef &locDef)
void setRunType(std::string runtype)
std::string to_string(char value[])
void setConfigTag(std::string x)
void setLocation(std::string loc)
void setGeneralTag(std::string tag)
void writeFile(const char *inputFile)
cond::TagInfo_t const & tagInfo() const