1 #ifndef PixelConfigFile_h 2 #define PixelConfigFile_h 48 #include <sys/types.h> 64 static std::vector<std::pair<std::string, unsigned int> >
getAliases(){
66 std::vector<std::pair<std::string, unsigned int> >
tmp;
68 std::pair<std::string, unsigned int> apair(aliases.
name(
i),aliases.
key(
i));
80 std::vector<std::pair<std::string,std::string> > &versionAliases){
93 std::map<std::string, unsigned int>
tmp;
95 tmp.insert(make_pair(aliases.
name(
i), aliases.
key(
i)));
103 return theConfigList;
132 std::vector<std::pair<std::string, std::string> > versionaliases){
134 for(
unsigned int i=0;
i<versionaliases.size();
i++){
160 static unsigned int makeKey(std::vector<std::pair<std::string, unsigned int> > versions){
164 for(
unsigned int i=0;
i<versions.size();
i++){
170 unsigned int newkey=configs.
add(config);
190 std::cout << __LINE__ <<
"]\t[PixelConfigFile::getConfig()]\t\t\t\t Waiting for other thread to complete reading"<<std::endl;
201 directory=getenv(
"PIXELCONFIGURATIONBASE");
236 directory=getenv(
"PIXELCONFIGURATIONBASE");
270 unsigned int theKey=key.
key();
274 unsigned int last=path.find_last_of(
"/");
275 assert(last!=(
unsigned int)std::string::npos);
280 unsigned int slashpos=base.find_last_of(
"/");
281 if (slashpos==(
unsigned int)std::string::npos) {
282 std::cout <<
"[pos::PixelConfigFile::getPath()]\t\t\tOn path:" <<path <<std::endl;
283 std::cout <<
"[pos::PixelConfigFile::getPath()]\t\t\tRecall that you need a trailing /" <<std::endl;
294 int err=
getConfig()[theKey].find(dir,version);
301 std::ostringstream s1;
306 directory=getenv(
"PIXELCONFIGURATIONBASE");
308 std::string fullpath=directory+
"/"+dir+
"/"+strversion+
"/";
319 unsigned int theKey=
key.key();
327 unsigned int last=path.find_last_of(
"/");
328 assert(last!=(
unsigned int)std::string::npos);
333 unsigned int slashpos=base.find_last_of(
"/");
334 if (slashpos==(
unsigned int)std::string::npos) {
335 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tAsking for data of type:"<<
typeid(
data).
name()<<std::endl;
336 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tOn path:" <<path <<std::endl;
337 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tRecall that you need a trailing /" <<std::endl;
348 int err=
configList()[theKey].find(dir,version);
352 std::cout<<
"[PixelConfigFile.h::get] error loading config list. "<<theKey<<
" "<<dir<<
" "<<version<<std::endl;
357 std::ostringstream s1;
362 directory=getenv(
"PIXELCONFIGURATIONBASE");
364 std::string fullpath=directory+
"/"+dir+
"/"+strversion+
"/";
392 assert(dir==
"detconfig");
397 assert(dir==
"lowvoltagemap");
403 assert(dir==
"maxvsf");
409 assert(dir==
"nametranslation");
414 assert(dir==
"fedcard");
416 data = (
T*)
new PixelFEDCard(fullpath+
"params_fed_"+ext+
".dat");
420 assert(dir==
"calib");
423 std::ifstream calibin(calibfile.c_str());
427 calibfile=fullpath+
"delay25.dat";
429 std::ifstream delayin(calibfile.c_str());
433 calibfile=fullpath+
"fedtestdac.dat";
435 std::ifstream delayin(calibfile.c_str());
439 throw std::runtime_error(
"[pos::PixelConfigFile::get()]\t\t\tCan't find calibration file calib.dat or delay25.dat or fedtestdac.dat");
446 assert(dir==
"tkfecconfig");
451 assert(dir==
"fecconfig");
456 assert(dir==
"fedconfig");
461 assert(dir==
"portcard");
466 assert(dir==
"portcardmap");
471 assert(dir==
"portcard");
476 assert(dir==
"ttcciconfig");
481 assert(dir==
"ltcconfig");
486 assert(dir==
"globaldelay25");
490 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tNo match" << std::endl;
494 std::cout<<
"[PixelConfigFile::get] Caught exception while constructing configuration object. Will rethrow."<<std::endl;
503 std::string mthn =
"]\t[pos::PixelConfigFile::configurationDataExists()]\t " ;
505 unsigned int theKey=key.
key();
511 unsigned int last=path.find_last_of(
"/");
512 assert(last!=(
unsigned int)std::string::npos);
517 unsigned int slashpos=base.find_last_of(
"/");
518 if (slashpos==(
unsigned int)std::string::npos) {
519 std::cout << __LINE__ << mthn <<
"Asking for data of type:" <<
typeid(
data).
name() <<std::endl;
520 std::cout << __LINE__ << mthn <<
"On path:" << path <<std::endl;
521 std::cout << __LINE__ << mthn <<
"Recall that you need a trailing /" <<std::endl;
532 int err=
configList()[theKey].find(dir,version);
542 std::ostringstream s1;
547 directory=getenv(
"PIXELCONFIGURATIONBASE");
549 std::string fullpath=directory+
"/"+dir+
"/"+strversion+
"/";
555 fileName = fullpath+
"ROC_Trims_module_"+ext+
".dat" ;
557 fileName = fullpath+
"ROC_Masks_module_"+ext+
".dat";
559 fileName = fullpath+
"ROC_DAC_module_"+ext+
".dat";
561 fileName = fullpath+
"TBM_module_"+ext+
".dat";
563 fileName = fullpath+
"detectconfig.dat";
565 fileName = fullpath+
"lowvoltagemap.dat";
567 fileName = fullpath+
"maxvsf.dat";
569 fileName = fullpath+
"translation.dat";
571 fileName = fullpath+
"params_fed_"+ext+
".dat";
573 fileName = fullpath+
"tkfecconfig.dat";
575 fileName = fullpath+
"fecconfig.dat";
577 fileName = fullpath+
"fedconfig.dat";
579 fileName = fullpath+
"portcard_"+ext+
".dat";
581 fileName = fullpath+
"portcardmap.dat";
583 fileName = fullpath+
"delay25.dat";
585 fileName = fullpath+
"TTCciConfiguration.txt";
587 fileName = fullpath+
"LTCConfiguration.txt";
589 fileName = fullpath+
"globaldelay25.dat";
591 assert(dir==
"calib");
593 std::ifstream calibin(calibfile.c_str());
596 std::cout << __LINE__ << mthn <<
"Found " << calibfile << std::endl ;
599 calibfile=fullpath+
"delay25.dat";
600 std::ifstream delayin(calibfile.c_str());
603 std::cout << __LINE__ << mthn <<
"Found " << calibfile << std::endl ;
606 calibfile=fullpath+
"fedtestdac.dat";
607 std::ifstream delayin(calibfile.c_str());
610 std::cout << __LINE__ << mthn <<
"Found " << calibfile << std::endl ;
613 std::cout << mthn <<
"Can't find calibration file calib.dat or delay25.dat or fedtestdac.dat" << std::endl;
619 std::cout << __LINE__ << mthn <<
"No match of class type" << std::endl;
635 std::ifstream
in(fileName.c_str());
638 std::cout << __LINE__ << mthn <<
"Not found " << fileName << std::endl ;
653 std::string mthn =
"]\t[pos::PixelConfigFile::get()]\t\t\t\t " ;
655 unsigned int last=path.find_last_of(
"/");
656 assert(last!=(
unsigned int)std::string::npos);
661 unsigned int slashpos=base.find_last_of(
"/");
675 std::ostringstream s1;
680 directory=getenv(
"PIXELCONFIGURATIONBASE");
682 std::string fullpath=directory+
"/"+dir+
"/"+strversion+
"/";
708 assert(dir==
"detconfig");
713 assert(dir==
"lowvoltagemap");
719 assert(dir==
"maxvsf");
725 assert(dir==
"nametranslation");
730 assert(dir==
"fedcard");
732 data = (
T*)
new PixelFEDCard(fullpath+
"params_fed_"+ext+
".dat");
736 assert(base==
"calib");
739 std::ifstream calibin(calibfile.c_str());
743 calibfile=fullpath+
"delay25.dat";
745 std::ifstream delayin(calibfile.c_str());
749 calibfile=fullpath+
"fedtestdac.dat";
751 std::ifstream delayin(calibfile.c_str());
755 std::cout << __LINE__ << mthn <<
"Can't find calibration file calib.dat or delay25.dat or fedtestdac.dat" << std::endl;
763 assert(dir==
"tkfecconfig");
768 assert(dir==
"fecconfig");
773 assert(dir==
"fedconfig");
778 assert(dir==
"portcard");
783 assert(dir==
"portcardmap");
788 assert(dir==
"portcard");
793 assert(dir==
"ttcciconfig");
798 assert(dir==
"ltcconfig");
803 assert(dir==
"globaldelay25");
807 std::cout << __LINE__ << mthn <<
"No class match" << std::endl;
818 typename std::map<std::string, T* >::iterator iObject=pixelObjects.begin();
820 for(;iObject!=pixelObjects.end();++iObject){
821 get(iObject->second,iObject->first,
key);
833 if (
stat(directory.c_str(),&stbuf)!=0){
835 std::cout <<
"[pos::PixelConfigFile::makeNewVersion()]\t\tThe path:"<<path<<
" does not exist."<<std::endl;
836 std::cout <<
"[pos::PixelConfigFile::makeNewVersion()]\t\tFull path:"<<directory<<std::endl;
843 std::ostringstream s1;
846 dir=directory+strversion;
848 }
while(
stat(dir.c_str(),&stbuf)==0);
850 mkdir(dir.c_str(),0777);
859 object->writeASCII(dir);
865 std::cout <<
"[pos::PixelConfigFile::put()]\t\t# of objects to write: "<< objects.size() << std::endl;
868 for(
unsigned int i=0;
i<objects.size();
i++){
870 objects[
i]->writeASCII(dir);
This class specifies which TKFEC boards are used and how they are addressed.
This class specifies which delay25 channels are delayed over the entire pixel detector and by how muc...
unsigned int getVersion(std::string path, std::string alias)
std::vector< std::pair< std::string, std::string > > versionAliases()
This class specifies which detector components are used in the configuration (and eventually should s...
static void addAlias(std::string alias, unsigned int key, std::vector< std::pair< std::string, std::string > > versionaliases)
void readfile(std::string filename)
This class specifies which FEC boards are used and how they are addressed.
static void addAlias(std::string alias, unsigned int key)
static bool & getForceAliasesReload()
pathVersionAliasMmap getVersionData()
static std::vector< pathAliasPair > getConfigAliases(std::string path)
static PixelAliasList & getAlias()
void updateConfigAlias(std::string path, unsigned int version, std::string alias, PixelConfigList &config)
std::map< std::string, vectorVAPairs > pathVersionAliasMmap
std::vector< std::pair< std::string, unsigned int > > versions()
void add(std::string dir, unsigned int version)
This class provides the mapping between portcards and the modules controlled by the card...
static std::map< std::string, unsigned int > getAliases_map()
static int put(const T *object, std::string path)
This class specifies which FEC boards are used and how they are addressed.
static PixelConfigList & configList()
std::vector< pathAliasPair > getConfigAliases(std::string path)
unsigned int key(unsigned int i)
This class provides a translation from the naming documents standard to specify the ROC to the corres...
U second(std::pair< T, U > const &p)
static void addVersionAlias(std::string path, unsigned int version, std::string alias)
This class is responsible for manipulating the DACsettings of a ROC.
This class manages data and files used in the Delay25 calibration.
This file contains the base class for "pixel configuration data" management.
void readfile(std::string filename)
Base class for pixel calibration procedures.
This class specifies which TKFEC boards are used and how they are addressed.
static unsigned int getVersion(std::string path, std::string alias)
static std::vector< std::pair< std::string, unsigned int > > getVersions(pos::PixelConfigKey key)
This class implements the steps that are used in a scan over Threshold and CalDelay.
This class implements the configuration key which actually just is an integer.
This is the documentation about PixelDetectorConfig...
static std::vector< std::pair< std::string, unsigned int > > getAliases()
The class to handle 'aliases.txt'.
static void forceAliasesReload(bool m)
This is the documentation about PixelLTCConfig...
static pos::pathVersionAliasMmap getVersionData(std::string koc)
This is the documentation about PixelLowVoltageMap...
std::string name(unsigned int i)
void insertVersionAlias(PixelVersionAlias &anAlias)
base
Make Sure CMSSW is Setup ##.
static int put(std::vector< T * > objects, std::string path)
This class provide a base class for the pixel ROC dac data for the pixel FEC configuration.
This is the documentation about PixelMaskAllPixels...
unsigned int add(PixelConfig &aConfig)
This is the documentation about PixelMaskBase...
static bool & getForceConfigReload()
This is the documentation about PixelNameTranslation...
void addVersionAlias(std::string path, std::string alias)
void insertAlias(PixelConfigAlias &anAlias)
std::vector< std::string > getVersionAliases(std::string path)
static std::string getPath(std::string path, PixelConfigKey key)
static unsigned int makeKey(std::vector< std::pair< std::string, unsigned int > > versions)
This class implements the configuration key which actually just is an integer.
This class manages data and files used in the Delay25 calibration.
This class provides a base class for the pixel trim data for the pixel FEC configuration.
static std::vector< std::string > getVersionAliases(std::string path)
This is the documentation about PixelNameTranslation...
std::vector< std::vector< double > > tmp
This class specifies the maximum Vsf setting that should be used for each ROC.
PixelConfigAlias * versionAliases(std::string aliasName)
static pos::pathVersionAliasMmap getVersionData()
char data[epos_bytes_allocation]
This is the documentation about PixelFEDConfig...
void reload(std::string filename)
static int makeNewVersion(std::string path, std::string &dir)
This is the documentation about PixelMaxVsf...
This class implements the steps that are used in a scan over Threshold and CalDelay.
static void forceConfigReload(bool m)
static bool getVersionAliases(std::string configAlias, unsigned int &key, std::vector< std::pair< std::string, std::string > > &versionAliases)
This is the documentation about PixelFEDCard...
This class specifies the settings on the TKPCIFEC and the settings on the portcard.
static PixelConfigList & getConfig()
static bool configurationDataExists(T *&data, std::string path, PixelConfigKey key)
This class specifies which delay25 channels are delayed over the entire pixel detector and by how muc...
This is the documentation about PixelTBMSettings...
This class implements the steps that are used in a scan over Threshold and CalDelay.