1 #ifndef PixelConfigFile_h
2 #define PixelConfigFile_h
48 #include <sys/types.h>
63 static std::vector<std::pair<std::string, unsigned int> >
getAliases(){
65 std::vector<std::pair<std::string, unsigned int> >
tmp;
67 std::pair<std::string, unsigned int> apair(aliases.
name(
i),aliases.
key(
i));
79 std::vector<std::pair<std::string,std::string> > &versionAliases){
92 std::map<std::string, unsigned int>
tmp;
94 tmp.insert(make_pair(aliases.
name(
i), aliases.
key(
i)));
102 return theConfigList;
131 std::vector<std::pair<std::string, std::string> > versionaliases){
133 for(
unsigned int i=0;
i<versionaliases.size();
i++){
159 static unsigned int makeKey(std::vector<std::pair<std::string, unsigned int> > versions){
163 for(
unsigned int i=0;
i<versions.size();
i++){
169 unsigned int newkey=configs.
add(config);
189 std::cout << __LINE__ <<
"]\t[PixelConfigFile::getConfig()]\t\t\t\t Waiting for other thread to complete reading"<<std::endl;
200 directory=getenv(
"PIXELCONFIGURATIONBASE");
235 directory=getenv(
"PIXELCONFIGURATIONBASE");
269 unsigned int theKey=key.
key();
273 unsigned int last=path.find_last_of(
"/");
274 assert(last!=(
unsigned int)std::string::npos);
279 unsigned int slashpos=base.find_last_of(
"/");
280 if (slashpos==(
unsigned int)std::string::npos) {
281 std::cout <<
"[pos::PixelConfigFile::getPath()]\t\t\tOn path:" <<path <<std::endl;
282 std::cout <<
"[pos::PixelConfigFile::getPath()]\t\t\tRecall that you need a trailing /" <<std::endl;
293 int err=
getConfig()[theKey].find(dir,version);
300 std::ostringstream s1;
305 directory=getenv(
"PIXELCONFIGURATIONBASE");
307 std::string fullpath=directory+
"/"+dir+
"/"+strversion+
"/";
318 unsigned int theKey=
key.key();
326 unsigned int last=
path.find_last_of(
"/");
327 assert(last!=(
unsigned int)std::string::npos);
332 unsigned int slashpos=base.find_last_of(
"/");
333 if (slashpos==(
unsigned int)std::string::npos) {
334 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tAsking for data of type:"<<
typeid(
data).
name()<<std::endl;
335 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tOn path:" <<
path <<std::endl;
336 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tRecall that you need a trailing /" <<std::endl;
347 int err=
configList()[theKey].find(dir,version);
351 std::cout<<
"[PixelConfigFile.h::get] error loading config list. "<<theKey<<
" "<<dir<<
" "<<version<<std::endl;
356 std::ostringstream s1;
361 directory=getenv(
"PIXELCONFIGURATIONBASE");
363 std::string fullpath=directory+
"/"+dir+
"/"+strversion+
"/";
396 assert(dir==
"lowvoltagemap");
408 assert(dir==
"nametranslation");
422 std::ifstream calibin(calibfile.c_str());
426 calibfile=fullpath+
"delay25.dat";
428 std::ifstream delayin(calibfile.c_str());
432 calibfile=fullpath+
"fedtestdac.dat";
434 std::ifstream delayin(calibfile.c_str());
438 throw std::runtime_error(
"[pos::PixelConfigFile::get()]\t\t\tCan't find calibration file calib.dat or delay25.dat or fedtestdac.dat");
445 assert(dir==
"tkfecconfig");
465 assert(dir==
"portcardmap");
475 assert(dir==
"ttcciconfig");
485 assert(dir==
"globaldelay25");
489 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tNo match" << std::endl;
493 std::cout<<
"[PixelConfigFile::get] Caught exception while constructing configuration object. Will rethrow."<<std::endl;
502 std::string mthn =
"]\t[pos::PixelConfigFile::configurationDataExists()]\t " ;
504 unsigned int theKey=key.
key();
510 unsigned int last=path.find_last_of(
"/");
511 assert(last!=(
unsigned int)std::string::npos);
516 unsigned int slashpos=base.find_last_of(
"/");
517 if (slashpos==(
unsigned int)std::string::npos) {
518 std::cout << __LINE__ << mthn <<
"Asking for data of type:" <<
typeid(
data).
name() <<std::endl;
519 std::cout << __LINE__ << mthn <<
"On path:" << path <<std::endl;
520 std::cout << __LINE__ << mthn <<
"Recall that you need a trailing /" <<std::endl;
531 int err=
configList()[theKey].find(dir,version);
541 std::ostringstream s1;
546 directory=getenv(
"PIXELCONFIGURATIONBASE");
548 std::string fullpath=directory+
"/"+dir+
"/"+strversion+
"/";
554 fileName = fullpath+
"ROC_Trims_module_"+ext+
".dat" ;
556 fileName = fullpath+
"ROC_Masks_module_"+ext+
".dat";
558 fileName = fullpath+
"ROC_DAC_module_"+ext+
".dat";
560 fileName = fullpath+
"TBM_module_"+ext+
".dat";
562 fileName = fullpath+
"detectconfig.dat";
564 fileName = fullpath+
"lowvoltagemap.dat";
566 fileName = fullpath+
"maxvsf.dat";
568 fileName = fullpath+
"translation.dat";
570 fileName = fullpath+
"params_fed_"+ext+
".dat";
572 fileName = fullpath+
"tkfecconfig.dat";
574 fileName = fullpath+
"fecconfig.dat";
576 fileName = fullpath+
"fedconfig.dat";
578 fileName = fullpath+
"portcard_"+ext+
".dat";
580 fileName = fullpath+
"portcardmap.dat";
582 fileName = fullpath+
"delay25.dat";
584 fileName = fullpath+
"TTCciConfiguration.txt";
586 fileName = fullpath+
"LTCConfiguration.txt";
588 fileName = fullpath+
"globaldelay25.dat";
592 std::ifstream calibin(calibfile.c_str());
595 std::cout << __LINE__ << mthn <<
"Found " << calibfile << std::endl ;
598 calibfile=fullpath+
"delay25.dat";
599 std::ifstream delayin(calibfile.c_str());
602 std::cout << __LINE__ << mthn <<
"Found " << calibfile << std::endl ;
605 calibfile=fullpath+
"fedtestdac.dat";
606 std::ifstream delayin(calibfile.c_str());
609 std::cout << __LINE__ << mthn <<
"Found " << calibfile << std::endl ;
612 std::cout << mthn <<
"Can't find calibration file calib.dat or delay25.dat or fedtestdac.dat" << std::endl;
618 std::cout << __LINE__ << mthn <<
"No match of class type" << std::endl;
634 std::ifstream
in(fileName.c_str());
637 std::cout << __LINE__ << mthn <<
"Not found " << fileName << std::endl ;
652 std::string mthn =
"]\t[pos::PixelConfigFile::get()]\t\t\t\t " ;
654 unsigned int last=
path.find_last_of(
"/");
655 assert(last!=(
unsigned int)std::string::npos);
660 unsigned int slashpos=base.find_last_of(
"/");
674 std::ostringstream s1;
679 directory=getenv(
"PIXELCONFIGURATIONBASE");
681 std::string fullpath=directory+
"/"+dir+
"/"+strversion+
"/";
712 assert(dir==
"lowvoltagemap");
724 assert(dir==
"nametranslation");
738 std::ifstream calibin(calibfile.c_str());
742 calibfile=fullpath+
"delay25.dat";
744 std::ifstream delayin(calibfile.c_str());
748 calibfile=fullpath+
"fedtestdac.dat";
750 std::ifstream delayin(calibfile.c_str());
754 std::cout << __LINE__ << mthn <<
"Can't find calibration file calib.dat or delay25.dat or fedtestdac.dat" << std::endl;
762 assert(dir==
"tkfecconfig");
782 assert(dir==
"portcardmap");
792 assert(dir==
"ttcciconfig");
802 assert(dir==
"globaldelay25");
806 std::cout << __LINE__ << mthn <<
"No class match" << std::endl;
817 typename std::map<std::string, T* >::iterator iObject=pixelObjects.begin();
819 for(;iObject!=pixelObjects.end();++iObject){
820 get(iObject->second,iObject->first,
key);
832 if (stat(directory.c_str(),&stbuf)!=0){
834 std::cout <<
"[pos::PixelConfigFile::makeNewVersion()]\t\tThe path:"<<path<<
" does not exist."<<std::endl;
835 std::cout <<
"[pos::PixelConfigFile::makeNewVersion()]\t\tFull path:"<<directory<<std::endl;
842 std::ostringstream s1;
845 dir=directory+strversion;
847 }
while(stat(dir.c_str(),&stbuf)==0);
849 mkdir(dir.c_str(),0777);
858 object->writeASCII(dir);
864 std::cout <<
"[pos::PixelConfigFile::put()]\t\t# of objects to write: "<< objects.size() << std::endl;
867 for(
unsigned int i=0;
i<objects.size();
i++){
869 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)
static int put(std::vector< T * > objects, std::string path)
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
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()
This is the documentation about PixelFEDConfig...
static std::atomic< unsigned int > counter
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)
volatile std::atomic< bool > shutdown_flag false
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.
tuple size
Write out results.
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.