#include "ChipTest.h" #include #include "Pixel/pixelConfigStructures.h" #include #include #include #include using namespace PixLib; using namespace std; ChipTest::ChipTest(chipTestType type){ m_type = type; m_typeList["GLOBALREG"] = GLOBALREG; m_typeList["PIXELREG"] = PIXELREG; m_typeList["SCANCHAIN"] = SCANCHAIN; configInit(); } ChipTest::~ChipTest(){ delete m_conf; } void ChipTest::configInit(){ m_conf = new Config(getTypeName()); } ChipTest* ChipTest::make(chipTestType type){ ChipTest *ct; switch(type){ case GLOBALREG: ct = new GlobalRegTest(type); break; case PIXELREG: ct = new PixelRegTest(type); break; case SCANCHAIN: ct = new ScanChainTest(type); break; default: ct = 0; } return ct; } std::string ChipTest::getTypeName(){ static std::string defName = "unknown"; for(std::map::iterator it=m_typeList.begin(); it!=m_typeList.end(); it++) if(it->second==m_type) return it->first; return defName; } GlobalRegTest::GlobalRegTest(chipTestType type) : ChipTest(type){ configInit(); } GlobalRegTest::~GlobalRegTest(){ } void GlobalRegTest::configInit(){ Config &conf = *m_conf; // Group general conf.addGroup("options"); std::map typeMap; typeMap["current configuration"] = CURRENTCFG; typeMap["read back only"] = READONLY; typeMap["all 0's"] = ALLZERO; typeMap["all 1's part A"] = ALLONE_A; typeMap["all 1's part B"] = ALLONE_B; typeMap["all 1's part C"] = ALLONE_C; typeMap["all 1's part D"] = ALLONE_D; typeMap["all 1's part E"] = ALLONE_E; typeMap["all 1's part F"] = ALLONE_F; typeMap["random"] = RANDOM; conf["options"].addList("Bitpattern", (int &)m_patternType, 0, typeMap, "Type of bit pattern to write", true); conf.reset(); } PixelRegTest::PixelRegTest(chipTestType type) : ChipTest(type){ configInit(); } PixelRegTest::~PixelRegTest(){ } void PixelRegTest::configInit(){ Config &conf = *m_conf; // Group general conf.addGroup("options"); std::map typeMap; typeMap["current configuration"] = CURRENTCFG; typeMap["read back only"] = READONLY; typeMap["all 0's"] = ALLZERO; typeMap["all 1's"] = ALLONE; typeMap["odd rows 1"] = ALLODD; typeMap["even rows 1"] = ALLEVEN; typeMap["random"] = RANDOM; conf["options"].addList("Bitpattern", (int &)m_patternType, 0, typeMap, "Type of bit pattern to write", true); std::map pixNames; pixNames["ALL"] = 0; PixFeI4A fe(0,0,"DummyFE",0); // pixel registers are identical in I4A and I4B, so doesn't matter which is used Config &feconf = fe.config(); ConfGroup &trimgrp = feconf.subConfig("Trim_0/Trim")["Trim"]; ConfGroup &maskgrp = feconf.subConfig("PixelRegister_0/PixelRegister")["PixelRegister"]; for(int i=0;i<(int)maskgrp.size();i++){ std::string prname = maskgrp[i].name(); prname.erase(0,std::string("PixelRegister_").length()); pixNames[prname] = i+1; } // trim registers: >1 bit, must add bit index to name int maxval, nmask=pixNames.size()+1; for(int i=0;i<(int)trimgrp.size();i++){ std::string prname = trimgrp[i].name(); prname.erase(0,std::string("Trim_").length()); if(!fe.getTrimMax(prname,maxval)) maxval=0; maxval = (int)TMath::Log2((double)(maxval+1)); for(int j=0;j typeMap; typeMap["DOB"] = 0; typeMap["CMD"] = 1; typeMap["ECL"] = 2; conf["options"].addList("ChainType", m_chainType, 0, typeMap, "Chain to be tested", true); conf["options"].addString("DscName", m_dcsDeviceName, "USB-regulators", "Name of the USB-regulator device in DCS", true); conf.reset(); }