15 : m_name(ps.getUntrackedParameter<
std::
string>(
"name",
"EcalTPGPhysicsConstHandler")) {
17 edm::LogInfo(
"EcalTPGPhysicsConstHandler") <<
"EcalTPGPhysicsConst Source handler constructor.";
40 edm::LogInfo(
"EcalTPGPhysicsConstHandler") <<
"Started GetNewObjects!!!";
45 std::cout <<
"got offlineInfo = " << std::endl;
49 std::cout <<
" First object for this tag " << std::endl;
52 unsigned int max_since=0;
54 edm::LogInfo(
"EcalTPGPhysicsConstHandler") <<
"max_since : " << max_since;
57 edm::LogInfo(
"EcalTPGPhysicsConstHandler") <<
"retrieved last payload ";
60 edm::LogInfo(
"EcalTPGPhysicsConstHandler") <<
"Retrieving run list from ONLINE DB ... ";
62 edm::LogInfo(
"EcalTPGPhysicsConstHandler") <<
"Making connection...";
98 if(min_run<max_since) {
103 edm::LogInfo(
"EcalTPGPhysicsConstHandler") <<
"min_run= " << min_run <<
"max_run= " << max_run;
110 std::vector<RunIOV> run_vec= my_list.
getRuns();
111 size_t num_runs=run_vec.size();
113 std::cout <<
"number of runs is : "<< num_runs<< std::endl;
118 for(
size_t kr=0; kr<run_vec.size(); kr++){
120 irun=
static_cast<unsigned int>(run_vec[kr].getRunNumber());
122 std::cout<<
" **************** "<<std::endl;
123 std::cout<<
" **************** "<<std::endl;
127 std::map<EcalLogicID, RunTPGConfigDat>
dataset;
131 int the_config_version=0;
133 std::map< EcalLogicID, RunTPGConfigDat>::const_iterator it;
136 for( it=dataset.begin(); it!=dataset.end(); it++ )
149 std::cout<<
" run= "<<irun<<
" tag "<<the_config_tag<<
" version="<<the_config_version <<std::endl;
155 std::cout<<
"the tag is different from last transferred run ... retrieving last config set from DB"<<std::endl;
162 std::cout <<
" before fetch config set" << std::endl;
163 econn-> fetchConfigSet(&fe_main_info);
164 std::cout <<
" after fetch config set" << std::endl;
174 std::cout<<
"one of the parameters: linId, LutId or fgrId is different from" <<std::endl;
175 std::cout<<
"last transferred run ..."<<std::endl;
180 fe_physLin_info.
setId(linId);
181 fe_physFgr_info.
setId(fgrId);
182 fe_physLut_info.
setId(lutId);
184 econn-> fetchConfigSet(&fe_physLin_info);
185 econn-> fetchConfigSet(&fe_physFgr_info);
186 econn-> fetchConfigSet(&fe_physLut_info);
187 std::map<EcalLogicID, FEConfigLinParamDat> dataset_TpgPhysicsLin;
188 std::map<EcalLogicID, FEConfigLUTParamDat> dataset_TpgPhysicsLut;
189 std::map<EcalLogicID, FEConfigFgrParamDat> dataset_TpgPhysicsFgr;
196 typedef std::map<EcalLogicID, FEConfigLinParamDat>::const_iterator CIfeLin;
197 typedef std::map<EcalLogicID, FEConfigLUTParamDat>::const_iterator CIfeLUT;
198 typedef std::map<EcalLogicID, FEConfigFgrParamDat>::const_iterator CIfeFgr;
207 std::map<int,float> EtSatLinEB;
208 std::map<int,float> EtSatLinEE;
209 typedef std::map<int,float>::const_iterator itEtSat;
211 std::map<int,EcalTPGPhysicsConst::Item> temporaryMapEB;
212 std::map<int,EcalTPGPhysicsConst::Item> temporaryMapEE;
213 typedef std::map<int,EcalTPGPhysicsConst::Item>::iterator iterEB;
214 typedef std::map<int,EcalTPGPhysicsConst::Item>::iterator iterEE;
217 for (CIfeLin p0 = dataset_TpgPhysicsLin.begin(); p0 != dataset_TpgPhysicsLin.end(); p0++)
219 ecidLin_xt = p0->first;
220 rd_physLin = p0->second;
224 if(ecid_nameLin==
"EB") {
226 EtSatLinEB.insert(std::make_pair(eb.
rawId(),rd_physLin.
getETSat()));
228 else if (ecid_nameLin==
"EE"){
230 EtSatLinEE.insert(std::make_pair(ee.
rawId(),rd_physLin.
getETSat()));
236 for (CIfeLUT
p1 = dataset_TpgPhysicsLut.begin();
p1 != dataset_TpgPhysicsLut.end();
p1++)
238 ecidLut_xt =
p1->first;
239 rd_physLut =
p1->second;
244 if(ecid_nameLut==
"EB") {
248 for (itEtSat it1 = EtSatLinEB.begin() ; it1 != EtSatLinEB.end(); it1++){
250 if (it1->first == (
int)eb.
rawId()){
251 float ETSatLin = it1->second;
253 if (rd_physLut.
getETSat() == ETSatLin) {
262 temporaryMapEB.insert(std::make_pair(eb.
rawId(),item));
264 else throw cms::Exception(
"The values of the ETSatLin and ETSatLut are different.");
272 else if (ecid_nameLut==
"EE") {
277 for (itEtSat it2 = EtSatLinEE.begin(); it2 != EtSatLinEE.end(); it2++){
279 if (it2->first == (
int)ee.
rawId()){
280 float ETSatLin = it2->second;
282 if (rd_physLut.
getETSat() == ETSatLin) {
291 temporaryMapEE.insert( std::make_pair(ee.
rawId(),item) );
293 else throw cms::Exception(
"The values of the ETSatLin and ETSatLut are different.");
304 for (CIfeFgr
p2 = dataset_TpgPhysicsFgr.begin();
p2 != dataset_TpgPhysicsFgr.end();
p2++)
306 ecidFgr_xt =
p2->first;
307 rd_physFgr =
p2->second;
312 if(ecid_nameFgr==
"EB") {
316 for ( iterEB itt=temporaryMapEB.begin() ; itt != temporaryMapEB.end() ; itt++ ){
318 if (itt->first == (
int)eb.
rawId()){
333 else if (ecid_nameFgr==
"EE") {
339 for ( iterEE itEE=temporaryMapEE.begin() ; itEE != temporaryMapEE.end() ; itEE++ ){
341 if (itEE->first == (
int)ee.
rawId()){
372 writeFile(
"last_tpg_physC_settings.txt");
380 writeFile(
"last_tpg_physC_settings.txt");
382 std::cout<<
" even if the tag/version is not the same, the physics constants id is the same -> no transfer needed "<< std::endl;
391 std::cout <<
"ERROR: THIS CONFIG DOES NOT EXIST: tag=" <<the_config_tag
392 <<
" version="<<the_config_version<< std::endl;
397 std::cout<<
" **************** "<<std::endl;
401 std::cout<<
" no tag saved to RUN_TPGCONFIG_DAT by EcalSupervisor -> no transfer needed "<< std::endl;
402 std::cout<<
" **************** "<<std::endl;
407 std::cout<<
" the tag/version is the same -> no transfer needed "<< std::endl;
408 std::cout<<
" **************** "<<std::endl;
409 writeFile(
"last_tpg_physC_settings.txt");
415 edm::LogInfo(
"EcalTPGPhysicsConstHandler") <<
"Ecal - > end of getNewObjects -----------";
431 inpFile = fopen(inputFile,
"r");
439 std::ostringstream
str;
441 fgets(line,255,inpFile);
443 str <<
"gen tag " <<
m_i_tag << std::endl ;
445 fgets(line,255,inpFile);
449 fgets(line,255,inpFile);
453 fgets(line,255,inpFile);
455 str <<
"physClin_config= " <<
m_i_physClin << std::endl ;
457 fgets(line,255,inpFile);
459 str <<
"physClut_config= " <<
m_i_physClut << std::endl ;
461 fgets(line,255,inpFile);
463 str <<
"physCfgr_config= " <<
m_i_physCfgr << std::endl ;
473 std::ofstream myfile;
474 myfile.open (inputFile);
void setValue(const uint32_t &id, const Item &value)
T getParameter(std::string const &) const
void setRunTypeDef(const RunTypeDef &runTypeDef)
float getFGlowthresh() const
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
float getFGhighthresh() const
std::string to_string(char value[])
EcalTPGPhysicsConstHandler(edm::ParameterSet const &)
std::string m_locationsource
float getFGhighratio() const
float getTTThreshhigh() const
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov) noexcept(false)
OldContainer m_to_transfer
uint32_t rawId() const
get the raw id
cond::ValidityInterval lastInterval
std::string getName() const
unsigned int m_i_run_number
~EcalTPGPhysicsConstHandler()
float getTTThreshlow() const
void writeFile(const char *inputFile)
void setLocationDef(const LocationDef &locDef)
void setRunType(std::string runtype)
void readFromFile(const char *inputFile)
float getFGlowratio() const
double ttf_threshold_High
void setConfigTag(std::string x)
EcalCondDBInterface * econn
void setLocation(std::string loc)
void setGeneralTag(std::string tag)
cond::TagInfo_t const & tagInfo() const