26 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGBadTTHandler")) {
28 edm::LogInfo(
"EcalTPGBadTTHandler") <<
"EcalTPGTowerStatus Source handler constructor.";
50 edm::LogInfo(
"EcalTPGBadTTHandler") <<
"Started GetNewObjects!!!";
52 unsigned int max_since=0;
54 edm::LogInfo(
"EcalTPGBadTTHandler") <<
"max_since : " << max_since;
55 edm::LogInfo(
"EcalTPGBadTTHandler") <<
"retrieved last payload ";
58 edm::LogInfo(
"EcalTPGBadTTHandler") <<
"Retrieving run list from ONLINE DB ... ";
60 edm::LogInfo(
"EcalTPGBadTTHandler") <<
"Making connection...";
91 if(min_run<max_since) {
98 edm::LogInfo(
"EcalTPGBadTTHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
104 std::vector<RunIOV> run_vec= my_list.
getRuns();
105 size_t num_runs=run_vec.size();
107 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
116 std::vector<EcalLogicID> my_TTEcalLogicId_EE;
121 "EE_offline_towerid",12 );
122 std::cout <<
" GOT the logic ID for the EE trigger towers "<< std::endl;
126 for(
size_t kr=0; kr<run_vec.size(); kr++){
128 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
131 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
135 int the_config_version=0;
137 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
140 for( it=dataset.begin(); it!=dataset.end(); it++ )
157 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
158 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
166 econn-> fetchConfigSet(&fe_main_info);
169 int badttId=fe_main_info.
getBttId();
174 fe_badTT_info.
setId(badttId);
176 econn-> fetchConfigSet(&fe_badTT_info);
178 std::vector< FEConfigBadTTDat > dataset_TpgBadTT;
183 typedef std::vector<FEConfigBadTTDat>::const_iterator CIfeped;
190 for(
int ito=1; ito<=68; ito++) {
191 int tow_eta=(ito-1)/4;
192 int tow_phi=((ito-1)-tow_eta*4);
193 int axt=(tow_eta*5)*20 + tow_phi*5 +1 ;
201 for (
size_t itower=0; itower<my_TTEcalLogicId_EE.size(); itower++) {
202 int towid =my_TTEcalLogicId_EE[itower].getLogicID();
204 towerStatus->
setValue(towid,tower_status);
209 for (CIfeped
p = dataset_TpgBadTT.begin();
p != dataset_TpgBadTT.end();
p++) {
215 std::cout<<
" tcc/tt"<< tcc_num<<
"/"<<tt_num<< std::endl;
217 if(tcc_num>36 && tcc_num<=72) {
220 if(tcc_num<55) smid=tcc_num-18;
224 int tow_eta=(towerid-1)/4;
225 int tow_phi=((towerid-1)-tow_eta*4);
226 int axt=(tow_eta*5)*20 + tow_phi*5 +1 ;
241 bool set_the_tower=
false;
243 for (
size_t itower=0; itower<my_TTEcalLogicId_EE.size(); itower++) {
247 if(my_TTEcalLogicId_EE[itower].getID1()==tccid && my_TTEcalLogicId_EE[itower].getID2()==towerid){
248 towid =my_TTEcalLogicId_EE[itower].getLogicID();
262 std::cout <<
" these may be the additional towers TCC/TT " 263 << tccid<<
"/"<<towerid<<std::endl;
276 edm::LogInfo(
"EcalTPGBadTTHandler") <<
"Finished badTT reading.";
287 writeFile(
"last_tpg_badTT_settings.txt");
295 writeFile(
"last_tpg_badTT_settings.txt");
304 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
305 <<
" version="<<the_config_version<< std::endl;
320 writeFile(
"last_tpg_badTT_settings.txt");
327 edm::LogInfo(
"EcalTPGBadTTHandler") <<
"Ecal - > end of getNewObjects -----------";
340 inpFile = fopen(inputFile,
"r");
348 std::ostringstream
str;
350 fgets(line,255,inpFile);
352 str <<
"gen tag " <<
m_i_tag << std::endl ;
354 fgets(line,255,inpFile);
358 fgets(line,255,inpFile);
362 fgets(line,255,inpFile);
364 str <<
"badTT_config= " <<
m_i_badTT << std::endl ;
375 std::ofstream myfile;
376 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)
std::string getConfigTag() const
unsigned int m_i_run_number
constexpr uint32_t rawId() const
get the raw id
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
OldContainer m_to_transfer
std::string m_locationsource
cond::ValidityInterval lastInterval
std::string to_string(char value[])
~EcalTPGBadTTHandler() override
void getNewObjects() override
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)
void writeFile(const char *inputFile)
void setLocationDef(const LocationDef &locDef)
EcalCondDBInterface * econn
void setRunType(std::string runtype)
void readFromFile(const char *inputFile)
void setConfigTag(std::string x)
void setLocation(std::string loc)
void setValue(const uint32_t &id, const uint16_t &val)
void fetchConfigDataSet(std::vector< DATT > *fillMap, ICONF *iconf) noexcept(false)
void setGeneralTag(std::string tag)
static const int SMCRYSTALMODE
int ism(int ieta, int iphi)
EcalTPGBadTTHandler(edm::ParameterSet const &)
cond::TagInfo_t const & tagInfo() const
std::string id() const override