#include <interface/PixelConfigFile.h>
Static Public Member Functions | |
static void | addAlias (std::string alias, unsigned int key) |
static void | addAlias (std::string alias, unsigned int key, std::vector< std::pair< std::string, std::string > > versionaliases) |
static void | addVersionAlias (std::string path, unsigned int version, std::string alias) |
static PixelConfigList & | configList () |
template<class T > | |
static bool | configurationDataExists (T *&data, std::string path, PixelConfigKey key) |
static void | forceAliasesReload (bool m) |
static void | forceConfigReload (bool m) |
template<class T > | |
static void | get (std::map< std::string, T * > &pixelObjects, PixelConfigKey key) |
template<class T > | |
static void | get (T *&data, std::string path, PixelConfigKey key) |
template<class T > | |
static void | get (T *&data, std::string path, unsigned int version) |
static PixelAliasList & | getAlias () |
static std::vector< std::pair < std::string, unsigned int > > | getAliases () |
static std::map< std::string, unsigned int > | getAliases_map () |
static PixelConfigList & | getConfig () |
static std::vector< pathAliasPair > | getConfigAliases (std::string path) |
static std::string | getPath (std::string path, PixelConfigKey key) |
static unsigned int | getVersion (std::string path, std::string alias) |
static std::vector< std::string > | getVersionAliases (std::string path) |
static bool | getVersionAliases (std::string configAlias, unsigned int &key, std::vector< std::pair< std::string, std::string > > &versionAliases) |
static pos::pathVersionAliasMmap | getVersionData (std::string koc) |
static pos::pathVersionAliasMmap | getVersionData () |
static std::vector< std::pair < std::string, unsigned int > > | getVersions (pos::PixelConfigKey key) |
static unsigned int | makeKey (std::vector< std::pair< std::string, unsigned int > > versions) |
static int | makeNewVersion (std::string path, std::string &dir) |
template<class T > | |
static int | put (std::vector< T * > objects, std::string path) |
template<class T > | |
static int | put (const T *object, std::string path) |
Static Private Member Functions | |
static bool & | getForceAliasesReload () |
static bool & | getForceConfigReload () |
OK, first this is not a DB; this class will try to define an interface to accessing the configuration data.
Definition at line 59 of file PixelConfigFile.h.
static void pos::PixelConfigFile::addAlias | ( | std::string | alias, |
unsigned int | key | ||
) | [inline, static] |
Definition at line 123 of file PixelConfigFile.h.
References getAlias(), pos::PixelAliasList::insertAlias(), and pos::PixelAliasList::writefile().
static void pos::PixelConfigFile::addAlias | ( | std::string | alias, |
unsigned int | key, | ||
std::vector< std::pair< std::string, std::string > > | versionaliases | ||
) | [inline, static] |
Definition at line 130 of file PixelConfigFile.h.
References pos::PixelConfigAlias::addVersionAlias(), first, getAlias(), i, pos::PixelAliasList::insertAlias(), edm::second(), and pos::PixelAliasList::writefile().
static void pos::PixelConfigFile::addVersionAlias | ( | std::string | path, |
unsigned int | version, | ||
std::string | alias | ||
) | [inline, static] |
Definition at line 148 of file PixelConfigFile.h.
References cmsPerfCommons::configs, getAlias(), getConfig(), pos::PixelAliasList::insertVersionAlias(), pos::PixelAliasList::updateConfigAlias(), pos::PixelAliasList::writefile(), and pos::PixelConfigList::writefile().
static PixelConfigList& pos::PixelConfigFile::configList | ( | ) | [inline, static] |
Definition at line 100 of file PixelConfigFile.h.
References getConfig().
Referenced by configurationDataExists(), and get().
{ static PixelConfigList theConfigList=getConfig(); return theConfigList; }
static bool pos::PixelConfigFile::configurationDataExists | ( | T *& | data, |
std::string | path, | ||
PixelConfigKey | key | ||
) | [inline, static] |
Definition at line 500 of file PixelConfigFile.h.
References configList(), gather_cfg::cout, AlCaHLTBitMon_QueryRunRegistry::data, DEBUG_CF_, dir, createBeamHaloJobs::directory, funct::false, convertXMLtoSQLite_cfg::fileName, recoMuon::in, pos::PixelConfigKey::key(), prof2calltree::last, mergeVDriftHistosByStation::name, findQualityFiles::size, funct::true, and BeamSplash_cfg::version.
{ std::string mthn = "]\t[pos::PixelConfigFile::configurationDataExists()]\t " ; /* pos::PixelTimeFormatter * timer = new pos::PixelTimeFormatter("PixelConfigFile::ConfigurationDataExists") ; */ unsigned int theKey=key.key(); assert(theKey<=configList().size()); unsigned int last=path.find_last_of("/"); assert(last!=std::string::npos); std::string base=path.substr(0,last); std::string ext=path.substr(last+1); unsigned int slashpos=base.find_last_of("/"); if (slashpos==std::string::npos) { std::cout << __LINE__ << mthn << "Asking for data of type:" << typeid(data).name() <<std::endl; std::cout << __LINE__ << mthn << "On path:" << path <<std::endl; std::cout << __LINE__ << mthn << "Recall that you need a trailing /" <<std::endl; ::abort(); } std::string dir=base.substr(slashpos+1); /* timer->stopTimer() ; */ // std::cout << __LINE__ << mthn << "Extracted dir:" << dir <<std::endl; // std::cout << __LINE__ << mthn << "Extracted base:" << base <<std::endl; // std::cout << __LINE__ << mthn << "Extracted ext :" << ext <<std::endl; unsigned int version; int err=configList()[theKey].find(dir,version); // assert(err==0); if(0!=err) { data= 0; return false ; } /* timer->stopTimer() ; */ /* delete timer ; */ std::ostringstream s1; s1 << version; std::string strversion=s1.str(); static std::string directory; directory=getenv("PIXELCONFIGURATIONBASE"); std::string fullpath=directory+"/"+dir+"/"+strversion+"/"; //std::cout << __LINE__ << mthn << "Directory for configuration data:"<<fullpath<<std::endl; std::string fileName ; if (typeid(data)==typeid(PixelTrimBase*)){ fileName = fullpath+"ROC_Trims_module_"+ext+".dat" ; }else if (typeid(data)==typeid(PixelMaskBase*)){ fileName = fullpath+"ROC_Masks_module_"+ext+".dat"; }else if (typeid(data)==typeid(PixelDACSettings*)){ fileName = fullpath+"ROC_DAC_module_"+ext+".dat"; }else if (typeid(data)==typeid(PixelTBMSettings*)){ fileName = fullpath+"TBM_module_"+ext+".dat"; }else if (typeid(data)==typeid(PixelDetectorConfig*)){ fileName = fullpath+"detectconfig.dat"; }else if (typeid(data)==typeid(PixelLowVoltageMap*)){ fileName = fullpath+"lowvoltagemap.dat"; }else if (typeid(data)==typeid(PixelMaxVsf*)){ fileName = fullpath+"maxvsf.dat"; }else if (typeid(data)==typeid(PixelNameTranslation*)){ fileName = fullpath+"translation.dat"; }else if (typeid(data)==typeid(PixelFEDCard*)){ fileName = fullpath+"params_fed_"+ext+".dat"; }else if (typeid(data)==typeid(PixelTKFECConfig*)){ fileName = fullpath+"tkfecconfig.dat"; }else if (typeid(data)==typeid(PixelFECConfig*)){ fileName = fullpath+"fecconfig.dat"; }else if (typeid(data)==typeid(PixelFEDConfig*)){ fileName = fullpath+"fedconfig.dat"; }else if (typeid(data)==typeid(PixelPortCardConfig*)){ fileName = fullpath+"portcard_"+ext+".dat"; }else if (typeid(data)==typeid(PixelPortcardMap*)){ fileName = fullpath+"portcardmap.dat"; }else if (typeid(data)==typeid(PixelDelay25Calib*)){ fileName = fullpath+"delay25.dat"; }else if (typeid(data)==typeid(PixelTTCciConfig*)){ fileName = fullpath+"TTCciConfiguration.txt"; }else if (typeid(data)==typeid(PixelLTCConfig*)){ fileName = fullpath+"LTCConfiguration.txt"; }else if (typeid(data)==typeid(PixelGlobalDelay25*)){ fileName = fullpath+"globaldelay25.dat"; }else if (typeid(data)==typeid(PixelCalibBase*)){ assert(dir=="calib"); std::string calibfile=fullpath+"calib.dat"; std::ifstream calibin(calibfile.c_str()); if(calibin.good()) { std::cout << __LINE__ << mthn << "Found " << calibfile << std::endl ; return true ; }else{ calibfile=fullpath+"delay25.dat"; std::ifstream delayin(calibfile.c_str()); if(delayin.good()) { std::cout << __LINE__ << mthn << "Found " << calibfile << std::endl ; return true ; }else{ calibfile=fullpath+"fedtestdac.dat"; std::ifstream delayin(calibfile.c_str()); if(delayin.good()) { std::cout << __LINE__ << mthn << "Found " << calibfile << std::endl ; return true ; }else{ std::cout << mthn << "Can't find calibration file calib.dat or delay25.dat or fedtestdac.dat" << std::endl; return false ; } } } }else{ std::cout << __LINE__ << mthn << "No match of class type" << std::endl; return false ; } /* struct stat * tmp = NULL ; if(stat(fileName.c_str(), tmp)==0) { std::cout << mthn << "Found(stat) " << fileName << std::endl ; return true ; } else { std::cout << mthn << "Not found(stat) " << fileName << std::endl ; return false ; } */ std::ifstream in(fileName.c_str()); if (!in.good()) { std::cout << __LINE__ << mthn << "Not found " << fileName << std::endl ; return false ; } in.close() ; if( DEBUG_CF_ ) std::cout << __LINE__ << mthn << "Found " << fileName << std::endl ; return true ; }
static void pos::PixelConfigFile::forceAliasesReload | ( | bool | m | ) | [inline, static] |
Definition at line 254 of file PixelConfigFile.h.
References getForceAliasesReload(), and m.
Referenced by getAlias(), and getForceAliasesReload().
{ if(getForceAliasesReload() != m){ getForceAliasesReload() = m; } }
static void pos::PixelConfigFile::forceConfigReload | ( | bool | m | ) | [inline, static] |
Definition at line 260 of file PixelConfigFile.h.
References getForceConfigReload(), and m.
Referenced by getConfig(), and getForceConfigReload().
{ if(getForceConfigReload() != m){ getForceConfigReload() = m; } }
static void pos::PixelConfigFile::get | ( | std::map< std::string, T * > & | pixelObjects, |
PixelConfigKey | key | ||
) | [inline, static] |
Definition at line 815 of file PixelConfigFile.h.
References combine::key.
{ typename std::map<std::string, T* >::iterator iObject=pixelObjects.begin(); for(;iObject!=pixelObjects.end();++iObject){ get(iObject->second,iObject->first,key); } }
static void pos::PixelConfigFile::get | ( | T *& | data, |
std::string | path, | ||
PixelConfigKey | key | ||
) | [inline, static] |
Definition at line 317 of file PixelConfigFile.h.
References configList(), gather_cfg::cout, AlCaHLTBitMon_QueryRunRegistry::data, dir, createBeamHaloJobs::directory, alignCSCRings::e, exception, getConfig(), combine::key, prof2calltree::last, mergeVDriftHistosByStation::name, getHLTPrescaleColumns::path, findQualityFiles::size, and BeamSplash_cfg::version.
{ unsigned int theKey=key.key(); if (theKey>=configList().size()){ configList()=getConfig(); } assert(theKey<=configList().size()); unsigned int last=path.find_last_of("/"); assert(last!=std::string::npos); std::string base=path.substr(0,last); std::string ext=path.substr(last+1); unsigned int slashpos=base.find_last_of("/"); if (slashpos==std::string::npos) { std::cout << "[pos::PixelConfigFile::get()]\t\t\tAsking for data of type:"<<typeid(data).name()<<std::endl; std::cout << "[pos::PixelConfigFile::get()]\t\t\tOn path:" <<path <<std::endl; std::cout << "[pos::PixelConfigFile::get()]\t\t\tRecall that you need a trailing /" <<std::endl; ::abort(); } std::string dir=base.substr(slashpos+1); // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted dir:" <<dir <<std::endl; // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted base:"<<base<<std::endl; // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted ext :"<<ext <<std::endl; unsigned int version; int err=configList()[theKey].find(dir,version); // assert(err==0); if(0!=err) { std::cout<<"[PixelConfigFile.h::get] error loading config list. "<<theKey<<" "<<dir<<" "<<version<<std::endl; data= 0; return; } std::ostringstream s1; s1 << version; std::string strversion=s1.str(); static std::string directory; directory=getenv("PIXELCONFIGURATIONBASE"); std::string fullpath=directory+"/"+dir+"/"+strversion+"/"; //std::cout << "Directory for configuration data:"<<fullpath<<std::endl; try { if (typeid(data)==typeid(PixelTrimBase*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTrimBase" << std::endl; assert(dir=="trim"); data = (T*) new PixelTrimAllPixels(fullpath+"ROC_Trims_module_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelMaskBase*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelMaskBase" << std::endl; assert(dir=="mask"); data = (T*) new PixelMaskAllPixels(fullpath+"ROC_Masks_module_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelDACSettings*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDACSettings" << std::endl; assert(dir=="dac"); data = (T*) new PixelDACSettings(fullpath+"ROC_DAC_module_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelTBMSettings*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTBMSettings" << std::endl; assert(dir=="tbm"); data = (T*) new PixelTBMSettings(fullpath+"TBM_module_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelDetectorConfig*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDetectorConfig" << std::endl; assert(dir=="detconfig"); data = (T*) new PixelDetectorConfig(fullpath+"detectconfig.dat"); return; }else if (typeid(data)==typeid(PixelLowVoltageMap*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill fetch PixelLowVoltageMap" << std::endl; assert(dir=="lowvoltagemap"); data = (T*) new PixelLowVoltageMap(fullpath+"lowvoltagemap.dat"); //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return the PixelLowVoltageMap" << std::endl; return; }else if (typeid(data)==typeid(PixelMaxVsf*)){ //std::cout << "Will fetch PixelMaxVsf" << std::endl; assert(dir=="maxvsf"); data = (T*) new PixelMaxVsf(fullpath+"maxvsf.dat"); //std::cout << "Will return the PixelMaxVsf" << std::endl; return; }else if (typeid(data)==typeid(PixelNameTranslation*)){ //std::cout << __LINE__ << "]\t[pos::PixelConfigFile::get()]\t\t\t Will return PixelNameTranslation*" << std::endl; assert(dir=="nametranslation"); data = (T*) new PixelNameTranslation(fullpath+"translation.dat"); return; }else if (typeid(data)==typeid(PixelFEDCard*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelFEDCard" << std::endl; assert(dir=="fedcard"); //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill open:"<<fullpath+"params_fed_"+ext+".dat"<< std::endl; data = (T*) new PixelFEDCard(fullpath+"params_fed_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelCalibBase*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelCalibBase" << std::endl; assert(dir=="calib"); std::string calibfile=fullpath+"calib.dat"; //std::cout << "[pos::PixelConfigFile::get()]\t\t\tLooking for file " << calibfile << std::endl; std::ifstream calibin(calibfile.c_str()); if(calibin.good()){ data = (T*) new PixelCalibConfiguration(calibfile); }else{ calibfile=fullpath+"delay25.dat"; //std::cout << "[pos::PixelConfigFile::get()]\t\t\tNow looking for file " << calibfile << std::endl; std::ifstream delayin(calibfile.c_str()); if(delayin.good()){ data = (T*) new PixelDelay25Calib(calibfile); }else{ calibfile=fullpath+"fedtestdac.dat"; //std::cout << "[pos::PixelConfigFile::get()]\t\t\tNow looking for file " << calibfile << std::endl; std::ifstream delayin(calibfile.c_str()); if(delayin.good()){ data = (T*) new PixelFEDTestDAC(calibfile); }else{ throw std::runtime_error("[pos::PixelConfigFile::get()]\t\t\tCan't find calibration file calib.dat or delay25.dat or fedtestdac.dat"); } } } return; }else if (typeid(data)==typeid(PixelTKFECConfig*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTKFECConfig" << std::endl; assert(dir=="tkfecconfig"); data = (T*) new PixelTKFECConfig(fullpath+"tkfecconfig.dat"); return; }else if (typeid(data)==typeid(PixelFECConfig*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelFECConfig" << std::endl; assert(dir=="fecconfig"); data = (T*) new PixelFECConfig(fullpath+"fecconfig.dat"); return; }else if (typeid(data)==typeid(PixelFEDConfig*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelFEDConfig" << std::endl; assert(dir=="fedconfig"); data = (T*) new PixelFEDConfig(fullpath+"fedconfig.dat"); return; }else if (typeid(data)==typeid(PixelPortCardConfig*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelPortCardConfig" << std::endl; assert(dir=="portcard"); data = (T*) new PixelPortCardConfig(fullpath+"portcard_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelPortcardMap*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelPortcardMap" << std::endl; assert(dir=="portcardmap"); data = (T*) new PixelPortcardMap(fullpath+"portcardmap.dat"); return; }else if (typeid(data)==typeid(PixelDelay25Calib*)){ //cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDelay25Calib" << std::endl; assert(dir=="portcard"); data = (T*) new PixelDelay25Calib(fullpath+"delay25.dat"); return; }else if (typeid(data)==typeid(PixelTTCciConfig*)){ //cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTTCciConfig" << std::endl; assert(dir=="ttcciconfig"); data = (T*) new PixelTTCciConfig(fullpath+"TTCciConfiguration.txt"); return; }else if (typeid(data)==typeid(PixelLTCConfig*)){ //cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelLTCConfig" << std::endl; assert(dir=="ltcconfig"); data = (T*) new PixelLTCConfig(fullpath+"LTCConfiguration.txt"); return; }else if (typeid(data)==typeid(PixelGlobalDelay25*)){ //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelGlobalDelay25" << std::endl; assert(dir=="globaldelay25"); data = (T*) new PixelGlobalDelay25(fullpath+"globaldelay25.dat"); return; }else{ std::cout << "[pos::PixelConfigFile::get()]\t\t\tNo match" << std::endl; assert(0); } } catch (std::exception & e) { std::cout<<"[PixelConfigFile::get] Caught exception while constructing configuration object. Will rethrow."<<std::endl; throw; } }
static void pos::PixelConfigFile::get | ( | T *& | data, |
std::string | path, | ||
unsigned int | version | ||
) | [inline, static] |
Definition at line 650 of file PixelConfigFile.h.
References gather_cfg::cout, AlCaHLTBitMon_QueryRunRegistry::data, dir, createBeamHaloJobs::directory, prof2calltree::last, getHLTPrescaleColumns::path, and BeamSplash_cfg::version.
{ std::string mthn = "]\t[pos::PixelConfigFile::get()]\t\t\t\t " ; unsigned int last=path.find_last_of("/"); assert(last!=std::string::npos); std::string base=path.substr(0,last); std::string ext=path.substr(last+1); unsigned int slashpos=base.find_last_of("/"); //if (slashpos==std::string::npos) { //std::cout << __LINE__ << mthn << "Asking for data of type:" << typeid(data).name() << std::endl; //std::cout << __LINE__ << mthn << "On path:" << path << std::endl; //std::cout << __LINE__ << mthn << "Recall that you need a trailing /" << std::endl; //::abort(); //} std::string dir=base.substr(slashpos+1); //std::cout << __LINE__ << mthn << "Extracted dir :" << dir <<std::endl; //std::cout << __LINE__ << mthn << "Extracted base:" << base <<std::endl; //std::cout << __LINE__ << mthn << "Extracted ext :" << ext <<std::endl; std::ostringstream s1; s1 << version; std::string strversion=s1.str(); static std::string directory; directory=getenv("PIXELCONFIGURATIONBASE"); std::string fullpath=directory+"/"+dir+"/"+strversion+"/"; //std::cout << __LINE__ << mthn << "Directory for configuration data:"<<fullpath<<std::endl; if (typeid(data)==typeid(PixelTrimBase*)){ //std::cout << __LINE__ << mthn << "Will return PixelTrimBase" << std::endl; assert(dir=="trim"); data = (T*) new PixelTrimAllPixels(fullpath+"ROC_Trims_module_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelMaskBase*)){ //std::cout << __LINE__ << mthn << "Will return PixelMaskBase" << std::endl; assert(dir=="mask"); data = (T*) new PixelMaskAllPixels(fullpath+"ROC_Masks_module_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelDACSettings*)){ //std::cout << __LINE__ << mthn << "Will return PixelDACSettings" << std::endl; assert(dir=="dac"); data = (T*) new PixelDACSettings(fullpath+"ROC_DAC_module_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelTBMSettings*)){ //std::cout << __LINE__ << mthn << "Will return PixelTBMSettings" << std::endl; assert(dir=="tbm"); data = (T*) new PixelTBMSettings(fullpath+"TBM_module_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelDetectorConfig*)){ //std::cout << __LINE__ << mthn << "Will return PixelDACSettings" << std::endl; assert(dir=="detconfig"); data = (T*) new PixelDetectorConfig(fullpath+"detectconfig.dat"); return; }else if (typeid(data)==typeid(PixelLowVoltageMap*)){ //std::cout << __LINE__ << mthn << "Will fetch1 PixelLowVoltageMap" << std::endl; assert(dir=="lowvoltagemap"); data = (T*) new PixelLowVoltageMap(fullpath+"detectconfig.dat"); //std::cout << __LINE__ << mthn << "Will return1 the PixelLowVoltageMap" << std::endl; return; }else if (typeid(data)==typeid(PixelMaxVsf*)){ //std::cout << __LINE__ << mthn << "Will fetch1 PixelMaxVsf" << std::endl; assert(dir=="maxvsf"); data = (T*) new PixelMaxVsf(fullpath+"maxvsf.dat"); //std::cout << __LINE__ << mthn << "Will return1 the PixelMaxVsf" << std::endl; return; }else if (typeid(data)==typeid(PixelNameTranslation*)){ //std::cout << __LINE__ << mthn << "Will return PixelNameTranslation" << std::endl; assert(dir=="nametranslation"); data = (T*) new PixelNameTranslation(fullpath+"translation.dat"); return; }else if (typeid(data)==typeid(PixelFEDCard*)){ //std::cout << __LINE__ << mthn << "Will return PixelFEDCard" << std::endl; assert(dir=="fedcard"); //std::cout << __LINE__ << mthn << "Will open:"<<fullpath+"params_fed_"+ext+".dat"<< std::endl; data = (T*) new PixelFEDCard(fullpath+"params_fed_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelCalibBase*)) { //std::cout << __LINE__ << mthn << "Will return PixelCalibBase" << std::endl; assert(base=="calib"); std::string calibfile=fullpath+"calib.dat"; //std::cout << mthn << "Looking for file " << calibfile << std::endl; std::ifstream calibin(calibfile.c_str()); if(calibin.good()){ data = (T*) new PixelCalibConfiguration(calibfile); }else{ calibfile=fullpath+"delay25.dat"; //std::cout << __LINE__ << mthn << "Now looking for file " << calibfile << std::endl; std::ifstream delayin(calibfile.c_str()); if(delayin.good()){ data = (T*) new PixelDelay25Calib(calibfile); }else{ calibfile=fullpath+"fedtestdac.dat"; //std::cout << __LINE__ << mthn << "Now looking for file " << calibfile << std::endl; std::ifstream delayin(calibfile.c_str()); if(delayin.good()){ data = (T*) new PixelFEDTestDAC(calibfile); }else{ std::cout << __LINE__ << mthn << "Can't find calibration file calib.dat or delay25.dat or fedtestdac.dat" << std::endl; data=0; } } } return; }else if (typeid(data)==typeid(PixelTKFECConfig*)){ //std::cout << __LINE__ << mthn << "Will return PixelTKFECConfig" << std::endl; assert(dir=="tkfecconfig"); data = (T*) new PixelTKFECConfig(fullpath+"tkfecconfig.dat"); return; }else if (typeid(data)==typeid(PixelFECConfig*)){ //std::cout << __LINE__ << mthn << "Will return PixelFECConfig" << std::endl; assert(dir=="fecconfig"); data = (T*) new PixelFECConfig(fullpath+"fecconfig.dat"); return; }else if (typeid(data)==typeid(PixelFEDConfig*)){ //std::cout << __LINE__ << mthn << "Will return PixelFEDConfig" << std::endl; assert(dir=="fedconfig"); data = (T*) new PixelFEDConfig(fullpath+"fedconfig.dat"); return; }else if (typeid(data)==typeid(PixelPortCardConfig*)){ //std::cout << __LINE__ << mthn << "Will return PixelPortCardConfig" << std::endl; assert(dir=="portcard"); data = (T*) new PixelPortCardConfig(fullpath+"portcard_"+ext+".dat"); return; }else if (typeid(data)==typeid(PixelPortcardMap*)){ //std::cout << __LINE__ << mthn << "Will return PixelPortcardMap" << std::endl; assert(dir=="portcardmap"); data = (T*) new PixelPortcardMap(fullpath+"portcardmap.dat"); return; }else if (typeid(data)==typeid(PixelDelay25Calib*)){ //cout << __LINE__ << mthn << "Will return PixelDelay25Calib" << std::endl; assert(dir=="portcard"); data = (T*) new PixelDelay25Calib(fullpath+"delay25.dat"); return; }else if (typeid(data)==typeid(PixelTTCciConfig*)){ //cout << __LINE__ << mthn << "Will return PixelTTCciConfig" << std::endl; assert(dir=="ttcciconfig"); data = (T*) new PixelTTCciConfig(fullpath+"TTCciConfiguration.txt"); return; }else if (typeid(data)==typeid(PixelLTCConfig*)){ //cout << __LINE__ << mthn << "Will return PixelLTCConfig" << std::endl; assert(dir=="ltcconfig"); data = (T*) new PixelLTCConfig(fullpath+"LTCConfiguration.txt"); return; }else if (typeid(data)==typeid(PixelGlobalDelay25*)){ //std::cout << __LINE__ << mthn << "Will return PixelGlobalDelay25" << std::endl; assert(dir=="globaldelay25"); data = (T*) new PixelGlobalDelay25(fullpath+"globaldelay25.dat"); return; }else{ std::cout << __LINE__ << mthn << "No class match" << std::endl; assert(0); data=0; return; } }
static PixelAliasList& pos::PixelConfigFile::getAlias | ( | ) | [inline, static] |
Definition at line 228 of file PixelConfigFile.h.
References createBeamHaloJobs::directory, lut2db_cfg::filename, first, forceAliasesReload(), getForceAliasesReload(), and pos::PixelAliasList::readfile().
Referenced by addAlias(), addVersionAlias(), getAliases(), getAliases_map(), getConfigAliases(), getVersion(), getVersionAliases(), and getVersionData().
{ static std::string directory; static int first=1; static PixelAliasList aliases; directory=getenv("PIXELCONFIGURATIONBASE"); std::string filename=directory+"/aliases.txt"; if (first) { first=0; aliases.readfile(filename); forceAliasesReload(false) ; } else { if( getForceAliasesReload() ) { aliases.readfile(filename); forceAliasesReload(false) ; } } return aliases; }
static std::vector<std::pair<std::string, unsigned int> > pos::PixelConfigFile::getAliases | ( | ) | [inline, static] |
Definition at line 63 of file PixelConfigFile.h.
References getAlias(), i, pos::PixelAliasList::key(), pos::PixelAliasList::nAliases(), pos::PixelAliasList::name(), and tmp.
static std::map<std::string, unsigned int> pos::PixelConfigFile::getAliases_map | ( | ) | [inline, static] |
Definition at line 90 of file PixelConfigFile.h.
References getAlias(), i, pos::PixelAliasList::key(), pos::PixelAliasList::nAliases(), pos::PixelAliasList::name(), and tmp.
static PixelConfigList& pos::PixelConfigFile::getConfig | ( | ) | [inline, static] |
Definition at line 177 of file PixelConfigFile.h.
References cmsPerfCommons::configs, gather_cfg::cout, createBeamHaloJobs::directory, lut2db_cfg::filename, first, forceConfigReload(), pos::PixelConfigList::readfile(), pos::PixelConfigList::reload(), and stor::utils::sleep().
Referenced by addVersionAlias(), configList(), get(), getPath(), getVersions(), and makeKey().
{ static PixelConfigList configs; //FIXME static int counter=0; if(counter!=0) { while(counter!=0) { std::cout << __LINE__ << "]\t[PixelConfigFile::getConfig()]\t\t\t\t Waiting for other thread to complete reading"<<std::endl; ::sleep(1); } return configs; } counter++; static std::string directory; static int first=1; directory=getenv("PIXELCONFIGURATIONBASE"); std::string filename=directory+"/configurations.txt"; /* Don't know who put this snippet of code here: this case is already contemplated in the 'else' of the 'if' statement below if(!first) { configs.reload(filename) } */ if (first) { first=0; configs.readfile(filename); forceConfigReload(false) ; } else { // if( getForceConfigReload() ) { configs.reload(filename); forceConfigReload(false) ; // } } counter--; return configs; }
static std::vector<pathAliasPair> pos::PixelConfigFile::getConfigAliases | ( | std::string | path | ) | [inline, static] |
Definition at line 118 of file PixelConfigFile.h.
References getAlias(), and pos::PixelAliasList::getConfigAliases().
static bool& pos::PixelConfigFile::getForceAliasesReload | ( | ) | [inline, static, private] |
Definition at line 875 of file PixelConfigFile.h.
References forceAliasesReload().
Referenced by forceAliasesReload(), and getAlias().
{ static bool forceAliasesReload = false; return forceAliasesReload; }
static bool& pos::PixelConfigFile::getForceConfigReload | ( | ) | [inline, static, private] |
Definition at line 879 of file PixelConfigFile.h.
References forceConfigReload().
Referenced by forceConfigReload().
{ static bool forceConfigReload = false; return forceConfigReload; }
static std::string pos::PixelConfigFile::getPath | ( | std::string | path, |
PixelConfigKey | key | ||
) | [inline, static] |
Definition at line 267 of file PixelConfigFile.h.
References gather_cfg::cout, dir, createBeamHaloJobs::directory, getConfig(), pos::PixelConfigKey::key(), prof2calltree::last, findQualityFiles::size, and BeamSplash_cfg::version.
{ unsigned int theKey=key.key(); assert(theKey<=getConfig().size()); unsigned int last=path.find_last_of("/"); assert(last!=std::string::npos); std::string base=path.substr(0,last); std::string ext=path.substr(last+1); unsigned int slashpos=base.find_last_of("/"); if (slashpos==std::string::npos) { std::cout << "[pos::PixelConfigFile::getPath()]\t\t\tOn path:" <<path <<std::endl; std::cout << "[pos::PixelConfigFile::getPath()]\t\t\tRecall that you need a trailing /" <<std::endl; ::abort(); } std::string dir=base.substr(slashpos+1); // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted dir:" <<dir <<std::endl; // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted base:"<<base<<std::endl; // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted ext :"<<ext <<std::endl; unsigned int version; int err=getConfig()[theKey].find(dir,version); // assert(err==0); if(0!=err) { return ""; } std::ostringstream s1; s1 << version; std::string strversion=s1.str(); static std::string directory; directory=getenv("PIXELCONFIGURATIONBASE"); std::string fullpath=directory+"/"+dir+"/"+strversion+"/"; return fullpath; }
static unsigned int pos::PixelConfigFile::getVersion | ( | std::string | path, |
std::string | alias | ||
) | [inline, static] |
Definition at line 106 of file PixelConfigFile.h.
References getAlias(), and pos::PixelAliasList::getVersion().
static std::vector<std::string> pos::PixelConfigFile::getVersionAliases | ( | std::string | path | ) | [inline, static] |
Definition at line 73 of file PixelConfigFile.h.
References getAlias(), and pos::PixelAliasList::getVersionAliases().
static bool pos::PixelConfigFile::getVersionAliases | ( | std::string | configAlias, |
unsigned int & | key, | ||
std::vector< std::pair< std::string, std::string > > & | versionAliases | ||
) | [inline, static] |
Definition at line 77 of file PixelConfigFile.h.
References getAlias(), pos::PixelConfigAlias::key(), pos::PixelAliasList::versionAliases(), and pos::PixelConfigAlias::versionAliases().
static pos::pathVersionAliasMmap pos::PixelConfigFile::getVersionData | ( | ) | [inline, static] |
Definition at line 111 of file PixelConfigFile.h.
References getAlias(), and pos::PixelAliasList::getVersionData().
{ return getAlias().getVersionData(); }
static pos::pathVersionAliasMmap pos::PixelConfigFile::getVersionData | ( | std::string | koc | ) | [inline, static] |
Definition at line 114 of file PixelConfigFile.h.
References getAlias(), and pos::PixelAliasList::getVersionData().
{ return getAlias().getVersionData(koc); }
static std::vector< std::pair< std::string, unsigned int> > pos::PixelConfigFile::getVersions | ( | pos::PixelConfigKey | key | ) | [inline, static] |
Definition at line 140 of file PixelConfigFile.h.
References cmsPerfCommons::configs, getConfig(), pos::PixelConfigKey::key(), and pos::PixelConfig::versions().
static unsigned int pos::PixelConfigFile::makeKey | ( | std::vector< std::pair< std::string, unsigned int > > | versions | ) | [inline, static] |
Definition at line 159 of file PixelConfigFile.h.
References pos::PixelConfigList::add(), pos::PixelConfig::add(), HDQMDatabaseProducer::config, cmsPerfCommons::configs, first, getConfig(), i, edm::second(), and pos::PixelConfigList::writefile().
static int pos::PixelConfigFile::makeNewVersion | ( | std::string | path, |
std::string & | dir | ||
) | [inline, static] |
Definition at line 826 of file PixelConfigFile.h.
References gather_cfg::cout, createBeamHaloJobs::directory, getHLTPrescaleColumns::path, testRegression::stat, and BeamSplash_cfg::version.
Referenced by put().
{ //std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tInserting data on path:"<<path<<std::endl; struct stat stbuf; std::string directory=getenv("PIXELCONFIGURATIONBASE"); directory+="/"; directory+=path; if (stat(directory.c_str(),&stbuf)!=0){ std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tThe path:"<<path<<" does not exist."<<std::endl; std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tFull path:"<<directory<<std::endl; return -1; } directory+="/"; int version=-1; do{ version++; std::ostringstream s1; s1 << version ; std::string strversion=s1.str(); dir=directory+strversion; //std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tWill check for version:"<<dir<<std::endl; }while(stat(dir.c_str(),&stbuf)==0); //std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tThe new version is:"<<version<<std::endl; mkdir(dir.c_str(),0777); return version; }
static int pos::PixelConfigFile::put | ( | const T * | object, |
std::string | path | ||
) | [inline, static] |
Definition at line 855 of file PixelConfigFile.h.
References dir, makeNewVersion(), and BeamSplash_cfg::version.
{ std::string dir; int version=makeNewVersion(path,dir); object->writeASCII(dir); return version; }
static int pos::PixelConfigFile::put | ( | std::vector< T * > | objects, |
std::string | path | ||
) | [inline, static] |
Definition at line 863 of file PixelConfigFile.h.
References gather_cfg::cout, dir, i, makeNewVersion(), and BeamSplash_cfg::version.
{ std::cout << "[pos::PixelConfigFile::put()]\t\t# of objects to write: "<< objects.size() << std::endl; std::string dir; int version=makeNewVersion(path,dir); for(unsigned int i=0;i<objects.size();i++){ // std::cout << "[pos::PixelConfigFile::put()]\t\t\t\t\tWill write i="<<i<<" ptr: "<<objects[i]<<std::endl; objects[i]->writeASCII(dir); } return version; }