31 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGWeightGroupHandler")) {
33 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"EcalTPGWeightGroup Source handler constructor.";
54 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"Started GetNewObjects!!!";
59 std::cout <<
"got offlineInfo = " << std::endl;
63 std::cout <<
" First object for this tag " << std::endl;
66 unsigned int max_since=0;
68 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"max_since : " << max_since;
70 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"retrieved last payload ";
74 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"Retrieving run list from ONLINE DB ... ";
76 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"Making connection...";
109 if(min_run<max_since) {
116 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"min_run= " << min_run <<
" max_run= " << max_run;
122 std::vector<RunIOV> run_vec= my_list.
getRuns();
123 size_t num_runs=run_vec.size();
125 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
131 std::vector<EcalLogicID> my_StripEcalLogicId_EE;
136 "EE_offline_stripid",123 );
138 std::cout <<
" GOT the logic ID for the EE trigger strips "<< std::endl;
140 for(
size_t kr=0; kr<run_vec.size(); kr++){
142 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
144 std::cout<<
" **************** "<<std::endl;
145 std::cout<<
" **************** "<<std::endl;
149 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
153 int the_config_version=0;
155 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
158 for( it=dataset.begin(); it!=dataset.end(); it++ )
171 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
177 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
184 std::cout <<
" before fetch config set" << std::endl;
185 econn-> fetchConfigSet(&fe_main_info);
186 std::cout <<
" after fetch config set" << std::endl;
195 fe_w_info.
setId(wId);
196 econn-> fetchConfigSet(&fe_w_info);
197 std::map<EcalLogicID, FEConfigWeightDat> dataset_TpgW;
202 typedef std::map<EcalLogicID, FEConfigWeightDat>::const_iterator CIfesli;
207 std::map<std::string,int>
map;
210 for (CIfesli
p = dataset_TpgW.begin();
p != dataset_TpgW.end();
p++) {
212 weightGroup =
p->second.getWeightGroupId();
217 if (ecid_name==
"EB_VFE") {
222 if(sm>18) tcc=sm+18 ;
226 unsigned int stripEBId = 303176+(tt-1)*64+(strip-1)*8+(tcc-37)*8192;
228 weightG->
setValue(stripEBId,weightGroup);
231 else if (ecid_name==
"ECAL_readout_strip"){
237 bool set_the_strip=
false;
239 for (
size_t istrip=0; istrip<my_StripEcalLogicId_EE.size(); istrip++) {
243 if(my_StripEcalLogicId_EE[istrip].getID1()==id1
244 && my_StripEcalLogicId_EE[istrip].getID2()==id2
245 && my_StripEcalLogicId_EE[istrip].getID3()==id3
247 stripEEId =my_StripEcalLogicId_EE[istrip].getLogicID();
257 weightG->
setValue(stripEEId,weightGroup);
260 std::cout <<
" these may be the additional towers TCC/TT " 261 << id1<<
"/"<<id2<<std::endl;
277 writeFile(
"last_tpg_weightGroup_settings.txt");
285 writeFile(
"last_tpg_weightGroup_settings.txt");
287 std::cout<<
" even if the tag/version is not the same, the weight group id is the same -> no transfer needed "<< std::endl;
294 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
295 <<
" version="<<the_config_version<< std::endl;
300 std::cout<<
" **************** "<<std::endl;
304 std::cout<<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "<< std::endl;
305 std::cout<<
" **************** "<<std::endl;
310 std::cout<<
" the tag/version is the same -> no transfer needed "<< std::endl;
311 std::cout<<
" **************** "<<std::endl;
312 writeFile(
"last_tpg_weightGroup_settings.txt");
320 edm::LogInfo(
"EcalTPGWeightGroupHandler") <<
"Ecal - > end of getNewObjects -----------";
333 inpFile = fopen(inputFile,
"r");
341 std::ostringstream
str;
343 fgets(line,255,inpFile);
345 str <<
"gen tag " <<
m_i_tag << std::endl ;
347 fgets(line,255,inpFile);
351 fgets(line,255,inpFile);
355 fgets(line,255,inpFile);
368 std::ofstream myfile;
369 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