added inlfux token for supporting influxDB 2, and update ClassDigitizer for DT5730 model
This commit is contained in:
parent
aa361938a4
commit
eb799802ab
|
@ -122,8 +122,9 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
|
|||
isInputChEqRegCh = true;
|
||||
regChannelMask = pow(2, NumInputCh)-1;
|
||||
switch(BoardInfo.Model){
|
||||
case CAEN_DGTZ_V1730: tick2ns = 2.0; NCoupledCh = NumInputCh/2; break; ///ns -> 500 MSamples/s
|
||||
case CAEN_DGTZ_V1725: tick2ns = 4.0; NCoupledCh = NumInputCh/2; break; ///ns -> 250 MSamples/s
|
||||
case CAEN_DGTZ_V1730: tick2ns = 2.0; NCoupledCh = NumInputCh/2; break; ///ns -> 500 MSamples/s
|
||||
case CAEN_DGTZ_DT5730: tick2ns = 2.0; NCoupledCh = NumInputCh; break; ///ns -> 500 MSamples/s
|
||||
case CAEN_DGTZ_V1725: tick2ns = 4.0; NCoupledCh = NumInputCh/2; break; ///ns -> 250 MSamples/s
|
||||
case CAEN_DGTZ_V1740: {
|
||||
NumInputCh = 64;
|
||||
NCoupledCh = NumRegChannel;
|
||||
|
@ -332,14 +333,16 @@ int Digitizer::ProgramBoard_PHA(){
|
|||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0x5, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0x6, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0x7, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0x8, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0x9, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xA, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xB, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xC, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xD, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xE, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xF, 0xAAAA);
|
||||
if( NumRegChannel > 8 ){
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0x8, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0x9, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xA, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xB, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xC, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xD, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xE, 0xAAAA);
|
||||
ret |= CAEN_DGTZ_SetChannelDCOffset(handle, 0xF, 0xAAAA);
|
||||
}
|
||||
|
||||
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::PreTrigger) + 0x7000 , 32 );
|
||||
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::InputDynamicRange) + 0x7000 , 0x0 );
|
||||
|
@ -806,6 +809,7 @@ void Digitizer::ReadAllSettingsFromBoard(bool force){
|
|||
|
||||
for( int p = 0; p < (int) RegisterBoardList_PHAPSD.size(); p++){
|
||||
if( RegisterBoardList_PHAPSD[p].GetRWType() == RW::WriteONLY) continue;
|
||||
if( BoardInfo.Model == CAEN_DGTZ_DT5730 && RegisterBoardList_PHAPSD[p].GetAddress() == 0x81C4 ) continue;
|
||||
ReadRegister(RegisterBoardList_PHAPSD[p]);
|
||||
}
|
||||
regChannelMask = GetSettingFromMemory(DPP::RegChannelEnableMask);
|
||||
|
@ -881,6 +885,7 @@ void Digitizer::ProgramSettingsToBoard(){
|
|||
if( DPPType == V1730_DPP_PHA_CODE ){
|
||||
for( int p = 0; p < (int) RegisterChannelList_PHA.size(); p++){
|
||||
if( RegisterChannelList_PHA[p].GetRWType() == RW::ReadWrite ){
|
||||
if( BoardInfo.Model == CAEN_DGTZ_DT5730 && RegisterBoardList_PHAPSD[p].GetAddress() == 0x81C4 ) continue;
|
||||
haha = RegisterChannelList_PHA[p];
|
||||
WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false);
|
||||
usleep(pauseMilliSec * 1000);
|
||||
|
@ -890,6 +895,7 @@ void Digitizer::ProgramSettingsToBoard(){
|
|||
if( DPPType == V1730_DPP_PSD_CODE ){
|
||||
for( int p = 0; p < (int) RegisterChannelList_PSD.size(); p++){
|
||||
if( RegisterChannelList_PSD[p].GetRWType() == RW::ReadWrite){
|
||||
if( BoardInfo.Model == CAEN_DGTZ_DT5730 && RegisterBoardList_PHAPSD[p].GetAddress() == 0x81C4 ) continue;
|
||||
haha = RegisterChannelList_PSD[p];
|
||||
WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false);
|
||||
usleep(pauseMilliSec * 1000);
|
||||
|
@ -1126,6 +1132,9 @@ void Digitizer::SaveAllSettingsAsText(std::string fileName){
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
if( BoardInfo.Model == CAEN_DGTZ_DT5730 && haha.GetAddress() == 0x81C4 ) continue;
|
||||
|
||||
if( haha.GetName() != "" ) {
|
||||
std::string typeStr ;
|
||||
if( haha.GetRWType() == RW::ReadWrite ) typeStr = "R/W";
|
||||
|
|
|
@ -41,17 +41,16 @@ void InfluxDB::SetURL(std::string url){
|
|||
}else{
|
||||
this->databaseIP = url;
|
||||
}
|
||||
|
||||
headers = curl_slist_append(headers, "Accept: application/csv");
|
||||
}
|
||||
|
||||
void InfluxDB::SetToken(std::string token){
|
||||
this->token = token;
|
||||
headers = curl_slist_append(headers, ("Authorization: Token " + token).c_str());
|
||||
headers = curl_slist_append(headers, "Accept: application/csv");
|
||||
if( !token.empty() ) headers = curl_slist_append(headers, ("Authorization: Token " + token).c_str());
|
||||
}
|
||||
|
||||
bool InfluxDB::TestingConnection(bool debug){
|
||||
CheckInfluxVersion();
|
||||
CheckInfluxVersion(debug);
|
||||
if( respond != CURLE_OK ) return false;
|
||||
connectionOK = true;
|
||||
return true;
|
||||
|
@ -86,7 +85,7 @@ std::string InfluxDB::CheckInfluxVersion(bool debug){
|
|||
}
|
||||
}
|
||||
|
||||
printf("Influx Version : %s | %u\n", influxVersionStr.c_str(), influxVersion);
|
||||
// printf("Influx Version : %s | %u\n", influxVersionStr.c_str(), influxVersion);
|
||||
|
||||
return respondStr;
|
||||
|
||||
|
|
58
FSUDAQ.cpp
58
FSUDAQ.cpp
|
@ -123,6 +123,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
leDatabaseName->setReadOnly(true);
|
||||
layout->addWidget(leDatabaseName, rowID, 4);
|
||||
|
||||
rowID ++;
|
||||
QLabel * lbToken = new QLabel("Influx Token : ", this);
|
||||
lbToken->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
layout->addWidget(lbToken, rowID, 1);
|
||||
|
||||
leInfluxToken = new QLineEdit(this);
|
||||
leInfluxToken->setReadOnly(true);
|
||||
layout->addWidget(leInfluxToken, rowID, 2, 1, 3);
|
||||
|
||||
rowID ++;
|
||||
QLabel * lbElogIP = new QLabel("Elog IP : ", this);
|
||||
lbElogIP->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
|
@ -279,6 +288,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
elogPWD = "";
|
||||
influxIP = "";
|
||||
dataBaseName = "";
|
||||
influxToken = "";
|
||||
programSettingsFilePath = QDir::current().absolutePath() + "/programSettings.txt";
|
||||
LoadProgramSettings();
|
||||
|
||||
|
@ -436,10 +446,11 @@ void MainWindow::LoadProgramSettings(){
|
|||
if( count == 0 ) rawDataPath = line;
|
||||
if( count == 1 ) influxIP = line;
|
||||
if( count == 2 ) dataBaseName = line;
|
||||
if( count == 3 ) elogIP = line;
|
||||
if( count == 4 ) elogName = line;
|
||||
if( count == 5 ) elogUser = line;
|
||||
if( count == 6 ) elogPWD = line;
|
||||
if( count == 3 ) influxToken = line;
|
||||
if( count == 4 ) elogIP = line;
|
||||
if( count == 5 ) elogName = line;
|
||||
if( count == 6 ) elogUser = line;
|
||||
if( count == 7 ) elogPWD = line;
|
||||
|
||||
count ++;
|
||||
line = in.readLine();
|
||||
|
@ -449,17 +460,19 @@ void MainWindow::LoadProgramSettings(){
|
|||
leDataPath->setText(rawDataPath);
|
||||
leInfluxIP->setText(influxIP);
|
||||
leDatabaseName->setText(dataBaseName);
|
||||
leInfluxToken->setText(influxToken);
|
||||
leElogIP->setText(elogIP);
|
||||
leElogName->setText(elogName);
|
||||
|
||||
logMsgHTMLMode = false;
|
||||
LogMsg("Raw Data Path : " + rawDataPath);
|
||||
LogMsg(" Influx IP : " + influxIP);
|
||||
LogMsg("Database Name : " + dataBaseName);
|
||||
LogMsg(" Elog IP : " + elogIP);
|
||||
LogMsg(" Elog Name : " + elogName);
|
||||
LogMsg(" Elog User : " + elogUser);
|
||||
LogMsg(" Elog PWD : " + elogPWD);
|
||||
LogMsg(" Raw Data Path : " + rawDataPath);
|
||||
LogMsg(" Influx IP : " + influxIP);
|
||||
LogMsg(" Database Name : " + dataBaseName);
|
||||
LogMsg("Database Token : " + influxToken);
|
||||
LogMsg(" Elog IP : " + elogIP);
|
||||
LogMsg(" Elog Name : " + elogName);
|
||||
LogMsg(" Elog User : " + elogUser);
|
||||
LogMsg(" Elog PWD : " + elogPWD);
|
||||
logMsgHTMLMode = true;
|
||||
|
||||
//check is rawDataPath exist, if not, create one
|
||||
|
@ -489,6 +502,7 @@ void MainWindow::SaveProgramSettings(){
|
|||
file.write((rawDataPath+"\n").toStdString().c_str());
|
||||
file.write((influxIP+"\n").toStdString().c_str());
|
||||
file.write((dataBaseName+"\n").toStdString().c_str());
|
||||
file.write((influxToken+"\n").toStdString().c_str());
|
||||
file.write((elogIP+"\n").toStdString().c_str());
|
||||
file.write((elogName+"\n").toStdString().c_str());
|
||||
file.write((elogUser+"\n").toStdString().c_str());
|
||||
|
@ -1383,16 +1397,19 @@ void MainWindow::SetAndLockInfluxElog(){
|
|||
|
||||
leInfluxIP->setReadOnly(false);
|
||||
leDatabaseName->setReadOnly(false);
|
||||
leInfluxToken->setReadOnly(false);
|
||||
leElogIP->setReadOnly(false);
|
||||
leElogName->setReadOnly(false);
|
||||
|
||||
leInfluxIP->setEnabled(true);
|
||||
leDatabaseName->setEnabled(true);
|
||||
leInfluxToken->setEnabled(true);
|
||||
leElogIP->setEnabled(true);
|
||||
leElogName->setEnabled(true);
|
||||
|
||||
leInfluxIP->setStyleSheet("color : blue;");
|
||||
leDatabaseName->setStyleSheet("color : blue;");
|
||||
leInfluxToken->setStyleSheet("color : blue;");
|
||||
leElogIP->setStyleSheet("color : blue;");
|
||||
leElogName->setStyleSheet("color : blue;");
|
||||
|
||||
|
@ -1401,16 +1418,19 @@ void MainWindow::SetAndLockInfluxElog(){
|
|||
|
||||
leInfluxIP->setReadOnly(true);
|
||||
leDatabaseName->setReadOnly(true);
|
||||
leInfluxToken->setReadOnly(true);
|
||||
leElogIP->setReadOnly(true);
|
||||
leElogName->setReadOnly(true);
|
||||
|
||||
leInfluxIP->setStyleSheet("");
|
||||
leDatabaseName->setStyleSheet("");
|
||||
leInfluxToken->setStyleSheet("");
|
||||
leElogIP->setStyleSheet("");
|
||||
leElogName->setStyleSheet("");
|
||||
|
||||
influxIP = leInfluxIP->text();
|
||||
dataBaseName = leDatabaseName->text();
|
||||
influxToken = leInfluxToken->text();
|
||||
elogIP = leElogIP->text();
|
||||
elogName = leElogName->text();
|
||||
|
||||
|
@ -1784,14 +1804,24 @@ void MainWindow::SetUpInflux(){
|
|||
influx = new InfluxDB(influxIP.toStdString(), false);
|
||||
|
||||
if( influx->TestingConnection() ){
|
||||
LogMsg("<font style=\"color : green;\"> InfluxDB URL (<b>"+ influxIP + "</b>) is Valid </font>");
|
||||
LogMsg("<font style=\"color : green;\"> InfluxDB URL (<b>"+ influxIP + "</b>) is Valid. Version : " + QString::fromStdString(influx->GetVersionString())+ " </font>");
|
||||
|
||||
if( influx->GetVersionNo() > 1 && influxToken.isEmpty() ) {
|
||||
LogMsg("<font style=\"color : red;\">A Token is required for accessing the database.</font>");
|
||||
delete influx;
|
||||
influx = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
influx->SetToken(influxToken.toStdString());
|
||||
|
||||
//==== chck database exist
|
||||
//LogMsg("List of database:");
|
||||
influx->CheckDatabases();
|
||||
std::vector<std::string> databaseList = influx->GetDatabaseList();
|
||||
bool foundDatabase = false;
|
||||
for( int i = 0; i < (int) databaseList.size(); i++){
|
||||
if( databaseList[i] == dataBaseName.toStdString() ) foundDatabase = true;
|
||||
//LogMsg(QString::number(i) + "|" + QString::fromStdString(databaseList[i]));
|
||||
// LogMsg(QString::number(i) + "|" + QString::fromStdString(databaseList[i]));
|
||||
}
|
||||
if( foundDatabase ){
|
||||
LogMsg("<font style=\"color : green;\"> Database <b>" + dataBaseName + "</b> found.");
|
||||
|
|
2
FSUDAQ.h
2
FSUDAQ.h
|
@ -131,9 +131,11 @@ private:
|
|||
|
||||
QString influxIP;
|
||||
QString dataBaseName;
|
||||
QLineEdit * leInfluxToken;
|
||||
QLineEdit * leInfluxIP;
|
||||
QLineEdit * leDatabaseName;
|
||||
QPushButton * bnLock;
|
||||
QString influxToken;
|
||||
|
||||
//@----- Elog
|
||||
QString elogIP;
|
||||
|
|
|
@ -114,6 +114,7 @@ There is a folder Aux, this folder contains many auxillary programs, such as Eve
|
|||
|
||||
# Known Issues
|
||||
|
||||
* If accessing the database takes too long, recommend to disable the database.
|
||||
* Pile up rate is not accurate for very high input rate ( > 60 kHz ).
|
||||
* When using the scope, the Agg/Read must be smaller than 512.
|
||||
* Although the Events/Agg used the CAEN API to recalculate before ACQ start, for PHA firmware, when the trigger rate changed, the Events per Agg need to be changed.
|
||||
|
|
Loading…
Reference in New Issue
Block a user