1 #ifndef PixelConfigFile_h 2 #define PixelConfigFile_h 48 #include <sys/types.h> 62 static std::vector<std::pair<std::string, unsigned int> >
getAliases() {
64 std::vector<std::pair<std::string, unsigned int> >
tmp;
65 for (
unsigned int i = 0;
i < aliases.
nAliases();
i++) {
66 std::pair<std::string, unsigned int> apair(aliases.
name(
i), aliases.
key(
i));
76 std::vector<std::pair<std::string, std::string> >& versionAliases) {
88 std::map<std::string, unsigned int>
tmp;
89 for (
unsigned int i = 0;
i < aliases.
nAliases();
i++) {
90 tmp.insert(make_pair(aliases.
name(
i), aliases.
key(
i)));
117 std::vector<std::pair<std::string, std::string> > versionaliases) {
119 for (
unsigned int i = 0;
i < versionaliases.size();
i++) {
142 static unsigned int makeKey(std::vector<std::pair<std::string, unsigned int> > versions) {
145 for (
unsigned int i = 0;
i < versions.size();
i++) {
151 unsigned int newkey = configs.
add(config);
166 while (counter != 0) {
168 <<
"]\t[PixelConfigFile::getConfig()]\t\t\t\t Waiting for other thread to complete reading" 178 static int first = 1;
180 directory = std::getenv(
"PIXELCONFIGURATIONBASE");
206 static int first = 1;
210 directory = std::getenv(
"PIXELCONFIGURATIONBASE");
242 unsigned int theKey = key.
key();
246 unsigned int last = path.find_last_of(
"/");
247 assert(last != (
unsigned int)std::string::npos);
252 unsigned int slashpos = base.find_last_of(
"/");
253 if (slashpos == (
unsigned int)std::string::npos) {
254 std::cout <<
"[pos::PixelConfigFile::getPath()]\t\t\tOn path:" << path << std::endl;
255 std::cout <<
"[pos::PixelConfigFile::getPath()]\t\t\tRecall that you need a trailing /" << std::endl;
272 std::ostringstream s1;
277 directory = std::getenv(
"PIXELCONFIGURATIONBASE");
287 unsigned int theKey =
key.key();
295 unsigned int last = path.find_last_of(
"/");
296 assert(last != (
unsigned int)std::string::npos);
301 unsigned int slashpos = base.find_last_of(
"/");
302 if (slashpos == (
unsigned int)std::string::npos) {
303 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tAsking for data of type:" <<
typeid(
data).
name() << std::endl;
304 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tOn path:" << path << std::endl;
305 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tRecall that you need a trailing /" << std::endl;
319 std::cout <<
"[PixelConfigFile.h::get] error loading config list. " << theKey <<
" " << dir <<
" " << version
325 std::ostringstream s1;
330 directory = std::getenv(
"PIXELCONFIGURATIONBASE");
339 assert(dir ==
"trim");
344 assert(dir ==
"mask");
349 assert(dir ==
"dac");
354 assert(dir ==
"tbm");
359 assert(dir ==
"detconfig");
364 assert(dir ==
"lowvoltagemap");
370 assert(dir ==
"maxvsf");
376 assert(dir ==
"nametranslation");
381 assert(dir ==
"fedcard");
383 data = (
T*)
new PixelFEDCard(fullpath +
"params_fed_" + ext +
".dat");
387 assert(dir ==
"calib");
390 std::ifstream calibin(calibfile.c_str());
391 if (calibin.good()) {
394 calibfile = fullpath +
"delay25.dat";
396 std::ifstream delayin(calibfile.c_str());
397 if (delayin.good()) {
400 calibfile = fullpath +
"fedtestdac.dat";
402 std::ifstream delayin(calibfile.c_str());
403 if (delayin.good()) {
406 throw std::runtime_error(
407 "[pos::PixelConfigFile::get()]\t\t\tCan't find calibration file calib.dat or delay25.dat or " 415 assert(dir ==
"tkfecconfig");
420 assert(dir ==
"fecconfig");
425 assert(dir ==
"fedconfig");
430 assert(dir ==
"portcard");
435 assert(dir ==
"portcardmap");
440 assert(dir ==
"portcard");
445 assert(dir ==
"ttcciconfig");
450 assert(dir ==
"ltcconfig");
455 assert(dir ==
"globaldelay25");
459 std::cout <<
"[pos::PixelConfigFile::get()]\t\t\tNo match" << std::endl;
463 std::cout <<
"[PixelConfigFile::get] Caught exception while constructing configuration object. Will rethrow." 472 std::string mthn =
"]\t[pos::PixelConfigFile::configurationDataExists()]\t ";
474 unsigned int theKey = key.
key();
478 unsigned int last = path.find_last_of(
"/");
479 assert(last != (
unsigned int)std::string::npos);
484 unsigned int slashpos = base.find_last_of(
"/");
485 if (slashpos == (
unsigned int)std::string::npos) {
486 std::cout << __LINE__ << mthn <<
"Asking for data of type:" <<
typeid(
data).
name() << std::endl;
487 std::cout << __LINE__ << mthn <<
"On path:" << path << std::endl;
488 std::cout << __LINE__ << mthn <<
"Recall that you need a trailing /" << std::endl;
508 std::ostringstream s1;
513 directory = std::getenv(
"PIXELCONFIGURATIONBASE");
521 fileName = fullpath +
"ROC_Trims_module_" + ext +
".dat";
523 fileName = fullpath +
"ROC_Masks_module_" + ext +
".dat";
525 fileName = fullpath +
"ROC_DAC_module_" + ext +
".dat";
527 fileName = fullpath +
"TBM_module_" + ext +
".dat";
529 fileName = fullpath +
"detectconfig.dat";
531 fileName = fullpath +
"lowvoltagemap.dat";
533 fileName = fullpath +
"maxvsf.dat";
535 fileName = fullpath +
"translation.dat";
537 fileName = fullpath +
"params_fed_" + ext +
".dat";
539 fileName = fullpath +
"tkfecconfig.dat";
541 fileName = fullpath +
"fecconfig.dat";
543 fileName = fullpath +
"fedconfig.dat";
545 fileName = fullpath +
"portcard_" + ext +
".dat";
547 fileName = fullpath +
"portcardmap.dat";
549 fileName = fullpath +
"delay25.dat";
551 fileName = fullpath +
"TTCciConfiguration.txt";
553 fileName = fullpath +
"LTCConfiguration.txt";
555 fileName = fullpath +
"globaldelay25.dat";
557 assert(dir ==
"calib");
559 std::ifstream calibin(calibfile.c_str());
560 if (calibin.good()) {
561 std::cout << __LINE__ << mthn <<
"Found " << calibfile << std::endl;
564 calibfile = fullpath +
"delay25.dat";
565 std::ifstream delayin(calibfile.c_str());
566 if (delayin.good()) {
567 std::cout << __LINE__ << mthn <<
"Found " << calibfile << std::endl;
570 calibfile = fullpath +
"fedtestdac.dat";
571 std::ifstream delayin(calibfile.c_str());
572 if (delayin.good()) {
573 std::cout << __LINE__ << mthn <<
"Found " << calibfile << std::endl;
576 std::cout << mthn <<
"Can't find calibration file calib.dat or delay25.dat or fedtestdac.dat" 583 std::cout << __LINE__ << mthn <<
"No match of class type" << std::endl;
599 std::ifstream
in(fileName.c_str());
601 std::cout << __LINE__ << mthn <<
"Not found " << fileName << std::endl;
606 std::cout << __LINE__ << mthn <<
"Found " << fileName << std::endl;
614 std::string mthn =
"]\t[pos::PixelConfigFile::get()]\t\t\t\t ";
616 unsigned int last = path.find_last_of(
"/");
617 assert(last != (
unsigned int)std::string::npos);
622 unsigned int slashpos = base.find_last_of(
"/");
636 std::ostringstream s1;
641 directory = std::getenv(
"PIXELCONFIGURATIONBASE");
649 assert(dir ==
"trim");
654 assert(dir ==
"mask");
659 assert(dir ==
"dac");
664 assert(dir ==
"tbm");
669 assert(dir ==
"detconfig");
674 assert(dir ==
"lowvoltagemap");
680 assert(dir ==
"maxvsf");
686 assert(dir ==
"nametranslation");
691 assert(dir ==
"fedcard");
693 data = (
T*)
new PixelFEDCard(fullpath +
"params_fed_" + ext +
".dat");
697 assert(base ==
"calib");
700 std::ifstream calibin(calibfile.c_str());
701 if (calibin.good()) {
704 calibfile = fullpath +
"delay25.dat";
706 std::ifstream delayin(calibfile.c_str());
707 if (delayin.good()) {
710 calibfile = fullpath +
"fedtestdac.dat";
712 std::ifstream delayin(calibfile.c_str());
713 if (delayin.good()) {
716 std::cout << __LINE__ << mthn <<
"Can't find calibration file calib.dat or delay25.dat or fedtestdac.dat" 725 assert(dir ==
"tkfecconfig");
730 assert(dir ==
"fecconfig");
735 assert(dir ==
"fedconfig");
740 assert(dir ==
"portcard");
745 assert(dir ==
"portcardmap");
750 assert(dir ==
"portcard");
755 assert(dir ==
"ttcciconfig");
760 assert(dir ==
"ltcconfig");
765 assert(dir ==
"globaldelay25");
769 std::cout << __LINE__ << mthn <<
"No class match" << std::endl;
778 typename std::map<std::string, T*>::iterator iObject = pixelObjects.begin();
780 for (; iObject != pixelObjects.end(); ++iObject) {
781 get(iObject->second, iObject->first,
key);
791 if (
stat(directory.c_str(), &stbuf) != 0) {
792 std::cout <<
"[pos::PixelConfigFile::makeNewVersion()]\t\tThe path:" << path <<
" does not exist." << std::endl;
793 std::cout <<
"[pos::PixelConfigFile::makeNewVersion()]\t\tFull path:" << directory << std::endl;
800 std::ostringstream s1;
803 dir = directory + strversion;
805 }
while (
stat(dir.c_str(), &stbuf) == 0);
807 mkdir(dir.c_str(), 0777);
815 object->writeASCII(dir);
821 std::cout <<
"[pos::PixelConfigFile::put()]\t\t# of objects to write: " << objects.size() << std::endl;
824 for (
unsigned int i = 0;
i < objects.size();
i++) {
826 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::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)
static std::vector< std::pair< std::string, unsigned int > > getVersions(pos::PixelConfigKey key)
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)
This class implements the steps that are used in a scan over Threshold and CalDelay.
std::map< std::string, vectorVAPairs > pathVersionAliasMmap
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)
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...
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.