#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ConfigEdit.h" #include "CfgMap.h" #include "SetAll.h" #include "ColPairSwitch.h" #include "STControlEngine.h" ConfigEdit::ConfigEdit(PixLib::Config* conf_in[18], QWidget* parent, const char*, bool, Qt::WFlags fl) : QDialog(parent, fl) // ConfigEditBase(parent,name,modal, fl) { setupUi(this); QObject::connect(GlobalTable, SIGNAL(pressed(int,int,int,QPoint)), this, SLOT(GTableClicked(int,int,int,QPoint))); QObject::connect(PixelTable, SIGNAL(pressed(int,int,int,QPoint)), this, SLOT(PTableClicked(int,int,int,QPoint))); QObject::connect(CalibTable, SIGNAL(pressed(int,int,int,QPoint)), this, SLOT(CTableClicked(int,int,int,QPoint))); QObject::connect(SetupBox, SIGNAL(activated(int)), this, SLOT(setupChanged(int))); QObject::connect(SlotBox, SIGNAL(activated(int)), this, SLOT(slotChanged(int))); QObject::connect(InputBox, SIGNAL(activated(int)), this, SLOT(saveLinks())); QObject::connect(Output0Box, SIGNAL(activated(int)), this, SLOT(saveLinks())); QObject::connect(Output1Box, SIGNAL(activated(int)), this, SLOT(saveLinks())); QObject::connect(Output2Box, SIGNAL(activated(int)), this, SLOT(saveLinks())); QObject::connect(Output3Box, SIGNAL(activated(int)), this, SLOT(saveLinks())); QObject::connect(isActive, SIGNAL(toggled(bool)), this, SLOT(saveLinks())); QObject::connect(MCC_Bwidth, SIGNAL(activated(int)), this, SLOT(saveLinks())); QObject::connect(moduleID, SIGNAL(valueChanged(int)), this, SLOT(saveLinks())); QObject::connect(stave_sectorBox, SIGNAL(activated(int)), this, SLOT(setStavePosMax())); QObject::connect(PP0Box, SIGNAL(activated(int)), this, SLOT(PP0Changed(int))); QObject::connect(PP0Box, SIGNAL(activated(int)), this, SLOT(saveLinks())); m_didChanges = false; // will help to remember if the user did anything at all for(int i=0;i<18;i++) m_conf[i] = conf_in[i]; // associate group labels with GUI handles m_khFEgen.insert(std::make_pair("FREQUENCY_CEU",(QObject*)PhiClock)); // m_khFEgen.insert(std::make_pair("MUX_MON_HIT",(QObject*)HitbusEnabled)); m_khFEgen.insert(std::make_pair("MUX_MON_HIT",(QObject*)MonhitMux)); m_khFEgen.insert(std::make_pair("ENABLE_BUFFER",(QObject*)BuffEnable)); m_khFEgen.insert(std::make_pair("ENABLE_BUFFER_BOOST",(QObject*)BuffBoost)); m_khFEgen.insert(std::make_pair("MUX_TEST_PIXEL",(QObject*)BuffMux)); m_khFEgen.insert(std::make_pair("MUX_EOC",(QObject*)EoCMUX)); m_khFEgen.insert(std::make_pair("MODE_TOT_THRESH",(QObject*)TOTmode)); m_khFEgen.insert(std::make_pair("THRESH_TOT_MINIMUM",(QObject*)minTOT)); m_khFEgen.insert(std::make_pair("THRESH_TOT_DOUBLE",(QObject*)dblTOT)); m_khFEgen.insert(std::make_pair("ENABLE_SELF_TRIGGER",(QObject*)FESelfTen)); // m_khFEgen.insert(std::make_pair("WIDTH_SELF_TRIGGER",(QObject*)SelfTWidth)); m_khFEgen.insert(std::make_pair("ENABLE_VCAL_MEASURE",(QObject*)enableVCALV)); m_khFEgen.insert(std::make_pair("ENABLE_BIASCOMP",(QObject*)enableBiasComp)); m_khFEgen.insert(std::make_pair("ENABLE_HITBUS",(QObject*)HitbusEnabled)); m_khFEgen.insert(std::make_pair("ENABLE_AUTOTUNE",(QObject*)enableAutoTune)); m_khFEgen.insert(std::make_pair("SELF_WIDTH",(QObject*)SelfTWidth)); m_khFEgen.insert(std::make_pair("SELF_LATENCY",(QObject*)SelfTLatency)); // list of table-names m_swNames.push_back("ConfigEnable"); m_swNames.push_back("ScanEnable"); m_swNames.push_back("DacsEnable"); m_dNames.push_back("DAC_IVDD2"); m_dNames.push_back("DAC_ID"); m_dNames.push_back("DAC_IP"); m_dNames.push_back("DAC_IP2"); m_dNames.push_back("DAC_ITRIMTH"); m_dNames.push_back("DAC_IF"); m_dNames.push_back("DAC_ITRIMIF"); m_dNames.push_back("DAC_ITH1"); m_dNames.push_back("DAC_ITH2"); m_dNames.push_back("DAC_IL"); m_dNames.push_back("DAC_IL2"); m_sw2Names.push_back("ENABLE_TIMESTAMP"); m_sw2Names.push_back("ENABLE_CAP_TEST"); m_trimNames.push_back("TDAC"); m_trimNames.push_back("FDAC"); m_maskNames.push_back("ENABLE"); m_maskNames.push_back("HITBUS"); m_maskNames.push_back("SELECT"); m_maskNames.push_back("PREAMP"); m_calNames.push_back("CInjLo"); m_calNames.push_back("CInjHi"); m_calNames.push_back("VcalGradient1"); m_calNames.push_back("VcalGradient0"); m_calNames.push_back("VcalGradient2"); m_calNames.push_back("VcalGradient3"); monBox->insertItem("OFF"); monBox->insertItem("ADC_REF"); monBox->insertItem("IVDD2"); monBox->insertItem("ID"); monBox->insertItem("IP2"); monBox->insertItem("IP"); monBox->insertItem("ITRIMTH"); monBox->insertItem("IF"); monBox->insertItem("ITRIMIF"); monBox->insertItem("VCAL"); monBox->insertItem("ITH1"); monBox->insertItem("ITH2"); monBox->insertItem("IL"); monBox->insertItem("IL2"); capMeasBox->insertItem("OFF"); capMeasBox->insertItem("4x Clo"); capMeasBox->insertItem("2x Clo"); capMeasBox->insertItem("1x Clo"); capMeasBox->insertItem("empty"); capMeasBox->insertItem("0x Clo"); capMeasBox->insertItem("4x Cfb"); capMeasBox->insertItem("2x Cfb"); capMeasBox->insertItem("empty"); capMeasBox->insertItem("1x Cfb"); capMeasBox->insertItem("0x Cfb"); capMeasBox->insertItem("4x Clo+Chi"); capMeasBox->insertItem("empty"); capMeasBox->insertItem("2x Clo+Chi"); capMeasBox->insertItem("1x Clo+Chi"); capMeasBox->insertItem("0x Clo+Chi"); capFreqBox->insertItem("XCK/32"); capFreqBox->insertItem("XCK/16"); capFreqBox->insertItem("XCK/8"); capFreqBox->insertItem("XCK/4"); // read MCC output speed // see if the group Registers exists, if not we have nothing to do m_haveMCC=true; int type = -1; Config &mccconf = *(m_conf[16]); if(mccconf["Registers"].name()!="__TrashConfGroup__" && mccconf["Registers"]["CSR_OutputMode"].name()!="__TrashConfObj__"){ type = ((ConfInt&)mccconf["Registers"]["CSR_OutputMode"]).getValue(); QToolTip::add( (QWidget*)MCC_Bwidth, mccconf["Registers"]["CSR_OutputMode"].comment().c_str() ); } else{ m_haveMCC = false; MCCGroup->hide(); // std::cerr << "Can't find MCC output speed info"<setCurrentItem(type+1); // check if setup type and MCC output speed agree and disable MCC // output speed handle if so bool setMCCen = !((type==0 && SetupBox->currentItem()==0) || (type>1 && SetupBox->currentItem()==(type-1))); MCC_Bwidth->setEnabled(setMCCen); } saveLinks(false); // count valid FEs m_nFEs=0; for(int chip=0;chip<16;chip++){ Config &feconf = *(m_conf[chip]); Config &globreg = feconf.subConfig("GlobalRegister_0/GlobalRegister"); if(globreg["GlobalRegister"].name()!="__TrashConfGroup__") m_nFEs++; } // set up rest of GUI int i; Q3Header *hdr; QString chip; // set up global DAC table GlobalTable->setNumCols(19); GlobalTable->setNumRows(m_nFEs); hdr = GlobalTable->horizontalHeader(); hdr->setLabel(0,"GA"); hdr->setLabel(1,"Config"); hdr->setLabel(2,"Scan"); hdr->setLabel(3,"DACs"); hdr->setLabel(4,"VCAL"); hdr->setLabel(5,"GDAC(I2/3)"); hdr->setLabel(6,"IVDD2"); hdr->setLabel(7,"ID"); hdr->setLabel(8,"IP"); hdr->setLabel(9,"IP2"); hdr->setLabel(10,"TrimT"); hdr->setLabel(11,"IF"); hdr->setLabel(12,"TrimF"); hdr->setLabel(13,"ITh1"); hdr->setLabel(14,"ITh2"); hdr->setLabel(15, "IL"); hdr->setLabel(16, "IL2"); hdr->setLabel(17, "TSP"); hdr->setLabel(18, "CTST"); for(i=0;inumCols();i++) GlobalTable->setColumnWidth(i,50); hdr = GlobalTable->verticalHeader(); for(i=0;isetLabel(i,chip); } // set up pixel DAC table PixelTable->setNumRows(m_nFEs); hdr = PixelTable->verticalHeader(); for(i=0;isetLabel(i,chip); } hdr = PixelTable->horizontalHeader(); hdr->setLabel(0,"ColMask"); hdr->setLabel(1,"TDAC"); hdr->setLabel(2,"FDAC"); hdr->setLabel(3,"R/o Mask"); hdr->setLabel(4,"Hitbus Mask"); hdr->setLabel(5,"Strobe Mask"); hdr->setLabel(6,"Preamp Mask"); for(i=0;inumCols();i++) PixelTable->setColumnWidth(i,100); // set up calibration table CalibTable->setNumRows(m_nFEs); hdr = CalibTable->verticalHeader(); for(i=0;isetLabel(i,chip); } hdr = CalibTable->horizontalHeader(); hdr->setLabel(0,"C_low"); hdr->setLabel(1,"C_high"); hdr->setLabel(2,"VCAL grad"); hdr->setLabel(3,"VCAL offs"); hdr->setLabel(4,"VCAL quad."); hdr->setLabel(5,"VCAL cub."); hdr->setLabel(6,"CAL_low"); hdr->setLabel(7,"CAL_high"); for(i=0;inumCols();i++) CalibTable->setColumnWidth(i,100); // set up MCC strobe cal table if(m_haveMCC){ hdr = MCCStrCal->horizontalHeader(); for(i=0;i<16;i++){ chip.sprintf("%d",i); hdr->setLabel(i,chip); MCCStrCal->setColumnWidth(i,50); } MCCStrCal->verticalHeader()->setLabel(0," "); } // load data ResetCfg(); // connect manual edits to the store function // connect(minTOT, SIGNAL(valueChanged(int)), this, SLOT(StoreCfg())); // spin box // connect(dblTOT, SIGNAL(valueChanged(int)), this, SLOT(StoreCfg())); // spin box // connect(SelfTWidth, SIGNAL(valueChanged(int)), this, SLOT(StoreCfg())); // spin box // connect(staveID, SIGNAL(valueChanged(int)), this, SLOT(StoreCfg())); // spin box // connect(modPosition, SIGNAL(valueChanged(int)), this, SLOT(StoreCfg())); // spin box // connect(moduleID, SIGNAL(valueChanged(int)), this, SLOT(StoreCfg())); // spin box // connect(TOTmode, SIGNAL(activated(int)), this, SLOT(StoreCfg())); // combo box // connect(PhiClock, SIGNAL(activated(int)), this, SLOT(StoreCfg())); // combo box // connect(BuffMux, SIGNAL(activated(int)), this, SLOT(StoreCfg())); // combo box // connect(EoCMUX, SIGNAL(activated(int)), this, SLOT(StoreCfg())); // combo box // connect(stave_sectorBox, SIGNAL(activated(int)), this, SLOT(StoreCfg())); // combo box // connect(MonhitMux, SIGNAL(activated(int)), this, SLOT(StoreCfg())); // combo box // connect(MCC_FECheck, SIGNAL(toggled(bool)), this, SLOT(StoreCfg())); // tick box // connect(MCC_TimeStampComp, SIGNAL(toggled(bool)), this, SLOT(StoreCfg())); // tick box // connect(MCC_ErrorFlag, SIGNAL(toggled(bool)), this, SLOT(StoreCfg())); // tick box // connect(StrbDel, SIGNAL(valueChanged(int)), this, SLOT(StoreCfg())); // tick box // connect(StrbDelrg, SIGNAL(valueChanged(int)), this, SLOT(StoreCfg())); // tick box // connect(BuffEnable, SIGNAL(toggled(bool)), this, SLOT(StoreCfg())); // tick box // connect(BuffBoost, SIGNAL(toggled(bool)), this, SLOT(StoreCfg())); // tick box // connect(isActive, SIGNAL(toggled(bool)), this, SLOT(StoreCfg())); // tick box // connect(MCCStrCal, SIGNAL(valueChanged(int,int)),this, SLOT(StoreCfg())); // table connect(monBox, SIGNAL(activated(int)), this, SLOT(StoreCfg())); // combo box connect(capMeasBox, SIGNAL(activated(int)), this, SLOT(StoreCfg())); // combo box connect(capFreqBox, SIGNAL(activated(int)), this, SLOT(StoreCfg())); // combo box // connect(enableVCALV, SIGNAL(toggled(bool)), this, SLOT(StoreCfg())); // tick box // connect(enableBiasComp, SIGNAL(toggled(bool)), this, SLOT(StoreCfg())); // tick box connect(GlobalTable, SIGNAL(valueChanged(int,int)),this, SLOT(StoreCfg())); // table connect(PixelTable, SIGNAL(valueChanged(int,int)),this, SLOT(StoreCfg())); // table connect(CalibTable, SIGNAL(valueChanged(int,int)),this, SLOT(StoreCfg())); // table connect(ModConnName, SIGNAL(textChanged(const QString&)), this, SLOT(StoreCfg())); // conn. name // connect individual edit objects via their entry in the m_khFEgen-map for(std::map::const_iterator hndlIT = m_khFEgen.begin(); hndlIT!=m_khFEgen.end();hndlIT++){ if(dynamic_cast(hndlIT->second) != 0) connect(hndlIT->second, SIGNAL(valueChanged(int)), this, SLOT(StoreCfg())); if(dynamic_cast(hndlIT->second) != 0) connect(hndlIT->second, SIGNAL(activated(int)), this, SLOT(StoreCfg())); if(dynamic_cast(hndlIT->second) != 0) connect(hndlIT->second, SIGNAL(toggled(bool)), this, SLOT(StoreCfg())); } QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(closeEdt())); // temporary: hide geometry editors // stave_sectorBox->hide(); // staveID->hide(); // modPosition->hide(); // textLabel1_4_2->hide(); // textLabel1_4->hide(); // geoBox->hide(); return; } ConfigEdit::~ConfigEdit(){ emit cfgDone(); } void ConfigEdit::DisplayModule(){ // get the module config Config &conf = *(m_conf[17]); // geometrical stuff int assy_type=0, staveIDval=0, position=0; std::string connName=""; if(conf["geometry"].name()!="__TrashConfGroup__"){ if(conf["geometry"]["Type"].name()!="__TrashConfObj__") assy_type = ((ConfInt&)conf["geometry"]["Type"]).getValue(); if(conf["geometry"]["staveID"].name()!="__TrashConfObj__") staveIDval = ((ConfInt&)conf["geometry"]["staveID"]).getValue(); if(conf["geometry"]["position"].name()!="__TrashConfObj__") position = ((ConfInt&)conf["geometry"]["position"]).getValue(); if(conf["geometry"]["connName"].name()!="__TrashConfObj__") connName = ((ConfString&)conf["geometry"]["connName"]).value(); } ModConnName->setText(connName.c_str()); switch(assy_type){ case 1: // stave case 2: // sector stave_sectorBox->setCurrentItem(assy_type); staveID->setEnabled(true); staveID->setValue(staveIDval); modPosition->setEnabled(true); modPosition->setValue(position); break; default: case 0: // undef./unknown stave_sectorBox->setCurrentItem(0); staveID->setEnabled(false); modPosition->setEnabled(false); } // see if the group general exists, if not we have nothing to do if(conf["general"].name()!="__TrashConfGroup__"){ // get MCC and FE flavour if(m_haveMCC){ if(conf["general"]["MCC_Flavour"].name()!="__TrashConfObj__"){ if(((ConfList&)conf["general"]["MCC_Flavour"]).sValue()=="MCC_I1") MCCflavour->setCurrentItem(1); if(((ConfList&)conf["general"]["MCC_Flavour"]).sValue()=="MCC_I2") MCCflavour->setCurrentItem(2); } } if(conf["general"]["FE_Flavour"].name()!="__TrashConfObj__"){ if(((ConfList&)conf["general"]["FE_Flavour"]).sValue()=="FE_I1") FEflavour->setCurrentItem(1); if(((ConfList&)conf["general"]["FE_Flavour"]).sValue()=="FE_I2") FEflavour->setCurrentItem(2); } } // MCC matters if(m_haveMCC){ Config &mccconf = *(m_conf[16]); if(mccconf["Registers"].name()!="__TrashConfGroup__"){ if(mccconf["Registers"]["CSR_ErrorCheck"].name()!="__TrashConfObj__"){ MCC_ErrorFlag->setChecked((((ConfInt&)mccconf["Registers"]["CSR_ErrorCheck"]).getValue())); QToolTip::add( (QWidget*)MCC_ErrorFlag, mccconf["Registers"]["CSR_ErrorCheck"].comment().c_str() ); } if(mccconf["Registers"]["CNT_FEControlBits"].name()!="__TrashConfObj__"){ MCC_FECheck->setChecked((((ConfInt&)mccconf["Registers"]["CNT_FEControlBits"]).getValue())); QToolTip::add( (QWidget*)MCC_FECheck, mccconf["Registers"]["CSR_FEControlBits"].comment().c_str() ); } if(mccconf["Registers"]["CNT_FEDataBits"].name()!="__TrashConfObj__"){ MCC_TimeStampComp->setChecked((((ConfInt&)mccconf["Registers"]["CNT_FEDataBits"]).getValue())); QToolTip::add( (QWidget*)MCC_TimeStampComp, mccconf["Registers"]["CSR_FEDataBits"].comment().c_str() ); } if(mccconf["Registers"]["CAL_Range"].name()!="__TrashConfObj__"){ StrbDelrg->setValue((((ConfInt&)mccconf["Registers"]["CAL_Range"]).getValue())); QToolTip::add( (QWidget*)StrbDelrg, mccconf["Registers"]["CAL_Range"].comment().c_str() ); } if(mccconf["Registers"]["CAL_Delay"].name()!="__TrashConfObj__"){ StrbDel->setValue((((ConfInt&)mccconf["Registers"]["CAL_Delay"]).getValue())); QToolTip::add( (QWidget*)StrbDel, mccconf["Registers"]["CAL_Delay"].comment().c_str() ); } } if(mccconf["Strobe"].name()!="__TrashConfGroup__"){ for(int i=0;i<16;i++){ std::string name = "DELAY_"; stringstream b; b << i; name += b.str(); if(mccconf["Strobe"][name.c_str()].name()!="__TrashConfObj__"){ MCCStrCal->setText(0,i,QString::number(((ConfFloat&)mccconf["Strobe"][name.c_str()]).value(),'f',3)); if(i==0) QToolTip::add( (QWidget*)MCCStrCal, mccconf["Strobe"][name.c_str()].comment().c_str() ); } } } } // FE general things std::vector myval; for(int chip=0;chip::const_iterator hndlIT; if(globreg["GlobalRegister"].name()!="__TrashConfGroup__"){ int j = 0; std::string typeStr; for(hndlIT = m_khFEgen.begin(); hndlIT!=m_khFEgen.end();hndlIT++){ if(globreg["GlobalRegister"][hndlIT->first].name()!="__TrashConfObj__"){ switch( globreg["GlobalRegister"][hndlIT->first].type() ) { case ConfObj::INT : testval = ((ConfInt&)globreg["GlobalRegister"][hndlIT->first]).getValue(); break; case ConfObj::LIST : testval = ((ConfList&)globreg["GlobalRegister"][hndlIT->first]).getValue(); break; default: // @ to do: implement reading from the following types switch( globreg["GlobalRegister"][hndlIT->first].type() ) { case ConfObj::FLOAT : typeStr = "FLOAT"; break; case ConfObj::BOOL : typeStr = "BOOL"; break; case ConfObj::STRING : typeStr = "STRING"; break; case ConfObj::VOID : typeStr = "VOID"; break; default: typeStr = "Unrecognized"; } std::cout << hndlIT->first << " has unhandled type: " << typeStr << std::endl; testval = 0; } if(chip==0){ myval.push_back(testval); QToolTip::add( (QWidget*)hndlIT->second, globreg["GlobalRegister"][hndlIT->first].comment().c_str() ); if(dynamic_cast(hndlIT->second) != 0) ((QSpinBox*)hndlIT->second)->setValue(myval[j]); if(dynamic_cast(hndlIT->second) != 0) ((QComboBox*)hndlIT->second)->setCurrentItem(myval[j]+1); if(dynamic_cast(hndlIT->second) != 0) ((QCheckBox*)hndlIT->second)->setChecked((bool)myval[j]); } else if(testval!=myval[j]) std::cerr << "FE " << chip << " " << hndlIT->first << " does not agree with chip 0: " << testval << " vs " << myval[j] << std::endl; } j++; } for(int mind=1;mindcount();mind++){ QString monName = "MON_"+monBox->itemText(mind); if(globreg["GlobalRegister"][monName.latin1()].name()!="__TrashConfObj__" && ((ConfInt&)globreg["GlobalRegister"][monName.latin1()]).getValue()){ monBox->setCurrentIndex(mind); break; } } if(globreg["GlobalRegister"]["CAP_MEASURE"].name()!="__TrashConfObj__"){ int cmint = ((ConfInt&)globreg["GlobalRegister"]["CAP_MEASURE"]).getValue(); capMeasBox->setCurrentIndex(cmint&0xF); capFreqBox->setCurrentIndex((cmint&0x30)>>4); } } else std::cerr << "FE " << chip << " had no globreg config" << std::endl; } } void ConfigEdit::DisplayPDACs(){ QString DACstr; int i; // column pair switches for (int Chip = 0; Chip < PixelTable->numRows(); Chip++){ DACstr=""; Config &feconf = *(m_conf[Chip]); Config &globreg = feconf.subConfig("GlobalRegister_0/GlobalRegister"); if(globreg["GlobalRegister"].name()!="__TrashConfGroup__"){ for(int k=0;k<9;k++){ int CPsw=0; std::string name = "ENABLE_CP"; stringstream b; b << k; name += b.str(); if(globreg["GlobalRegister"][name.c_str()].name()!="__TrashConfObj__" && globreg["GlobalRegister"][name.c_str()].type()==ConfObj::INT){ // QToolTip::add( (QWidget*)PixelTable, PixelTable->cellGeometry(Chip,0), // globreg["GlobalRegister"][name.c_str()].comment().c_str() ); CPsw = ((ConfInt&)globreg["GlobalRegister"][name.c_str()]).getValue(); } DACstr+= QString::number(CPsw); } } PixelTable->setText(Chip,0,DACstr); // trim DACs Config &trimreg = feconf.subConfig("Trim_0/Trim"); if(trimreg["Trim"].name()!="__TrashConfGroup__"){ for(i=0;i<(int)m_trimNames.size();i++){ if(trimreg["Trim"][m_trimNames[i]].name()!="__TrashConfObj__" && trimreg["Trim"][m_trimNames[i]].type()==ConfObj::MATRIX && ((ConfMatrix&)trimreg["Trim"][m_trimNames[i]]).subtype()==ConfMatrix::U16){ // QToolTip::add( (QWidget*)PixelTable, PixelTable->cellGeometry(Chip,i+1), // trimreg["Trim"][m_trimNames[i]].comment().c_str() ); // read trims ConfMatrix &mapobj = (ConfMatrix&)trimreg["Trim"][m_trimNames[i]]; std::vector temp; ((ConfMask *)mapobj.m_value)->get(temp); std::vector::iterator it, itEnd=temp.end(); int cont=-999; for(it=temp.begin(); it!=itEnd; it++){ if(cont==-999) cont = (int) (*it); else if(cont!=(int)(*it)) cont=-1; } if(cont<0) PixelTable->setText(Chip,1+i,"map"); else PixelTable->setText(Chip,1+i,"ALL="+QString::number(cont)); } } } // masks Config &pixreg = feconf.subConfig("PixelRegister_0/PixelRegister"); if(pixreg["PixelRegister"].name()!="__TrashConfGroup__"){ for(i=0;i<(int)m_maskNames.size();i++){ if(pixreg["PixelRegister"][m_maskNames[i]].name()!="__TrashConfObj__" && pixreg["PixelRegister"][m_maskNames[i]].type()==ConfObj::MATRIX && ((ConfMatrix&)pixreg["PixelRegister"][m_maskNames[i]]).subtype()==ConfMatrix::U1){ // QToolTip::add( (QWidget*)PixelTable, PixelTable->cellGeometry(Chip,1+m_trimNames.size()+i), // pixreg["PixelRegister"][m_maskNames[i]].comment().c_str() ); // read mask ConfMatrix &mapobj = (ConfMatrix&)pixreg["PixelRegister"][m_maskNames[i]]; std::vector temp; ((ConfMask *)mapobj.m_value)->get(temp); std::vector::iterator it, itEnd=temp.end(); int cont=-999; for(it=temp.begin(); it!=itEnd; it++){ if(cont==-999) cont = (int) (*it); else if(cont!=(int)(*it)) cont=-1; } if(cont<0) PixelTable->setText(Chip,1+m_trimNames.size()+i,"map"); else PixelTable->setText(Chip,1+m_trimNames.size()+i,"ALL="+QString::number(cont)); } } } } } void ConfigEdit::DisplayGDACs(){ QString DACstr; int Chip; int i, readVal; std::string swText; for (Chip = 0; Chip < GlobalTable->numRows(); Chip++){ Config &feconf = *(m_conf[Chip]); if(feconf["Misc"].name()!="__TrashConfGroup__"){ if(feconf["Misc"]["Address"].name()!="__TrashConfObj__" && feconf["Misc"]["Address"].type()==ConfObj::INT) { DACstr.setNum(((ConfInt&)feconf["Misc"]["Address"]).getValue()); GlobalTable->setText(Chip,0,DACstr); } for(i=0;i<(int)m_swNames.size();i++){ swText="UNDEF"; if(feconf["Misc"][m_swNames[i]].name()!="__TrashConfObj__" && feconf["Misc"][m_swNames[i]].type()==ConfObj::BOOL) swText = ((ConfBool&)feconf["Misc"][m_swNames[i]]).value() ? "ON":"OFF"; GlobalTable->setText(Chip,i+1,swText.c_str()); } } Config &globreg = feconf.subConfig("GlobalRegister_0/GlobalRegister"); if(globreg["GlobalRegister"].name()!="__TrashConfGroup__"){ // read VCAL per chip readVal = -1; if(globreg["GlobalRegister"]["DAC_VCAL"].name()!="__TrashConfObj__" && globreg["GlobalRegister"]["DAC_VCAL"].type()==ConfObj::INT) readVal = ((ConfInt&)globreg["GlobalRegister"]["DAC_VCAL"]).getValue(); GlobalTable->setText(Chip,m_swNames.size()+1,QString::number(readVal)); if(FEflavour->currentItem()==2){ // GDAC is for FE-I2 only readVal = -1; if(globreg["GlobalRegister"]["GLOBAL_DAC"].name()!="__TrashConfObj__" && globreg["GlobalRegister"]["GLOBAL_DAC"].type()==ConfObj::INT) readVal = ((ConfInt&)globreg["GlobalRegister"]["GLOBAL_DAC"]).getValue(); GlobalTable->setText(Chip,2+m_swNames.size(),QString::number(readVal)); } for(i=0;i<(int)m_dNames.size();i++){ readVal = -1; if(globreg["GlobalRegister"][m_dNames[i]].name()!="__TrashConfObj__" && globreg["GlobalRegister"][m_dNames[i]].type()==ConfObj::INT) readVal = ((ConfInt&)globreg["GlobalRegister"][m_dNames[i]]).getValue(); GlobalTable->setText(Chip,i+3+m_swNames.size(),QString::number(readVal)); } for(i=0;i<(int)m_sw2Names.size();i++){ swText="UNDEF"; if(globreg["GlobalRegister"][m_sw2Names[i]].name()!="__TrashConfObj__" && globreg["GlobalRegister"][m_sw2Names[i]].type()==ConfObj::INT) swText = ((bool)((ConfInt&)globreg["GlobalRegister"][m_sw2Names[i]]).getValue()) ? "ON":"OFF"; GlobalTable->setText(Chip,i+3+m_swNames.size()+m_dNames.size(),swText.c_str()); } } } } void ConfigEdit::DisplayCalib(){ QString Calstr; float cfac, readVal; int i; bool isOK; for (int Chip = 0; Chip < CalibTable->numRows(); Chip++){ Config &feconf = *(m_conf[Chip]); if(feconf["Misc"].name()!="__TrashConfGroup__"){ for(i=0;i<(int)m_calNames.size();i++){ readVal = -1; if(feconf["Misc"][m_calNames[i]].name()!="__TrashConfObj__" && feconf["Misc"][m_calNames[i]].type()==ConfObj::FLOAT) readVal = ((ConfFloat&)feconf["Misc"][m_calNames[i]]).value(); if(abs(readVal)>.01) Calstr.sprintf("%.4f",readVal); else if(readVal!=0) Calstr.sprintf("%.3e",readVal); else Calstr = "0"; CalibTable->setText(Chip,i,Calstr); } } cfac = CalibTable->text(Chip,2).toFloat(&isOK)*CalibTable->text(Chip,0).toFloat(&isOK) / 0.160218; Calstr.sprintf("%.2f",cfac); CalibTable->setText(Chip,6,Calstr); cfac = CalibTable->text(Chip,2).toFloat(&isOK)*CalibTable->text(Chip,1).toFloat(&isOK) / 0.160218; Calstr.sprintf("%.2f",cfac); CalibTable->setText(Chip,7,Calstr); } } void ConfigEdit::StoreCfg(){ m_didChanges = true; int Chip, i; bool isOK; QString DACstr; int readVal; std::string swText; // cout << "ConfigEdit::StoreConfig() start" << endl; // get the module config Config &conf = *(m_conf[17]); if(conf["geometry"].name()!="__TrashConfGroup__"){ if(conf["geometry"]["Type"].name()!="__TrashConfObj__") WriteIntConf((ConfInt&)conf["geometry"]["Type"],stave_sectorBox->currentItem()); if(conf["geometry"]["staveID"].name()!="__TrashConfObj__") WriteIntConf((ConfInt&)conf["geometry"]["staveID"],staveID->value()); if(conf["geometry"]["position"].name()!="__TrashConfObj__") WriteIntConf((ConfInt&)conf["geometry"]["position"],modPosition->value()); if(conf["geometry"]["connName"].name()!="__TrashConfObj__"){ std::string connName = ModConnName->text().latin1(); ((ConfString&)conf["geometry"]["connName"]).m_value = connName; } } // MCC matters if(m_haveMCC){ Config &mccconf = *(m_conf[16]); if(mccconf["Registers"].name()!="__TrashConfGroup__"){ if(mccconf["Registers"]["CSR_ErrorCheck"].name()!="__TrashConfObj__") WriteIntConf((ConfInt&)mccconf["Registers"]["CSR_ErrorCheck"],(int)MCC_ErrorFlag->isChecked()); if(mccconf["Registers"]["CNT_FEControlBits"].name()!="__TrashConfObj__") WriteIntConf((ConfInt&)mccconf["Registers"]["CNT_FEControlBits"],(int)MCC_FECheck->isChecked()); if(mccconf["Registers"]["CNT_FEDataBits"].name()!="__TrashConfObj__") WriteIntConf((ConfInt&)mccconf["Registers"]["CNT_FEDataBits"],(int)MCC_TimeStampComp->isChecked()); if(mccconf["Registers"]["CAL_Range"].name()!="__TrashConfObj__") WriteIntConf((ConfInt&)mccconf["Registers"]["CAL_Range"],StrbDelrg->value()); if(mccconf["Registers"]["CAL_Delay"].name()!="__TrashConfObj__") WriteIntConf((ConfInt&)mccconf["Registers"]["CAL_Delay"],StrbDel->value()); } if(mccconf["Strobe"].name()!="__TrashConfGroup__"){ for(int i=0;i<16;i++){ float my_val = MCCStrCal->text(0,i).toFloat(&isOK); if(isOK){ std::string name = "DELAY_"; stringstream b; b << i; name += b.str(); if(mccconf["Strobe"][name.c_str()].name()!="__TrashConfObj__") ((ConfFloat&)mccconf["Strobe"][name.c_str()]).m_value = my_val; } } } } // if(m_CurrentCfg==NULL) return; // FE general things for(int chip=0;chipcurrentItem() - 1); } for(int mind=1;mindcount();mind++){ QString monName = "MON_"+monBox->itemText(mind); if(globreg["GlobalRegister"][monName.latin1()].name()!="__TrashConfObj__") WriteIntConf((ConfInt&)globreg["GlobalRegister"][monName.latin1()],(mind==monBox->currentIndex())?1:0); else std::cerr << "FE " << chip << " had no globreg config " << std::string(monName.latin1()) << std::endl; } if(globreg["GlobalRegister"]["CAP_MEASURE"].name()!="__TrashConfObj__"){ int cmint = (capMeasBox->currentIndex()&0xF) + ((capFreqBox->currentIndex()&0x3)<<4); WriteIntConf((ConfInt&)globreg["GlobalRegister"]["CAP_MEASURE"],cmint); } else std::cerr << "FE " << chip << " had no globreg config CAP_MEASURE" << std::endl; } else std::cerr << "FE " << chip << " had no globreg config" << std::endl; } // FE general things std::string typeStr; for(int chip=0;chip::const_iterator hndlIT; if(globreg["GlobalRegister"].name()!="__TrashConfGroup__"){ for(hndlIT = m_khFEgen.begin(); hndlIT!=m_khFEgen.end();hndlIT++){ if(globreg["GlobalRegister"][hndlIT->first].name()!="__TrashConfObj__"){ if(dynamic_cast(hndlIT->second) != 0){ switch( globreg["GlobalRegister"][hndlIT->first].type() ) { case ConfObj::INT : case ConfObj::LIST : WriteIntConf((ConfInt&)globreg["GlobalRegister"][hndlIT->first],((QSpinBox*)hndlIT->second)->value()); break; default: std::cout << hndlIT->first << " has unhandled type: " << typeStr << std::endl; } } if(dynamic_cast(hndlIT->second) != 0){ switch( globreg["GlobalRegister"][hndlIT->first].type() ) { case ConfObj::INT : case ConfObj::LIST : if(((QComboBox*)hndlIT->second)->currentItem()>0) WriteIntConf((ConfInt&)globreg["GlobalRegister"][hndlIT->first],((QComboBox*)hndlIT->second)->currentItem()-1); break; default: std::cout << hndlIT->first << " has unhandled type: " << typeStr << std::endl; } } if(dynamic_cast(hndlIT->second) != 0){ switch( globreg["GlobalRegister"][hndlIT->first].type() ) { case ConfObj::INT : case ConfObj::LIST : WriteIntConf((ConfInt&)globreg["GlobalRegister"][hndlIT->first],(int)((QCheckBox*)hndlIT->second)->isChecked()); break; default: std::cout << hndlIT->first << " has unhandled type: " << typeStr << std::endl; } } } } } else std::cerr << "FE " << chip << " had no globreg config" << std::endl; } //global stuff for (Chip = 0; Chip < GlobalTable->numRows(); Chip++){ Config &feconf = *(m_conf[Chip]); // first three switches and the calibration constants if(feconf["Misc"].name()!="__TrashConfGroup__"){ if(feconf["Misc"]["Address"].name()!="__TrashConfObj__" && feconf["Misc"]["Address"].type()==ConfObj::INT) { int readVal = GlobalTable->text(Chip,0).toInt(0); WriteIntConf(((ConfInt&)feconf["Misc"]["Address"]), readVal); } for(i=0;i<(int)m_swNames.size();i++){ swText="UNDEF"; if(feconf["Misc"][m_swNames[i]].name()!="__TrashConfObj__" && feconf["Misc"][m_swNames[i]].type()==ConfObj::BOOL) ((ConfBool&)feconf["Misc"][m_swNames[i]]).m_value = (GlobalTable->text(Chip,i+1)=="ON"); } for(i=0;i<(int)m_calNames.size();i++){ if(feconf["Misc"][m_calNames[i]].name()!="__TrashConfObj__" && feconf["Misc"][m_calNames[i]].type()==ConfObj::FLOAT) ((ConfFloat&)feconf["Misc"][m_calNames[i]]).m_value = CalibTable->text(Chip,i).toFloat(); } } // the DACs Config &globreg = feconf.subConfig("GlobalRegister_0/GlobalRegister"); if(globreg["GlobalRegister"].name()!="__TrashConfGroup__"){ readVal = GlobalTable->text(Chip,m_swNames.size()+1).toInt(&isOK); if(globreg["GlobalRegister"]["DAC_VCAL"].name()!="__TrashConfObj__" && globreg["GlobalRegister"]["DAC_VCAL"].type()==ConfObj::INT) WriteIntConf(((ConfInt&)globreg["GlobalRegister"]["DAC_VCAL"]),readVal); if(FEflavour->currentItem()==2){ // GDAC is for FE-I2 only readVal = GlobalTable->text(Chip,2+m_swNames.size()).toInt(&isOK); if(globreg["GlobalRegister"]["GLOBAL_DAC"].name()!="__TrashConfObj__" && globreg["GlobalRegister"]["GLOBAL_DAC"].type()==ConfObj::INT) WriteIntConf(((ConfInt&)globreg["GlobalRegister"]["GLOBAL_DAC"]),readVal); } for(i=0;i<(int)m_dNames.size();i++){ readVal = GlobalTable->text(Chip,i+3+m_swNames.size()).toInt(&isOK); if(globreg["GlobalRegister"][m_dNames[i]].name()!="__TrashConfObj__" && globreg["GlobalRegister"][m_dNames[i]].type()==ConfObj::INT) WriteIntConf(((ConfInt&)globreg["GlobalRegister"][m_dNames[i]]),readVal); } // Cap & TST switches for(i=0;i<(int)m_sw2Names.size();i++){ swText="UNDEF"; if(globreg["GlobalRegister"][m_sw2Names[i]].name()!="__TrashConfObj__" && globreg["GlobalRegister"][m_sw2Names[i]].type()==ConfObj::INT) WriteIntConf(((ConfInt&)globreg["GlobalRegister"][m_sw2Names[i]]), (int)(GlobalTable->text(Chip,i+3+m_swNames.size()+m_dNames.size())=="ON")); } // col pair switches for(int k=0;k<9;k++){ DACstr = PixelTable->text(Chip,0)[k]; int CPsw= DACstr.toInt(&isOK); std::string name = "ENABLE_CP"; stringstream b; b << k; name += b.str(); if(globreg["GlobalRegister"][name.c_str()].name()!="__TrashConfObj__" && globreg["GlobalRegister"][name.c_str()].type()==ConfObj::INT) WriteIntConf(((ConfInt&)globreg["GlobalRegister"][name.c_str()]),CPsw); } } // the calibration } ResetCfg(); // cout << "ConfigEdit::StoreConfig() done" << endl; emit cfgSaved((int) moduleID->value()); // cout << "ConfigEdit::StoreConfig() called for transfer" << endl; } void ConfigEdit::ResetCfg(){ DisplayModule(); DisplayGDACs(); DisplayPDACs(); DisplayCalib(); } void ConfigEdit::PTableClicked(int row, int col, int button, const QPoint &){ QString DACstr; if(button==2){ // right mouse click only if(col>0){ Q3PopupMenu tablemenu(this,"Table menu"); tablemenu.insertItem("Set this chip to value",0); tablemenu.insertItem("Set all chips to value",1); tablemenu.insertItem("Load file (this chip)",2); tablemenu.insertItem("Load file (all chips)",3); tablemenu.insertItem("Increment (all chips)",4); tablemenu.insertItem("Decrement (all chips)",5); tablemenu.insertItem("Inecrement by...(all chips)",6); tablemenu.insertItem("Display/Edit",7); // if(PixelTable->text(row,col)!="map") // tablemenu.setItemEnabled(4,0); if(col>2){ tablemenu.setItemEnabled(4,0); tablemenu.setItemEnabled(5,0); tablemenu.setItemEnabled(6,0); } switch(tablemenu.exec(QCursor::pos())){ case 0: SetConstPix(row,col, false); break; case 1: SetConstPix(row,col,true); break; case 2: LoadPTableFile(row,col,false); break; case 3: LoadPTableFile(row,col,true); break; case 4: ShiftPTable(row,col,1); break; case 5: ShiftPTable(row,col,-1); break; case 6:{ SetAll sti(this); sti.setCaption("Set T/FDAC increment"); sti.TextLabel1->setText("Set T/FDAC increment"); sti.SpinBox->setMinValue(-127); if(sti.exec()){ ShiftPTable(row,col,sti.SpinBox->value()); } break;} case 7: DisplayMap(row,col); break; default: break; } } else{// different menu for column stuff ColPairSwitch cps(this); std::vector buttons = cps.getButtons(); for(int i=0;i<9;i++){ DACstr = PixelTable->text(row,col)[i]; bool isOK; bool CPsw= (bool)DACstr.toInt(&isOK); buttons[i]->setOn(CPsw); buttons[i]->setState(); } if(cps.exec()==1){ DACstr=""; for(int i=0;i<9;i++){ int CPsw = (int)buttons[i]->isOn(); DACstr+= QString::number(CPsw); } PixelTable->setText(row,col,DACstr); } } StoreCfg(); } } void ConfigEdit::GTableClicked(int row, int col, int button, const QPoint &){ int i; if(button==2){ // right mouse click only if((col>0 && col<4) || col>16){ Q3PopupMenu tablemenu(this,"Table menu"); tablemenu.insertItem("Toggle",0); tablemenu.insertItem("All ON",1); tablemenu.insertItem("All OFF",2); switch(tablemenu.exec(QCursor::pos())){ case 0: default: if(GlobalTable->text(row,col)=="ON") GlobalTable->setText(row,col,"OFF"); else GlobalTable->setText(row,col,"ON"); break; case 1: for(i=0;inumRows();i++) GlobalTable->setText(i,col,"ON"); break; case 2: for(i=0;inumRows();i++) GlobalTable->setText(i,col,"OFF"); break; } } else if(col==0){ SetAll getval(this); getval.SpinBox->setMinValue(0); getval.SpinBox->setMaxValue(15); getval.SpinBox->setValue(GlobalTable->text(row,col).toInt()); getval.LineEdit->hide(); if(m_haveMCC){ // must not edit GA in full MCC modules } else { if(getval.exec()) GlobalTable->setText(row,col,QString::number(getval.SpinBox->value())); } } else{ Q3PopupMenu tablemenu(this,"Table menu"); tablemenu.insertItem("Set to value",0); tablemenu.insertItem("Set entire column",1); tablemenu.insertItem("Increment (all chips)",2); tablemenu.insertItem("Decrement (all chips)",3); tablemenu.insertItem("Increment by... (all chips)",4); SetAll getval(this); if(col==4) // GDAC has a wider range getval.SpinBox->setMaxValue(1023); else getval.SpinBox->setMaxValue(255); getval.SpinBox->setValue(GlobalTable->text(row,col).toInt()); getval.LineEdit->hide(); int incr_val = 1; int choice=tablemenu.exec(QCursor::pos()); switch(choice){ case 0:{ if(getval.exec()) GlobalTable->setText(row,col,QString::number(getval.SpinBox->value())); break;} case 1:{ if(getval.exec()){ for(int i=0;inumRows();i++) GlobalTable->setText(i,col,QString::number(getval.SpinBox->value())); } break;} case 4: getval.setCaption("Set GDAC increment"); getval.TextLabel1->setText("Set GDAC increment"); getval.SpinBox->setMinValue(-31); getval.SpinBox->setMaxValue(31); getval.SpinBox->setValue(0); incr_val = 0; if(getval.exec()) incr_val = getval.SpinBox->value(); case 3: case 2:{ if(choice==3) incr_val = -1; for(int i=0;inumRows();i++){ bool isOK; int myval = GlobalTable->text(i,col).toInt(&isOK); if(isOK){ myval+=incr_val; GlobalTable->setText(i,col,QString::number(myval)); } } break;} default: break; } } } StoreCfg(); } void ConfigEdit::CTableClicked(int row, int col, int button, const QPoint &){ return; // disabled if(button==2 && (col<3 || col>4)){ // right mouse click only Q3PopupMenu tablemenu(this,"Table menu"); tablemenu.insertItem("Set to value",0); tablemenu.insertItem("Set entire column",1); SetAll getval(this); getval.SpinBox->hide(); getval.LineEdit->setText(CalibTable->text(row,col)); switch(tablemenu.exec(QCursor::pos())){ case 0: if(getval.exec()) CalibTable->setText(row,col,getval.LineEdit->text()); break; case 1: if(getval.exec()){ for(int i=0;inumRows();i++) CalibTable->setText(i,col,getval.LineEdit->text()); } break; default: break; } } StoreCfg(); } void ConfigEdit::LoadPTableFile(int row, int col, bool all){ m_didChanges = true; int i; QStringList filter; std::map hnames; hnames.insert(std::make_pair(12,"TDAC_T")); hnames.insert(std::make_pair(13,"FDAC_T")); hnames.insert(std::make_pair(14,"HITOCC")); int htype=12; PixLib::PixScan::HistogramType pshtype = PixLib::PixScan::TDAC_T; if(col==2){ htype=13; pshtype = PixLib::PixScan::FDAC_T; } filter += "RootDB data file (*.root)"; if(col>2){ // mask file filter += "TurboDAQ Mask file (*.dat)"; htype = 14; pshtype = PixLib::PixScan::HITOCC; }else // T/FDAC file filter +="TurboDAQ T/FDAC file (*.out)"; filter += "Any file (*.*)"; Q3FileDialog fdia(QString::null, QString::null, this, "select file",TRUE); fdia.setFilters(filter); if(fdia.exec() == QDialog::Accepted){ int rmin = row, rmax=row+1; if(all){ rmin=0; rmax=16; } QString fname = fdia.selectedFile(); if(fname.right(5)==".root"){ // PixLib mode: read from RootDB file RefWin sclist(0, this,"scanlist", 0, 0, htype,fname.latin1()); disconnect( sclist.OKButt, SIGNAL( clicked() ), &sclist, SLOT( RDAccept() ) ); connect( sclist.OKButt, SIGNAL( clicked() ), &sclist, SLOT( accept() ) ); if(sclist.FuncSel->count()>0){ if(sclist.exec()){ //std::string path = fname.latin1(); QString modName = sclist.DatSel->itemData(sclist.DatSel->currentIndex()).toString(); QString grpName = modName; int pos = grpName.lastIndexOf("/"); grpName.remove(pos,grpName.length()-pos); pos = grpName.lastIndexOf("/"); grpName.remove(pos,grpName.length()-pos); QString path = fname+":"+grpName; cout << "Path: " << std::string(path.latin1()) << endl; TH2F *hi = 0; PixDBData *DataObj=0; try{ DataObj = new PixDBData("Name",path.latin1(),TLogFile::GetNameFromPath(modName.latin1()).c_str()); } catch(...){ DataObj = 0; } if(DataObj!=0){ for(int ichip=rmin;ichipgetGenericHisto(pshtype, ichip, 0, 0); } catch(...){ hi = 0; } if(hi!=0){ // get conf objects Config &feconf = *(m_conf[ichip]); if(col>2){ // mask // write into conf object Config &pixreg = feconf.subConfig("PixelRegister_0/PixelRegister"); if(pixreg["PixelRegister"].name()!="__TrashConfGroup__" && pixreg["PixelRegister"][m_maskNames[col-3]].name()!="__TrashConfObj__" && pixreg["PixelRegister"][m_maskNames[col-3]].type()==ConfObj::MATRIX && ((ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]).subtype()==ConfMatrix::U1){ ConfMatrix &mapobj = (ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]; std::vector temp; for(int row=0;rowGetBinContent(col+1,row+1)!=0)); } } ((ConfMask *)mapobj.m_value)->set(temp); } } else { // T/FDAC // write into conf object Config &trimreg = feconf.subConfig("Trim_0/Trim"); if(trimreg["Trim"].name()!="__TrashConfGroup__" && trimreg["Trim"][m_trimNames[col-1]].name()!="__TrashConfObj__" && trimreg["Trim"][m_trimNames[col-1]].type()==ConfObj::MATRIX && ((ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]).subtype()==ConfMatrix::U16){ ConfMatrix &mapobj = (ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]; std::vector temp; for(int row=0;rowGetBinContent(col+1,row+1)); } } ((ConfMask *)mapobj.m_value)->set(temp); } } } } delete DataObj; } } } else{ QMessageBox::warning(this,"MainPanel::setMasks","No scans with histo "+QString(hnames[htype].c_str())+" found in file "+fname); } } else{ // TurboDAQ mode: read from ascii file if(all){ fname.remove(fname.length()-5,5); if(fname.right(1)!="_") fname.remove(fname.length()-1,1); } for(int myrow=rmin;myrow2){ // mask file TMaskClass tmpmask; std::ifstream mfile(loadname.latin1()); tmpmask.ReadMask(&mfile); mfile.close(); // write into conf object Config &pixreg = feconf.subConfig("PixelRegister_0/PixelRegister"); if(pixreg["PixelRegister"].name()!="__TrashConfGroup__" && pixreg["PixelRegister"][m_maskNames[col-3]].name()!="__TrashConfObj__" && pixreg["PixelRegister"][m_maskNames[col-3]].type()==ConfObj::MATRIX && ((ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]).subtype()==ConfMatrix::U1){ ConfMatrix &mapobj = (ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]; std::vector temp; // for(i=0;i<2880;i++){ for(int row=0;row *)mapobj.m_value)->set(temp); } } else { // T/FDAC file TPixDACClass tmpdac; std::ifstream dfile(loadname.latin1()); tmpdac.ReadDAC(&dfile); dfile.close(); // write into conf object Config &trimreg = feconf.subConfig("Trim_0/Trim"); if(trimreg["Trim"].name()!="__TrashConfGroup__" && trimreg["Trim"][m_trimNames[col-1]].name()!="__TrashConfObj__" && trimreg["Trim"][m_trimNames[col-1]].type()==ConfObj::MATRIX && ((ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]).subtype()==ConfMatrix::U16){ ConfMatrix &mapobj = (ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]; std::vector temp; for(i=0;i<2880;i++){ temp.push_back((unsigned short int)tmpdac.m_DAC[i]); } ((ConfMask *)mapobj.m_value)->set(temp); } } } } emit cfgSaved((int) moduleID->value()); } ResetCfg(); return; } void ConfigEdit::DisplayMap(int row, int col){ if(col==0) return; // no action for CP. switches int i; uint maxdac=0; // scaling depends on mask/trim range if(col==1 && FEflavour->currentItem()==2) // FE-I2 TDAC maxdac = 127; if(col==2 && FEflavour->currentItem()==2) // FE-I2 FDAC maxdac = 7; if(col>0 && col<3 && FEflavour->currentItem()==1) // FE-I1 maxdac = 32; if(col>2) maxdac = 1; // get data uint *mydata[18]; for(uint k=0;k<18; k++) mydata[k] = new uint[160]; Config &feconf = *(m_conf[row]); if(col>0 && col<3){ // trim DACs Config &trimreg = feconf.subConfig("Trim_0/Trim"); if(trimreg["Trim"].name()!="__TrashConfGroup__" && trimreg["Trim"][m_trimNames[col-1]].name()!="__TrashConfObj__" && trimreg["Trim"][m_trimNames[col-1]].type()==ConfObj::MATRIX && ((ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]).subtype()==ConfMatrix::U16){ ConfMatrix &mapobj = (ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]; std::vector temp; ((ConfMask *)mapobj.m_value)->get(temp); std::vector::iterator it, itEnd=temp.end(); i=0; for(it=temp.begin(); it!=itEnd; it++){ mydata[i%18][159-i/18] = (uint)(*it); i++; } } } else { // masks Config &pixreg = feconf.subConfig("PixelRegister_0/PixelRegister"); if(pixreg["PixelRegister"].name()!="__TrashConfGroup__" && pixreg["PixelRegister"][m_maskNames[col-3]].name()!="__TrashConfObj__" && pixreg["PixelRegister"][m_maskNames[col-3]].type()==ConfObj::MATRIX && ((ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]).subtype()==ConfMatrix::U1){ ConfMatrix &mapobj = (ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]; std::vector temp; ((ConfMask *)mapobj.m_value)->get(temp); std::vector::iterator it, itEnd=temp.end(); i=0; for(it=temp.begin(); it!=itEnd; it++){ mydata[i%18][159-i/18] = (uint)(*it); i++; } } } CfgMap MapToShow(mydata, maxdac, 18, 160, this, 0, GroupName->text().latin1(), ModName->text().latin1(), row); if(MapToShow.exec()==QDialog::Accepted){ if(col>0 && col<3){ // trim DACs Config &trimreg = feconf.subConfig("Trim_0/Trim"); if(trimreg["Trim"].name()!="__TrashConfGroup__" && trimreg["Trim"][m_trimNames[col-1]].name()!="__TrashConfObj__" && trimreg["Trim"][m_trimNames[col-1]].type()==ConfObj::MATRIX && ((ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]).subtype()==ConfMatrix::U16){ ConfMatrix &mapobj = (ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]; std::vector temp; ((ConfMask *)mapobj.m_value)->get(temp); std::vector::iterator it, itEnd=temp.end(); i=0; for(it=temp.begin(); it!=itEnd; it++){ (*it) = (unsigned short int)mydata[i%18][159-i/18]; i++; } ((ConfMask *)mapobj.m_value)->set(temp); } } else { // masks Config &pixreg = feconf.subConfig("PixelRegister_0/PixelRegister"); if(pixreg["PixelRegister"].name()!="__TrashConfGroup__" && pixreg["PixelRegister"][m_maskNames[col-3]].name()!="__TrashConfObj__" && pixreg["PixelRegister"][m_maskNames[col-3]].type()==ConfObj::MATRIX && ((ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]).subtype()==ConfMatrix::U1){ ConfMatrix &mapobj = (ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]; std::vector temp; ((ConfMask *)mapobj.m_value)->get(temp); std::vector::iterator it, itEnd=temp.end(); i=0; for(it=temp.begin(); it!=itEnd; it++){ (*it) = (bool)mydata[i%18][159-i/18]; i++; } ((ConfMask *)mapobj.m_value)->set(temp); } } emit cfgSaved((int) moduleID->value()); DisplayPDACs(); } for(uint k=0;k<18; k++) delete[] mydata[k]; return; } void ConfigEdit::SetConstPix(int row, int col, bool all){ int i; SetAll getval(this); // maximum setting // default is 127 == FE-I2 TDAC if(col>2){ // mask getval.SpinBox->setMaxValue(1); } else{ if(col==2 && FEflavour->currentItem()==2) // FE-I2 FDAC getval.SpinBox->setMaxValue(7); if(FEflavour->currentItem()==1) // FE-I1 getval.SpinBox->setMaxValue(31); } // if all pixels set to same value already propose this as starting point int pos; bool isOK; QString tabtxt = PixelTable->text(row,col); if((pos=tabtxt.find("ALL="))==0){ tabtxt.remove(0,4); int value = tabtxt.toInt(&isOK); if(isOK) getval.SpinBox->setValue(value); else getval.SpinBox->setValue(0); } // show user the panel if(getval.exec()){ int rmin = row, rmax=row+1; if(all){ rmin=0; rmax=16; } for(int myrow=rmin;myrow0 && col<3){ // trim DACs Config &trimreg = feconf.subConfig("Trim_0/Trim"); if(trimreg["Trim"].name()!="__TrashConfGroup__" && trimreg["Trim"][m_trimNames[col-1]].name()!="__TrashConfObj__" && trimreg["Trim"][m_trimNames[col-1]].type()==ConfObj::MATRIX && ((ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]).subtype()==ConfMatrix::U16){ ConfMatrix &mapobj = (ConfMatrix&)trimreg["Trim"][m_trimNames[col-1]]; std::vector temp; for(i=0;i<2880;i++) temp.push_back((unsigned short int)getval.SpinBox->value()); ((ConfMask *)mapobj.m_value)->set(temp); } } else { // masks Config &pixreg = feconf.subConfig("PixelRegister_0/PixelRegister"); if(pixreg["PixelRegister"].name()!="__TrashConfGroup__" && pixreg["PixelRegister"][m_maskNames[col-3]].name()!="__TrashConfObj__" && pixreg["PixelRegister"][m_maskNames[col-3]].type()==ConfObj::MATRIX && ((ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]).subtype()==ConfMatrix::U1){ ConfMatrix &mapobj = (ConfMatrix&)pixreg["PixelRegister"][m_maskNames[col-3]]; std::vector temp; for(i=0;i<2880;i++) temp.push_back((bool)getval.SpinBox->value()); ((ConfMask *)mapobj.m_value)->set(temp); } } } emit cfgSaved((int) moduleID->value()); } ResetCfg(); } void ConfigEdit::ToBitArr(int value, int *bit_arr, int nel){ int i; for(i=0;i>i) & 1; return; } void ConfigEdit::FromBitArr(int &value, int *bit_arr, int nel){ int i; value = 0; for(i=0;i in, out1, out2, out3, out4; if(type==3) PP0Box->setEnabled(false); else PP0Box->setEnabled(true); int in_o, out_o[4], slot_o=0; bool isOK; QComboBox *obox[4]={Output0Box, Output1Box, Output2Box, Output3Box}; in_o = InputBox->currentText().toInt(&isOK); slot_o = SlotBox->currentText().toInt(&isOK)-1; for(int ilink=0;ilink<4;ilink++){ QString tmpStr = obox[ilink]->currentText(); tmpStr.remove(0,2); out_o[ilink] = 16*obox[ilink]->currentText().left(1).toInt(&isOK)+tmpStr.toInt(&isOK); } if(type<3){ // Type: 0=40MHz, 1=80MHz, 2=160MHz - but // MCC CSR: 0=1x40Mb/s, 1=2x40Mb/s, 2=1x80Mb/s, 3=2x80Mb/s int MCCbw = type; if(type>0) MCCbw++; MCC_Bwidth->setEnabled(false); MCC_Bwidth->setCurrentItem(MCCbw+1); } else MCC_Bwidth->setEnabled(true); SlotBox->setEnabled(TRUE); InputBox->setEnabled(FALSE); Output0Box->setEnabled(FALSE); Output1Box->setEnabled(FALSE); Output2Box->setEnabled(FALSE); Output3Box->setEnabled(FALSE); SlotBox->clear(); InputBox->clear(); Output0Box->clear(); Output1Box->clear(); Output2Box->clear(); Output3Box->clear(); if(type<3){ PixLib::listLinks(in,out1,out2,out3,out4,type, pp0); for(i=0;i<(int)in.size();i++){ // if(in[i] == in_o) slot_o = i; SlotBox->insertItem(QString::number(i+1),i); InputBox->insertItem(QString::number(in[i]),i); Output0Box->insertItem(QString::number(out1[i]/16)+":"+QString::number(out1[i]%16),i); Output1Box->insertItem(QString::number(out2[i]/16)+":"+QString::number(out2[i]%16),i); Output2Box->insertItem(QString::number(out3[i]/16)+":"+QString::number(out3[i]%16),i); Output3Box->insertItem(QString::number(out4[i]/16)+":"+QString::number(out4[i]%16),i); /* Output0Box->insertItem(QString::number(out1[i]),i); Output1Box->insertItem(QString::number(out2[i]),i); Output2Box->insertItem(QString::number(out3[i]),i); Output3Box->insertItem(QString::number(out4[i]),i); */ } SlotBox->setCurrentItem(slot_o); slotChanged(slot_o, manual_edit); } else{// free-style SlotBox->setEnabled(FALSE); InputBox->setEnabled(TRUE); Output0Box->setEnabled(TRUE); Output1Box->setEnabled(TRUE); Output2Box->setEnabled(TRUE); Output3Box->setEnabled(TRUE); for(i=0;i<48;i++) InputBox->insertItem(QString::number(i),i); for(i=0;i<32;i++){ for(j=0;j<4;j++) obox[j]->insertItem(QString::number(i/4)+":"+QString::number(i%4),i); } InputBox->setCurrentItem(in_o); for(j=0;j<4;j++){ i = out_o[j]%16+4*(out_o[j]/16); obox[j]->setCurrentItem(i); } /* Output0Box->setCurrentItem(out_o[0]); Output1Box->setCurrentItem(out_o[1]); Output2Box->setCurrentItem(out_o[2]); Output3Box->setCurrentItem(out_o[3]); */ slotChanged(-1, manual_edit); } return; } void ConfigEdit::slotChanged(int slot, bool manual_edit){ switch(SetupBox->currentItem()){ case 0: // only switch output 0 default: InputBox->setCurrentItem(slot); Output0Box->setCurrentItem(slot); Output1Box->setCurrentItem(slot); Output2Box->setCurrentItem(slot); Output3Box->setCurrentItem(slot); break; case 1: InputBox->setCurrentItem(slot); Output0Box->setCurrentItem(slot); Output1Box->setCurrentItem(slot); Output2Box->setCurrentItem(slot); Output3Box->setCurrentItem(slot); break; case 2: InputBox->setCurrentItem(slot); Output0Box->setCurrentItem(slot); Output1Box->setCurrentItem(slot); Output2Box->setCurrentItem(slot); Output3Box->setCurrentItem(slot); break; case 3: // free-style: output does not depend on input break; } saveLinks(manual_edit); return; } void ConfigEdit::setupLinks(){ int i,j,il, ol[4], type, slot, pp0; char lnam[200]; bool allident=false; std::vector in, out1, out2, out3, out4; QComboBox *obox[4]={Output0Box, Output1Box, Output2Box, Output3Box}; Config &conf = *(m_conf[17]); // see if the group general exists, if not we have nothing to do if(conf["general"].name()=="__TrashConfGroup__") return; // avoid interference with auto-saving connections disconnect( InputBox, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); disconnect( Output0Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); disconnect( Output1Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); disconnect( Output2Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); disconnect( Output3Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); disconnect( PP0Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); disconnect( SlotBox, SIGNAL( activated(int) ), this, SLOT( slotChanged(int) ) ); disconnect( isActive, SIGNAL( toggled(bool) ), this, SLOT( saveLinks() ) ); disconnect( moduleID, SIGNAL( valueChanged(int)),this, SLOT( saveLinks() ) ); disconnect( grpID, SIGNAL( valueChanged(int)),this, SLOT( saveLinks() ) ); disconnect( MCC_Bwidth, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); // read module ID if(conf["general"]["ModuleId"].name()!="__TrashConfObj__"){ moduleID->setValue((((ConfInt&)conf["general"]["ModuleId"]).getValue())); QToolTip::add( (QWidget*)moduleID, conf["general"]["ModuleId"].comment().c_str() ); } // read group ID if(conf["general"]["GroupId"].name()!="__TrashConfObj__"){ grpID->setValue((((ConfInt&)conf["general"]["GroupId"]).getValue())); QToolTip::add( (QWidget*)grpID, conf["general"]["GroupId"].comment().c_str() ); } // module is active? if(conf["general"]["Active"].name()!="__TrashConfObj__"){ isActive->setChecked(((ConfList&)conf["general"]["Active"]).sValue()=="TRUE"); QToolTip::add( (QWidget*)isActive, conf["general"]["Active"].comment().c_str() ); } else{ printf("ConfObj general_Active is not valid or does not exist\n"); isActive->setChecked(false); } QToolTip::add( (QWidget*) SlotBox, "Selects in/output links by PP0 slot number" ); QToolTip::add( (QWidget*) SetupBox, "Defines PP0-slot to in/output link association" ); // get in and out links if(conf["general"]["InputLink"].name()!="__TrashConfObj__"){ il = ((ConfInt&)conf["general"]["InputLink"]).getValue(); QToolTip::add( (QWidget*)InputBox, conf["general"]["InputLink"].comment().c_str() ); }else{ printf("ConfObj general_InputLink is not valid or does not exist\n"); il = 0; } for(i=0;i<4;i++){ sprintf(lnam,"OutputLink%d",i+1); QComboBox* oBox[4] = {Output0Box,Output1Box,Output2Box,Output3Box}; if(conf["general"][lnam].name()!="__TrashConfObj__"){ ol[i] = ((ConfInt&)conf["general"][lnam]).getValue(); QToolTip::add( (QWidget*)oBox[i], conf["general"][lnam].comment().c_str() ); } else{ printf("ConfObj general_%s is not valid or does not exist\n",lnam); ol[i] = 0; allident = false; } } //get pp0 type and links PP0Box->clear(); if(conf["pp0"]["Type"].name()!="__TrashConfObj__"){ pp0 = ((ConfList&)conf["pp0"]["Type"]).getValue(); QToolTip::add( (QWidget*)isActive, conf["general"]["Active"].comment().c_str() ); std::map syms = ((ConfList&)conf["pp0"]["Type"]).symbols(); for(std::map::iterator it = syms.begin(); it!=syms.end(); it++) PP0Box->insertItem("dummy"+QString::number(it->second)); for(std::map::iterator it = syms.begin(); it!=syms.end(); it++){ PP0Box->setCurrentItem(it->second); PP0Box->setCurrentText((it->first).c_str()); } if(syms["USB"] == pp0){ GroupBox5->hide(); geoBox->hide(); groupBox8->hide(); if(!m_haveMCC){ GroupBox1->setParent(tab1); vboxLayout3->addWidget(GroupBox1); MCCGroup->setParent(tab1); MCCGroup->hide(); vboxLayout3->addWidget(MCCGroup); TabWidget->removeTab(1);//TabWidget->indexOf(tab2)); } } } else{ printf("ConfObj pp0_Type is not valid or does not exist\n"); pp0 = 0; PP0Box->insertItem("unknown"); } if(conf["pp0"]["position"].name()!="__TrashConfObj__"){ slot= ((ConfInt&)conf["pp0"]["position"]).getValue(); }else{ printf("ConfObj pp0_position is not valid or does not exist\n"); slot = 1; } PP0Box->setCurrentItem(pp0); setupChanged(0,pp0, false); SlotBox->setCurrentItem(slot-1); slotChanged(slot-1, false); // check if in-/output links fit one of the 40,80,160MHz patter type = 0; while(!allident && type<3){ PixLib::listLinks(in,out1,out2,out3,out4,type,pp0); if(slot>0 && slot<=(int)in.size() && ol[0]==out1[slot-1] && ol[1]==out2[slot-1] && ol[2]==out3[slot-1] && ol[3]==out4[slot-1]){ SetupBox->setCurrentItem(type); setupChanged(type,pp0, false); break; } type++; } if(type==3) { // don't know what to do, use free-style SetupBox->setCurrentItem(3); setupChanged(3, pp0, false); InputBox->setCurrentItem(il); for(j=0;j<4;j++){ i = ol[j]%16+4*(ol[j]/16); obox[j]->setCurrentItem(i); } } // restore connections connect( InputBox, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); connect( Output0Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); connect( Output1Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); connect( Output2Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); connect( Output3Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); connect( PP0Box, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); connect( SlotBox, SIGNAL( activated(int) ), this, SLOT( slotChanged(int) ) ); connect( isActive, SIGNAL( toggled(bool) ), this, SLOT( saveLinks() ) ); connect( moduleID, SIGNAL( valueChanged(int)), this, SLOT( saveLinks() ) ); connect( grpID, SIGNAL( valueChanged(int)), this, SLOT( saveLinks() ) ); connect( MCC_Bwidth, SIGNAL( activated(int) ), this, SLOT( saveLinks() ) ); return; } void ConfigEdit::saveLinks(bool manual_edit){ if(manual_edit) m_didChanges = true; bool isOK; int links[5]; int slot; char lname[200]; QComboBox *obox[4]={Output0Box, Output1Box, Output2Box, Output3Box}; links[0] = InputBox->currentText().toInt(&isOK); slot = SlotBox->currentText().toInt(&isOK); for(int ilink=0;ilink<4;ilink++){ QString tmpStr = obox[ilink]->currentText(); tmpStr.remove(0,2); links[ilink+1] = 16*(obox[ilink]->currentText().left(1).toInt(&isOK))+tmpStr.toInt(&isOK); } Config &conf = *(m_conf[17]); // see if the group general exists, if not we have nothing to do if(conf["general"].name()=="__TrashConfGroup__") return; // write module ID if(conf["general"]["ModuleId"].name()!="__TrashConfObj__") *((int *)((ConfList&)conf["general"]["ModuleId"]).m_value) = (int) moduleID->value(); // write group ID if(conf["general"]["GroupId"].name()!="__TrashConfObj__") *((int *)((ConfList&)conf["general"]["GroupId"]).m_value) = (int) grpID->value(); // write active status if(conf["general"]["Active"].name()!="__TrashConfObj__"){ if(isActive->isChecked()) *((int *)((ConfList&)conf["general"]["Active"]).m_value)= (int)((ConfList&)conf["general"]["Active"]).m_symbols["TRUE"]; else *((int *)((ConfList&)conf["general"]["Active"]).m_value)= (int)((ConfList&)conf["general"]["Active"]).m_symbols["FALSE"]; } // write links for(int i=0;i<5;i++){ if(i==0) sprintf(lname,"InputLink"); else sprintf(lname,"OutputLink%d",i); if(conf["general"][lname].name()!="__TrashConfObj__"){ ConfInt &myco = (ConfInt&)conf["general"][lname]; WriteIntConf(myco,links[i]); } } // write PP0-Type if(conf["pp0"]["Type"].name()!="__TrashConfObj__"){ ConfInt &myco = (ConfInt&) conf["pp0"]["Type"]; WriteIntConf(myco,PP0Box->currentItem()); } //write PP0-Slotnumber if(conf["pp0"]["position"].name()!="__TrashConfObj__"){ ConfInt &myco = (ConfInt&)conf["pp0"]["position"]; WriteIntConf(myco,slot); } // write MCC output speed // see if the group Registers exists, if not we have nothing to do if(m_haveMCC){ Config &mccconf = *(m_conf[16]); if(mccconf["Registers"].name()!="__TrashConfGroup__" && mccconf["Registers"]["CSR_OutputMode"].name()!="__TrashConfObj__"){ WriteIntConf((ConfInt&)mccconf["Registers"]["CSR_OutputMode"], MCC_Bwidth->currentItem()-1); } else std::cerr << "Can't find MCC output speed info"<1) maxval = 7; if(FEflavour->currentItem()==1) // FE-I1 maxval = 32; for(chip=0;chip temp; ((ConfMask *)mapobj.m_value)->get(temp); for(i=0;i<2880;i++){ if((temp[i]+amount)>=0 && (temp[i]+amount) *)mapobj.m_value)->set(temp); } } return; } void ConfigEdit::setStavePosMax(){ int assy_type = stave_sectorBox->currentItem(); switch(assy_type){ case 1: // stave staveID->setEnabled(true); modPosition->setEnabled(true); modPosition->setMaxValue(13); break; case 2: // sector staveID->setEnabled(true); modPosition->setEnabled(true); modPosition->setMaxValue(6); break; default: case 0: // undef./unknown staveID->setEnabled(false); modPosition->setEnabled(false); } } void ConfigEdit::setupChanged(int type) { setupChanged(type,PP0Box->currentItem(),true); } void ConfigEdit::PP0Changed(int pp0) { setupChanged(SetupBox->currentItem(), pp0, true); }