#include <interface/PixelConfigFile.h>
Static Public Member Functions | |
static void | addAlias (std::string alias, unsigned int key, std::vector< std::pair< std::string, std::string > > versionaliases) |
static void | addAlias (std::string alias, unsigned int key) |
static void | addVersionAlias (std::string path, unsigned int version, std::string alias) |
template<class T> | |
static bool | configurationDataExists (T *&data, std::string path, PixelConfigKey key) |
static void | forceAliasesReload (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, unsigned int version) |
template<class T> | |
static void | get (T *&data, std::string path, PixelConfigKey key) |
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 bool | getVersionAliases (std::string configAlias, unsigned int &key, std::vector< std::pair< std::string, std::string > > &versionAliases) |
static std::vector< std::string > | getVersionAliases (std::string path) |
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 () |
Definition at line 56 of file PixelConfigFile.h.
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 117 of file PixelConfigFile.h.
References pos::PixelConfigAlias::addVersionAlias(), first, getAlias(), i, pos::PixelAliasList::insertAlias(), edm::second(), and pos::PixelAliasList::writefile().
00118 { 00119 PixelConfigAlias anAlias(alias,key); 00120 for(unsigned int i=0;i<versionaliases.size();i++){ 00121 anAlias.addVersionAlias(versionaliases[i].first,versionaliases[i].second); 00122 } 00123 getAlias().insertAlias(anAlias); 00124 getAlias().writefile(); 00125 }
Definition at line 110 of file PixelConfigFile.h.
References getAlias(), pos::PixelAliasList::insertAlias(), and pos::PixelAliasList::writefile().
00110 { 00111 PixelConfigAlias anAlias(alias,key); 00112 getAlias().insertAlias(anAlias); 00113 getAlias().writefile(); 00114 }
static void pos::PixelConfigFile::addVersionAlias | ( | std::string | path, | |
unsigned int | version, | |||
std::string | alias | |||
) | [inline, static] |
Definition at line 135 of file PixelConfigFile.h.
References cmsPerfCommons::configs, getAlias(), getConfig(), pos::PixelAliasList::insertVersionAlias(), pos::PixelAliasList::updateConfigAlias(), pos::PixelAliasList::writefile(), and pos::PixelConfigList::writefile().
00135 { 00136 00137 PixelConfigList& configs=getConfig(); 00138 00139 PixelVersionAlias anAlias(path, version, alias); 00140 getAlias().insertVersionAlias(anAlias); 00141 getAlias().updateConfigAlias(path,version,alias,configs); 00142 getAlias().writefile(); 00143 configs.writefile(); 00144 }
static bool pos::PixelConfigFile::configurationDataExists | ( | T *& | data, | |
std::string | path, | |||
PixelConfigKey | key | |||
) | [inline, static] |
Definition at line 473 of file PixelConfigFile.h.
References GenMuonPlsPt100GeV_cfg::cout, dir, lat::endl(), err, false, aod_PYTHIA_cfg::fileName, getConfig(), in, pos::PixelConfigKey::key(), prof2calltree::last, name, s1, size, true, and version().
00473 { 00474 00475 unsigned int theKey=key.key(); 00476 00477 assert(theKey<=getConfig().size()); 00478 00479 unsigned int last=path.find_last_of("/"); 00480 assert(last!=std::string::npos); 00481 00482 std::string base=path.substr(0,last); 00483 std::string ext=path.substr(last+1); 00484 00485 unsigned int slashpos=base.find_last_of("/"); 00486 if (slashpos==std::string::npos) { 00487 std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t Asking for data of type:" << typeid(data).name() <<std::endl; 00488 std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t On path:" << path <<std::endl; 00489 std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t Recall that you need a trailing /" <<std::endl; 00490 ::abort(); 00491 } 00492 00493 std::string dir=base.substr(slashpos+1); 00494 00495 // std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t\t\tExtracted dir:" << dir <<std::endl; 00496 // std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t\t\tExtracted base:" << base <<std::endl; 00497 // std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t\t\tExtracted ext :" << ext <<std::endl; 00498 00499 unsigned int version; 00500 int err=getConfig()[theKey].find(dir,version); 00501 // assert(err==0); 00502 if(0!=err) 00503 { 00504 data= 0; 00505 return false ; 00506 } 00507 00508 std::ostringstream s1; 00509 s1 << version; 00510 std::string strversion=s1.str(); 00511 00512 static std::string directory; 00513 directory=getenv("PIXELCONFIGURATIONBASE"); 00514 00515 std::string fullpath=directory+"/"+dir+"/"+strversion+"/"; 00516 00517 //std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t\t\tDirectory for configuration data:"<<fullpath<<std::endl; 00518 00519 std::string fileName ; 00520 if (typeid(data)==typeid(PixelTrimBase*)){ 00521 fileName = fullpath+"ROC_Trims_module_"+ext+".dat" ; 00522 }else if (typeid(data)==typeid(PixelMaskBase*)){ 00523 fileName = fullpath+"ROC_Masks_module_"+ext+".dat"; 00524 }else if (typeid(data)==typeid(PixelDACSettings*)){ 00525 fileName = fullpath+"ROC_DAC_module_"+ext+".dat"; 00526 }else if (typeid(data)==typeid(PixelTBMSettings*)){ 00527 fileName = fullpath+"TBM_module_"+ext+".dat"; 00528 }else if (typeid(data)==typeid(PixelDetectorConfig*)){ 00529 fileName = fullpath+"detectconfig.dat"; 00530 }else if (typeid(data)==typeid(PixelLowVoltageMap*)){ 00531 fileName = fullpath+"lowvoltagemap.dat"; 00532 }else if (typeid(data)==typeid(PixelMaxVsf*)){ 00533 fileName = fullpath+"maxvsf.dat"; 00534 }else if (typeid(data)==typeid(PixelNameTranslation*)){ 00535 fileName = fullpath+"translation.dat"; 00536 }else if (typeid(data)==typeid(PixelFEDCard*)){ 00537 fileName = fullpath+"params_fed_"+ext+".dat"; 00538 }else if (typeid(data)==typeid(PixelTKFECConfig*)){ 00539 fileName = fullpath+"tkfecconfig.dat"; 00540 }else if (typeid(data)==typeid(PixelFECConfig*)){ 00541 fileName = fullpath+"fecconfig.dat"; 00542 }else if (typeid(data)==typeid(PixelFEDConfig*)){ 00543 fileName = fullpath+"fedconfig.dat"; 00544 }else if (typeid(data)==typeid(PixelPortCardConfig*)){ 00545 fileName = fullpath+"portcard_"+ext+".dat"; 00546 }else if (typeid(data)==typeid(PixelPortcardMap*)){ 00547 fileName = fullpath+"portcardmap.dat"; 00548 }else if (typeid(data)==typeid(PixelDelay25Calib*)){ 00549 fileName = fullpath+"delay25.dat"; 00550 }else if (typeid(data)==typeid(PixelTTCciConfig*)){ 00551 fileName = fullpath+"TTCciConfiguration.txt"; 00552 }else if (typeid(data)==typeid(PixelLTCConfig*)){ 00553 fileName = fullpath+"LTCConfiguration.txt"; 00554 }else if (typeid(data)==typeid(PixelGlobalDelay25*)){ 00555 fileName = fullpath+"globaldelay25.dat"; 00556 }else if (typeid(data)==typeid(PixelCalibBase*)){ 00557 assert(dir=="calib"); 00558 std::string calibfile=fullpath+"calib.dat"; 00559 std::ifstream calibin(calibfile.c_str()); 00560 if(calibin.good()) 00561 { 00562 return true ; 00563 }else{ 00564 calibfile=fullpath+"delay25.dat"; 00565 std::ifstream delayin(calibfile.c_str()); 00566 if(delayin.good()) 00567 { 00568 return true ; 00569 }else{ 00570 calibfile=fullpath+"fedtestdac.dat"; 00571 std::ifstream delayin(calibfile.c_str()); 00572 if(delayin.good()) 00573 { 00574 return true ; 00575 }else{ 00576 std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t Can't find calibration file calib.dat or delay25.dat or fedtestdac.dat" << std::endl; 00577 return false ; 00578 } 00579 } 00580 } 00581 }else{ 00582 std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t No match of class type" << std::endl; 00583 return false ; 00584 } 00585 00586 std::cout << "[pos::PixelConfigFile::configurationDataExists()]\t fileName: " << fileName << std::endl ; 00587 std::ifstream in(fileName.c_str()); 00588 if (!in.good()){return false ;} 00589 in.close() ; 00590 return true ; 00591 }
Definition at line 234 of file PixelConfigFile.h.
References getForceAliasesReload().
Referenced by getAlias(), and getForceAliasesReload().
00234 { 00235 if(getForceAliasesReload() != m){ 00236 getForceAliasesReload() = m; 00237 } 00238 }
static void pos::PixelConfigFile::get | ( | std::map< std::string, T * > & | pixelObjects, | |
PixelConfigKey | key | |||
) | [inline, static] |
Definition at line 760 of file PixelConfigFile.h.
References getDQMSummary::key.
00760 { 00761 00762 typename std::map<std::string, T* >::iterator iObject=pixelObjects.begin(); 00763 00764 for(;iObject!=pixelObjects.end();++iObject){ 00765 get(iObject->second,iObject->first,key); 00766 } 00767 00768 }
static void pos::PixelConfigFile::get | ( | T *& | data, | |
std::string | path, | |||
unsigned int | version | |||
) | [inline, static] |
Definition at line 597 of file PixelConfigFile.h.
References GenMuonPlsPt100GeV_cfg::cout, data, dir, lat::endl(), prof2calltree::last, path(), s1, and version().
00597 { 00598 00599 unsigned int last=path.find_last_of("/"); 00600 assert(last!=std::string::npos); 00601 00602 std::string base=path.substr(0,last); 00603 std::string ext=path.substr(last+1); 00604 00605 unsigned int slashpos=base.find_last_of("/"); 00606 //if (slashpos==std::string::npos) { 00607 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tAsking for data of type:"<<typeid(data).name()<<std::endl; 00608 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tOn path:"<<path<<std::endl; 00609 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tRecall that you need a trailing /" << std::endl; 00610 //::abort(); 00611 //} 00612 00613 std::string dir=base.substr(slashpos+1); 00614 00615 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted dir:"<<dir<<std::endl; 00616 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted base:"<<base<<std::endl; 00617 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted ext :"<<ext<<std::endl; 00618 00619 std::ostringstream s1; 00620 s1 << version; 00621 std::string strversion=s1.str(); 00622 00623 static std::string directory; 00624 directory=getenv("PIXELCONFIGURATIONBASE"); 00625 00626 std::string fullpath=directory+"/"+dir+"/"+strversion+"/"; 00627 00628 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tDirectory for configuration data:"<<fullpath<<std::endl; 00629 00630 if (typeid(data)==typeid(PixelTrimBase*)){ 00631 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTrimBase" << std::endl; 00632 assert(dir=="trim"); 00633 data = (T*) new PixelTrimAllPixels(fullpath+"ROC_Trims_module_"+ext+".dat"); 00634 return; 00635 }else if (typeid(data)==typeid(PixelMaskBase*)){ 00636 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelMaskBase" << std::endl; 00637 assert(dir=="mask"); 00638 data = (T*) new PixelMaskAllPixels(fullpath+"ROC_Masks_module_"+ext+".dat"); 00639 return; 00640 }else if (typeid(data)==typeid(PixelDACSettings*)){ 00641 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDACSettings" << std::endl; 00642 assert(dir=="dac"); 00643 data = (T*) new PixelDACSettings(fullpath+"ROC_DAC_module_"+ext+".dat"); 00644 return; 00645 }else if (typeid(data)==typeid(PixelTBMSettings*)){ 00646 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTBMSettings" << std::endl; 00647 assert(dir=="tbm"); 00648 data = (T*) new PixelTBMSettings(fullpath+"TBM_module_"+ext+".dat"); 00649 return; 00650 }else if (typeid(data)==typeid(PixelDetectorConfig*)){ 00651 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDACSettings" << std::endl; 00652 assert(dir=="detconfig"); 00653 data = (T*) new PixelDetectorConfig(fullpath+"detectconfig.dat"); 00654 return; 00655 }else if (typeid(data)==typeid(PixelLowVoltageMap*)){ 00656 std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill fetch1 PixelLowVoltageMap" << std::endl; 00657 assert(dir=="lowvoltagemap"); 00658 data = (T*) new PixelLowVoltageMap(fullpath+"detectconfig.dat"); 00659 std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return1 the PixelLowVoltageMap" << std::endl; 00660 return; 00661 }else if (typeid(data)==typeid(PixelMaxVsf*)){ 00662 std::cout << "Will fetch1 PixelMaxVsf" << std::endl; 00663 assert(dir=="maxvsf"); 00664 data = (T*) new PixelMaxVsf(fullpath+"maxvsf.dat"); 00665 std::cout << "Will return1 the PixelMaxVsf" << std::endl; 00666 return; 00667 }else if (typeid(data)==typeid(PixelNameTranslation*)){ 00668 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDACSettings" << std::endl; 00669 assert(dir=="nametranslation"); 00670 data = (T*) new PixelNameTranslation(fullpath+"translation.dat"); 00671 return; 00672 }else if (typeid(data)==typeid(PixelFEDCard*)){ 00673 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelFEDCard" << std::endl; 00674 assert(dir=="fedcard"); 00675 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill open:"<<fullpath+"params_fed_"+ext+".dat"<< std::endl; 00676 data = (T*) new PixelFEDCard(fullpath+"params_fed_"+ext+".dat"); 00677 return; 00678 }else if (typeid(data)==typeid(PixelCalibBase*)){ 00679 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelCalibBase" << std::endl; 00680 assert(base=="calib"); 00681 std::string calibfile=fullpath+"calib.dat"; 00682 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tLooking for file " << calibfile << std::endl; 00683 std::ifstream calibin(calibfile.c_str()); 00684 if(calibin.good()){ 00685 data = (T*) new PixelCalibConfiguration(calibfile); 00686 }else{ 00687 calibfile=fullpath+"delay25.dat"; 00688 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tNow looking for file " << calibfile << std::endl; 00689 std::ifstream delayin(calibfile.c_str()); 00690 if(delayin.good()){ 00691 data = (T*) new PixelDelay25Calib(calibfile); 00692 }else{ 00693 calibfile=fullpath+"fedtestdac.dat"; 00694 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tNow looking for file " << calibfile << std::endl; 00695 std::ifstream delayin(calibfile.c_str()); 00696 if(delayin.good()){ 00697 data = (T*) new PixelFEDTestDAC(calibfile); 00698 }else{ 00699 std::cout << "[pos::PixelConfigFile::get()]\t\t\tCan't find calibration file calib.dat or delay25.dat or fedtestdac.dat" << std::endl; 00700 data=0; 00701 } 00702 } 00703 } 00704 return; 00705 }else if (typeid(data)==typeid(PixelTKFECConfig*)){ 00706 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTKFECConfig" << std::endl; 00707 assert(dir=="tkfecconfig"); 00708 data = (T*) new PixelTKFECConfig(fullpath+"tkfecconfig.dat"); 00709 return; 00710 }else if (typeid(data)==typeid(PixelFECConfig*)){ 00711 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelFECConfig" << std::endl; 00712 assert(dir=="fecconfig"); 00713 data = (T*) new PixelFECConfig(fullpath+"fecconfig.dat"); 00714 return; 00715 }else if (typeid(data)==typeid(PixelFEDConfig*)){ 00716 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelFEDConfig" << std::endl; 00717 assert(dir=="fedconfig"); 00718 data = (T*) new PixelFEDConfig(fullpath+"fedconfig.dat"); 00719 return; 00720 }else if (typeid(data)==typeid(PixelPortCardConfig*)){ 00721 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelPortCardConfig" << std::endl; 00722 assert(dir=="portcard"); 00723 data = (T*) new PixelPortCardConfig(fullpath+"portcard_"+ext+".dat"); 00724 return; 00725 }else if (typeid(data)==typeid(PixelPortcardMap*)){ 00726 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelPortcardMap" << std::endl; 00727 assert(dir=="portcardmap"); 00728 data = (T*) new PixelPortcardMap(fullpath+"portcardmap.dat"); 00729 return; 00730 }else if (typeid(data)==typeid(PixelDelay25Calib*)){ 00731 //cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDelay25Calib" << std::endl; 00732 assert(dir=="portcard"); 00733 data = (T*) new PixelDelay25Calib(fullpath+"delay25.dat"); 00734 return; 00735 }else if (typeid(data)==typeid(PixelTTCciConfig*)){ 00736 //cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTTCciConfig" << std::endl; 00737 assert(dir=="ttcciconfig"); 00738 data = (T*) new PixelTTCciConfig(fullpath+"TTCciConfiguration.txt"); 00739 return; 00740 }else if (typeid(data)==typeid(PixelLTCConfig*)){ 00741 //cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelLTCConfig" << std::endl; 00742 assert(dir=="ltcconfig"); 00743 data = (T*) new PixelLTCConfig(fullpath+"LTCConfiguration.txt"); 00744 return; 00745 }else if (typeid(data)==typeid(PixelGlobalDelay25*)){ 00746 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelGlobalDelay25" << std::endl; 00747 assert(dir=="globaldelay25"); 00748 data = (T*) new PixelGlobalDelay25(fullpath+"globaldelay25.dat"); 00749 return; 00750 }else{ 00751 std::cout << "[pos::PixelConfigFile::get()]\t\t\tNo match" << std::endl; 00752 assert(0); 00753 data=0; 00754 return; 00755 } 00756 00757 }
static void pos::PixelConfigFile::get | ( | T *& | data, | |
std::string | path, | |||
PixelConfigKey | key | |||
) | [inline, static] |
Definition at line 291 of file PixelConfigFile.h.
References GenMuonPlsPt100GeV_cfg::cout, data, dir, lat::endl(), err, getConfig(), getDQMSummary::key, prof2calltree::last, name, path(), s1, pos::PixelConfigList::size(), and version().
00291 { 00292 unsigned int theKey=key.key(); 00293 00294 static PixelConfigList configList=getConfig(); 00295 00296 if (theKey>=configList.size()){ 00297 configList=getConfig(); 00298 } 00299 00300 assert(theKey<=configList.size()); 00301 00302 unsigned int last=path.find_last_of("/"); 00303 assert(last!=std::string::npos); 00304 00305 std::string base=path.substr(0,last); 00306 std::string ext=path.substr(last+1); 00307 00308 unsigned int slashpos=base.find_last_of("/"); 00309 if (slashpos==std::string::npos) { 00310 std::cout << "[pos::PixelConfigFile::get()]\t\t\tAsking for data of type:"<<typeid(data).name()<<std::endl; 00311 std::cout << "[pos::PixelConfigFile::get()]\t\t\tOn path:" <<path <<std::endl; 00312 std::cout << "[pos::PixelConfigFile::get()]\t\t\tRecall that you need a trailing /" <<std::endl; 00313 ::abort(); 00314 } 00315 00316 std::string dir=base.substr(slashpos+1); 00317 00318 // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted dir:" <<dir <<std::endl; 00319 // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted base:"<<base<<std::endl; 00320 // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted ext :"<<ext <<std::endl; 00321 00322 unsigned int version; 00323 int err=configList[theKey].find(dir,version); 00324 // assert(err==0); 00325 if(0!=err) 00326 { 00327 data= 0; 00328 return; 00329 } 00330 00331 std::ostringstream s1; 00332 s1 << version; 00333 std::string strversion=s1.str(); 00334 00335 static std::string directory; 00336 directory=getenv("PIXELCONFIGURATIONBASE"); 00337 00338 std::string fullpath=directory+"/"+dir+"/"+strversion+"/"; 00339 00340 //std::cout << "Directory for configuration data:"<<fullpath<<std::endl; 00341 00342 if (typeid(data)==typeid(PixelTrimBase*)){ 00343 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTrimBase" << std::endl; 00344 assert(dir=="trim"); 00345 data = (T*) new PixelTrimAllPixels(fullpath+"ROC_Trims_module_"+ext+".dat"); 00346 return; 00347 }else if (typeid(data)==typeid(PixelMaskBase*)){ 00348 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelMaskBase" << std::endl; 00349 assert(dir=="mask"); 00350 data = (T*) new PixelMaskAllPixels(fullpath+"ROC_Masks_module_"+ext+".dat"); 00351 return; 00352 }else if (typeid(data)==typeid(PixelDACSettings*)){ 00353 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDACSettings" << std::endl; 00354 assert(dir=="dac"); 00355 data = (T*) new PixelDACSettings(fullpath+"ROC_DAC_module_"+ext+".dat"); 00356 return; 00357 }else if (typeid(data)==typeid(PixelTBMSettings*)){ 00358 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTBMSettings" << std::endl; 00359 assert(dir=="tbm"); 00360 data = (T*) new PixelTBMSettings(fullpath+"TBM_module_"+ext+".dat"); 00361 return; 00362 }else if (typeid(data)==typeid(PixelDetectorConfig*)){ 00363 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDetectorConfig" << std::endl; 00364 assert(dir=="detconfig"); 00365 data = (T*) new PixelDetectorConfig(fullpath+"detectconfig.dat"); 00366 return; 00367 }else if (typeid(data)==typeid(PixelLowVoltageMap*)){ 00368 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill fetch PixelLowVoltageMap" << std::endl; 00369 assert(dir=="lowvoltagemap"); 00370 data = (T*) new PixelLowVoltageMap(fullpath+"lowvoltagemap.dat"); 00371 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return the PixelLowVoltageMap" << std::endl; 00372 return; 00373 }else if (typeid(data)==typeid(PixelMaxVsf*)){ 00374 //std::cout << "Will fetch PixelMaxVsf" << std::endl; 00375 assert(dir=="maxvsf"); 00376 data = (T*) new PixelMaxVsf(fullpath+"maxvsf.dat"); 00377 //std::cout << "Will return the PixelMaxVsf" << std::endl; 00378 return; 00379 }else if (typeid(data)==typeid(PixelNameTranslation*)){ 00380 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDACSettings" << std::endl; 00381 assert(dir=="nametranslation"); 00382 data = (T*) new PixelNameTranslation(fullpath+"translation.dat"); 00383 return; 00384 }else if (typeid(data)==typeid(PixelFEDCard*)){ 00385 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelFEDCard" << std::endl; 00386 assert(dir=="fedcard"); 00387 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill open:"<<fullpath+"params_fed_"+ext+".dat"<< std::endl; 00388 data = (T*) new PixelFEDCard(fullpath+"params_fed_"+ext+".dat"); 00389 return; 00390 }else if (typeid(data)==typeid(PixelCalibBase*)){ 00391 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelCalibBase" << std::endl; 00392 assert(dir=="calib"); 00393 std::string calibfile=fullpath+"calib.dat"; 00394 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tLooking for file " << calibfile << std::endl; 00395 std::ifstream calibin(calibfile.c_str()); 00396 if(calibin.good()){ 00397 data = (T*) new PixelCalibConfiguration(calibfile); 00398 }else{ 00399 calibfile=fullpath+"delay25.dat"; 00400 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tNow looking for file " << calibfile << std::endl; 00401 std::ifstream delayin(calibfile.c_str()); 00402 if(delayin.good()){ 00403 data = (T*) new PixelDelay25Calib(calibfile); 00404 }else{ 00405 calibfile=fullpath+"fedtestdac.dat"; 00406 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tNow looking for file " << calibfile << std::endl; 00407 std::ifstream delayin(calibfile.c_str()); 00408 if(delayin.good()){ 00409 data = (T*) new PixelFEDTestDAC(calibfile); 00410 }else{ 00411 std::cout << "[pos::PixelConfigFile::get()]\t\t\tCan't find calibration file calib.dat or delay25.dat or fedtestdac.dat" << std::endl; 00412 data=0; 00413 } 00414 } 00415 } 00416 return; 00417 }else if (typeid(data)==typeid(PixelTKFECConfig*)){ 00418 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTKFECConfig" << std::endl; 00419 assert(dir=="tkfecconfig"); 00420 data = (T*) new PixelTKFECConfig(fullpath+"tkfecconfig.dat"); 00421 return; 00422 }else if (typeid(data)==typeid(PixelFECConfig*)){ 00423 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelFECConfig" << std::endl; 00424 assert(dir=="fecconfig"); 00425 data = (T*) new PixelFECConfig(fullpath+"fecconfig.dat"); 00426 return; 00427 }else if (typeid(data)==typeid(PixelFEDConfig*)){ 00428 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelFEDConfig" << std::endl; 00429 assert(dir=="fedconfig"); 00430 data = (T*) new PixelFEDConfig(fullpath+"fedconfig.dat"); 00431 return; 00432 }else if (typeid(data)==typeid(PixelPortCardConfig*)){ 00433 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelPortCardConfig" << std::endl; 00434 assert(dir=="portcard"); 00435 data = (T*) new PixelPortCardConfig(fullpath+"portcard_"+ext+".dat"); 00436 return; 00437 }else if (typeid(data)==typeid(PixelPortcardMap*)){ 00438 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelPortcardMap" << std::endl; 00439 assert(dir=="portcardmap"); 00440 data = (T*) new PixelPortcardMap(fullpath+"portcardmap.dat"); 00441 return; 00442 }else if (typeid(data)==typeid(PixelDelay25Calib*)){ 00443 //cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelDelay25Calib" << std::endl; 00444 assert(dir=="portcard"); 00445 data = (T*) new PixelDelay25Calib(fullpath+"delay25.dat"); 00446 return; 00447 }else if (typeid(data)==typeid(PixelTTCciConfig*)){ 00448 //cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelTTCciConfig" << std::endl; 00449 assert(dir=="ttcciconfig"); 00450 data = (T*) new PixelTTCciConfig(fullpath+"TTCciConfiguration.txt"); 00451 return; 00452 }else if (typeid(data)==typeid(PixelLTCConfig*)){ 00453 //cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelLTCConfig" << std::endl; 00454 assert(dir=="ltcconfig"); 00455 data = (T*) new PixelLTCConfig(fullpath+"LTCConfiguration.txt"); 00456 return; 00457 }else if (typeid(data)==typeid(PixelGlobalDelay25*)){ 00458 //std::cout << "[pos::PixelConfigFile::get()]\t\t\tWill return PixelGlobalDelay25" << std::endl; 00459 assert(dir=="globaldelay25"); 00460 data = (T*) new PixelGlobalDelay25(fullpath+"globaldelay25.dat"); 00461 return; 00462 }else{ 00463 std::cout << "[pos::PixelConfigFile::get()]\t\t\tNo match" << std::endl; 00464 assert(0); 00465 data=0; 00466 return; 00467 } 00468 00469 }
static PixelAliasList& pos::PixelConfigFile::getAlias | ( | ) | [inline, static] |
Definition at line 208 of file PixelConfigFile.h.
References EgammaValidation_cff::filename, first, forceAliasesReload(), getForceAliasesReload(), and pos::PixelAliasList::readfile().
Referenced by addAlias(), addVersionAlias(), getAliases(), getAliases_map(), getConfigAliases(), getVersion(), getVersionAliases(), and getVersionData().
00208 { 00209 00210 static std::string directory; 00211 static int first=1; 00212 00213 static PixelAliasList aliases; 00214 00215 directory=getenv("PIXELCONFIGURATIONBASE"); 00216 std::string filename=directory+"/aliases.txt"; 00217 00218 if (first) { 00219 first=0; 00220 aliases.readfile(filename); 00221 00222 forceAliasesReload(false) ; 00223 } else { 00224 if( getForceAliasesReload() ) { 00225 aliases.readfile(filename); 00226 forceAliasesReload(false) ; 00227 } 00228 } 00229 00230 return aliases; 00231 00232 }
static std::vector<std::pair<std::string, unsigned int> > pos::PixelConfigFile::getAliases | ( | ) | [inline, static] |
Definition at line 60 of file PixelConfigFile.h.
References getAlias(), i, pos::PixelAliasList::key(), pos::PixelAliasList::nAliases(), pos::PixelAliasList::name(), and tmp.
00060 { 00061 PixelAliasList& aliases=getAlias(); 00062 std::vector<std::pair<std::string, unsigned int> > tmp; 00063 for(unsigned int i=0;i<aliases.nAliases();i++){ 00064 std::pair<std::string, unsigned int> apair(aliases.name(i),aliases.key(i)); 00065 tmp.push_back(apair); 00066 } 00067 return tmp; 00068 }
static std::map<std::string, unsigned int> pos::PixelConfigFile::getAliases_map | ( | ) | [inline, static] |
Definition at line 87 of file PixelConfigFile.h.
References getAlias(), i, pos::PixelAliasList::key(), pos::PixelAliasList::nAliases(), pos::PixelAliasList::name(), and tmp.
00087 { 00088 PixelAliasList& aliases=getAlias(); 00089 std::map<std::string, unsigned int> tmp; 00090 for(unsigned int i=0;i<aliases.nAliases();i++){ 00091 tmp.insert(make_pair(aliases.name(i), aliases.key(i))); 00092 } 00093 return tmp; 00094 }
static PixelConfigList& pos::PixelConfigFile::getConfig | ( | ) | [inline, static] |
Definition at line 164 of file PixelConfigFile.h.
References cmsPerfCommons::configs, counter(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), EgammaValidation_cff::filename, first, pos::PixelConfigList::readfile(), and pos::PixelConfigList::reload().
Referenced by addVersionAlias(), configurationDataExists(), get(), getPath(), getVersions(), and makeKey().
00164 { 00165 00166 static PixelConfigList configs; 00167 00168 //FIXME 00169 00170 static int counter=0; 00171 00172 if (counter!=0){ 00173 while(counter!=0){ 00174 std::cout <<"[PixelConfigFile::getConfig()] waiting for other thread to complete reading"<<std::endl; 00175 ::sleep(1); 00176 } 00177 return configs; 00178 } 00179 00180 00181 counter++; 00182 00183 static std::string directory; 00184 static int first=1; 00185 00186 directory=getenv("PIXELCONFIGURATIONBASE"); 00187 std::string filename=directory+"/configurations.txt"; 00188 if(!first) 00189 { 00190 // std::cout << "[pos::PixelConfigFile::getConfig()] Reloading configurations.txt"<< std::endl ; 00191 configs.reload(filename) ; 00192 // std::cout << "[pos::PixelConfigFile::getConfig()] Size reloaded: " << configs.size() << std::endl ; 00193 } 00194 if (first) 00195 { 00196 first=0; 00197 // std::cout << "[pos::PixelConfigFile::getConfig()] Reading configurations.txt"<< std::endl ; 00198 configs.readfile(filename); 00199 // std::cout << "[pos::PixelConfigFile::getConfig()] Size read: " << configs.size() << std::endl ; 00200 } 00201 00202 counter--; 00203 00204 return configs; 00205 00206 }
static std::vector<pathAliasPair> pos::PixelConfigFile::getConfigAliases | ( | std::string | path | ) | [inline, static] |
Definition at line 105 of file PixelConfigFile.h.
References getAlias(), and pos::PixelAliasList::getConfigAliases().
static bool& pos::PixelConfigFile::getForceAliasesReload | ( | ) | [inline, static, private] |
Definition at line 820 of file PixelConfigFile.h.
References forceAliasesReload().
Referenced by forceAliasesReload(), and getAlias().
00820 { 00821 static bool forceAliasesReload = false; 00822 return forceAliasesReload; 00823 }
static std::string pos::PixelConfigFile::getPath | ( | std::string | path, | |
PixelConfigKey | key | |||
) | [inline, static] |
Definition at line 241 of file PixelConfigFile.h.
References GenMuonPlsPt100GeV_cfg::cout, dir, lat::endl(), err, getConfig(), pos::PixelConfigKey::key(), prof2calltree::last, s1, size, and version().
00241 { 00242 00243 unsigned int theKey=key.key(); 00244 00245 assert(theKey<=getConfig().size()); 00246 00247 unsigned int last=path.find_last_of("/"); 00248 assert(last!=std::string::npos); 00249 00250 std::string base=path.substr(0,last); 00251 std::string ext=path.substr(last+1); 00252 00253 unsigned int slashpos=base.find_last_of("/"); 00254 if (slashpos==std::string::npos) { 00255 std::cout << "[pos::PixelConfigFile::getPath()]\t\t\tOn path:" <<path <<std::endl; 00256 std::cout << "[pos::PixelConfigFile::getPath()]\t\t\tRecall that you need a trailing /" <<std::endl; 00257 ::abort(); 00258 } 00259 00260 std::string dir=base.substr(slashpos+1); 00261 00262 // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted dir:" <<dir <<std::endl; 00263 // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted base:"<<base<<std::endl; 00264 // std::cout << "[pos::PixelConfigFile::get()]\t\t\tExtracted ext :"<<ext <<std::endl; 00265 00266 unsigned int version; 00267 int err=getConfig()[theKey].find(dir,version); 00268 // assert(err==0); 00269 if(0!=err) 00270 { 00271 return ""; 00272 } 00273 00274 std::ostringstream s1; 00275 s1 << version; 00276 std::string strversion=s1.str(); 00277 00278 static std::string directory; 00279 directory=getenv("PIXELCONFIGURATIONBASE"); 00280 00281 std::string fullpath=directory+"/"+dir+"/"+strversion+"/"; 00282 00283 return fullpath; 00284 }
static unsigned int pos::PixelConfigFile::getVersion | ( | std::string | path, | |
std::string | alias | |||
) | [inline, static] |
Definition at line 96 of file PixelConfigFile.h.
References getAlias(), and pos::PixelAliasList::getVersion().
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 74 of file PixelConfigFile.h.
References getAlias(), pos::PixelConfigAlias::key(), pos::PixelAliasList::versionAliases(), and pos::PixelConfigAlias::versionAliases().
00076 { 00077 PixelConfigAlias* alias=getAlias().versionAliases(configAlias); 00078 if (alias==0) { 00079 return false; 00080 } 00081 key=alias->key(); 00082 versionAliases=alias->versionAliases(); 00083 return true; 00084 }
static std::vector<std::string> pos::PixelConfigFile::getVersionAliases | ( | std::string | path | ) | [inline, static] |
Definition at line 70 of file PixelConfigFile.h.
References getAlias(), and pos::PixelAliasList::getVersionAliases().
static pos::pathVersionAliasMmap pos::PixelConfigFile::getVersionData | ( | ) | [inline, static] |
Definition at line 101 of file PixelConfigFile.h.
References getAlias(), and pos::PixelAliasList::getVersionData().
00101 { 00102 return getAlias().getVersionData(); 00103 }
static std::vector< std::pair< std::string, unsigned int> > pos::PixelConfigFile::getVersions | ( | pos::PixelConfigKey | key | ) | [inline, static] |
Definition at line 127 of file PixelConfigFile.h.
References cmsPerfCommons::configs, getConfig(), pos::PixelConfigKey::key(), and pos::PixelConfig::versions().
00127 { 00128 00129 PixelConfigList& configs=getConfig(); 00130 PixelConfig& theConfig=configs[key.key()]; 00131 return theConfig.versions(); 00132 00133 }
static unsigned int pos::PixelConfigFile::makeKey | ( | std::vector< std::pair< std::string, unsigned int > > | versions | ) | [inline, static] |
Definition at line 146 of file PixelConfigFile.h.
References pos::PixelConfigList::add(), pos::PixelConfig::add(), edmplugin::standard::config(), cmsPerfCommons::configs, first, getConfig(), i, edm::second(), and pos::PixelConfigList::writefile().
00146 { 00147 00148 PixelConfig config; 00149 00150 for(unsigned int i=0;i<versions.size();i++){ 00151 config.add(versions[i].first,versions[i].second); 00152 } 00153 00154 PixelConfigList& configs=getConfig(); 00155 00156 unsigned int newkey=configs.add(config); 00157 00158 configs.writefile(); 00159 00160 return newkey; 00161 00162 }
static int pos::PixelConfigFile::makeNewVersion | ( | std::string | path, | |
std::string & | dir | |||
) | [inline, static] |
Definition at line 771 of file PixelConfigFile.h.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), s1, and version().
Referenced by put().
00771 { 00772 //std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tInserting data on path:"<<path<<std::endl; 00773 struct stat stbuf; 00774 std::string directory=getenv("PIXELCONFIGURATIONBASE"); 00775 directory+="/"; 00776 directory+=path; 00777 if (stat(directory.c_str(),&stbuf)!=0){ 00778 00779 std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tThe path:"<<path<<" does not exist."<<std::endl; 00780 std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tFull path:"<<directory<<std::endl; 00781 return -1; 00782 } 00783 directory+="/"; 00784 int version=-1; 00785 do{ 00786 version++; 00787 std::ostringstream s1; 00788 s1 << version ; 00789 std::string strversion=s1.str(); 00790 dir=directory+strversion; 00791 //std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tWill check for version:"<<dir<<std::endl; 00792 }while(stat(dir.c_str(),&stbuf)==0); 00793 //std::cout << "[pos::PixelConfigFile::makeNewVersion()]\t\tThe new version is:"<<version<<std::endl; 00794 mkdir(dir.c_str(),0777); 00795 return version; 00796 }
static int pos::PixelConfigFile::put | ( | std::vector< T * > | objects, | |
std::string | path | |||
) | [inline, static] |
Definition at line 808 of file PixelConfigFile.h.
References GenMuonPlsPt100GeV_cfg::cout, dir, lat::endl(), i, makeNewVersion(), and version().
00808 { 00809 std::cout << "[pos::PixelConfigFile::put()]\t\t# of objects to write: "<< objects.size() << std::endl; 00810 std::string dir; 00811 int version=makeNewVersion(path,dir); 00812 for(unsigned int i=0;i<objects.size();i++){ 00813 // std::cout << "[pos::PixelConfigFile::put()]\t\t\t\t\tWill write i="<<i<<" ptr: "<<objects[i]<<std::endl; 00814 objects[i]->writeASCII(dir); 00815 } 00816 return version; 00817 }
static int pos::PixelConfigFile::put | ( | const T * | object, | |
std::string | path | |||
) | [inline, static] |
Definition at line 800 of file PixelConfigFile.h.
References dir, makeNewVersion(), and version().
00800 { 00801 std::string dir; 00802 int version=makeNewVersion(path,dir); 00803 object->writeASCII(dir); 00804 return version; 00805 }