improve the readability of the code in solaris panel
This commit is contained in:
parent
259bc9d244
commit
a65d7ffa94
|
@ -231,7 +231,6 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
|
|||
printf(" Model name : %s\n", ModelName.c_str());
|
||||
printf(" CUP version : %s\n", GetSettingValue(PHA::DIG::CupVer).c_str());
|
||||
printf(" DPP Type : %s\n", GetSettingValue(PHA::DIG::FirmwareType).c_str());
|
||||
printf(" DPP Version : %s\n", FPGAType.c_str());
|
||||
printf("Serial number : %d\n", serialNumber);
|
||||
printf(" ADC bits : %s\n", GetSettingValue(PHA::DIG::ADC_bit).c_str());
|
||||
printf(" ADC rate : %d Msps, ch2ns : %d ns\n", adcRate, ch2ns);
|
||||
|
|
210
SOLARISpanel.cpp
210
SOLARISpanel.cpp
|
@ -5,10 +5,9 @@
|
|||
#include <QSet>
|
||||
#include <QList>
|
||||
|
||||
#define NCOL 20 // number of column
|
||||
#define NCOL 10 // number of column
|
||||
|
||||
std::vector<Reg> SettingItems = {PHA::CH::TriggerThreshold, PHA::CH::DC_Offset};
|
||||
|
||||
const std::vector<QString> arrayLabel = {"e", "xf", "xn"};
|
||||
|
||||
SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
||||
|
@ -18,7 +17,7 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
|||
QWidget *parent) : QWidget(parent){
|
||||
|
||||
setWindowTitle("SOLARIS Settings");
|
||||
setGeometry(0, 0, 1850, 750);
|
||||
setGeometry(0, 0, 1400, 800);
|
||||
|
||||
printf("%s\n", __func__);
|
||||
|
||||
|
@ -29,22 +28,24 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
|||
this->detMaxID = detMaxID;
|
||||
|
||||
nDigiMapping = mapping.size();
|
||||
for( int i = 0; i < nDigiMapping; i++) nChMapping.push_back(mapping[i].size());
|
||||
for( int i = 0; i < nDigiMapping; i++) {
|
||||
int count = 0;
|
||||
for( int j = 0; j < (int )mapping[i].size(); j++) if( mapping[i][j] >= 0) count ++;
|
||||
nChMapping.push_back(count);
|
||||
}
|
||||
|
||||
//Check number of detector type; Array 0-199, Recoil 200-299, other 300-
|
||||
int nDetType = detType.size();
|
||||
for( int k = 0 ; k < nDetType; k++) nDet.push_back(0);
|
||||
|
||||
int nDet[nDetType];
|
||||
for( int k = 0 ; k < nDetType; k++) nDet[k] = 0;
|
||||
|
||||
QList<QList<int>> detIDListTemp; //to be consolidated
|
||||
QList<QList<int>> detIDListTemp; // store { detID, (Digi << 8 ) + ch}, making mapping into 1-D array to be consolidated
|
||||
|
||||
printf("################################# \n");
|
||||
for( int i = 0; i < nDigiMapping ; i++){
|
||||
for( int j = 0; j < nChMapping[i]; j++ ){
|
||||
for( int j = 0; j < (int) mapping[i].size(); j++ ){
|
||||
printf("%3d,", mapping[i][j]);
|
||||
QList<int> haha ;
|
||||
haha << i << mapping[i][j];
|
||||
haha << mapping[i][j] << ((i << 8 ) + j);
|
||||
if( mapping[i][j] >= 0 ) detIDListTemp << haha;
|
||||
for( int k = 0 ; k < nDetType; k++){
|
||||
int lowID = (k == 0 ? 0 : detMaxID[k-1]);
|
||||
|
@ -56,32 +57,47 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
|||
}
|
||||
|
||||
//----- consolidate detIDList;
|
||||
QList<QList<int>> detIDList;
|
||||
detIDList << detIDListTemp[0];
|
||||
detIDList.clear();
|
||||
QList<int> haha;
|
||||
haha << detIDListTemp[0][0];
|
||||
detIDList << haha;
|
||||
bool repeated = false;
|
||||
for( int i = 0; i < detIDListTemp.size(); i++ ){
|
||||
repeated = false;
|
||||
for( int j = 0; j < detIDList.size() ; j++){
|
||||
if( detIDList[j] == detIDListTemp[i] ) {
|
||||
if( detIDList[j][0] == detIDListTemp[i][0] ) {
|
||||
repeated = true;
|
||||
detIDList[j] << detIDListTemp[i][1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( !repeated ) detIDList << detIDListTemp [i];
|
||||
if( !repeated ) detIDList << detIDListTemp[i];
|
||||
}
|
||||
|
||||
//---- sort detIDList;
|
||||
std::sort(detIDList.begin(), detIDList.end(), [](const QList<int>& a, const QList<int>& b) {
|
||||
return a.at(0) < b.at(0);
|
||||
});
|
||||
|
||||
//qDebug() << detIDList;
|
||||
|
||||
//------------ create Widgets
|
||||
leDisplay = new QLineEdit***[(int) SettingItems.size()];
|
||||
sbSetting = new RSpinBox***[(int) SettingItems.size()];
|
||||
leDisplay = new QLineEdit ***[(int) SettingItems.size()];
|
||||
sbSetting = new RSpinBox ***[(int) SettingItems.size()];
|
||||
chkOnOff = new QCheckBox ***[(int) SettingItems.size()];
|
||||
for( int k = 0; k < (int) SettingItems.size() ; k ++){
|
||||
leDisplay[k] = new QLineEdit**[nDigiMapping];
|
||||
sbSetting[k] = new RSpinBox**[nDigiMapping];
|
||||
leDisplay[k] = new QLineEdit **[nDigiMapping];
|
||||
sbSetting[k] = new RSpinBox **[nDigiMapping];
|
||||
chkOnOff[k] = new QCheckBox **[nDigiMapping];
|
||||
for( int i = 0; i < nDigiMapping; i++){
|
||||
sbSetting[k][i] = new RSpinBox*[(int) mapping[i].size()];
|
||||
leDisplay[k][i] = new QLineEdit*[(int) mapping[i].size()];
|
||||
leDisplay[k][i] = new QLineEdit *[(int) mapping[i].size()];
|
||||
sbSetting[k][i] = new RSpinBox *[(int) mapping[i].size()];
|
||||
chkOnOff[k][i] = new QCheckBox *[(int) mapping[i].size()];
|
||||
}
|
||||
}
|
||||
|
||||
cbTrigger = new RComboBox *[nDet[0]]; /// nDet[0] store the number of det. for the Array
|
||||
|
||||
//---------- Set Panel
|
||||
QVBoxLayout * mainLayout = new QVBoxLayout(this); this->setLayout(mainLayout);
|
||||
QTabWidget * tabWidget = new QTabWidget(this); mainLayout->addWidget(tabWidget);
|
||||
|
@ -93,67 +109,97 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
|||
|
||||
for( int SettingID = 0; SettingID < (int) SettingItems.size(); SettingID ++){
|
||||
|
||||
QScrollArea * scrollArea = new QScrollArea(this);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
tab2->addTab(scrollArea, QString::fromStdString(SettingItems[SettingID]));
|
||||
|
||||
QWidget * tab = new QWidget(tab2);
|
||||
tab2->addTab(tab, QString::fromStdString(SettingItems[SettingID]));
|
||||
scrollArea->setWidget(tab);
|
||||
|
||||
QGridLayout * layout = new QGridLayout(tab);
|
||||
layout->setAlignment(Qt::AlignLeft|Qt::AlignTop);
|
||||
layout->setSpacing(0);
|
||||
|
||||
QCheckBox * chkAll = new QCheckBox("Set for all", tab);
|
||||
//TODO======= check all
|
||||
chkAll = new QCheckBox("Set for all", tab);
|
||||
layout->addWidget(chkAll, 0, 0);
|
||||
|
||||
if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara() ){
|
||||
chkAlle = new QCheckBox("Set for all e", tab);
|
||||
layout->addWidget(chkAlle, 0, 1);
|
||||
|
||||
chkAllxf = new QCheckBox("Set for all xf", tab);
|
||||
layout->addWidget(chkAllxf, 0, 2);
|
||||
|
||||
chkAllxn = new QCheckBox("Set for all xn", tab);
|
||||
layout->addWidget(chkAllxn, 0, 3);
|
||||
|
||||
}
|
||||
|
||||
//range of detID
|
||||
int lowID = (detTypeID == 0 ? 0 : detMaxID[detTypeID-1]);
|
||||
|
||||
for(int i = 0; i < detIDList.size(); i++){
|
||||
if( detIDList[i][1] >= detMaxID[detTypeID] || lowID > detIDList[i][1] ) continue;
|
||||
CreateSpinBoxGroup(SettingID, detIDList[i], layout, i/NCOL + 1, i%NCOL);
|
||||
if( detIDList[i][0] >= detMaxID[detTypeID] || lowID > detIDList[i][0] ) continue;
|
||||
CreateDetGroup(SettingID, detIDList[i], layout, i/NCOL + 1, i%NCOL);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//TODO ========== when digiSettingPanel or Scope change setting, reflect in solarisPanel
|
||||
|
||||
//TODO ========== when tab change, update panel
|
||||
|
||||
}
|
||||
|
||||
SOLARISpanel::~SOLARISpanel(){
|
||||
|
||||
}
|
||||
|
||||
void SOLARISpanel::CreateSpinBoxGroup(int SettingID, QList<int> detID, QGridLayout * &layout, int row, int col){
|
||||
void SOLARISpanel::CreateDetGroup(int SettingID, QList<int> detID, QGridLayout * &layout, int row, int col){
|
||||
|
||||
//find all chID = (iDigi << 8 + ch) for detID
|
||||
std::vector<int> chID;
|
||||
for( int i = 0; i < nDigiMapping ; i++){
|
||||
for( int j = 0; j < nChMapping[i]; j++ ){
|
||||
if( mapping[i][j] == detID[1] ) chID.push_back((i << 8) + j);
|
||||
}
|
||||
}
|
||||
|
||||
QGroupBox * groupbox = new QGroupBox("Det-" + QString::number(detID[1]), this);
|
||||
groupbox->setFixedWidth(100);
|
||||
QGroupBox * groupbox = new QGroupBox("Det-" + QString::number(detID[0]), this);
|
||||
groupbox->setFixedWidth(130);
|
||||
groupbox->setAlignment(Qt::AlignCenter);
|
||||
QGridLayout * layout0 = new QGridLayout(groupbox);
|
||||
layout0->setSpacing(0);
|
||||
layout0->setAlignment(Qt::AlignLeft);
|
||||
|
||||
for( int i = 0; i < (int) chID.size(); i ++){
|
||||
for( int i = 1; i < (int) detID.size(); i ++){
|
||||
|
||||
QLabel * lb = new QLabel(arrayLabel[i], this);
|
||||
QLabel * lb = new QLabel(arrayLabel[i-1], this);
|
||||
layout0->addWidget(lb, 2*i, 0, 2, 1);
|
||||
|
||||
int digiID = (chID[i] >> 8);
|
||||
int ch = (chID[i] & 0xFF);
|
||||
int digiID = (detID[i] >> 8 );
|
||||
int chID = (detID[i] & 0xFF);
|
||||
|
||||
leDisplay[SettingID][digiID][ch] = new QLineEdit(this);
|
||||
leDisplay[SettingID][digiID][ch]->setFixedWidth(50);
|
||||
layout0->addWidget(leDisplay[SettingID][digiID][ch], 2*i, 1);
|
||||
chkOnOff[SettingID][digiID][chID] = new QCheckBox(this);
|
||||
layout0->addWidget(chkOnOff[SettingID][digiID][chID], 2*i, 1, 2, 1);
|
||||
|
||||
sbSetting[SettingID][digiID][ch] = new RSpinBox(this);
|
||||
if( digiID < nDigi ) sbSetting[SettingID][digiID][ch]->setToolTip( "Digi-" + QString::number(digi[digiID]->GetSerialNumber()) + ",Ch-" + QString::number(ch));
|
||||
sbSetting[SettingID][digiID][ch]->setToolTipDuration(-1);
|
||||
sbSetting[SettingID][digiID][ch]->setFixedWidth(50);
|
||||
layout0->addWidget(sbSetting[SettingID][digiID][ch], 2*i+1, 1);
|
||||
leDisplay[SettingID][digiID][chID] = new QLineEdit(this);
|
||||
leDisplay[SettingID][digiID][chID]->setFixedWidth(70);
|
||||
layout0->addWidget(leDisplay[SettingID][digiID][chID], 2*i, 2);
|
||||
|
||||
RSpinBox * spb = sbSetting[SettingID][digiID][ch];
|
||||
sbSetting[SettingID][digiID][chID] = new RSpinBox(this);
|
||||
if( digiID < nDigi ) sbSetting[SettingID][digiID][chID]->setToolTip( "Digi-" + QString::number(digi[digiID]->GetSerialNumber()) + ", Ch-" + QString::number(chID));
|
||||
sbSetting[SettingID][digiID][chID]->setToolTipDuration(-1);
|
||||
sbSetting[SettingID][digiID][chID]->setFixedWidth(70);
|
||||
|
||||
sbSetting[SettingID][digiID][chID]->setMinimum(atoi(SettingItems[SettingID].GetAnswers()[0].first.c_str()));
|
||||
sbSetting[SettingID][digiID][chID]->setMaximum(atoi(SettingItems[SettingID].GetAnswers()[1].first.c_str()));
|
||||
sbSetting[SettingID][digiID][chID]->setSingleStep(atoi(SettingItems[SettingID].GetAnswers()[2].first.c_str()));
|
||||
|
||||
layout0->addWidget(sbSetting[SettingID][digiID][chID], 2*i+1, 2);
|
||||
|
||||
if( digiID >= nDigi || chID >= digi[digiID]->GetNChannels() ) {
|
||||
leDisplay[SettingID][digiID][chID]->setEnabled(false);
|
||||
sbSetting[SettingID][digiID][chID]->setEnabled(false);
|
||||
chkOnOff[SettingID][digiID][chID]->setEnabled(false);
|
||||
}
|
||||
|
||||
RSpinBox * spb = sbSetting[SettingID][digiID][chID];
|
||||
const Reg para = SettingItems[SettingID];
|
||||
|
||||
connect(spb, &RSpinBox::valueChanged, this, [=](){
|
||||
|
@ -171,9 +217,9 @@ void SOLARISpanel::CreateSpinBoxGroup(int SettingID, QList<int> detID, QGridLayo
|
|||
}
|
||||
QString msg;
|
||||
msg = QString::fromStdString(para.GetPara()) + "|DIG:"+ QString::number(digi[digiID]->GetSerialNumber());
|
||||
if( para.GetType() == TYPE::CH ) msg += ",CH:" + QString::number(ch);
|
||||
if( para.GetType() == TYPE::CH ) msg += ",CH:" + QString::number(chID);
|
||||
msg += " = " + QString::number(spb->value());
|
||||
if( digi[digiID]->WriteValue(para, std::to_string(spb->value()), ch)){
|
||||
if( digi[digiID]->WriteValue(para, std::to_string(spb->value()), chID)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
spb->setStyleSheet("");
|
||||
}else{
|
||||
|
@ -182,9 +228,42 @@ void SOLARISpanel::CreateSpinBoxGroup(int SettingID, QList<int> detID, QGridLayo
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
connect(chkOnOff[SettingID][digiID][chID], &QCheckBox::stateChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
|
||||
bool haha = chkOnOff[SettingID][digiID][chID]->isChecked();
|
||||
|
||||
if( haha ) {
|
||||
digi[digiID]->WriteValue(PHA::CH::ChannelEnable, "True", chID);
|
||||
}else{
|
||||
digi[digiID]->WriteValue(PHA::CH::ChannelEnable, "False", chID);
|
||||
}
|
||||
leDisplay[SettingID][digiID][chID]->setEnabled(haha);
|
||||
sbSetting[SettingID][digiID][chID]->setEnabled(haha);
|
||||
});
|
||||
|
||||
layout0->setColumnStretch(0, 1);
|
||||
layout0->setColumnStretch(1, 1);
|
||||
layout0->setColumnStretch(2, 5);
|
||||
|
||||
}
|
||||
|
||||
if( detID[0] >= nDigi || detID[1] >= digi[detID[0]]->GetNChannels() ) groupbox->setEnabled(false);
|
||||
//TODO ==== detMaxID[0] should belong to Array
|
||||
if( 0 <= detID[0] && detID[0] < detMaxID[0] && SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara()){
|
||||
cbTrigger[detID[0]] = new RComboBox(this);
|
||||
cbTrigger[detID[0]]->addItem("Non-Trigger", 0x0);
|
||||
cbTrigger[detID[0]]->addItem("Self Trigger", -1);
|
||||
cbTrigger[detID[0]]->addItem("Trigger all", 0x7);
|
||||
cbTrigger[detID[0]]->addItem("Trigger (e)", 0x1);
|
||||
cbTrigger[detID[0]]->addItem("Trigger (xf)", 0x2);
|
||||
cbTrigger[detID[0]]->addItem("Trigger (xn)", 0x4);
|
||||
cbTrigger[detID[0]]->addItem("Trigger 011", 0x3);
|
||||
cbTrigger[detID[0]]->addItem("Trigger 110", 0x6);
|
||||
cbTrigger[detID[0]]->addItem("Trigger 101", 0x5);
|
||||
cbTrigger[detID[0]]->addItem("Oops....", -999);
|
||||
layout0->addWidget(cbTrigger[detID[0]], 8, 0, 1, 3);
|
||||
}
|
||||
|
||||
layout->addWidget(groupbox, row, col);
|
||||
|
||||
|
@ -192,7 +271,6 @@ void SOLARISpanel::CreateSpinBoxGroup(int SettingID, QList<int> detID, QGridLayo
|
|||
|
||||
|
||||
void SOLARISpanel::UpdatePanel(){
|
||||
|
||||
enableSignalSlot = false;
|
||||
|
||||
for( int SettingID = 0; SettingID < (int) SettingItems.size() ; SettingID ++){
|
||||
|
@ -201,7 +279,6 @@ void SOLARISpanel::UpdatePanel(){
|
|||
|
||||
for( int chID = 0; chID < (int) mapping[DigiID].size(); chID++){
|
||||
|
||||
if( chID >= digi[DigiID]->GetNChannels() ) continue;
|
||||
if( mapping[DigiID][chID] < 0 ) continue;
|
||||
|
||||
std::string haha = digi[DigiID]->GetSettingValue(SettingItems[SettingID], chID);
|
||||
|
@ -213,11 +290,36 @@ void SOLARISpanel::UpdatePanel(){
|
|||
}else{
|
||||
leDisplay[SettingID][DigiID][chID]->setText(QString::fromStdString(haha));
|
||||
}
|
||||
|
||||
haha = digi[DigiID]->GetSettingValue(PHA::CH::ChannelEnable, chID);
|
||||
chkOnOff[SettingID][DigiID][chID]->setChecked( haha == "True" ? true : false);
|
||||
|
||||
///printf("====== %d %d %d |%s|\n", SettingID, DigiID, chID, haha.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( int k = 0; k < detIDList.size() ; k++){
|
||||
if( detIDList[k][0] >= detMaxID[0] || 0 > detIDList[k][0]) continue;
|
||||
|
||||
//if( detIDList[k].size() <= 2) continue;
|
||||
std::vector<unsigned long> triggerMap;
|
||||
std::vector<std::string> coincidentMask;
|
||||
std::vector<std::string> eventTriggerSource;
|
||||
|
||||
for( int h = 1; h < detIDList[k].size(); h++){
|
||||
int digiID = detIDList[k][h] >> 8;
|
||||
int chID = (detIDList[k][h] & 0xFF);
|
||||
triggerMap.push_back(std::stoul(digi[digiID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, chID).c_str()));
|
||||
coincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::CoincidenceMask, chID));
|
||||
eventTriggerSource.push_back(digi[digiID]->GetSettingValue(PHA::CH::EventTriggerSource, chID));
|
||||
}
|
||||
|
||||
//====== only acceptable condition is eventTriggerSource are all ChSelfTrigger
|
||||
// and coincidentMask for e, xf, xn, are at least one for Ch64Trigger
|
||||
|
||||
}
|
||||
|
||||
enableSignalSlot = true;
|
||||
}
|
||||
|
||||
|
@ -231,7 +333,6 @@ void SOLARISpanel::UpdateThreshold(){
|
|||
|
||||
for( int chID = 0; chID < (int) mapping[DigiID].size(); chID++){
|
||||
|
||||
if( chID >= digi[DigiID]->GetNChannels() ) continue;
|
||||
if( mapping[DigiID][chID] < 0 ) continue;
|
||||
|
||||
std::string haha = digi[DigiID]->GetSettingValue(PHA::CH::SelfTrgRate, chID);
|
||||
|
@ -241,5 +342,4 @@ void SOLARISpanel::UpdateThreshold(){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,19 +46,29 @@ signals:
|
|||
void SendLogMsg(const QString str);
|
||||
|
||||
private:
|
||||
void CreateSpinBoxGroup(int SettingID, QList<int> detID, QGridLayout * &layout, int row, int col);
|
||||
void CreateDetGroup(int SettingID, QList<int> detID, QGridLayout * &layout, int row, int col);
|
||||
|
||||
Digitizer2Gen ** digi;
|
||||
unsigned short nDigi;
|
||||
std::vector<std::vector<int>> mapping;
|
||||
QStringList detType;
|
||||
std::vector<int> detMaxID;
|
||||
QList<QList<int>> detIDList; // 1-D array of { detID, (Digi << 8 ) + ch}
|
||||
std::vector<int> nDet;
|
||||
|
||||
int nDigiMapping;
|
||||
std::vector<int> nChMapping;
|
||||
int nDigiMapping; /// mapping.size()
|
||||
std::vector<int> nChMapping; /// mapping[i].size(), NON -1
|
||||
|
||||
QCheckBox * chkAll; // checkBox for all setting on that tab;
|
||||
QCheckBox * chkAlle;
|
||||
QCheckBox * chkAllxf;
|
||||
QCheckBox * chkAllxn;
|
||||
|
||||
QLineEdit **** leDisplay; // [SettingID][DigiID][ChID]
|
||||
RSpinBox **** sbSetting;
|
||||
RSpinBox **** sbSetting;
|
||||
QCheckBox **** chkOnOff;
|
||||
|
||||
RComboBox ** cbTrigger; //[detID] for array only
|
||||
|
||||
bool enableSignalSlot;
|
||||
|
||||
|
|
|
@ -773,6 +773,7 @@ bool MainWindow::CheckSOLARISpanelOK(){
|
|||
QTextStream in(&file);
|
||||
while (!in.atEnd()) {
|
||||
QString line = in.readLine();
|
||||
if( line.contains("//^")) continue;
|
||||
if( line.contains("//*=")){
|
||||
int in1 = line.indexOf("{");
|
||||
int in2 = line.lastIndexOf("}");
|
||||
|
@ -976,12 +977,12 @@ void MainWindow::UpdateScalar(){
|
|||
leTrigger[iDigi][ch]->setText(QString::fromStdString(haha[ch]));
|
||||
|
||||
|
||||
if( oldTimeStamp[iDigi][ch] > 0 && time - oldTimeStamp[iDigi][ch] > 1e9){
|
||||
if( oldTimeStamp[iDigi][ch] > 0 && time - oldTimeStamp[iDigi][ch] > 1e9 && kaka > oldSavedCount[iDigi][ch]){
|
||||
acceptRate[ch] = (kaka - oldSavedCount[iDigi][ch]) * 1e9 *1.0 / (time - oldTimeStamp[iDigi][ch]);
|
||||
}else{
|
||||
acceptRate[ch] = 0;
|
||||
}
|
||||
if( acceptRate[ch] > 10000 ) printf("%d-%2d | old (%lu, %lu), new (%lu, %lu)\n", iDigi, ch, oldTimeStamp[iDigi][ch], oldSavedCount[iDigi][ch], time, kaka);
|
||||
//if( acceptRate[ch] > 10000 ) printf("%d-%2d | old (%lu, %lu), new (%lu, %lu)\n", iDigi, ch, oldTimeStamp[iDigi][ch], oldSavedCount[iDigi][ch], time, kaka);
|
||||
|
||||
oldSavedCount[iDigi][ch] = kaka;
|
||||
oldTimeStamp[iDigi][ch] = time;
|
||||
|
|
Loading…
Reference in New Issue
Block a user