Compare commits
46 Commits
377324888f
...
ce9d2d3063
Author | SHA1 | Date | |
---|---|---|---|
|
ce9d2d3063 | ||
|
ceb4cf4563 | ||
|
f8e60f94ce | ||
|
bd47bc4928 | ||
|
8dd9023b68 | ||
|
bc73eaa91d | ||
|
369d99524c | ||
|
5c62ccbc89 | ||
|
b5a974a38d | ||
|
daf8d133a9 | ||
|
2c039dc743 | ||
|
bcf73b4112 | ||
|
beb4cdef8e | ||
|
005c752772 | ||
|
aa60a0dbe3 | ||
|
66ba308d9b | ||
|
852f4b52f4 | ||
|
4b7ae83997 | ||
|
b7f2fcbc58 | ||
|
6571f93d9b | ||
|
844f14be5f | ||
|
ab94ef3dfa | ||
|
0c6db57f47 | ||
|
8b668cb8d5 | ||
|
378fffe4ec | ||
|
2fa22bbcc2 | ||
|
f0f25f860d | ||
|
95efe40ffa | ||
|
b7a23b4a7e | ||
|
119eb64fd2 | ||
|
bdf4208070 | ||
|
8d10d24d18 | ||
|
fdc155ed90 | ||
|
68d86c3618 | ||
|
d65c324119 | ||
|
29f551018e | ||
|
a8b87e70f4 | ||
|
b888a8ea63 | ||
|
d96ed2984e | ||
|
fbb20eff93 | ||
|
f5fd9174f9 | ||
|
20478c317e | ||
|
40230300fe | ||
|
6041a6880b | ||
|
ee3edbeba6 | ||
|
1186de195d |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -26,6 +26,7 @@ moc_*
|
|||
*.rej
|
||||
*.so
|
||||
*.so.*
|
||||
*.json
|
||||
*_pch.h.cpp
|
||||
*_resource.rc
|
||||
*.qm
|
||||
|
@ -86,3 +87,4 @@ CMakeLists.txt.user*
|
|||
*.dll
|
||||
*.exe
|
||||
|
||||
EventBuilder
|
16
.vscode/c_cpp_properties.json
vendored
16
.vscode/c_cpp_properties.json
vendored
|
@ -5,14 +5,26 @@
|
|||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"/usr/include/x86_64-linux-gnu/qt6/**",
|
||||
"/opt/root/include/**"
|
||||
"/opt/root/**"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "gnu17",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
},
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c17",
|
||||
"cppStandard": "gnu++17",
|
||||
"intelliSenseMode": "linux-gcc-x64"
|
||||
}
|
||||
|
||||
],
|
||||
"version": 4
|
||||
}
|
364
Aux/EventBuilder.cpp
Normal file
364
Aux/EventBuilder.cpp
Normal file
|
@ -0,0 +1,364 @@
|
|||
#include "SolReader.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "TFile.h"
|
||||
#include "TTree.h"
|
||||
#include "TMath.h"
|
||||
#include "TString.h"
|
||||
#include "TMacro.h"
|
||||
//#include "TClonesArray.h" // plan to save trace as TVector with TClonesArray
|
||||
//#include "TVector.h"
|
||||
|
||||
#include <sys/time.h> /** struct timeval, select() */
|
||||
|
||||
inline unsigned int getTime_us(){
|
||||
unsigned int time_us;
|
||||
struct timeval t1;
|
||||
struct timezone tz;
|
||||
gettimeofday(&t1, &tz);
|
||||
time_us = (t1.tv_sec) * 1000 * 1000 + t1.tv_usec;
|
||||
return time_us;
|
||||
}
|
||||
|
||||
#define MAX_MULTI 64
|
||||
#define MAX_TRACE_LEN 1250 /// = 10 us
|
||||
|
||||
#define tick2ns 8 // 1 tick = 8 ns
|
||||
|
||||
SolReader ** reader;
|
||||
Hit ** hit;
|
||||
|
||||
std::vector<std::vector<int>> idList;
|
||||
|
||||
unsigned long totFileSize = 0;
|
||||
unsigned long processedFileSize = 0;
|
||||
|
||||
std::vector<int> activeFileID;
|
||||
std::vector<int> groupIndex;
|
||||
std::vector<std::vector<int>> group; // group[i][j], i = group ID, j = group member)
|
||||
|
||||
void findEarliestTime(int &fileID, int &groupID){
|
||||
|
||||
unsigned long firstTime = 0;
|
||||
for( int i = 0; i < (int) activeFileID.size(); i++){
|
||||
int id = activeFileID[i];
|
||||
if( i == 0 ) {
|
||||
firstTime = hit[id]->timestamp;
|
||||
fileID = id;
|
||||
groupID = i;
|
||||
//printf("%d | %d %lu %d | %d \n", id, reader[id]->GetBlockID(), hit[id]->timestamp, hit[id]->channel, (int) activeFileID.size());
|
||||
continue;
|
||||
}
|
||||
if( hit[id]->timestamp <= firstTime) {
|
||||
firstTime = hit[id]->timestamp;
|
||||
fileID = id;
|
||||
groupID = i;
|
||||
//printf("%d | %d %lu %d | %d \n", id, reader[id]->GetBlockID(), hit[id]->timestamp, hit[id]->channel, (int) activeFileID.size());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
unsigned long long evID = 0;
|
||||
unsigned int multi = 0;
|
||||
unsigned short bd[MAX_MULTI] = {0};
|
||||
unsigned short sn[MAX_MULTI] = {0};
|
||||
unsigned short ch[MAX_MULTI] = {0};
|
||||
unsigned short e[MAX_MULTI] = {0};
|
||||
unsigned short e2[MAX_MULTI] = {0}; //for PSD energy short
|
||||
unsigned long long e_t[MAX_MULTI] = {0};
|
||||
unsigned short e_f[MAX_MULTI] = {0};
|
||||
unsigned short lowFlag[MAX_MULTI] = {0};
|
||||
unsigned short highFlag[MAX_MULTI] = {0};
|
||||
int traceLen[MAX_MULTI] = {0};
|
||||
int trace[MAX_MULTI][MAX_TRACE_LEN] = {0};
|
||||
|
||||
void fillData(int &fileID, const bool &saveTrace){
|
||||
bd[multi] = idList[fileID][1];
|
||||
sn[multi] = idList[fileID][3];
|
||||
ch[multi] = hit[fileID]->channel;
|
||||
e[multi] = hit[fileID]->energy;
|
||||
e2[multi] = hit[fileID]->energy_short;
|
||||
e_t[multi] = hit[fileID]->timestamp;
|
||||
e_f[multi] = hit[fileID]->fine_timestamp;
|
||||
lowFlag[multi] = hit[fileID]->flags_low_priority;
|
||||
highFlag[multi] = hit[fileID]->flags_high_priority;
|
||||
|
||||
if( saveTrace ){
|
||||
traceLen[multi] = hit[fileID]->traceLenght;
|
||||
for( int i = 0; i < TMath::Min(traceLen[multi], MAX_TRACE_LEN); i++){
|
||||
trace[multi][i] = hit[fileID]->analog_probes[0][i];
|
||||
}
|
||||
}
|
||||
|
||||
multi++;
|
||||
reader[fileID]->ReadNextBlock();
|
||||
}
|
||||
|
||||
void printEvent(){
|
||||
printf("==================== evID : %llu\n", evID);
|
||||
for( int i = 0; i < multi; i++){
|
||||
printf(" %2d | %d %d | %llu %d \n", i, bd[i], ch[i], e_t[i], e[i] );
|
||||
}
|
||||
printf("==========================================\n");
|
||||
}
|
||||
|
||||
//^##################################################################################
|
||||
int main(int argc, char ** argv){
|
||||
|
||||
printf("=======================================================\n");
|
||||
printf("=== SOLARIS Event Builder sol --> root ===\n");
|
||||
printf("=======================================================\n");
|
||||
|
||||
if( argc <= 3){
|
||||
printf("%s [outfile] [timeWindow] [saveTrace] [sol-1] [sol-2] ... \n", argv[0]);
|
||||
printf(" outfile : output root file name\n");
|
||||
printf(" timeWindow : number of tick, 1 tick = %d ns.\n", tick2ns);
|
||||
printf(" saveTrace : 1 = save trace, 0 = no trace\n");
|
||||
printf(" sol-X : the sol file(s)\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned int runStartTime = getTime_us();
|
||||
|
||||
TString outFileName = argv[1];
|
||||
int timeWindow = abs(atoi(argv[2]));
|
||||
const bool saveTrace = atoi(argv[3]);
|
||||
|
||||
const int nFile = argc - 4;
|
||||
TString inFileName[nFile];
|
||||
for( int i = 0 ; i < nFile ; i++){
|
||||
inFileName[i] = argv[i+4];
|
||||
}
|
||||
|
||||
//*======================================== setup reader
|
||||
reader = new SolReader*[nFile];
|
||||
hit = new Hit *[nFile];
|
||||
|
||||
for( int i = 0 ; i < nFile ; i++){
|
||||
reader[i] = new SolReader(inFileName[i].Data());
|
||||
hit[i] = reader[i]->hit; //TODO check is file open propertly
|
||||
reader[i]->ReadNextBlock(); // read the first block
|
||||
}
|
||||
|
||||
//*======================================== group files
|
||||
idList.clear();
|
||||
for( int i = 0; i < nFile; i++){
|
||||
TString fn = inFileName[i];
|
||||
|
||||
int pos = fn.Last('/'); // path
|
||||
fn.Remove(0, pos+1);
|
||||
|
||||
pos = fn.First('_'); // expName;
|
||||
fn.Remove(0, pos+1);
|
||||
|
||||
pos = fn.First('_'); // runNum;
|
||||
fn.Remove(0, pos+1);
|
||||
|
||||
pos = fn.First('_'); // digiID
|
||||
TString f1 = fn;
|
||||
int digiID = f1.Remove(pos).Atoi();
|
||||
fn.Remove(0, pos+1);
|
||||
|
||||
pos = fn.Last('_'); // digi serial num
|
||||
f1 = fn;
|
||||
int digisn = f1.Remove(pos).Atoi();
|
||||
fn.Remove(0, pos+1);
|
||||
|
||||
pos = fn.First('.'); // get the file id;
|
||||
int indexID = fn.Remove(pos).Atoi();
|
||||
|
||||
int fileID = i;
|
||||
std::vector<int> haha = {fileID, digiID, indexID, digisn};
|
||||
idList.push_back(haha);
|
||||
}
|
||||
|
||||
// sort by digiID
|
||||
std::sort(idList.begin(), idList.end(), [](const std::vector<int>& a, const std::vector<int>& b){
|
||||
if (a[1] == b[1]) {
|
||||
return a[2] < b[2];
|
||||
}
|
||||
return a[1] < b[1];
|
||||
});
|
||||
|
||||
group.clear(); // group[i][j], i is the group Index = digiID
|
||||
int last_id = 0;
|
||||
std::vector<int> kaka;
|
||||
for( int i = 0; i < (int) idList.size() ; i++){
|
||||
if( i == 0 ) {
|
||||
kaka.clear();
|
||||
last_id = idList[i][1];
|
||||
kaka.push_back(idList[i][0]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if( idList[i][1] != last_id ) {
|
||||
last_id = idList[i][1];
|
||||
group.push_back(kaka);
|
||||
kaka.clear();
|
||||
kaka.push_back(idList[i][0]);
|
||||
}else{
|
||||
kaka.push_back(idList[i][0]);
|
||||
}
|
||||
}
|
||||
group.push_back(kaka);
|
||||
|
||||
printf(" out file : \033[1;33m%s\033[m\n", outFileName.Data());
|
||||
printf(" Event building time window : %d tics = %d nsec \n", timeWindow, timeWindow*tick2ns);
|
||||
printf(" Save Trace ? %s \n", saveTrace ? "Yes" : "No");
|
||||
printf(" Number of input file : %d \n", nFile);
|
||||
for( int i = 0; i < nFile; i++){
|
||||
printf(" %2d| %5.1f MB| %s \n", i, reader[i]->GetFileSize()/1024./1024., inFileName[i].Data());
|
||||
totFileSize += reader[i]->GetFileSize();
|
||||
}
|
||||
printf("------------------------------------\n");
|
||||
for( int i = 0; i < (int) group.size(); i++){
|
||||
printf("Group %d :", i);
|
||||
for( int j = 0; j < (int) group[i].size(); j ++){
|
||||
printf("%d, ", group[i][j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
printf("------------------------------------\n");
|
||||
|
||||
//*======================================== setup tree
|
||||
TFile * outRootFile = new TFile(outFileName, "recreate");
|
||||
outRootFile->cd();
|
||||
|
||||
TTree * tree = new TTree("tree", outFileName);
|
||||
|
||||
tree->Branch("evID", &evID, "evID/l");
|
||||
tree->Branch("multi", &multi, "multi/i");
|
||||
tree->Branch("bd", bd, "bd[multi]/s");
|
||||
tree->Branch("sn", sn, "sn[multi]/s");
|
||||
tree->Branch("ch", ch, "ch[multi]/s");
|
||||
tree->Branch("e", e, "e[multi]/s");
|
||||
tree->Branch("e2", e2, "e2[multi]/s");
|
||||
tree->Branch("e_t", e_t, "e_t[multi]/l");
|
||||
tree->Branch("e_f", e_f, "e_f[multi]/s");
|
||||
tree->Branch("lowFlag", lowFlag, "lowFlag[multi]/s");
|
||||
tree->Branch("highFlag", highFlag, "highFlag[multi]/s");
|
||||
|
||||
if( saveTrace){
|
||||
tree->Branch("traceLen", traceLen, "traceLen[multi]/I");
|
||||
tree->Branch("trace", trace, Form("trace[multi][%d]/I", MAX_TRACE_LEN));
|
||||
tree->GetBranch("trace")->SetCompressionSettings(205);
|
||||
}
|
||||
|
||||
//*=========================================== build event
|
||||
|
||||
//@---- using file from group[i][0] first
|
||||
|
||||
//--- find earlist time among the files
|
||||
activeFileID.clear();
|
||||
groupIndex.clear(); //the index of each group
|
||||
|
||||
for(int i = 0; i < (int) group.size(); i++) {
|
||||
groupIndex.push_back(0);
|
||||
activeFileID.push_back(group[i][0]);
|
||||
}
|
||||
|
||||
int fileID = 0;
|
||||
int groupID = 0;
|
||||
findEarliestTime(fileID, groupID);
|
||||
fillData(fileID, saveTrace);
|
||||
|
||||
unsigned long firstTimeStamp = hit[fileID]->timestamp;
|
||||
unsigned long lastTimeStamp = 0;
|
||||
|
||||
int last_precentage = 0;
|
||||
while((activeFileID.size() > 0)){
|
||||
|
||||
findEarliestTime(fileID, groupID);
|
||||
if( reader[fileID]->IsEndOfFile() ){
|
||||
groupIndex[groupID] ++;
|
||||
if( groupIndex[groupID] < (int) group[groupID].size() ){
|
||||
activeFileID[groupID] = group[groupID][groupIndex[groupID]];
|
||||
fileID = activeFileID[groupID];
|
||||
}else{
|
||||
activeFileID.erase(activeFileID.begin() + groupID);
|
||||
}
|
||||
}
|
||||
|
||||
if( hit[fileID]->timestamp - e_t[0] < timeWindow ){
|
||||
fillData(fileID, saveTrace);
|
||||
}else{
|
||||
outRootFile->cd();
|
||||
tree->Fill();
|
||||
evID ++;
|
||||
|
||||
multi = 0;
|
||||
fillData(fileID, saveTrace);
|
||||
}
|
||||
|
||||
///========= calculate progress
|
||||
processedFileSize = 0;
|
||||
for( int p = 0; p < (int) group.size(); p ++){
|
||||
for( int q = 0; q <= groupIndex[p]; q++){
|
||||
if( groupIndex[p] < (int) group[p].size() ){
|
||||
int id = group[p][q];
|
||||
processedFileSize += reader[id]->GetFilePos();
|
||||
}
|
||||
}
|
||||
}
|
||||
double percentage = processedFileSize * 100/ totFileSize;
|
||||
if( percentage >= last_precentage ) {
|
||||
printf("Processed : %llu, %.0f%% | %lu/%lu | ", evID, percentage, processedFileSize, totFileSize);
|
||||
for( int i = 0; i < (int) activeFileID.size(); i++) printf("%d, ", activeFileID[i]);
|
||||
printf(" \n\033[A\r");
|
||||
last_precentage = percentage + 1.0;
|
||||
}
|
||||
}; ///====== end of event building loop
|
||||
|
||||
processedFileSize = 0;
|
||||
for( int p = 0; p < (int) group.size(); p ++){
|
||||
for( int q = 0; q < (int) group[p].size(); q++){
|
||||
int id = group[p][q];
|
||||
processedFileSize += reader[id]->GetFilePos();
|
||||
}
|
||||
}
|
||||
double percentage = processedFileSize * 100/ totFileSize;
|
||||
printf("Processed : %llu, %.0f%% | %lu/%lu \n", evID, percentage, processedFileSize, totFileSize);
|
||||
|
||||
lastTimeStamp = hit[fileID]->timestamp;
|
||||
//*=========================================== save file
|
||||
outRootFile->cd();
|
||||
tree->Fill();
|
||||
evID ++;
|
||||
tree->Write();
|
||||
|
||||
//*=========================================== Save timestamp as TMacro
|
||||
TMacro timeStamp;
|
||||
TString str;
|
||||
str.Form("%lu", firstTimeStamp); timeStamp.AddLine( str.Data() );
|
||||
str.Form("%lu", lastTimeStamp); timeStamp.AddLine( str.Data() );
|
||||
timeStamp.Write("timeStamp");
|
||||
|
||||
unsigned int numBlock = 0;
|
||||
for( int i = 0; i < nFile; i++){
|
||||
//printf("%d | %8ld | %10u/%10u\n", i, reader[i]->GetBlockID() + 1, reader[i]->GetFilePos(), reader[i]->GetFileSize());
|
||||
numBlock += reader[i]->GetBlockID() + 1;
|
||||
}
|
||||
|
||||
unsigned int runEndTime = getTime_us();
|
||||
double runTime = (runEndTime - runStartTime) * 1e-6;
|
||||
printf("===================================== done. \n");
|
||||
printf(" event building time : %.2f sec = %.2f min\n", runTime, runTime/60.);
|
||||
printf("Number of Block Scanned : %u\n", numBlock);
|
||||
printf(" Number of Event Built : %lld\n", evID);
|
||||
printf(" Output Root File Size : %.2f MB\n", outRootFile->GetSize()/1024./1024.);
|
||||
printf(" first timestamp : %lu \n", firstTimeStamp);
|
||||
printf(" last timestamp : %lu \n", lastTimeStamp);
|
||||
unsigned long duration = lastTimeStamp - firstTimeStamp;
|
||||
printf(" total duration : %lu = %.2f sec \n", duration, duration * tick2ns * 1.0 / 1e9 );
|
||||
printf("===================================== end of summary. \n");
|
||||
|
||||
|
||||
//^############## delete new
|
||||
for( int i = 0; i < nFile; i++) delete reader[i];
|
||||
delete [] reader;
|
||||
outRootFile->Close();
|
||||
|
||||
return 0;
|
||||
}
|
23
Aux/Makefile
Normal file
23
Aux/Makefile
Normal file
|
@ -0,0 +1,23 @@
|
|||
CC=g++
|
||||
CFLAG= -O2
|
||||
#CFLAG= -g -O0
|
||||
ROOTFLAG=`root-config --cflags --glibs`
|
||||
|
||||
OBJS = ClassDigitizer.o ClassInfluxDB.o
|
||||
|
||||
all: EventBuilder
|
||||
|
||||
EventBuilder: EventBuilder.cpp SolReader.h ../Hit.h
|
||||
$(CC) $(CFLAG) EventBuilder.cpp -o EventBuilder ${ROOTFLAG}
|
||||
|
||||
ClassDigitizer.o : ../ClassDigitizer.cpp ../ClassDigitizer.h ../RegisterAddress.h ../macro.h ../ClassData.h
|
||||
$(CC) $(COPTS) -c ../ClassDigitizer.cpp
|
||||
|
||||
ClassInfluxDB.o : ../ClassInfluxDB.cpp ../ClassInfluxDB.h
|
||||
$(CC) $(COPTS) -c ../ClassInfluxDB.cpp -lcurl
|
||||
|
||||
test: test.cpp ../ClassDigitizer2Gen.o ../ClassInfluxDB.o
|
||||
$(CC) $(CFLAG) test.cpp ../ClassDigitizer2Gen.o ../ClassInfluxDB.o -o test -lcurl -lCAEN_FELib -lX11
|
||||
|
||||
clean:
|
||||
-rm EventBuilder test
|
271
Aux/SolReader.h
Normal file
271
Aux/SolReader.h
Normal file
|
@ -0,0 +1,271 @@
|
|||
#ifndef SOLREADER_H
|
||||
#define SOLREADER_H
|
||||
|
||||
#include <stdio.h> /// for FILE
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unistd.h>
|
||||
#include <time.h> // time in nano-sec
|
||||
|
||||
#include "../Hit.h"
|
||||
|
||||
class SolReader {
|
||||
private:
|
||||
FILE * inFile;
|
||||
unsigned int inFileSize;
|
||||
unsigned int filePos;
|
||||
unsigned int totNumBlock;
|
||||
|
||||
unsigned short blockStartIdentifier;
|
||||
unsigned int numBlock;
|
||||
bool isScanned;
|
||||
|
||||
void init();
|
||||
|
||||
std::vector<unsigned int> blockPos;
|
||||
|
||||
size_t dummy;
|
||||
|
||||
public:
|
||||
SolReader();
|
||||
SolReader(std::string fileName, unsigned short dataType);
|
||||
~SolReader();
|
||||
|
||||
void OpenFile(std::string fileName);
|
||||
int ReadNextBlock(bool fastRead = false, bool debug = false);
|
||||
int ReadBlock(unsigned int index, bool verbose = false);
|
||||
|
||||
void ScanNumBlock();
|
||||
|
||||
bool IsEndOfFile() const {return (filePos >= inFileSize ? true : false);}
|
||||
unsigned int GetBlockID() const {return numBlock - 1;}
|
||||
unsigned int GetNumBlock() const {return numBlock;}
|
||||
unsigned int GetTotalNumBlock() const {return totNumBlock;}
|
||||
unsigned int GetFilePos() const {return filePos;}
|
||||
unsigned int GetFileSize() const {return inFileSize;}
|
||||
|
||||
void RewindFile();
|
||||
|
||||
Hit * hit;
|
||||
|
||||
};
|
||||
|
||||
void SolReader::init(){
|
||||
inFileSize = 0;
|
||||
numBlock = 0;
|
||||
filePos = 0;
|
||||
totNumBlock = 0;
|
||||
hit = new Hit();
|
||||
|
||||
isScanned = false;
|
||||
|
||||
blockPos.clear();
|
||||
|
||||
}
|
||||
|
||||
SolReader::SolReader(){
|
||||
init();
|
||||
}
|
||||
|
||||
SolReader::SolReader(std::string fileName, unsigned short dataType = 0){
|
||||
init();
|
||||
OpenFile(fileName);
|
||||
hit->SetDataType(dataType, DPPType::PHA);
|
||||
}
|
||||
|
||||
SolReader::~SolReader(){
|
||||
if( inFile ) fclose(inFile);
|
||||
delete hit;
|
||||
}
|
||||
|
||||
inline void SolReader::OpenFile(std::string fileName){
|
||||
inFile = fopen(fileName.c_str(), "r");
|
||||
if( inFile == NULL ){
|
||||
printf("Cannot open file : %s \n", fileName.c_str());
|
||||
}else{
|
||||
fseek(inFile, 0L, SEEK_END);
|
||||
inFileSize = ftell(inFile);
|
||||
rewind(inFile);
|
||||
}
|
||||
}
|
||||
|
||||
inline int SolReader::ReadBlock(unsigned int index, bool verbose){
|
||||
if( isScanned == false) return -1;
|
||||
if( index >= totNumBlock )return -1;
|
||||
fseek(inFile, 0L, SEEK_SET);
|
||||
|
||||
if( verbose ) printf("Block index: %u, File Pos: %u byte\n", index, blockPos[index]);
|
||||
|
||||
fseek(inFile, blockPos[index], SEEK_CUR);
|
||||
|
||||
filePos = blockPos[index];
|
||||
|
||||
numBlock = index;
|
||||
|
||||
return ReadNextBlock();
|
||||
}
|
||||
|
||||
inline int SolReader::ReadNextBlock(bool fastRead, bool debug){
|
||||
if( inFile == NULL ) return -1;
|
||||
if( feof(inFile) ) return -1;
|
||||
if( filePos >= inFileSize) return -1;
|
||||
|
||||
dummy = fread(&blockStartIdentifier, 2, 1, inFile);
|
||||
|
||||
if( (blockStartIdentifier & 0xAA00) != 0xAA00 ) {
|
||||
printf("header fail.\n");
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
if( ( blockStartIdentifier & 0xF ) == DataFormat::Raw ){
|
||||
hit->SetDataType(DataFormat::Raw, ((blockStartIdentifier >> 1) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD);
|
||||
}
|
||||
hit->dataType = blockStartIdentifier & 0xF;
|
||||
hit->DPPType = ((blockStartIdentifier >> 4) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD;
|
||||
|
||||
if( debug ) {
|
||||
printf(" DPP Type : %s \n", hit->DPPType.c_str());
|
||||
printf(" Data Type : %d \n", hit->dataType);
|
||||
}
|
||||
|
||||
if( hit->dataType == DataFormat::ALL){
|
||||
if( !fastRead ){
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
dummy = fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
dummy = fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
dummy = fread(&hit->downSampling, 1, 1, inFile);
|
||||
dummy = fread(&hit->board_fail, 1, 1, inFile);
|
||||
dummy = fread(&hit->flush, 1, 1, inFile);
|
||||
dummy = fread(&hit->trigger_threashold, 2, 1, inFile);
|
||||
dummy = fread(&hit->event_size, 8, 1, inFile);
|
||||
dummy = fread(&hit->aggCounter, 4, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 31 : 33, SEEK_CUR);
|
||||
}
|
||||
dummy = fread(&hit->traceLenght, 8, 1, inFile);
|
||||
if( !fastRead ){
|
||||
dummy = fread(hit->analog_probes_type, 2, 1, inFile);
|
||||
dummy = fread(hit->digital_probes_type, 4, 1, inFile);
|
||||
dummy = fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||
dummy = fread(hit->analog_probes[1], hit->traceLenght*4, 1, inFile);
|
||||
dummy = fread(hit->digital_probes[0], hit->traceLenght, 1, inFile);
|
||||
dummy = fread(hit->digital_probes[1], hit->traceLenght, 1, inFile);
|
||||
dummy = fread(hit->digital_probes[2], hit->traceLenght, 1, inFile);
|
||||
dummy = fread(hit->digital_probes[3], hit->traceLenght, 1, inFile);
|
||||
}else{
|
||||
dummy = fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::OneTrace){
|
||||
if( !fastRead ){
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
dummy = fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
dummy = fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
||||
}
|
||||
dummy = fread(&hit->traceLenght, 8, 1, inFile);
|
||||
if( !fastRead ){
|
||||
dummy = fread(&hit->analog_probes_type[0], 1, 1, inFile);
|
||||
dummy = fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 1 + hit->traceLenght*4, SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::NoTrace){
|
||||
if( !fastRead ){
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
dummy = fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
dummy = fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::MiniWithFineTime){
|
||||
if( !fastRead ){
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
dummy = fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 11 : 13, SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::Minimum){
|
||||
if( !fastRead ){
|
||||
dummy = fread(&hit->channel, 1, 1, inFile);
|
||||
dummy = fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) dummy = fread(&hit->energy_short, 2, 1, inFile);
|
||||
dummy = fread(&hit->timestamp, 6, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR);
|
||||
}
|
||||
|
||||
}else if( hit->dataType == DataFormat::Raw){
|
||||
dummy = fread(&hit->dataSize, 8, 1, inFile);
|
||||
if( !fastRead ){
|
||||
dummy = fread(hit->data, hit->dataSize, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->dataSize, SEEK_CUR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
numBlock ++;
|
||||
filePos = ftell(inFile);
|
||||
|
||||
if( debug ) {
|
||||
hit->PrintAll();
|
||||
printf(" file Pos : %u/%u\n", filePos, inFileSize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SolReader::RewindFile(){
|
||||
rewind(inFile);
|
||||
filePos = 0;
|
||||
numBlock = 0;
|
||||
}
|
||||
|
||||
void SolReader::ScanNumBlock(){
|
||||
if( inFile == NULL ) return;
|
||||
if( feof(inFile) ) return;
|
||||
|
||||
numBlock = 0;
|
||||
blockPos.clear();
|
||||
|
||||
blockPos.push_back(0);
|
||||
|
||||
while( ReadNextBlock(1) == 0){
|
||||
blockPos.push_back(filePos);
|
||||
printf("%u, %.2f%% %u/%u\n\033[A\r", numBlock, filePos*100./inFileSize, filePos, inFileSize);
|
||||
}
|
||||
|
||||
totNumBlock = numBlock;
|
||||
numBlock = 0;
|
||||
isScanned = true;
|
||||
printf("\nScan complete: number of data Block : %u\n", totNumBlock);
|
||||
rewind(inFile);
|
||||
filePos = 0;
|
||||
|
||||
//for( int i = 0; i < totNumBlock; i++){
|
||||
// printf("%7d | %u \n", i, blockPos[i]);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
44
Aux/netTraffic.py
Executable file
44
Aux/netTraffic.py
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import psutil
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
def calculate_speed(interface, interval=1):
|
||||
# Get the initial number of bytes sent and received
|
||||
initial_bytes_sent = psutil.net_io_counters(pernic=True)[interface].bytes_sent
|
||||
initial_bytes_recv = psutil.net_io_counters(pernic=True)[interface].bytes_recv
|
||||
|
||||
# Wait for the specified interval
|
||||
time.sleep(interval)
|
||||
|
||||
# Get the number of bytes sent and received after the interval
|
||||
final_bytes_sent = psutil.net_io_counters(pernic=True)[interface].bytes_sent
|
||||
final_bytes_recv = psutil.net_io_counters(pernic=True)[interface].bytes_recv
|
||||
|
||||
# Calculate the data speed in bytes per second
|
||||
sent_speed = final_bytes_sent - initial_bytes_sent
|
||||
recv_speed = final_bytes_recv - initial_bytes_recv
|
||||
|
||||
return sent_speed, recv_speed
|
||||
|
||||
# Define the network interface
|
||||
interface = 'enp6s0f0'
|
||||
|
||||
print("Monitoring data speed for interface: {}".format(interface))
|
||||
|
||||
# Continuous monitoring loop
|
||||
while True:
|
||||
# Calculate the data speed for the interface
|
||||
sent_speed, recv_speed = calculate_speed(interface, 6)
|
||||
|
||||
# Convert bytes
|
||||
sent_speed_mbps = sent_speed / 1024.
|
||||
recv_speed_mbps = recv_speed / 1024.
|
||||
|
||||
current_time = datetime.now().strftime("%H:%M:%S")
|
||||
|
||||
print("{}| Data speed (sent): {:10f} KiB/s (received): {:10f} KiB/s".format(current_time, sent_speed_mbps,recv_speed_mbps))
|
||||
|
||||
# Wait for one second before the next iteration
|
||||
#time.sleep(1)
|
|
@ -8,12 +8,11 @@
|
|||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
#include "ClassDigitizer2Gen.h"
|
||||
#include "influxdb.h"
|
||||
|
||||
#include "../ClassDigitizer2Gen.h"
|
||||
#include "../ClassInfluxDB.h"
|
||||
|
||||
#define maxRead 400
|
||||
|
||||
ß
|
||||
std::mutex digiMTX;
|
||||
Digitizer2Gen * digi = new Digitizer2Gen();
|
||||
InfluxDB * influx = new InfluxDB("https://fsunuc.physics.fsu.edu/influx/", false);
|
||||
|
@ -78,17 +77,29 @@ static void StatLoop(){
|
|||
|
||||
}
|
||||
|
||||
// #include <CAENDig2.h>
|
||||
// int CAENDig2_GetLibVersion(char* version);
|
||||
// void CAEN_test(){
|
||||
// printf("##########################################\n");
|
||||
// printf("\t CAEN firmware DPP-PHA testing \n");
|
||||
// printf("##########################################\n");
|
||||
// remove("haha_000.sol");
|
||||
// char version[16];
|
||||
// CAENDig2_GetLibVersion(version);
|
||||
// puts(version);
|
||||
// char haha[100];
|
||||
// CAEN_FELib_GetLibInfo(haha, 100);
|
||||
// puts(haha);
|
||||
// CAEN_FELib_GetLibVersion(version);
|
||||
// puts(version);
|
||||
|
||||
// }
|
||||
|
||||
int main(int argc, char* argv[]){
|
||||
|
||||
printf("##########################################\n");
|
||||
printf("\t CAEN firmware DPP-PHA testing \n");
|
||||
printf("##########################################\n");
|
||||
|
||||
remove("haha_000.sol");
|
||||
|
||||
//const char * url = "dig2://192.168.0.100/";
|
||||
const char * url = "dig2://192.168.0.254/";
|
||||
/*
|
||||
const char * url = "dig2://192.168.0.100/";
|
||||
//const char * url = "dig2://192.168.0.254/";
|
||||
|
||||
digi->OpenDigitizer(url);
|
||||
//digi->Reset();
|
||||
|
@ -100,6 +111,7 @@ int main(int argc, char* argv[]){
|
|||
|
||||
digi->PrintChannelSettings(0);
|
||||
|
||||
digi->ReadValue(PHA::CH::ADCToVolts, 0, true);
|
||||
|
||||
digi->SetDataFormat(DataFormat::ALL);
|
||||
|
||||
|
@ -135,9 +147,13 @@ int main(int argc, char* argv[]){
|
|||
|
||||
digi->CloseOutFile();
|
||||
|
||||
|
||||
|
||||
digi->CloseDigitizer();
|
||||
|
||||
delete digi;
|
||||
*/
|
||||
|
||||
delete influx;
|
||||
|
||||
}
|
|
@ -25,7 +25,8 @@ void Digitizer2Gen::Initialization(){
|
|||
serialNumber = 0;
|
||||
FPGAType = "";
|
||||
nChannels = 0;
|
||||
ch2ns = 0;
|
||||
tick2ns = 0;
|
||||
CupVer = 0;
|
||||
|
||||
outFileIndex = 0;
|
||||
FinishedOutFilesSize = 0;
|
||||
|
@ -45,6 +46,9 @@ void Digitizer2Gen::Initialization(){
|
|||
VGASetting[index] = PHA::VGA::VGAGain;
|
||||
LVDSSettings[index] = PHA::LVDS::AllSettings;
|
||||
}
|
||||
for( int idx = 0; idx < 16; idx ++){
|
||||
InputDelay[idx] = PHA::GROUP::InputDelay;
|
||||
}
|
||||
|
||||
//build map
|
||||
for( int i = 0; i < (int) PHA::DIG::AllSettings.size(); i++) boardMap[PHA::DIG::AllSettings[i].GetPara()] = i;
|
||||
|
@ -104,6 +108,7 @@ int Digitizer2Gen::FindIndex(const Reg para){
|
|||
case TYPE::DIG: return boardMap[para.GetPara()];
|
||||
case TYPE::VGA: return 0;
|
||||
case TYPE::LVDS: return LVDSMap[para.GetPara()];
|
||||
case TYPE::GROUP : return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -122,7 +127,7 @@ std::string Digitizer2Gen::ReadValue(const char * parameter, bool verbose){
|
|||
}
|
||||
|
||||
std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose){
|
||||
std:: string ans = ReadValue(para.GetFullPara(ch_index).c_str(), verbose);
|
||||
std:: string ans = ReadValue(para.GetFullPara(ch_index, nChannels).c_str(), verbose);
|
||||
|
||||
int index = FindIndex(para);
|
||||
switch( para.GetType()){
|
||||
|
@ -130,6 +135,7 @@ std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose
|
|||
case TYPE::DIG : boardSettings[index].SetValue(ans); break;
|
||||
case TYPE::VGA : VGASetting[ch_index].SetValue(ans); break;
|
||||
case TYPE::LVDS: LVDSSettings[ch_index][index].SetValue(ans);break;
|
||||
case TYPE::GROUP: InputDelay[ch_index].SetValue(ans); break;
|
||||
}
|
||||
|
||||
//printf("%s | %s | index %d | %s \n", para.GetFullPara(ch_index).c_str(), ans.c_str(), index, chSettings[ch_index][index].GetValue().c_str());
|
||||
|
@ -151,7 +157,7 @@ bool Digitizer2Gen::WriteValue(const char * parameter, std::string value, bool v
|
|||
}
|
||||
|
||||
bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){
|
||||
if( WriteValue(para.GetFullPara(ch_index).c_str(), value) || isDummy){
|
||||
if( WriteValue(para.GetFullPara(ch_index, nChannels).c_str(), value) || isDummy){
|
||||
int index = FindIndex(para);
|
||||
if( index != -1 ){
|
||||
switch(para.GetType()){
|
||||
|
@ -167,6 +173,7 @@ bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){
|
|||
// chSettings[ch_index][index].GetFullPara(ch_index).c_str(),
|
||||
// chSettings[ch_index][index].GetValue().c_str());
|
||||
}break;
|
||||
|
||||
case TYPE::VGA : {
|
||||
VGASetting[ch_index].SetValue(value);
|
||||
|
||||
|
@ -174,13 +181,25 @@ bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){
|
|||
// VGASetting[ch_index].GetFullPara(ch_index).c_str(),
|
||||
// VGASetting[ch_index].GetValue().c_str());
|
||||
}break;
|
||||
|
||||
case TYPE::DIG : {
|
||||
boardSettings[index].SetValue(value);
|
||||
//printf("%s %s %s |%s|\n", __func__, para.GetPara().c_str(),
|
||||
// boardSettings[index].GetFullPara(ch_index).c_str(),
|
||||
// boardSettings[index].GetValue().c_str());
|
||||
}break;
|
||||
case TYPE::LVDS : break;
|
||||
|
||||
case TYPE::LVDS : {
|
||||
LVDSSettings[ch_index][index].SetValue(value);
|
||||
}break;
|
||||
|
||||
case TYPE::GROUP : {
|
||||
InputDelay[ch_index].SetValue(value);
|
||||
// printf("%s %s %s |%s|\n", __func__, para.GetPara().c_str(),
|
||||
// InputDelay[ch_index].GetFullPara(ch_index).c_str(),
|
||||
// InputDelay[ch_index].GetValue().c_str());
|
||||
}break;
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -228,8 +247,9 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
|
|||
FPGAVer = atoi(ReadValue(PHA::DIG::CupVer).c_str());
|
||||
nChannels = atoi(ReadValue(PHA::DIG::NumberOfChannel).c_str());
|
||||
ModelName = ReadValue(PHA::DIG::ModelName);
|
||||
CupVer = atoi(ReadValue(PHA::DIG::CupVer).c_str());
|
||||
int adcRate = atoi(ReadValue(PHA::DIG::ADC_SampleRate).c_str());
|
||||
ch2ns = 1000/adcRate;
|
||||
tick2ns = 1000/adcRate;
|
||||
|
||||
printf(" IP address : %s\n", ReadValue(PHA::DIG::IPAddress).c_str());
|
||||
printf(" Net Mask : %s\n", ReadValue(PHA::DIG::NetMask).c_str());
|
||||
|
@ -238,7 +258,7 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
|
|||
printf(" DPP Type : %s (%d)\n", FPGAType.c_str(), FPGAVer);
|
||||
printf("Serial number : %d\n", serialNumber);
|
||||
printf(" ADC bits : %s\n", ReadValue(PHA::DIG::ADC_bit).c_str());
|
||||
printf(" ADC rate : %d Msps, ch2ns : %d ns\n", adcRate, ch2ns);
|
||||
printf(" ADC rate : %d Msps, tick2ns : %d ns\n", adcRate, tick2ns);
|
||||
printf(" Channels : %d\n", nChannels);
|
||||
|
||||
if( FPGAType == DPPType::PHA) {
|
||||
|
@ -246,11 +266,14 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
|
|||
printf("========== defining setting arrays for %s \n", FPGAType.c_str());
|
||||
|
||||
boardSettings = PHA::DIG::AllSettings;
|
||||
for( int ch = 0; ch < MaxNumberOfChannel ; ch ++) chSettings[ch] = PHA::CH::AllSettings;
|
||||
for( int ch = 0; ch < nChannels ; ch ++) chSettings[ch] = PHA::CH::AllSettings;
|
||||
for( int index = 0 ; index < 4; index ++) {
|
||||
VGASetting[index] = PHA::VGA::VGAGain;
|
||||
LVDSSettings[index] = PHA::LVDS::AllSettings;
|
||||
}
|
||||
for( int idx = 0; idx < 16; idx ++ ){
|
||||
InputDelay[idx] = PHA::GROUP::InputDelay;
|
||||
}
|
||||
|
||||
//build map
|
||||
for( int i = 0; i < (int) PHA::DIG::AllSettings.size(); i++) boardMap[PHA::DIG::AllSettings[i].GetPara()] = i;
|
||||
|
@ -262,11 +285,14 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
|
|||
printf("========== defining setting arrays for %s \n", FPGAType.c_str());
|
||||
|
||||
boardSettings = PSD::DIG::AllSettings;
|
||||
for( int ch = 0; ch < MaxNumberOfChannel ; ch ++) chSettings[ch] = PSD::CH::AllSettings;
|
||||
for( int ch = 0; ch < nChannels ; ch ++) chSettings[ch] = PSD::CH::AllSettings;
|
||||
for( int index = 0 ; index < 4; index ++) {
|
||||
VGASetting[index] = PSD::VGA::VGAGain;
|
||||
LVDSSettings[index] = PSD::LVDS::AllSettings;
|
||||
}
|
||||
for( int idx = 0; idx < 16; idx ++ ){
|
||||
InputDelay[idx] = PSD::GROUP::InputDelay;
|
||||
}
|
||||
|
||||
//build map
|
||||
for( int i = 0; i < (int) PSD::DIG::AllSettings.size(); i++) boardMap[PSD::DIG::AllSettings[i].GetPara()] = i;
|
||||
|
@ -445,6 +471,16 @@ void Digitizer2Gen::SetDataFormat(unsigned short dataFormat){
|
|||
]");
|
||||
}
|
||||
|
||||
if( dataFormat == DataFormat::MiniWithFineTime ){
|
||||
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||
"[ \
|
||||
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||
{ \"name\" : \"TIMESTAMP\", \"type\" : \"U64\" }, \
|
||||
{ \"name\" : \"FINE_TIMESTAMP\", \"type\" : \"U16\" }, \
|
||||
{ \"name\" : \"ENERGY\", \"type\" : \"U16\" } \
|
||||
]");
|
||||
}
|
||||
|
||||
//^===================================================== PSD
|
||||
}else if ( FPGAType == DPPType::PSD ){
|
||||
|
||||
|
@ -521,6 +557,17 @@ void Digitizer2Gen::SetDataFormat(unsigned short dataFormat){
|
|||
]");
|
||||
}
|
||||
|
||||
if( dataFormat == DataFormat::MiniWithFineTime ){
|
||||
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||
"[ \
|
||||
{ \"name\" : \"CHANNEL\", \"type\" : \"U8\" }, \
|
||||
{ \"name\" : \"TIMESTAMP\", \"type\" : \"U64\" }, \
|
||||
{ \"name\" : \"FINE_TIMESTAMP\", \"type\" : \"U16\" }, \
|
||||
{ \"name\" : \"ENERGY\", \"type\" : \"U16\" }, \
|
||||
{ \"name\" : \"ENERGY_SHORT\", \"type\" : \"U16\" } \
|
||||
]");
|
||||
}
|
||||
|
||||
if( dataFormat == DataFormat::Minimum ){
|
||||
ret = CAEN_FELib_SetReadDataFormat(ep_handle,
|
||||
"[ \
|
||||
|
@ -745,6 +792,26 @@ int Digitizer2Gen::ReadData(){
|
|||
|
||||
hit->isTraceAllZero = true;
|
||||
|
||||
}else if( hit->dataType == DataFormat::MiniWithFineTime){
|
||||
if( FPGAType == DPPType::PHA ){
|
||||
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||
&hit->channel,
|
||||
&hit->timestamp,
|
||||
&hit->fine_timestamp,
|
||||
&hit->energy
|
||||
);
|
||||
}else{
|
||||
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||
&hit->channel,
|
||||
&hit->timestamp,
|
||||
&hit->fine_timestamp,
|
||||
&hit->energy,
|
||||
&hit->energy_short
|
||||
);
|
||||
}
|
||||
|
||||
hit->isTraceAllZero = true;
|
||||
|
||||
}else if( hit->dataType == DataFormat::Minimum){
|
||||
if( FPGAType == DPPType::PHA ){
|
||||
ret = CAEN_FELib_ReadData(ep_handle, 100,
|
||||
|
@ -762,6 +829,7 @@ int Digitizer2Gen::ReadData(){
|
|||
}
|
||||
|
||||
hit->isTraceAllZero = true;
|
||||
|
||||
}else if( hit->dataType == DataFormat::Raw){
|
||||
ret = CAEN_FELib_ReadData(ep_handle, 100, hit->data, &hit->dataSize, &hit->n_events );
|
||||
//printf("data size: %lu byte\n", evt.dataSize);
|
||||
|
@ -832,6 +900,7 @@ void Digitizer2Gen::SaveDataToFile(){
|
|||
fwrite(hit->digital_probes[1], hit->traceLenght, 1, outFile);
|
||||
fwrite(hit->digital_probes[2], hit->traceLenght, 1, outFile);
|
||||
fwrite(hit->digital_probes[3], hit->traceLenght, 1, outFile);
|
||||
|
||||
}else if( hit->dataType == DataFormat::OneTrace){
|
||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||
fwrite(&hit->channel, 1, 1, outFile);
|
||||
|
@ -844,6 +913,7 @@ void Digitizer2Gen::SaveDataToFile(){
|
|||
fwrite(&hit->traceLenght, 8, 1, outFile);
|
||||
fwrite(&hit->analog_probes_type[0], 1, 1, outFile);
|
||||
fwrite(hit->analog_probes[0], hit->traceLenght*4, 1, outFile);
|
||||
|
||||
}else if( hit->dataType == DataFormat::NoTrace ){
|
||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||
fwrite(&hit->channel, 1, 1, outFile);
|
||||
|
@ -853,12 +923,22 @@ void Digitizer2Gen::SaveDataToFile(){
|
|||
fwrite(&hit->fine_timestamp, 2, 1, outFile);
|
||||
fwrite(&hit->flags_high_priority, 1, 1, outFile);
|
||||
fwrite(&hit->flags_low_priority, 2, 1, outFile);
|
||||
|
||||
}else if( hit->dataType == DataFormat::MiniWithFineTime ){
|
||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||
fwrite(&hit->channel, 1, 1, outFile);
|
||||
fwrite(&hit->energy, 2, 1, outFile);
|
||||
if( FPGAType == DPPType::PSD ) fwrite(&hit->energy_short, 2, 1, outFile);
|
||||
fwrite(&hit->timestamp, 6, 1, outFile);
|
||||
fwrite(&hit->fine_timestamp, 2, 1, outFile);
|
||||
|
||||
}else if( hit->dataType == DataFormat::Minimum ){
|
||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||
fwrite(&hit->channel, 1, 1, outFile);
|
||||
fwrite(&hit->energy, 2, 1, outFile);
|
||||
if( FPGAType == DPPType::PSD ) fwrite(&hit->energy_short, 2, 1, outFile);
|
||||
fwrite(&hit->timestamp, 6, 1, outFile);
|
||||
|
||||
}else if( hit->dataType == DataFormat::Raw){
|
||||
fwrite(&dataStartIndetifier, 2, 1, outFile);
|
||||
fwrite(&hit->dataSize, 8, 1, outFile);
|
||||
|
@ -920,14 +1000,14 @@ void Digitizer2Gen::ProgramBoard(){
|
|||
|
||||
void Digitizer2Gen::ProgramChannels(bool testPulse){
|
||||
|
||||
std::string para_prefix = "/ch/0.." + std::to_string(nChannels-1) + "/par/";
|
||||
|
||||
// Channel setting
|
||||
if( testPulse){
|
||||
WriteValue("/ch/0..63/par/ChEnable" , "false");
|
||||
WriteValue("/ch/0..63/par/ChEnable" , "true");
|
||||
WriteValue((para_prefix + "ChEnable").c_str() , "false");
|
||||
|
||||
WriteValue("/ch/0..63/par/EventTriggerSource", "GlobalTriggerSource");
|
||||
WriteValue("/ch/0..63/par/WaveTriggerSource" , "GlobalTriggerSource"); // EventTriggerSource enought
|
||||
WriteValue((para_prefix + "EventTriggerSource").c_str(), "GlobalTriggerSource");
|
||||
WriteValue((para_prefix + "WaveTriggerSource").c_str() , "GlobalTriggerSource"); // EventTriggerSource enought
|
||||
|
||||
WriteValue("/par/GlobalTriggerSource", "SwTrg | TestPulse");
|
||||
WriteValue("/par/TestPulsePeriod" , "1000000"); // 1.0 msec = 1000Hz, tested, 1 trace recording
|
||||
|
@ -938,99 +1018,100 @@ void Digitizer2Gen::ProgramChannels(bool testPulse){
|
|||
}else{
|
||||
|
||||
//======== Self trigger for each channel
|
||||
WriteValue("/ch/0..63/par/ChEnable" , "True");
|
||||
WriteValue("/ch/0..63/par/DCOffset" , "50");
|
||||
WriteValue("/ch/0..63/par/TriggerThr" , "1000");
|
||||
WriteValue("/ch/0..63/par/WaveDataSource" , "ADC_DATA");
|
||||
WriteValue("/ch/0..63/par/PulsePolarity" , "Positive");
|
||||
WriteValue("/ch/0..63/par/ChRecordLengthT" , "4096"); /// 4096 ns, S and T are not Sync
|
||||
WriteValue("/ch/0..63/par/ChPreTriggerT" , "1000");
|
||||
WriteValue((para_prefix + "ChEnable").c_str() , "True");
|
||||
|
||||
WriteValue("/ch/0..63/par/WaveSaving" , "OnRequest");
|
||||
WriteValue("/ch/0..63/par/WaveResolution" , "RES8");
|
||||
WriteValue((para_prefix + "DCOffset").c_str() , "50");
|
||||
WriteValue((para_prefix + "TriggerThr").c_str() , "1000");
|
||||
WriteValue((para_prefix + "WaveDataSource").c_str() , "ADC_DATA");
|
||||
WriteValue((para_prefix + "PulsePolarity").c_str() , "Positive");
|
||||
WriteValue((para_prefix + "ChRecordLengthT").c_str() , "4096"); /// 4096 ns, S and T are not Sync
|
||||
WriteValue((para_prefix + "ChPreTriggerT").c_str() , "1000");
|
||||
|
||||
WriteValue((para_prefix + "WaveSaving").c_str() , "OnRequest");
|
||||
WriteValue((para_prefix + "WaveResolution").c_str() , "RES8");
|
||||
|
||||
//======== Trigger setting
|
||||
WriteValue("/ch/0..63/par/EventTriggerSource" , "ChSelfTrigger");
|
||||
WriteValue("/ch/0..63/par/WaveTriggerSource" , "Disabled");
|
||||
WriteValue("/ch/0..63/par/ChannelVetoSource" , "Disabled");
|
||||
WriteValue("/ch/0..63/par/ChannelsTriggerMask" , "0x0");
|
||||
WriteValue("/ch/0..63/par/CoincidenceMask" , "Disabled");
|
||||
WriteValue("/ch/0..63/par/AntiCoincidenceMask" , "Disabled");
|
||||
WriteValue("/ch/0..63/par/CoincidenceLengthT" , "0");
|
||||
WriteValue("/ch/0..63/par/ADCVetoWidth" , "0");
|
||||
WriteValue((para_prefix + "EventTriggerSource").c_str() , "ChSelfTrigger");
|
||||
WriteValue((para_prefix + "WaveTriggerSource").c_str() , "Disabled");
|
||||
WriteValue((para_prefix + "ChannelVetoSource").c_str() , "Disabled");
|
||||
WriteValue((para_prefix + "ChannelsTriggerMask").c_str() , "0x0");
|
||||
WriteValue((para_prefix + "CoincidenceMask").c_str() , "Disabled");
|
||||
WriteValue((para_prefix + "AntiCoincidenceMask").c_str() , "Disabled");
|
||||
WriteValue((para_prefix + "CoincidenceLengthT").c_str() , "0");
|
||||
WriteValue((para_prefix + "ADCVetoWidth").c_str() , "0");
|
||||
|
||||
//======== Other Setting
|
||||
WriteValue("/ch/0..63/par/EventSelector" , "All");
|
||||
WriteValue("/ch/0..63/par/WaveSelector" , "All");
|
||||
WriteValue("/ch/0..63/par/EnergySkimLowDiscriminator" , "0");
|
||||
WriteValue("/ch/0..63/par/EnergySkimHighDiscriminator" , "65534");
|
||||
WriteValue("/ch/0..63/par/ITLConnect" , "Disabled");
|
||||
WriteValue((para_prefix + "EventSelector").c_str() , "All");
|
||||
WriteValue((para_prefix + "WaveSelector").c_str() , "All");
|
||||
WriteValue((para_prefix + "EnergySkimLowDiscriminator").c_str() , "0");
|
||||
WriteValue((para_prefix + "EnergySkimHighDiscriminator").c_str() , "65534");
|
||||
WriteValue((para_prefix + "ITLConnect").c_str() , "Disabled");
|
||||
|
||||
if( FPGAType == DPPType::PHA){
|
||||
|
||||
WriteValue("/ch/0..63/par/TimeFilterRiseTimeT" , "80"); // 80 ns
|
||||
WriteValue("/ch/0..63/par/TimeFilterRetriggerGuardT" , "80"); // 80 ns
|
||||
WriteValue((para_prefix + "TimeFilterRiseTimeT").c_str() , "80"); // 80 ns
|
||||
WriteValue((para_prefix + "TimeFilterRetriggerGuardT").c_str() , "80"); // 80 ns
|
||||
|
||||
WriteValue("/ch/0..63/par/EnergyFilterLFLimitation" , "Off");
|
||||
WriteValue((para_prefix + "EnergyFilterLFLimitation").c_str() , "Off");
|
||||
|
||||
//======== Trapezoid setting
|
||||
WriteValue("/ch/0..63/par/EnergyFilterRiseTimeT" , "496"); // 496 ns
|
||||
WriteValue("/ch/0..63/par/EnergyFilterFlatTopT" , "1600"); // 1600 ns
|
||||
WriteValue("/ch/0..63/par/EnergyFilterPoleZeroT" , "50000"); // 50 us
|
||||
WriteValue("/ch/0..63/par/EnergyFilterPeakingPosition" , "20"); // 20 % = Flatup * 20% = 320 ns
|
||||
WriteValue("/ch/0..63/par/EnergyFilterBaselineGuardT" , "800"); // 800 ns
|
||||
WriteValue("/ch/0..63/par/EnergyFilterPileupGuardT" , "80"); // 80 ns
|
||||
WriteValue("/ch/0..63/par/EnergyFilterBaselineAvg" , "Medium"); // 1024 sample
|
||||
WriteValue("/ch/0..63/par/EnergyFilterFineGain" , "1.0");
|
||||
WriteValue("/ch/0..63/par/EnergyFilterPeakingAvg" , "LowAVG");
|
||||
WriteValue((para_prefix + "EnergyFilterRiseTimeT").c_str() , "496"); // 496 ns
|
||||
WriteValue((para_prefix + "EnergyFilterFlatTopT").c_str() , "1600"); // 1600 ns
|
||||
WriteValue((para_prefix + "EnergyFilterPoleZeroT").c_str() , "50000"); // 50 us
|
||||
WriteValue((para_prefix + "EnergyFilterPeakingPosition").c_str() , "20"); // 20 % = Flatup * 20% = 320 ns
|
||||
WriteValue((para_prefix + "EnergyFilterBaselineGuardT").c_str() , "800"); // 800 ns
|
||||
WriteValue((para_prefix + "EnergyFilterPileupGuardT").c_str() , "80"); // 80 ns
|
||||
WriteValue((para_prefix + "EnergyFilterBaselineAvg").c_str() , "Medium"); // 1024 sample
|
||||
WriteValue((para_prefix + "EnergyFilterFineGain").c_str() , "1.0");
|
||||
WriteValue((para_prefix + "EnergyFilterPeakingAvg").c_str() , "LowAVG");
|
||||
|
||||
//======== Probe Setting
|
||||
WriteValue("/ch/0..63/par/WaveAnalogProbe0" , "ADCInput");
|
||||
WriteValue("/ch/0..63/par/WaveAnalogProbe1" , "EnergyFilterMinusBaseline");
|
||||
WriteValue("/ch/0..63/par/WaveDigitalProbe0" , "Trigger");
|
||||
WriteValue("/ch/0..63/par/WaveDigitalProbe1" , "EnergyFilterPeaking");
|
||||
WriteValue("/ch/0..63/par/WaveDigitalProbe2" , "TimeFilterArmed");
|
||||
WriteValue("/ch/0..63/par/WaveDigitalProbe3" , "EnergyFilterPeakReady");
|
||||
WriteValue((para_prefix + "WaveAnalogProbe0").c_str() , "ADCInput");
|
||||
WriteValue((para_prefix + "WaveAnalogProbe1").c_str() , "EnergyFilterMinusBaseline");
|
||||
WriteValue((para_prefix + "WaveDigitalProbe0").c_str() , "Trigger");
|
||||
WriteValue((para_prefix + "WaveDigitalProbe1").c_str() , "EnergyFilterPeaking");
|
||||
WriteValue((para_prefix + "WaveDigitalProbe2").c_str() , "TimeFilterArmed");
|
||||
WriteValue((para_prefix + "WaveDigitalProbe3").c_str() , "EnergyFilterPeakReady");
|
||||
|
||||
}
|
||||
|
||||
if( FPGAType == DPPType::PSD ){
|
||||
|
||||
WriteValue("/ch/0..63/par/WaveAnalogProbe0" , "ADCInput");
|
||||
WriteValue("/ch/0..63/par/WaveAnalogProbe1" , "CFDFilter");
|
||||
WriteValue("/ch/0..63/par/WaveDigitalProbe0" , "Trigger");
|
||||
WriteValue("/ch/0..63/par/WaveDigitalProbe1" , "LongGate");
|
||||
WriteValue("/ch/0..63/par/WaveDigitalProbe2" , "ShortGate");
|
||||
WriteValue("/ch/0..63/par/WaveDigitalProbe3" , "ChargeReady");
|
||||
WriteValue((para_prefix + "WaveAnalogProbe0").c_str() , "ADCInput");
|
||||
WriteValue((para_prefix + "WaveAnalogProbe1").c_str() , "CFDFilter");
|
||||
WriteValue((para_prefix + "WaveDigitalProbe0").c_str() , "Trigger");
|
||||
WriteValue((para_prefix + "WaveDigitalProbe1").c_str() , "LongGate");
|
||||
WriteValue((para_prefix + "WaveDigitalProbe2").c_str() , "ShortGate");
|
||||
WriteValue((para_prefix + "WaveDigitalProbe3").c_str() , "ChargeReady");
|
||||
|
||||
//=========== QDC
|
||||
WriteValue("/ch/0..63/par/GateLongLengthT" , "400");
|
||||
WriteValue("/ch/0..63/par/GateShortLengthT" , "100");
|
||||
WriteValue("/ch/0..63/par/GateOffsetT" , "50");
|
||||
WriteValue("/ch/0..63/par/LongChargeIntegratorPedestal" , "0");
|
||||
WriteValue("/ch/0..63/par/ShortChargeIntegratorPedestal" , "0");
|
||||
WriteValue("/ch/0..63/par/EnergyGain" , "x1");
|
||||
WriteValue((para_prefix + "GateLongLengthT").c_str() , "400");
|
||||
WriteValue((para_prefix + "GateShortLengthT").c_str() , "100");
|
||||
WriteValue((para_prefix + "GateOffsetT").c_str() , "50");
|
||||
WriteValue((para_prefix + "LongChargeIntegratorPedestal").c_str() , "0");
|
||||
WriteValue((para_prefix + "ShortChargeIntegratorPedestal").c_str() , "0");
|
||||
WriteValue((para_prefix + "EnergyGain").c_str() , "x1");
|
||||
|
||||
//=========== Discrimination
|
||||
WriteValue("/ch/0..63/par/TriggerFilterSelection" , "LeadingEdge");
|
||||
WriteValue("/ch/0..63/par/CFDDelayT" , "32");
|
||||
WriteValue("/ch/0..63/par/CFDFraction" , "25");
|
||||
WriteValue("/ch/0..63/par/TimeFilterSmoothing" , "Disabled");
|
||||
WriteValue("/ch/0..63/par/ChargeSmoothing" , "Disabled");
|
||||
WriteValue("/ch/0..63/par/SmoothingFactor" , "1");
|
||||
WriteValue("/ch/0..63/par/PileupGap" , "1000");
|
||||
WriteValue((para_prefix + "TriggerFilterSelection").c_str() , "LeadingEdge");
|
||||
WriteValue((para_prefix + "CFDDelayT").c_str() , "32");
|
||||
WriteValue((para_prefix + "CFDFraction").c_str() , "25");
|
||||
WriteValue((para_prefix + "TimeFilterSmoothing").c_str() , "Disabled");
|
||||
WriteValue((para_prefix + "ChargeSmoothing").c_str() , "Disabled");
|
||||
WriteValue((para_prefix + "SmoothingFactor").c_str() , "1");
|
||||
WriteValue((para_prefix + "PileupGap").c_str() , "1000");
|
||||
|
||||
//=========== Input
|
||||
WriteValue("/ch/0..63/par/ADCInputBaselineAvg" , "MediumHigh");
|
||||
WriteValue("/ch/0..63/par/AbsoluteBaseline" , "1000");
|
||||
WriteValue("/ch/0..63/par/ADCInputBaselineGuardT" , "0");
|
||||
WriteValue("/ch/0..63/par/TimeFilterRetriggerGuardT" , "0");
|
||||
WriteValue("/ch/0..63/par/TriggerHysteresis" , "Enabled");
|
||||
WriteValue((para_prefix + "ADCInputBaselineAvg").c_str() , "MediumHigh");
|
||||
WriteValue((para_prefix + "AbsoluteBaseline").c_str() , "1000");
|
||||
WriteValue((para_prefix + "ADCInputBaselineGuardT").c_str() , "0");
|
||||
WriteValue((para_prefix + "TimeFilterRetriggerGuardT").c_str() , "8");
|
||||
WriteValue((para_prefix + "TriggerHysteresis").c_str() , "Enabled");
|
||||
|
||||
//========== Other
|
||||
WriteValue("/ch/0..63/par/NeutronThreshold" , "0");
|
||||
WriteValue("/ch/0..63/par/EventNeutronReject" , "Disabled");
|
||||
WriteValue("/ch/0..63/par/WaveNeutronReject" , "Disabled");
|
||||
WriteValue((para_prefix + "NeutronThreshold").c_str() , "0");
|
||||
WriteValue((para_prefix + "EventNeutronReject").c_str() , "Disabled");
|
||||
WriteValue((para_prefix + "WaveNeutronReject").c_str() , "Disabled");
|
||||
|
||||
}
|
||||
|
||||
|
@ -1066,6 +1147,14 @@ void Digitizer2Gen::PrintBoardSettings(){
|
|||
}
|
||||
}
|
||||
|
||||
if( CupVer >= 2023091800 ){
|
||||
for(int idx = 0; idx < 16 ; idx ++ ){
|
||||
printf("%-45s %d %s\n", InputDelay[idx].GetFullPara(idx).c_str(),
|
||||
InputDelay[idx].ReadWrite(),
|
||||
InputDelay[idx].GetValue().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
for( int i = 0; i < (int) LVDSSettings[0].size(); i++){
|
||||
for( int index = 0; index < 4; index++){
|
||||
if( LVDSSettings[index][i].ReadWrite() == RW::WriteOnly) continue;
|
||||
|
@ -1081,7 +1170,7 @@ void Digitizer2Gen::PrintChannelSettings(unsigned short ch){
|
|||
|
||||
for( int i = 0; i < (int) chSettings[0].size(); i++){
|
||||
if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue;
|
||||
printf("%-45s %d %s\n", chSettings[ch][i].GetFullPara(ch).c_str(),
|
||||
printf("%-45s %d %s\n", chSettings[ch][i].GetFullPara(ch, nChannels).c_str(),
|
||||
chSettings[ch][i].ReadWrite(),
|
||||
chSettings[ch][i].GetValue().c_str());
|
||||
}
|
||||
|
@ -1111,13 +1200,11 @@ void Digitizer2Gen::ReadAllSettings(){
|
|||
if( boardSettings[i].ReadWrite() == RW::WriteOnly) continue;
|
||||
|
||||
// here TempSens is same for PHA and PSD
|
||||
if( !(ModelName == "VX2745") &&
|
||||
(boardSettings[i].GetPara() == PHA::DIG::TempSensADC1.GetPara() ||
|
||||
boardSettings[i].GetPara() == PHA::DIG::TempSensADC2.GetPara() ||
|
||||
boardSettings[i].GetPara() == PHA::DIG::TempSensADC3.GetPara() ||
|
||||
boardSettings[i].GetPara() == PHA::DIG::TempSensADC4.GetPara() ||
|
||||
boardSettings[i].GetPara() == PHA::DIG::TempSensADC5.GetPara() ||
|
||||
boardSettings[i].GetPara() == PHA::DIG::TempSensADC6.GetPara()
|
||||
if( ModelName == "VX2740" && boardSettings[i].GetPara() != PHA::DIG::TempSensADC0.GetPara()) continue;
|
||||
|
||||
if( ModelName != "VX2740" &&
|
||||
(boardSettings[i].GetPara() == PHA::DIG::FreqSensCore.GetPara() ||
|
||||
boardSettings[i].GetPara() == PHA::DIG::DutyCycleSensDCDC.GetPara()
|
||||
)
|
||||
) continue;
|
||||
ReadValue(boardSettings[i]);
|
||||
|
@ -1125,6 +1212,10 @@ void Digitizer2Gen::ReadAllSettings(){
|
|||
|
||||
if( ModelName == "VX2745") for(int i = 0; i < 4 ; i ++) ReadValue(VGASetting[i], i);
|
||||
|
||||
if( ModelName != "VX2730"){
|
||||
if( CupVer >= 2023091800 ) for( int idx = 0; idx < 16; idx++) ReadValue(InputDelay[idx], idx, false);
|
||||
}
|
||||
|
||||
for( int index = 0; index < 4; index++){
|
||||
for( int i = 0; i < (int) LVDSSettings[index].size(); i++){
|
||||
if( LVDSSettings[index][i].ReadWrite() == RW::WriteOnly) continue;
|
||||
|
@ -1136,6 +1227,7 @@ void Digitizer2Gen::ReadAllSettings(){
|
|||
for(int ch = 0; ch < nChannels ; ch++ ){
|
||||
for( int i = 0; i < (int) chSettings[ch].size(); i++){
|
||||
if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue;
|
||||
if( ModelName != "VX2730" && chSettings[ch][i].GetPara() == PSD::CH::ChGain.GetPara()) continue;
|
||||
ReadValue(chSettings[ch][i], ch);
|
||||
}
|
||||
}
|
||||
|
@ -1181,6 +1273,21 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
|||
count ++;
|
||||
}
|
||||
|
||||
if( CupVer >= 2023091800 ){
|
||||
for( int idx = 0; idx < 16; idx ++){
|
||||
totCount ++;
|
||||
if( InputDelay[idx].GetValue() == "" ) {
|
||||
printf(" No value for %s \n", InputDelay[idx].GetPara().c_str());
|
||||
continue;
|
||||
}
|
||||
fprintf(saveFile, "%-45s!%d!%4d!%s\n", InputDelay[idx].GetFullPara(idx).c_str(),
|
||||
InputDelay[idx].ReadWrite(),
|
||||
9050 + idx,
|
||||
InputDelay[idx].GetValue().c_str());
|
||||
count ++;
|
||||
}
|
||||
}
|
||||
|
||||
if( ModelName == "VX2745" && FPGAType == DPPType::PHA) {
|
||||
for(int i = 0; i < 4 ; i ++){
|
||||
totCount ++;
|
||||
|
@ -1220,7 +1327,7 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
|
|||
printf("[%i] No value for %s , ch-%02d\n", i, chSettings[ch][i].GetPara().c_str(), ch);
|
||||
continue;
|
||||
}
|
||||
fprintf(saveFile, "%-45s!%d!%4d!%s\n", chSettings[ch][i].GetFullPara(ch).c_str(),
|
||||
fprintf(saveFile, "%-45s!%d!%4d!%s\n", chSettings[ch][i].GetFullPara(ch, nChannels).c_str(),
|
||||
chSettings[ch][i].ReadWrite(),
|
||||
ch*100 + i,
|
||||
chSettings[ch][i].GetValue().c_str());
|
||||
|
@ -1261,6 +1368,7 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
|
|||
FILE * loadFile = fopen(settingFileName.c_str(), "r");
|
||||
|
||||
if( loadFile ){
|
||||
printf("Opened %s\n", settingFileName.c_str());
|
||||
char * para = new char[100];
|
||||
char * readWrite = new char[100];
|
||||
char * idStr = new char[100];
|
||||
|
@ -1312,8 +1420,10 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
|
|||
//printf("%s|%d|%d|%s\n", boardSettings[id-8000].GetFullPara().c_str(),
|
||||
// boardSettings[id-8000].ReadWrite(), id,
|
||||
// boardSettings[id-8000].GetValue().c_str());
|
||||
}else{ // vga
|
||||
}else if ( 9000 <= id && id < 9050){ // vga
|
||||
VGASetting[id - 9000].SetValue(value);
|
||||
}else{ // group
|
||||
if( CupVer >= 2023091800 ) InputDelay[id - 9050].SetValue(value);
|
||||
}
|
||||
//printf("%s|%s|%d|%s|\n", para, readWrite, id, value);
|
||||
if( std::strcmp(readWrite, "2") == 0 && isConnected) WriteValue(para, value, false);
|
||||
|
@ -1326,20 +1436,21 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
|
|||
|
||||
return true;
|
||||
}else{
|
||||
//printf("Fail to load file %s\n", loadFileName);
|
||||
printf("Fail to opened %s\n", settingFileName.c_str());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
std::string Digitizer2Gen::GetSettingValue(const Reg para, unsigned int ch_index) {
|
||||
std::string Digitizer2Gen::GetSettingValueFromMemory(const Reg para, unsigned int ch_index) {
|
||||
int index = FindIndex(para);
|
||||
switch (para.GetType()){
|
||||
case TYPE::DIG: return boardSettings[index].GetValue();
|
||||
case TYPE::CH: return chSettings[ch_index][index].GetValue();
|
||||
case TYPE::VGA: return VGASetting[ch_index].GetValue();
|
||||
case TYPE::LVDS: return LVDSSettings[ch_index][index].GetValue();
|
||||
case TYPE::GROUP: return InputDelay[ch_index].GetValue();
|
||||
default : return "invalid";
|
||||
}
|
||||
return "no such parameter";
|
||||
|
|
|
@ -5,13 +5,14 @@
|
|||
#include <CAEN_FELib.h>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Hit.h"
|
||||
|
||||
#define MaxOutFileSize 2*1024*1024*1024 //2GB
|
||||
//#define MaxOutFileSize 20*1024*1024 //20MB
|
||||
#define MaxNumberOfChannel 64
|
||||
#define MaxNumberOfGroup 16
|
||||
|
||||
#include "DigiParameters.h"
|
||||
|
||||
|
@ -32,10 +33,11 @@ class Digitizer2Gen {
|
|||
char retValue[256];
|
||||
|
||||
unsigned short serialNumber;
|
||||
unsigned int CupVer;
|
||||
std::string FPGAType; // look the DigitiParameter.h::PHA::DIG::FirwareType, DPP_PHA, DPP_ZLE, DPP_PSD, DPP_DAW, DPP_OPEN, and Scope
|
||||
unsigned int FPGAVer; // for checking copy setting
|
||||
unsigned short nChannels;
|
||||
unsigned short ch2ns;
|
||||
unsigned short tick2ns;
|
||||
std::string ModelName;
|
||||
|
||||
void Initialization();
|
||||
|
@ -62,10 +64,11 @@ class Digitizer2Gen {
|
|||
std::vector<Reg> chSettings[MaxNumberOfChannel];
|
||||
std::vector<Reg> LVDSSettings[4];
|
||||
Reg VGASetting[4];
|
||||
Reg InputDelay[16];
|
||||
|
||||
std::map<std::string, int> boardMap;
|
||||
std::map<std::string, int> LVDSMap;
|
||||
std::map<std::string, int> chMap;
|
||||
std::unordered_map<std::string, int> boardMap;
|
||||
std::unordered_map<std::string, int> LVDSMap;
|
||||
std::unordered_map<std::string, int> chMap;
|
||||
|
||||
public:
|
||||
Digitizer2Gen();
|
||||
|
@ -75,6 +78,7 @@ class Digitizer2Gen {
|
|||
std::string GetFPGAType() const {return FPGAType;}
|
||||
std::string GetModelName() const {return ModelName;}
|
||||
unsigned int GetFPGAVersion() const {return FPGAVer;}
|
||||
unsigned int GetCupVer() const {return CupVer;}
|
||||
|
||||
void SetDummy(unsigned short sn);
|
||||
bool IsDummy() const {return isDummy;}
|
||||
|
@ -97,7 +101,7 @@ class Digitizer2Gen {
|
|||
void SendCommand(std::string shortPara);
|
||||
|
||||
int FindIndex(const Reg para); // get index from DIGIPARA
|
||||
std::string GetSettingValue(const Reg para, unsigned int ch_index = 0); // read from memory
|
||||
std::string GetSettingValueFromMemory(const Reg para, unsigned int ch_index = 0); // read from memory
|
||||
|
||||
|
||||
std::string ErrorMsg(const char * funcName);
|
||||
|
@ -122,7 +126,7 @@ class Digitizer2Gen {
|
|||
void PrintChannelSettings(unsigned short ch);
|
||||
|
||||
unsigned short GetNChannels() const {return nChannels;}
|
||||
unsigned short GetCh2ns() const {return ch2ns;}
|
||||
unsigned short GetTick2ns() const {return tick2ns;}
|
||||
uint64_t GetHandle() const {return handle;}
|
||||
|
||||
Hit *hit; // should be hit[MaxNumber], when full or stopACQ, save into file
|
||||
|
|
267
ClassInfluxDB.cpp
Normal file
267
ClassInfluxDB.cpp
Normal file
|
@ -0,0 +1,267 @@
|
|||
#include "ClassInfluxDB.h"
|
||||
|
||||
#include <regex>
|
||||
|
||||
InfluxDB::InfluxDB(){
|
||||
curl = curl_easy_init();
|
||||
databaseIP = "";
|
||||
respondCode = 0;
|
||||
dataPoints = "";
|
||||
headers = nullptr;
|
||||
influxVersionStr = "";
|
||||
influxVersion = -1;
|
||||
token = "";
|
||||
connectionOK = false;
|
||||
}
|
||||
|
||||
InfluxDB::InfluxDB(std::string url, bool verbose){
|
||||
curl = curl_easy_init();
|
||||
if( verbose) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||
SetURL(url);
|
||||
respondCode = 0;
|
||||
dataPoints = "";
|
||||
headers = nullptr;
|
||||
influxVersionStr = "";
|
||||
influxVersion = -1;
|
||||
token = "";
|
||||
connectionOK = false;
|
||||
}
|
||||
|
||||
InfluxDB::~InfluxDB(){
|
||||
curl_slist_free_all(headers);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
void InfluxDB::SetURL(std::string url){
|
||||
// check the last char of url is "/"
|
||||
if( url.back() != '/') {
|
||||
this->databaseIP = url + "/";
|
||||
}else{
|
||||
this->databaseIP = url;
|
||||
}
|
||||
}
|
||||
|
||||
void InfluxDB::SetToken(std::string token){
|
||||
this->token = token;
|
||||
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(debug);
|
||||
if( respond != CURLE_OK ) return false;
|
||||
connectionOK = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string InfluxDB::CheckInfluxVersion(bool debug){
|
||||
curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "ping").c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, NULL);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADER, 1);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallBack);
|
||||
std::string respondStr;
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &respondStr);
|
||||
|
||||
Execute();
|
||||
|
||||
if( respond != CURLE_OK) return "CURL Error.";
|
||||
|
||||
if( debug) printf("%s\n", respondStr.c_str());
|
||||
|
||||
//Find Version from readBuffer
|
||||
std::regex pattern(R"(X-Influxdb-Version: (.*))");
|
||||
std::smatch match;
|
||||
|
||||
if (regex_search(respondStr, match, pattern)) {
|
||||
influxVersionStr = match[1];
|
||||
|
||||
size_t dotPosition = influxVersionStr.find('.');
|
||||
if( dotPosition != std::string::npos){
|
||||
influxVersion = atoi(influxVersionStr.substr(dotPosition-1, 1).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
// printf("Influx Version : %s | %u\n", influxVersionStr.c_str(), influxVersion);
|
||||
|
||||
return respondStr;
|
||||
|
||||
}
|
||||
|
||||
std::string InfluxDB::CheckDatabases(){
|
||||
if( ! connectionOK ) return "no connection. try TestConnection() again.";
|
||||
if( influxVersion == 2 && token.empty() ) return "token no provided, abort.";
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "query").c_str());
|
||||
|
||||
std::string postFields="q=Show databases";
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(postFields.length()));
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postFields.c_str());
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallBack);
|
||||
std::string respondStr;
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &respondStr);
|
||||
|
||||
Execute();
|
||||
|
||||
//printf("|%s|\n", respondStr.c_str());
|
||||
|
||||
if( respond != CURLE_OK) return "CURL Error.";
|
||||
|
||||
databaseList.clear();
|
||||
|
||||
// Split the input string into lines
|
||||
std::istringstream iss(respondStr);
|
||||
std::vector<std::string> lines;
|
||||
std::string line;
|
||||
// printf("==== InfluxDB::CheckDatabases()\n");
|
||||
while (std::getline(iss, line)) {
|
||||
// printf("%s\n", line.c_str());
|
||||
lines.push_back(line);
|
||||
}
|
||||
|
||||
// Extract the third column from each line and store it in a vector
|
||||
std::vector<std::string> thirdColumn;
|
||||
for (const auto& l : lines) {
|
||||
std::istringstream lineIss(l);
|
||||
std::string token;
|
||||
for (int i = 0; std::getline(lineIss, token, ','); ++i) {
|
||||
if (i == 2) { // Third column
|
||||
databaseList.push_back(token);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// {//============ when output is JSON
|
||||
// size_t pos = readBuffer.find("values");
|
||||
// if( pos > 0 ){
|
||||
// std::string kaka = readBuffer.substr(pos+8);
|
||||
// pos = kaka.find("}");
|
||||
// kaka = kaka.substr(0, pos);
|
||||
// int len = kaka.length();
|
||||
// bool startFlag = false;
|
||||
// std::string lala;
|
||||
// char yaya = '"';
|
||||
// for( int i = 0; i < len; i++){
|
||||
// if( startFlag == false && kaka[i] == yaya ) {
|
||||
// startFlag = true;
|
||||
// lala = "";
|
||||
// continue;
|
||||
// }
|
||||
// if( startFlag && kaka[i] == yaya ){
|
||||
// startFlag = false;
|
||||
// databaseList.push_back(lala);
|
||||
// continue;
|
||||
// }
|
||||
// if( startFlag ) lala += kaka[i];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return respondStr;
|
||||
|
||||
}
|
||||
|
||||
void InfluxDB::PrintDataBaseList(){
|
||||
for( size_t i = 0; i < databaseList.size(); i++){
|
||||
printf("%2ld| %s\n", i, databaseList[i].c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string InfluxDB::Query(std::string databaseName, std::string influxQL_query){
|
||||
if( ! connectionOK ) return "no connection. try TestConnection() again.";
|
||||
if( influxVersion == 2 && token.empty() ) return "token no provided, abort.";
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "query?db=" + databaseName).c_str());
|
||||
|
||||
std::string postFields = "q=" + influxQL_query;
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(postFields.length()));
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postFields.c_str());
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallBack);
|
||||
std::string respondStr;
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &respondStr);
|
||||
|
||||
Execute();
|
||||
|
||||
//printf("|%s|\n", readBuffer.c_str());
|
||||
|
||||
return respondStr;
|
||||
}
|
||||
|
||||
void InfluxDB::CreateDatabase(std::string databaseName){
|
||||
if( ! connectionOK ) return ;
|
||||
if( influxVersion == 2 && token.empty() ) return;
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "query").c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
|
||||
|
||||
std::string postFields = "q=CREATE DATABASE " + databaseName;
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(postFields.length()));
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postFields.c_str());
|
||||
|
||||
Execute();
|
||||
}
|
||||
|
||||
void InfluxDB::AddDataPoint(std::string fullString){
|
||||
// printf(" InfluxDB::%s |%s| \n", __func__, fullString.c_str());
|
||||
dataPoints += fullString + "\n";
|
||||
}
|
||||
|
||||
void InfluxDB::ClearDataPointsBuffer(){
|
||||
// printf(" InfluxDB::%s \n", __func__);
|
||||
dataPoints = "";
|
||||
}
|
||||
|
||||
void InfluxDB::PrintDataPoints(){
|
||||
// printf(" InfluxDB::%s \n", __func__);
|
||||
printf("%s\n", dataPoints.c_str());
|
||||
}
|
||||
|
||||
void InfluxDB::WriteData(std::string databaseName){
|
||||
if( ! connectionOK ) return ;
|
||||
if( influxVersion == 2 && token.empty() ) return;
|
||||
|
||||
// printf(" InfluxDB::%s \n", __func__);
|
||||
if( dataPoints.length() == 0 ) return;
|
||||
//printf("|%s|\n", (databaseIP + "write?db=" + databaseName).c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "write?db=" + databaseName).c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(dataPoints.length()));
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, dataPoints.c_str());
|
||||
Execute();
|
||||
}
|
||||
|
||||
void InfluxDB::Execute(){
|
||||
// printf(" InfluxDB::%s \n", __func__);
|
||||
try{
|
||||
respond = curl_easy_perform(curl);
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &respondCode);
|
||||
//printf("==== respond %d (OK = %d)\n", respond, CURLE_OK);
|
||||
if( respond != CURLE_OK ) printf("############# InfluxDB::Execute fail | %ld\n", respondCode);
|
||||
} catch (std::exception& e){ // in case of unexpected error
|
||||
printf("%s\n", e.what());
|
||||
respond = CURLE_SEND_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
size_t InfluxDB::WriteCallBack(char *contents, size_t size, size_t nmemb, void *userp){
|
||||
// printf(" InfluxDB::%s \n", __func__);
|
||||
((std::string*)userp)->append((char*)contents, size * nmemb);
|
||||
return size * nmemb;
|
||||
}
|
|
@ -10,32 +10,45 @@
|
|||
class InfluxDB{
|
||||
private:
|
||||
|
||||
bool isURLValid;
|
||||
|
||||
CURL * curl;
|
||||
CURLcode respond;
|
||||
long respondCode;
|
||||
|
||||
std::string databaseIP;
|
||||
std::string dataPoints;
|
||||
std::string token;
|
||||
|
||||
struct curl_slist * headers;
|
||||
|
||||
std::vector<std::string> databaseList;
|
||||
|
||||
unsigned short influxVersion;
|
||||
std::string influxVersionStr;
|
||||
|
||||
bool connectionOK;
|
||||
|
||||
static size_t WriteCallBack(char *contents, size_t size, size_t nmemb, void *userp);
|
||||
|
||||
void Execute();
|
||||
|
||||
public:
|
||||
/// url = https://fsunuc.physics.fsu.edu/InfluxDB/
|
||||
|
||||
InfluxDB(std::string url, bool verbose = false);
|
||||
InfluxDB();
|
||||
~InfluxDB();
|
||||
|
||||
void SetURL(std::string url);
|
||||
bool TestingConnection();
|
||||
bool IsURLValid() const {return isURLValid;}
|
||||
void SetToken(std::string token);
|
||||
bool TestingConnection(bool debug = false);
|
||||
bool IsConnectionOK() const {return connectionOK;}
|
||||
|
||||
/// Query
|
||||
unsigned short GetVersionNo() const {return influxVersion;}
|
||||
std::string GetVersionString() const {return influxVersionStr;}
|
||||
|
||||
/// Query, query will be in CSV format
|
||||
std::string CheckInfluxVersion(bool debug = false);
|
||||
std::string CheckDatabases(); /// this save the list of database into databaseList
|
||||
void PrintDataBaseList();
|
||||
std::string Query(std::string databaseName, std::string query);
|
||||
|
||||
/// the CheckDatabases() function must be called before
|
|
@ -19,12 +19,15 @@ public:
|
|||
this->ID = digiID;
|
||||
isSaveData = false;
|
||||
stop = false;
|
||||
// canSendMsg = true;
|
||||
}
|
||||
// void SuppressFileSizeMsg() {canSendMsg = false;}
|
||||
void Stop(){ this->stop = true;}
|
||||
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
||||
void run(){
|
||||
// canSendMsg = true;
|
||||
stop = false;
|
||||
clock_gettime(CLOCK_REALTIME, &ta);
|
||||
// clock_gettime(CLOCK_REALTIME, &ta);
|
||||
emit sendMsg("Digi-" + QString::number(digi->GetSerialNumber()) + " ReadDataThread started.");
|
||||
|
||||
while(!stop){
|
||||
|
@ -42,17 +45,17 @@ public:
|
|||
//digi->ErrorMsg("ReadDataLoop()");
|
||||
digi->hit->ClearTrace();
|
||||
}
|
||||
|
||||
if( isSaveData ){
|
||||
clock_gettime(CLOCK_REALTIME, &tb);
|
||||
if( tb.tv_sec - ta.tv_sec > 2 ) {
|
||||
emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetTotalFilesSize()/1024./1024.) + " MB");
|
||||
//emit checkFileSize();
|
||||
//double duration = tb.tv_nsec-ta.tv_nsec + tb.tv_sec*1e+9 - ta.tv_sec*1e+9;
|
||||
//printf("%4d, duration : %10.0f, %6.1f\n", readCount, duration, 1e9/duration);
|
||||
ta = tb;
|
||||
}
|
||||
}
|
||||
//
|
||||
// if( isSaveData && canSendMsg ){
|
||||
// clock_gettime(CLOCK_REALTIME, &tb);
|
||||
// if( tb.tv_sec - ta.tv_sec > 2 ) {
|
||||
// emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetTotalFilesSize()/1024./1024.) + " MB");
|
||||
// //emit checkFileSize();
|
||||
// //double duration = tb.tv_nsec-ta.tv_nsec + tb.tv_sec*1e+9 - ta.tv_sec*1e+9;
|
||||
// //printf("%4d, duration : %10.0f, %6.1f\n", readCount, duration, 1e9/duration);
|
||||
// ta = tb;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
emit sendMsg("Digi-" + QString::number(digi->GetSerialNumber()) + " ReadDataThread stopped.");
|
||||
|
@ -66,6 +69,7 @@ private:
|
|||
Digitizer2Gen * digi;
|
||||
int ID;
|
||||
timespec ta, tb;
|
||||
// bool isSaveData, stop, canSendMsg;
|
||||
bool isSaveData, stop;
|
||||
};
|
||||
|
||||
|
@ -74,7 +78,7 @@ class TimingThread : public QThread {
|
|||
Q_OBJECT
|
||||
public:
|
||||
TimingThread(QObject * parent = 0 ) : QThread(parent){
|
||||
waitTime = 20; // 10 x 100 milisec
|
||||
waitTime = 20; // 20 x 100 milisec
|
||||
stop = false;
|
||||
}
|
||||
void Stop() { this->stop = true;}
|
||||
|
@ -84,7 +88,7 @@ public:
|
|||
unsigned int count = 0;
|
||||
stop = false;
|
||||
do{
|
||||
usleep(100000);
|
||||
usleep(100000); // sleep for 100 ms
|
||||
count ++;
|
||||
if( count % waitTime == 0){
|
||||
emit TimeUp();
|
||||
|
|
154
DigiParameters.h
154
DigiParameters.h
|
@ -5,8 +5,10 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum ANSTYPE {INTEGER, FLOAT, LIST, STR, BYTE, BINARY, NONE};
|
||||
enum TYPE {CH, DIG, LVDS, VGA};
|
||||
#define MIN_VERSION_GROUP 2022122300
|
||||
|
||||
enum ANSTYPE {INTEGER, FLOAT, COMBOX, STR, BYTE, BINARY, NONE};
|
||||
enum TYPE {CH, DIG, LVDS, VGA, GROUP};
|
||||
enum RW { ReadOnly, WriteOnly, ReadWrite};
|
||||
|
||||
//^==================== Register Class
|
||||
|
@ -28,14 +30,14 @@ class Reg {
|
|||
type = TYPE::CH;
|
||||
isCmd = false;
|
||||
value = "";
|
||||
ansType = ANSTYPE::LIST;
|
||||
ansType = ANSTYPE::COMBOX;
|
||||
answerUnit = "";
|
||||
answer.clear();
|
||||
}
|
||||
Reg(std::string para, RW readwrite,
|
||||
TYPE type = TYPE::CH,
|
||||
std::vector<std::pair<std::string,std::string>> answer = {},
|
||||
ANSTYPE ansType = ANSTYPE::LIST,
|
||||
std::vector<std::pair<std::string,std::string>> answer = {}, // first = value, second = display
|
||||
ANSTYPE ansType = ANSTYPE::COMBOX,
|
||||
std::string ansUnit = "",
|
||||
bool isCmd = false){
|
||||
this->name = para;
|
||||
|
@ -49,7 +51,7 @@ class Reg {
|
|||
}
|
||||
~Reg(){};
|
||||
|
||||
void SetValue(std::string sv) { this->value = sv;}
|
||||
void SetValue(std::string sv) { value = sv;}
|
||||
std::string GetValue() const { return value;}
|
||||
RW ReadWrite() const {return readWrite;}
|
||||
TYPE GetType() const {return type;}
|
||||
|
@ -58,7 +60,7 @@ class Reg {
|
|||
std::vector<std::pair<std::string,std::string>> GetAnswers() const {return answer;}
|
||||
|
||||
std::string GetPara() const {return name;}
|
||||
std::string GetFullPara(int ch_index = -1) const {
|
||||
std::string GetFullPara(int ch_index = -1, int nChannals = MaxNumberOfChannel) const {
|
||||
switch (type){
|
||||
case TYPE::DIG:{
|
||||
if( isCmd){
|
||||
|
@ -70,10 +72,10 @@ class Reg {
|
|||
case TYPE::CH:{
|
||||
std::string haha = "/par/";
|
||||
if( isCmd ){
|
||||
haha = "/cmd/";
|
||||
haha = "/cmd/"; // for SendChSWTrigger, not in GUI
|
||||
}
|
||||
if( ch_index == -1 ){
|
||||
return "/ch/0..63" + haha + name;
|
||||
return "/ch/0.." + std::to_string(nChannals-1) + haha + name;
|
||||
}else{
|
||||
return "/ch/" + std::to_string(ch_index) + haha + name;
|
||||
}
|
||||
|
@ -92,12 +94,19 @@ class Reg {
|
|||
return "/vga/" + std::to_string(ch_index) + "/par/"+ name;
|
||||
}
|
||||
}; break;
|
||||
case TYPE::GROUP:{
|
||||
if( ch_index == -1 ){
|
||||
return "/group/0..15/par/" + name;
|
||||
}else{
|
||||
return "/group/" + std::to_string(ch_index) + "/par/" + name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return "invalid"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
operator std::string () const {return name;} // this allow Reg kaka("XYZ", true); std::string haha = kaka;
|
||||
|
||||
};
|
||||
|
@ -165,6 +174,10 @@ namespace PHA{
|
|||
const Reg ErrorFlags ("ErrorFlags", RW::ReadOnly, TYPE::DIG, {}, ANSTYPE::BINARY, "byte");
|
||||
const Reg BoardReady ("BoardReady", RW::ReadOnly, TYPE::DIG, {{"True", "No Error"}, {"False", "Error"}});
|
||||
|
||||
const Reg SPFLinkPresence ("SPFLinkPresence", RW::ReadOnly, TYPE::DIG, {{"True", "Inserted"}, {"False", "Disconnected"}});
|
||||
const Reg SPFLinkActive ("SPFLinkActive", RW::ReadOnly, TYPE::DIG, {{"True", "Active"}, {"False", "Deactive"}});
|
||||
const Reg SPFLinkProtocol ("SPFLinkProtocal", RW::ReadOnly, TYPE::DIG, {{"Eth1G", "1 GB/s"}, {"Eth10G", "10 GB/s"}, {"CONET2", "Conet2"}});
|
||||
|
||||
///============= read write
|
||||
const Reg ClockSource ("ClockSource", RW::ReadWrite, TYPE::DIG, {{"Internal", "Internal Clock 62.5 MHz"},
|
||||
{"FPClkIn", "Front Panel Clock Input"}});
|
||||
|
@ -178,7 +191,12 @@ namespace PHA{
|
|||
{"SwTrg", "Software" },
|
||||
{"GPIO", "GPIO" },
|
||||
{"TestPulse", "Test Pulse" },
|
||||
{"LVDS", "LVDS"}}, ANSTYPE::STR);
|
||||
{"LVDS", "LVDS"},
|
||||
{"ITLA", "ITL-A"},
|
||||
{"ITLB", "ITL-B"},
|
||||
{"ITLA_AND_ITLB", "ITL-A & ITL-B"},
|
||||
{"ITLA_OR_ITLB", "ITL-A || ITL-B"},
|
||||
{"UserTrg", "User custom Trigger"}}, ANSTYPE::STR);
|
||||
|
||||
const Reg BusyInSource ("BusyInSource", RW::ReadWrite, TYPE::DIG, {{"Disabled","Disabled"},
|
||||
{"SIN", "SIN"},
|
||||
|
@ -204,6 +222,7 @@ namespace PHA{
|
|||
{"SyncIn", "SyncIn Signal"},
|
||||
{"SIN", "S-IN Signal"},
|
||||
{"GPIO", "GPIO Signal"},
|
||||
{"LBinClk", "GPIO Signal"},
|
||||
{"AcceptTrg", "Acceped Trigger Signal"},
|
||||
{"TrgClk", "Trigger Clock"}});
|
||||
const Reg GPIOMode ("GPIOMode", RW::ReadWrite, TYPE::DIG, {{"Disabled", "Disabled"},
|
||||
|
@ -244,8 +263,8 @@ namespace PHA{
|
|||
const Reg PermanentClockOutDelay ("PermanentClockOutDelay", RW::ReadWrite, TYPE::DIG, {{"-18888.888", ""}, {"18888.888", ""}, {"74.074", ""}}, ANSTYPE::FLOAT, "ps");
|
||||
const Reg TestPulsePeriod ("TestPulsePeriod", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"34359738360", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg TestPulseWidth ("TestPulseWidth", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"34359738360", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg TestPulseLowLevel ("TestPulseLowLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg TestPulseHighLevel ("TestPulseHighLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg TestPulseLowLevel ("TestPulseLowLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ADC counts");
|
||||
const Reg TestPulseHighLevel ("TestPulseHighLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ADC counts");
|
||||
const Reg ErrorFlagMask ("ErrorFlagMask", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::BINARY);
|
||||
const Reg ErrorFlagDataMask ("ErrorFlagDataMask", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::BINARY);
|
||||
const Reg DACoutMode ("DACoutMode", RW::ReadWrite, TYPE::DIG, {{"Static", "DAC static level"},
|
||||
|
@ -254,6 +273,7 @@ namespace PHA{
|
|||
{"OverThrSum", "Number of Channels triggered"},
|
||||
{"Ramp", "14-bit counter"},
|
||||
{"Sin5MHz", "5 MHz Sin wave Vpp = 2V"},
|
||||
{"IPE", "Internal Pulse Emultor"},
|
||||
{"Square", "Test Pulse"}});
|
||||
const Reg DACoutStaticLevel ("DACoutStaticLevel", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"16383", ""}, {"1",""}}, ANSTYPE::INTEGER, "units");
|
||||
const Reg DACoutChSelect ("DACoutChSelect", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"64", ""}, {"1",""}}, ANSTYPE::INTEGER);
|
||||
|
@ -286,6 +306,7 @@ namespace PHA{
|
|||
const Reg SoftwareStopACQ ("SwStopAcquisition", RW::WriteOnly, TYPE::DIG, {}, ANSTYPE::NONE, "", true); // stop ACQ, whatever start source
|
||||
const Reg SendSoftwareTrigger ("SendSWTrigger", RW::WriteOnly, TYPE::DIG, {}, ANSTYPE::NONE, "", true); // only work when Swtrg in the GlobalTriggerSource
|
||||
const Reg ReloadCalibration ("ReloadCalibration", RW::WriteOnly, TYPE::DIG, {}, ANSTYPE::NONE, "", true);
|
||||
const Reg Reboot ("Reboot", RW::WriteOnly, TYPE::DIG, {}, ANSTYPE::NONE, "", true); //^ not implemented
|
||||
|
||||
|
||||
const std::vector<Reg> AllSettings = {
|
||||
|
@ -339,6 +360,9 @@ namespace PHA{
|
|||
SpeedSensFan2 ,
|
||||
ErrorFlags ,
|
||||
BoardReady ,
|
||||
// SPFLinkPresence ,
|
||||
// SPFLinkActive ,
|
||||
// SPFLinkProtocol ,
|
||||
ClockSource ,
|
||||
IO_Level ,
|
||||
StartSource ,
|
||||
|
@ -387,6 +411,10 @@ namespace PHA{
|
|||
|
||||
}
|
||||
|
||||
namespace GROUP{
|
||||
const Reg InputDelay ("InputDelay", RW::ReadWrite, TYPE::GROUP, {{"0",""}, {"32768", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
}
|
||||
|
||||
namespace VGA{
|
||||
const Reg VGAGain ("VGAGain", RW::ReadWrite, TYPE::VGA, {{"0", ""},{"40", ""}, {"0.5",""}}, ANSTYPE::INTEGER, "dB"); // VX2745 only
|
||||
}
|
||||
|
@ -409,6 +437,9 @@ namespace PHA{
|
|||
|
||||
namespace CH{
|
||||
|
||||
/// ========= command
|
||||
const Reg SendChSWTrigger ("SendChSWrigger", RW::WriteOnly, TYPE::CH, {}, ANSTYPE::NONE, "", true);
|
||||
|
||||
/// ========= red only
|
||||
const Reg SelfTrgRate ("SelfTrgRate", RW::ReadOnly, TYPE::CH, {}, ANSTYPE::INTEGER, "Hz");
|
||||
const Reg ChannelStatus ("ChStatus", RW::ReadOnly, TYPE::CH, {}, ANSTYPE::STR);
|
||||
|
@ -422,6 +453,11 @@ namespace PHA{
|
|||
const Reg ChannelWaveCount ("ChWaveCnt", RW::ReadOnly, TYPE::CH, {}, ANSTYPE::STR);
|
||||
|
||||
/// ======= read write
|
||||
//^ not impletemented in digitizer panel
|
||||
const Reg SelfTriggerWidth ("SelfTriggerWidth", RW::ReadWrite, TYPE::CH, {{"0", ""},{"6000", ""},{"8", ""}}, ANSTYPE::INTEGER, "ns"); // not sure the max
|
||||
const Reg SignalOffset ("SignalOffset", RW::ReadWrite, TYPE::CH, {{"-1000000", ""},{"1000000", ""},{"1", ""}}, ANSTYPE::INTEGER, "uV"); // not sure the max
|
||||
|
||||
//^ impletemented
|
||||
const Reg ChannelEnable ("ChEnable", RW::ReadWrite, TYPE::CH, {{"True", "Enabled"}, {"False", "Disabled"}});
|
||||
const Reg DC_Offset ("DCOffset", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"100", ""}, {"1",""}}, ANSTYPE::INTEGER, "%");
|
||||
const Reg TriggerThreshold ("TriggerThr", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8191", ""}, {"1",""}}, ANSTYPE::INTEGER);
|
||||
|
@ -432,6 +468,7 @@ namespace PHA{
|
|||
{"ADC_TEST_RAMP", "ADC produces RAMP signal"},
|
||||
{"ADC_TEST_SIN", "ADC produce SIN signal"},
|
||||
{"Ramp", "Ramp generator"},
|
||||
{"IPE", "Internal Pulse Emulator"},
|
||||
{"SquareWave", "Test Pusle (Square Wave)"} });
|
||||
const Reg RecordLength ("ChRecordLengthT", RW::ReadWrite, TYPE::CH, {{"32", ""}, {"64800", ""}, {"8",""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg PreTrigger ("ChPreTriggerT", RW::ReadWrite, TYPE::CH, {{"32", ""}, {"32000", ""}, {"8",""}}, ANSTYPE::INTEGER, "ns");
|
||||
|
@ -533,6 +570,9 @@ namespace PHA{
|
|||
{"SWTrigger", "Software Trigger"},
|
||||
{"ChSelfTrigger", "Channel Self-Trigger"},
|
||||
{"Ch64Trigger", "Channel 64-Trigger"},
|
||||
{"ITLA", "ITL-A"},
|
||||
{"ITLB", "ITL-B"},
|
||||
{"LVDS", "LVDS"},
|
||||
{"Disabled", "Disabled"}});
|
||||
const Reg ChannelsTriggerMask ("ChannelsTriggerMask", RW::ReadWrite, TYPE::CH, {}, ANSTYPE::BYTE, "64-bit" );
|
||||
const Reg ChannelVetoSource ("ChannelVetoSource", RW::ReadWrite, TYPE::CH, {{"BoardVeto", "Board Veto"},
|
||||
|
@ -547,6 +587,9 @@ namespace PHA{
|
|||
{"SWTrigger", "Software Trigger"},
|
||||
{"ChSelfTrigger", "Channel Self-Trigger"},
|
||||
{"Ch64Trigger", "Channel 64-Trigger"},
|
||||
{"ITLA", "ITL-A"},
|
||||
{"ITLB", "ITL-B"},
|
||||
{"LVDS", "LVDS"},
|
||||
{"Disabled", "Disabled"}});
|
||||
|
||||
const Reg EventSelector ("EventSelector", RW::ReadWrite, TYPE::CH, {{"All", "All"},
|
||||
|
@ -641,16 +684,19 @@ namespace PHA{
|
|||
WaveDigitalProbe2 ,
|
||||
WaveDigitalProbe3 ,
|
||||
|
||||
CoincidenceLengthSample ,
|
||||
RecordLengthSample ,
|
||||
PreTriggerSample ,
|
||||
TimeFilterRiseTimeSample ,
|
||||
TimeFilterRetriggerGuardSample ,
|
||||
EnergyFilterRiseTimeSample ,
|
||||
EnergyFilterFlatTopSample ,
|
||||
EnergyFilterPoleZeroSample ,
|
||||
EnergyFilterBaselineGuardSample ,
|
||||
EnergyFilterPileUpGuardSample
|
||||
SelfTriggerWidth ,
|
||||
SignalOffset
|
||||
|
||||
// CoincidenceLengthSample ,
|
||||
// RecordLengthSample ,
|
||||
// PreTriggerSample ,
|
||||
// TimeFilterRiseTimeSample ,
|
||||
// TimeFilterRetriggerGuardSample ,
|
||||
// EnergyFilterRiseTimeSample ,
|
||||
// EnergyFilterFlatTopSample ,
|
||||
// EnergyFilterPoleZeroSample ,
|
||||
// EnergyFilterBaselineGuardSample ,
|
||||
// EnergyFilterPileUpGuardSample
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -718,6 +764,11 @@ namespace PSD{
|
|||
const Reg ErrorFlags = PHA::DIG::ErrorFlags;
|
||||
const Reg BoardReady = PHA::DIG::BoardReady;
|
||||
|
||||
const Reg SPFLinkPresence = PHA::DIG::SPFLinkPresence;
|
||||
const Reg SPFLinkActive = PHA::DIG::SPFLinkActive;
|
||||
const Reg SPFLinkProtocol = PHA::DIG::SPFLinkProtocol;
|
||||
|
||||
|
||||
///============= read write
|
||||
//const Reg EnableClockOutBackplane ("EnClockOutP0", RW::ReadWrite, TYPE::DIG);
|
||||
const Reg ClockSource = PHA::DIG::ClockSource;
|
||||
|
@ -738,10 +789,20 @@ namespace PSD{
|
|||
const Reg EnableStatisticEvents = PHA::DIG::EnableStatisticEvents;
|
||||
const Reg VolatileClockOutDelay = PHA::DIG::VolatileClockOutDelay;
|
||||
const Reg PermanentClockOutDelay = PHA::DIG::PermanentClockOutDelay;
|
||||
|
||||
const Reg TestPulsePeriod = PHA::DIG::TestPulsePeriod;
|
||||
const Reg TestPulseWidth = PHA::DIG::TestPulseWidth;
|
||||
const Reg TestPulseLowLevel = PHA::DIG::TestPulseLowLevel;
|
||||
const Reg TestPulseHighLevel = PHA::DIG::TestPulseHighLevel;
|
||||
|
||||
// only for version >= 2024041200
|
||||
const Reg IPEAmplitude ("IPEAmplitude", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"16383", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ADC counts");
|
||||
const Reg IPEBaseline ("IPEBaseline", RW::ReadWrite, TYPE::DIG, {{"0", ""},{"16383", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ADC counts");
|
||||
const Reg IPEDecayTime ("IPEDecayTime", RW::ReadWrite, TYPE::DIG, {{"8", ""},{ "2000", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg IPERate ("IPERate", RW::ReadWrite, TYPE::DIG, {{"1", ""},{"60000", ""}, {"1", ""}}, ANSTYPE::INTEGER, "Hz");
|
||||
const Reg IPETimeMode ("IPETimeMode", RW::ReadWrite, TYPE::DIG, {{"ConstantRate", "constant rate"},
|
||||
{"Poissonian", "Poisson"}});
|
||||
|
||||
const Reg ErrorFlagMask = PHA::DIG::ErrorFlagMask;
|
||||
const Reg ErrorFlagDataMask = PHA::DIG::ErrorFlagDataMask;
|
||||
const Reg DACoutMode = PHA::DIG::DACoutMode;
|
||||
|
@ -828,6 +889,9 @@ namespace PSD{
|
|||
SpeedSensFan2 ,
|
||||
ErrorFlags ,
|
||||
BoardReady ,
|
||||
// SPFLinkPresence ,
|
||||
// SPFLinkActive ,
|
||||
// SPFLinkProtocol ,
|
||||
ClockSource ,
|
||||
IO_Level ,
|
||||
StartSource ,
|
||||
|
@ -875,6 +939,10 @@ namespace PSD{
|
|||
|
||||
}
|
||||
|
||||
namespace GROUP{
|
||||
const Reg InputDelay = PHA::GROUP::InputDelay;
|
||||
}
|
||||
|
||||
namespace VGA{
|
||||
const Reg VGAGain = PHA::VGA::VGAGain;
|
||||
}
|
||||
|
@ -893,6 +961,9 @@ namespace PSD{
|
|||
|
||||
namespace CH{
|
||||
|
||||
/// ========= command
|
||||
const Reg SendChSWTrigger ("SendChSWrigger", RW::WriteOnly, TYPE::CH, {}, ANSTYPE::NONE, "", true);
|
||||
|
||||
/// ========= red only
|
||||
const Reg SelfTrgRate = PHA::CH::SelfTrgRate;
|
||||
const Reg ChannelStatus = PHA::CH::ChannelStatus;
|
||||
|
@ -905,6 +976,17 @@ namespace PSD{
|
|||
const Reg ChannelWaveCount = PHA::CH::ChannelWaveCount;
|
||||
|
||||
/// ======= read write
|
||||
//^ not impletemented in digitizer panel
|
||||
//--- only for VX2745
|
||||
const Reg SelfTriggerWidth = PHA::CH::SelfTriggerWidth;
|
||||
|
||||
//--- for VX2730
|
||||
const Reg ChGain ("ChGain", RW::ReadWrite, TYPE::CH, {{"0", ""},{"29", ""}, {"1", ""}}, ANSTYPE::INTEGER, "dB");
|
||||
|
||||
//--- for VX2745 and VX2730
|
||||
const Reg SignalOffset = PHA::CH::SignalOffset;
|
||||
|
||||
//^ impletemented
|
||||
const Reg ChannelEnable = PHA::CH::ChannelEnable;
|
||||
const Reg DC_Offset = PHA::CH::DC_Offset;
|
||||
const Reg TriggerThreshold = PHA::CH::TriggerThreshold;
|
||||
|
@ -1023,7 +1105,7 @@ namespace PSD{
|
|||
const Reg CFDDelay ("CFDDelayT", RW::ReadWrite, TYPE::CH, {{"32", ""},{"8184", ""},{"8", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg CFDFraction ("CFDFraction", RW::ReadWrite, TYPE::CH, {{"25", ""},{"100", ""},{"0", ""}}, ANSTYPE::INTEGER, "%");
|
||||
|
||||
const Reg TimeFilterRetriggerGuard ("TimeFilterRetriggerGuardT", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8000", ""},{"8", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
const Reg TimeFilterRetriggerGuard ("TimeFilterRetriggerGuardT", RW::ReadWrite, TYPE::CH, {{"8", ""},{"8000", ""},{"8", ""}}, ANSTYPE::INTEGER, "ns");
|
||||
|
||||
const Reg TriggerHysteresis ("TriggerHysteresis", RW::ReadWrite, TYPE::CH, {{"Enabled", "Enabled"}, {"Disabled", "Disabled"}});
|
||||
const Reg PileupGap ("PileupGap", RW::ReadWrite, TYPE::CH, {{"0", ""},{"65535", ""},{"1", ""}}, ANSTYPE::INTEGER, "sample");
|
||||
|
@ -1109,17 +1191,21 @@ namespace PSD{
|
|||
WaveDigitalProbe0 , //
|
||||
WaveDigitalProbe1 , //
|
||||
WaveDigitalProbe2 , //
|
||||
WaveDigitalProbe3 , //
|
||||
WaveDigitalProbe3 ,
|
||||
|
||||
RecordLengthSample , // 21
|
||||
PreTriggerSample , // 22
|
||||
CoincidenceLengthSample , //
|
||||
ADCInputBaselineGuardSample,
|
||||
CFDDelaySample ,
|
||||
TimeFilterRetriggerGuardSample,
|
||||
GateLongLengthSample ,
|
||||
GateShortLengthSample ,
|
||||
GateOffsetSample
|
||||
SelfTriggerWidth ,
|
||||
SignalOffset ,
|
||||
ChGain
|
||||
|
||||
// RecordLengthSample , // 21
|
||||
// PreTriggerSample , // 22
|
||||
// CoincidenceLengthSample , //
|
||||
// ADCInputBaselineGuardSample,
|
||||
// CFDDelaySample ,
|
||||
// TimeFilterRetriggerGuardSample,
|
||||
// GateLongLengthSample ,
|
||||
// GateShortLengthSample ,
|
||||
// GateOffsetSample
|
||||
};
|
||||
|
||||
}
|
||||
|
|
14
Hit.h
14
Hit.h
|
@ -14,6 +14,7 @@ enum DataFormat{
|
|||
OneTrace = 0x01,
|
||||
NoTrace = 0x02,
|
||||
Minimum = 0x03,
|
||||
MiniWithFineTime = 0x04,
|
||||
Raw = 0x0A,
|
||||
|
||||
};
|
||||
|
@ -36,7 +37,7 @@ class Hit {
|
|||
uint16_t energy; // 16 bit
|
||||
uint16_t energy_short; // 16 bit, only for PSD
|
||||
uint64_t timestamp; // 48 bit
|
||||
uint16_t fine_timestamp; // 16 bit
|
||||
uint16_t fine_timestamp; // 10 bit
|
||||
uint16_t flags_low_priority; // 12 bit
|
||||
uint16_t flags_high_priority; // 8 bit
|
||||
size_t traceLenght; // 64 bit
|
||||
|
@ -240,6 +241,7 @@ class Hit {
|
|||
case DataFormat::ALL : printf("============= Type : ALL\n"); break;
|
||||
case DataFormat::OneTrace : printf("============= Type : OneTrace\n"); break;
|
||||
case DataFormat::NoTrace : printf("============= Type : NoTrace\n"); break;
|
||||
case DataFormat::MiniWithFineTime : printf("============= Type : Min with FineTimestamp\n"); break;
|
||||
case DataFormat::Minimum : printf("============= Type : Minimum\n"); break;
|
||||
case DataFormat::Raw : printf("============= Type : Raw\n"); return; break;
|
||||
default : return;
|
||||
|
@ -269,7 +271,14 @@ class Hit {
|
|||
}
|
||||
}
|
||||
|
||||
void PrintAllTrace(){
|
||||
void PrintTrace(){
|
||||
printf("---------- trace length : %zu\n", traceLenght);
|
||||
if( dataType == DataFormat::OneTrace ){
|
||||
for(unsigned short i = 0; i < (unsigned short)traceLenght; i++){
|
||||
printf("%4d| %6d\n", i, analog_probes[0][i]);
|
||||
}
|
||||
}
|
||||
if( dataType == DataFormat::ALL){
|
||||
for(unsigned short i = 0; i < (unsigned short)traceLenght; i++){
|
||||
printf("%4d| %6d %6d %1d %1d %1d %1d\n", i, analog_probes[0][i],
|
||||
analog_probes[1][i],
|
||||
|
@ -279,6 +288,7 @@ class Hit {
|
|||
digital_probes[3][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
674
LICENSE
Normal file
674
LICENSE
Normal file
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
21
README.md
21
README.md
|
@ -68,6 +68,15 @@ CAEN_FELIB_v1.2.5
|
|||
|
||||
CAEN_DIG2_v1.5.10
|
||||
|
||||
with these new API, Digitizer firmwares
|
||||
|
||||
* V2745-dpp-pha-1G-2023091800.cup
|
||||
* V2745-dpp-psd-1G-2023091901.cup
|
||||
* V2740-dpp-pha-1G-2023091800.cup
|
||||
* V2740-dpp-psd-1G-2023091901.cup
|
||||
|
||||
are supported.
|
||||
|
||||
# Compile
|
||||
|
||||
## if *.pro does not exist
|
||||
|
@ -85,6 +94,17 @@ run ` qmake6 *.pro` it will generate Makefile
|
|||
|
||||
then ` make`
|
||||
|
||||
# Using the CAENDig2.h
|
||||
|
||||
The CAENDig2.h is not copied to system include path as the CAEN+FELib.h. But we can copy it from the source. In the caen_dig2-vXXXX folder, go to the include folder, copy the CAENDig2.h to /usr/local/include/.
|
||||
|
||||
This enable us to compile code with -lCAEN_Dig2. For example, we can use the following to get the CAEN Dig2 Library version.
|
||||
```
|
||||
char version[16];
|
||||
CAENDig2_GetLibVersion(version);
|
||||
puts(version);
|
||||
```
|
||||
|
||||
# Known Issues
|
||||
|
||||
- The "Trig." Rate in the Scaler does not included the coincident condition. This is related to the ChSavedEventCnt from the firmware.
|
||||
|
@ -92,3 +112,4 @@ then ` make`
|
|||
- The CoincidenceLengthT not loaded.
|
||||
- Sometime, the digitizer halt after sent the /cmd/armacquisition command. This is CAEN library problem.
|
||||
- Event/Wave trig. Source cannot set as SWTrigger.
|
||||
- After update to CAEN_FELIB_v1.2.5 and CAEN_DIG2_v1.5.10, old firmware version before 202309XXXX is not supported.
|
|
@ -11,9 +11,9 @@ QT += widgets charts
|
|||
LIBS += -lcurl -lCAEN_FELib -lX11
|
||||
|
||||
#=========== for GDB debug
|
||||
#QMAKE_CXXFLAGS += -g # for gdb debug
|
||||
#QMAKE_CXXFLAGS_RELEASE = -O0
|
||||
#QMAKE_CFLAGS_RELEASE = -O0
|
||||
QMAKE_CXXFLAGS += -g # for gdb debug
|
||||
QMAKE_CXXFLAGS_RELEASE = -O0
|
||||
QMAKE_CFLAGS_RELEASE = -O0
|
||||
|
||||
# You can make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
|
@ -25,7 +25,7 @@ LIBS += -lcurl -lCAEN_FELib -lX11
|
|||
# Input
|
||||
HEADERS += ClassDigitizer2Gen.h \
|
||||
Hit.h \
|
||||
influxdb.h \
|
||||
ClassInfluxDB.h \
|
||||
mainwindow.h \
|
||||
digiSettingsPanel.h \
|
||||
Digiparameters.h \
|
||||
|
@ -36,7 +36,7 @@ HEADERS += ClassDigitizer2Gen.h \
|
|||
SOLARISpanel.h
|
||||
|
||||
SOURCES += ClassDigitizer2Gen.cpp \
|
||||
influxdb.cpp \
|
||||
ClassInfluxDB.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
digiSettingsPanel.cpp \
|
||||
|
|
|
@ -28,7 +28,7 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
|||
this->digi = digi;
|
||||
this->nDigi = nDigi;
|
||||
if( this->nDigi > MaxNumberOfDigitizer ) {
|
||||
this->nDigi = MaxNumberOfChannel;
|
||||
this->nDigi = MaxNumberOfDigitizer;
|
||||
qDebug() << "Please increase the MaxNumberOfChannel";
|
||||
}
|
||||
this->mapping = mapping;
|
||||
|
@ -301,6 +301,8 @@ void SOLARISpanel::CreateDetGroup(int SettingID, QList<int> detIDArray, QGridLay
|
|||
|
||||
leDisplay[SettingID][digiID][chID] = new QLineEdit(this);
|
||||
leDisplay[SettingID][digiID][chID]->setFixedWidth(70);
|
||||
leDisplay[SettingID][digiID][chID]->setReadOnly(true);
|
||||
leDisplay[SettingID][digiID][chID]->setStyleSheet("color : green;");
|
||||
layout0->addWidget(leDisplay[SettingID][digiID][chID], 2*chIndex, 2);
|
||||
|
||||
sbSetting[SettingID][digiID][chID] = new RSpinBox(this);
|
||||
|
@ -471,6 +473,8 @@ void SOLARISpanel::CreateDetGroup(int SettingID, QList<int> detIDArray, QGridLay
|
|||
connect(cbTrigger[detGroup][detID], &RComboBox::currentIndexChanged, this , [=](int index){
|
||||
if( !enableSignalSlot) return;
|
||||
|
||||
if( cbTrigger[detGroup][detID]->itemData(index).toInt() == -999 ) return;
|
||||
|
||||
if( chkAll[detGroup][SettingID]->isChecked() ){
|
||||
|
||||
for( int k = 0; k < detIDArrayList.size(); k++){
|
||||
|
@ -567,17 +571,17 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
|||
for( int chID = 0; chID < (int) mapping[DigiID].size(); chID++){
|
||||
if( mapping[DigiID][chID] < 0 ) continue;
|
||||
|
||||
std::string haha = digi[DigiID]->GetSettingValue(SettingItems[SettingID], chID);
|
||||
std::string haha = digi[DigiID]->GetSettingValueFromMemory(SettingItems[SettingID], chID);
|
||||
sbSetting[SettingID][DigiID][chID]->setValue( atof(haha.c_str()));
|
||||
|
||||
if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara() ){
|
||||
std::string haha = digi[DigiID]->GetSettingValue(PHA::CH::SelfTrgRate, chID);
|
||||
std::string haha = digi[DigiID]->GetSettingValueFromMemory(PHA::CH::SelfTrgRate, chID);
|
||||
leDisplay[SettingID][DigiID][chID]->setText(QString::number(atof(haha.c_str()), 'f', 2) );
|
||||
}else{
|
||||
leDisplay[SettingID][DigiID][chID]->setText(QString::number(atof(haha.c_str()), 'f', 2) );
|
||||
}
|
||||
|
||||
haha = digi[DigiID]->GetSettingValue(PHA::CH::ChannelEnable, chID);
|
||||
haha = digi[DigiID]->GetSettingValueFromMemory(PHA::CH::ChannelEnable, chID);
|
||||
chkOnOff[SettingID][DigiID][chID]->setChecked( haha == "True" ? true : false);
|
||||
leDisplay[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
|
||||
sbSetting[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
|
||||
|
@ -609,11 +613,11 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
|||
}
|
||||
|
||||
int chID = (detIDArrayList[k][h] & 0xFF);
|
||||
triggerMap.push_back(Utility::TenBase(digi[digiID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, chID)));
|
||||
coincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::CoincidenceMask, chID));
|
||||
antiCoincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::AntiCoincidenceMask, chID));
|
||||
eventTriggerSource.push_back(digi[digiID]->GetSettingValue(PHA::CH::EventTriggerSource, chID));
|
||||
waveTriggerSource.push_back(digi[digiID]->GetSettingValue(PHA::CH::WaveTriggerSource, chID));
|
||||
triggerMap.push_back(Utility::TenBase(digi[digiID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, chID)));
|
||||
coincidentMask.push_back(digi[digiID]->GetSettingValueFromMemory(PHA::CH::CoincidenceMask, chID));
|
||||
antiCoincidentMask.push_back(digi[digiID]->GetSettingValueFromMemory(PHA::CH::AntiCoincidenceMask, chID));
|
||||
eventTriggerSource.push_back(digi[digiID]->GetSettingValueFromMemory(PHA::CH::EventTriggerSource, chID));
|
||||
waveTriggerSource.push_back(digi[digiID]->GetSettingValueFromMemory(PHA::CH::WaveTriggerSource, chID));
|
||||
}
|
||||
|
||||
if(skipFlag) continue;
|
||||
|
@ -704,7 +708,7 @@ void SOLARISpanel::UpdatePanelFromMemory(){
|
|||
int chID = (detIDArrayList[i][j] & 0xFF);
|
||||
if( digiID >= nDigi ) continue;
|
||||
if( digi[digiID]->IsDummy() || !digi[digiID]->IsConnected() ) continue;
|
||||
coinTime.push_back( atoi(digi[digiID]->GetSettingValue(PHA::CH::CoincidenceLength, chID).c_str()));
|
||||
coinTime.push_back( atoi(digi[digiID]->GetSettingValueFromMemory(PHA::CH::CoincidenceLength, chID).c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -738,7 +742,7 @@ void SOLARISpanel::UpdateThreshold(){
|
|||
|
||||
if( mapping[DigiID][chID] < 0 ) continue;
|
||||
|
||||
std::string haha = digi[DigiID]->GetSettingValue(PHA::CH::SelfTrgRate, chID);
|
||||
std::string haha = digi[DigiID]->GetSettingValueFromMemory(PHA::CH::SelfTrgRate, chID);
|
||||
leDisplay[SettingID][DigiID][chID]->setText(QString::fromStdString(haha));
|
||||
|
||||
///printf("====== %d %d %d |%s|\n", SettingID, DigiID, chID, haha.c_str());
|
||||
|
|
239
SolReader.h
239
SolReader.h
|
@ -1,239 +0,0 @@
|
|||
#ifndef SOLREADER_H
|
||||
#define SOLREADER_H
|
||||
|
||||
#include <stdio.h> /// for FILE
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unistd.h>
|
||||
#include <time.h> // time in nano-sec
|
||||
|
||||
#include "Hit.h"
|
||||
|
||||
class SolReader {
|
||||
private:
|
||||
FILE * inFile;
|
||||
unsigned int inFileSize;
|
||||
unsigned int filePos;
|
||||
unsigned int totNumBlock;
|
||||
|
||||
unsigned short blockStartIdentifier;
|
||||
unsigned int numBlock;
|
||||
bool isScanned;
|
||||
|
||||
void init();
|
||||
|
||||
std::vector<unsigned int> blockPos;
|
||||
|
||||
public:
|
||||
SolReader();
|
||||
SolReader(std::string fileName, unsigned short dataType);
|
||||
~SolReader();
|
||||
|
||||
void OpenFile(std::string fileName);
|
||||
int ReadNextBlock(int opt = 0); // opt = 0, noraml, 1, fast
|
||||
int ReadBlock(unsigned int index);
|
||||
|
||||
void ScanNumBlock();
|
||||
|
||||
unsigned int GetNumBlock() {return numBlock;}
|
||||
unsigned int GetTotalNumBlock() {return totNumBlock;}
|
||||
unsigned int GetFilePos() {return filePos;}
|
||||
unsigned int GetFileSize() {return inFileSize;}
|
||||
|
||||
void RewindFile();
|
||||
|
||||
Hit * hit;
|
||||
|
||||
};
|
||||
|
||||
void SolReader::init(){
|
||||
inFileSize = 0;
|
||||
numBlock = 0;
|
||||
filePos = 0;
|
||||
totNumBlock = 0;
|
||||
hit = new Hit();
|
||||
|
||||
isScanned = false;
|
||||
|
||||
blockPos.clear();
|
||||
|
||||
}
|
||||
|
||||
SolReader::SolReader(){
|
||||
init();
|
||||
}
|
||||
|
||||
SolReader::SolReader(std::string fileName, unsigned short dataType = 0){
|
||||
init();
|
||||
OpenFile(fileName);
|
||||
hit->SetDataType(dataType, DPPType::PHA);
|
||||
}
|
||||
|
||||
SolReader::~SolReader(){
|
||||
if( !inFile ) fclose(inFile);
|
||||
delete hit;
|
||||
}
|
||||
|
||||
inline void SolReader::OpenFile(std::string fileName){
|
||||
inFile = fopen(fileName.c_str(), "r");
|
||||
if( inFile == NULL ){
|
||||
printf("Cannot open file : %s \n", fileName.c_str());
|
||||
}else{
|
||||
fseek(inFile, 0L, SEEK_END);
|
||||
inFileSize = ftell(inFile);
|
||||
rewind(inFile);
|
||||
}
|
||||
}
|
||||
|
||||
inline int SolReader::ReadBlock(unsigned int index){
|
||||
if( isScanned == false) return -1;
|
||||
if( index >= totNumBlock )return -1;
|
||||
fseek(inFile, 0L, SEEK_SET);
|
||||
|
||||
printf("-----------%u, %u\n", index, blockPos[index]);
|
||||
|
||||
fseek(inFile, blockPos[index], SEEK_CUR);
|
||||
|
||||
numBlock = index;
|
||||
|
||||
return ReadNextBlock();
|
||||
}
|
||||
|
||||
inline int SolReader::ReadNextBlock(int opt){
|
||||
if( inFile == NULL ) return -1;
|
||||
if( feof(inFile) ) return -1;
|
||||
if( filePos >= inFileSize) return -1;
|
||||
|
||||
fread(&blockStartIdentifier, 2, 1, inFile);
|
||||
|
||||
if( (blockStartIdentifier & 0xAA00) != 0xAA00 ) {
|
||||
printf("header fail.\n");
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
if( ( blockStartIdentifier & 0xF ) == DataFormat::Raw ){
|
||||
hit->SetDataType(DataFormat::Raw, ((blockStartIdentifier >> 1) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD);
|
||||
}
|
||||
hit->dataType = blockStartIdentifier & 0xF;
|
||||
hit->DPPType = ((blockStartIdentifier >> 4) & 0xF) == 0 ? DPPType::PHA : DPPType::PSD;
|
||||
|
||||
if( hit->dataType == DataFormat::ALL){
|
||||
if( opt == 0 ){
|
||||
fread(&hit->channel, 1, 1, inFile);
|
||||
fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
||||
fread(&hit->timestamp, 6, 1, inFile);
|
||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
fread(&hit->downSampling, 1, 1, inFile);
|
||||
fread(&hit->board_fail, 1, 1, inFile);
|
||||
fread(&hit->flush, 1, 1, inFile);
|
||||
fread(&hit->trigger_threashold, 2, 1, inFile);
|
||||
fread(&hit->event_size, 8, 1, inFile);
|
||||
fread(&hit->aggCounter, 4, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 31 : 33, SEEK_CUR);
|
||||
}
|
||||
fread(&hit->traceLenght, 8, 1, inFile);
|
||||
if( opt == 0){
|
||||
fread(hit->analog_probes_type, 2, 1, inFile);
|
||||
fread(hit->digital_probes_type, 4, 1, inFile);
|
||||
fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||
fread(hit->analog_probes[1], hit->traceLenght*4, 1, inFile);
|
||||
fread(hit->digital_probes[0], hit->traceLenght, 1, inFile);
|
||||
fread(hit->digital_probes[1], hit->traceLenght, 1, inFile);
|
||||
fread(hit->digital_probes[2], hit->traceLenght, 1, inFile);
|
||||
fread(hit->digital_probes[3], hit->traceLenght, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 6 + hit->traceLenght*(12), SEEK_CUR);
|
||||
}
|
||||
}else if( hit->dataType == DataFormat::OneTrace){
|
||||
if( opt == 0 ){
|
||||
fread(&hit->channel, 1, 1, inFile);
|
||||
fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
||||
fread(&hit->timestamp, 6, 1, inFile);
|
||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
||||
}
|
||||
fread(&hit->traceLenght, 8, 1, inFile);
|
||||
if( opt == 0){
|
||||
fread(&hit->analog_probes_type[0], 1, 1, inFile);
|
||||
fread(hit->analog_probes[0], hit->traceLenght*4, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, 1 + hit->traceLenght*4, SEEK_CUR);
|
||||
}
|
||||
}else if( hit->dataType == DataFormat::NoTrace){
|
||||
if( opt == 0 ){
|
||||
fread(&hit->channel, 1, 1, inFile);
|
||||
fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
||||
fread(&hit->timestamp, 6, 1, inFile);
|
||||
fread(&hit->fine_timestamp, 2, 1, inFile);
|
||||
fread(&hit->flags_high_priority, 1, 1, inFile);
|
||||
fread(&hit->flags_low_priority, 2, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 14 : 16, SEEK_CUR);
|
||||
}
|
||||
}else if( hit->dataType == DataFormat::Minimum){
|
||||
if( opt == 0 ){
|
||||
fread(&hit->channel, 1, 1, inFile);
|
||||
fread(&hit->energy, 2, 1, inFile);
|
||||
if( hit->DPPType == DPPType::PSD ) fread(&hit->energy_short, 2, 1, inFile);
|
||||
fread(&hit->timestamp, 6, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->DPPType == DPPType::PHA ? 9 : 11, SEEK_CUR);
|
||||
}
|
||||
}else if( hit->dataType == DataFormat::Raw){
|
||||
fread(&hit->dataSize, 8, 1, inFile);
|
||||
if( opt == 0){
|
||||
fread(hit->data, hit->dataSize, 1, inFile);
|
||||
}else{
|
||||
fseek(inFile, hit->dataSize, SEEK_CUR);
|
||||
}
|
||||
}
|
||||
|
||||
numBlock ++;
|
||||
filePos = ftell(inFile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SolReader::RewindFile(){
|
||||
rewind(inFile);
|
||||
filePos = 0;
|
||||
numBlock = 0;
|
||||
}
|
||||
|
||||
void SolReader::ScanNumBlock(){
|
||||
if( inFile == NULL ) return;
|
||||
if( feof(inFile) ) return;
|
||||
|
||||
numBlock = 0;
|
||||
blockPos.clear();
|
||||
|
||||
blockPos.push_back(0);
|
||||
|
||||
while( ReadNextBlock(1) == 0){
|
||||
blockPos.push_back(filePos);
|
||||
printf("%u, %.2f%% %u/%u\n\033[A\r", numBlock, filePos*100./inFileSize, filePos, inFileSize);
|
||||
}
|
||||
|
||||
totNumBlock = numBlock;
|
||||
numBlock = 0;
|
||||
isScanned = true;
|
||||
printf("\nScan complete: number of data Block : %u\n", totNumBlock);
|
||||
rewind(inFile);
|
||||
filePos = 0;
|
||||
|
||||
//for( int i = 0; i < totNumBlock; i++){
|
||||
// printf("%7d | %u \n", i, blockPos[i]);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -58,7 +58,9 @@ QStringList chToolTip = { "Channel signal delay initialization status (1 = initi
|
|||
"Time-energy event free space status (1 = time-energy can be written)",
|
||||
"Waveform event free space status (1 = waveform can be written)"};
|
||||
|
||||
DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QString analysisPath, QWidget * parent) : QWidget(parent){
|
||||
QColor orangeColor(255, 165, 0);
|
||||
|
||||
DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi, QString settingPath, QWidget * parent) : QWidget(parent){
|
||||
|
||||
setWindowTitle("Digitizers Settings");
|
||||
setGeometry(0, 0, 1850, 1050);
|
||||
|
@ -67,10 +69,10 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
this->digi = digi;
|
||||
this->nDigi = nDigi;
|
||||
if( nDigi > MaxNumberOfDigitizer ) {
|
||||
this->nDigi = MaxNumberOfChannel;
|
||||
this->nDigi = MaxNumberOfDigitizer;
|
||||
qDebug() << "Please increase the MaxNumberOfChannel";
|
||||
}
|
||||
this->digiSettingPath = analysisPath + "/working/Settings/";
|
||||
this->digiSettingPath = settingPath;
|
||||
|
||||
ID = 0;
|
||||
enableSignalSlot = false;
|
||||
|
@ -105,13 +107,19 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
lab->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
leInfo[iDigi][j] = new QLineEdit(digiTab[iDigi]);
|
||||
leInfo[iDigi][j]->setReadOnly(true);
|
||||
leInfo[iDigi][j]->setText(QString::fromStdString(digi[iDigi]->ReadValue(infoIndex[j].second)));
|
||||
|
||||
Reg reg = infoIndex[j].second;
|
||||
QString text = QString::fromStdString(digi[iDigi]->ReadValue(reg));
|
||||
if( reg.GetPara() == PHA::DIG::ADC_SampleRate.GetPara() ) {
|
||||
text += " = " + QString::number(digi[iDigi]->GetTick2ns(), 'f', 1) + " ns" ;
|
||||
}
|
||||
leInfo[iDigi][j]->setText(text);
|
||||
infoLayout->addWidget(lab, j%nRow, 2*(j/nRow));
|
||||
infoLayout->addWidget(leInfo[iDigi][j], j%nRow, 2*(j/nRow) +1);
|
||||
}
|
||||
}
|
||||
|
||||
{//^====================== Group Board status
|
||||
{//^====================== Group of Board status
|
||||
QGroupBox * statusBox = new QGroupBox("Board Status", digiTab[iDigi]);
|
||||
QGridLayout * statusLayout = new QGridLayout(statusBox);
|
||||
statusLayout->setAlignment(Qt::AlignLeft);
|
||||
|
@ -330,8 +338,9 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
|
||||
for( int i = 0; i < (int) PHA::DIG::GlobalTriggerSource.GetAnswers().size(); i++){
|
||||
ckbGlbTrgSource[iDigi][i] = new QCheckBox( QString::fromStdString((PHA::DIG::GlobalTriggerSource.GetAnswers())[i].second), digiTab[iDigi]);
|
||||
boardLayout->addWidget(ckbGlbTrgSource[iDigi][i], rowId, 1 + i);
|
||||
boardLayout->addWidget(ckbGlbTrgSource[iDigi][i], rowId, 1 + i%5);
|
||||
connect(ckbGlbTrgSource[iDigi][i], &QCheckBox::stateChanged, this, &DigiSettingsPanel::SetGlobalTriggerSource);
|
||||
if ( i == 4) rowId++;
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
@ -435,7 +444,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
QString msg;
|
||||
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::BoardVetoPolarity.GetPara());
|
||||
msg += " = " + cbbBdVetoPolarity[ID]->currentData().toString();
|
||||
if( digi[ID]->WriteValue(PHA::DIG::BoardVetoPolarity, cbbStatEvents[ID]->currentData().toString().toStdString()) ){
|
||||
if( digi[ID]->WriteValue(PHA::DIG::BoardVetoPolarity, cbbBdVetoPolarity[ID]->currentData().toString().toStdString()) ){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
cbbBdVetoPolarity[ID]->setStyleSheet("");
|
||||
}else{
|
||||
|
@ -548,13 +557,13 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
}
|
||||
});
|
||||
|
||||
connect(cbDACoutMode[iDigi], &RComboBox::currentIndexChanged, this, [=](){
|
||||
if( cbDACoutMode[iDigi]->currentData().toString().toStdString() == "Square" ) {
|
||||
bdTestPulse[iDigi]->setEnabled(true);
|
||||
}else{
|
||||
if( ckbGlbTrgSource[iDigi][3]->isChecked() == false ) bdTestPulse[iDigi]->setEnabled(false);
|
||||
}
|
||||
});
|
||||
// connect(cbDACoutMode[iDigi], &RComboBox::currentIndexChanged, this, [=](){
|
||||
// if( cbDACoutMode[iDigi]->currentData().toString().toStdString() == "Square" ) {
|
||||
// bdTestPulse[iDigi]->setEnabled(true);
|
||||
// }else{
|
||||
// if( ckbGlbTrgSource[iDigi][3]->isChecked() == false ) bdTestPulse[iDigi]->setEnabled(false);
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
|
@ -576,9 +585,22 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
spbTestPusleLowLevel[iDigi]->setFixedWidth(100);
|
||||
spbTestPusleHighLevel[iDigi]->setFixedWidth(100);
|
||||
|
||||
QLabel * lbFreq = new QLabel("", bdTestPulse[iDigi]); lbFreq->setAlignment(Qt::AlignCenter); testPulseLayout->addWidget(lbFreq, 0, 2);
|
||||
QLabel * lblow = new QLabel("", bdTestPulse[iDigi]); lblow->setAlignment(Qt::AlignCenter); testPulseLayout->addWidget(lblow, 2, 2);
|
||||
QLabel * lbhigh = new QLabel("", bdTestPulse[iDigi]); lbhigh->setAlignment(Qt::AlignCenter); testPulseLayout->addWidget(lbhigh, 3, 2);
|
||||
|
||||
connect(dsbTestPuslePeriod[iDigi], &RSpinBox::valueChanged, this, [=](){
|
||||
double value = dsbTestPuslePeriod[iDigi]->value();
|
||||
double freq = 1e9/value; // Hz
|
||||
if( 1e3 > freq){
|
||||
lbFreq->setText(" = " + QString::number(freq, 'f', 2) + " Hz");
|
||||
}else if( 1e6 > freq && freq >= 1e3 ) {
|
||||
lbFreq->setText(" = " + QString::number(freq/1e3, 'f', 2) + " KHz");
|
||||
}else if( freq >= 1e6 ) {
|
||||
lbFreq->setText(" = " + QString::number(freq/1e6, 'f', 2) + " MHz");
|
||||
}
|
||||
});
|
||||
|
||||
connect(spbTestPusleLowLevel[iDigi], &RSpinBox::valueChanged, this, [=](){
|
||||
double value = spbTestPusleLowLevel[iDigi]->value();
|
||||
lblow->setText("approx. " + QString::number(value/0xffff*2 - 1, 'f', 2) + " V");
|
||||
|
@ -589,6 +611,38 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
lbhigh->setText("approx. " + QString::number(value/0xffff*2 - 1, 'f', 2) + " V");
|
||||
});
|
||||
|
||||
|
||||
QPushButton * bnTestPulse = new QPushButton("Set 1 kHz, +1 V Square Pulse", bdTestPulse[iDigi]);
|
||||
testPulseLayout->addWidget(bnTestPulse, 4, 0, 1, 3);
|
||||
connect(bnTestPulse, &QPushButton::clicked, this, [=](){
|
||||
|
||||
SendLogMsg("Digi-" + QString::number(digi[ID]->GetSerialNumber()) + "|Set Test Pulse to 1kHz, +1V, 3000 ns");
|
||||
|
||||
digi[ID]->WriteValue(PHA::DIG::TestPulsePeriod, std::to_string(1e6));
|
||||
digi[ID]->WriteValue(PHA::DIG::TestPulseWidth, std::to_string(3000));
|
||||
digi[ID]->WriteValue(PHA::DIG::TestPulseLowLevel, std::to_string(24700));
|
||||
digi[ID]->WriteValue(PHA::DIG::TestPulseHighLevel, std::to_string(45000));
|
||||
|
||||
enableSignalSlot = false;
|
||||
|
||||
FillSpinBoxValueFromMemory(dsbTestPuslePeriod[ID], PHA::DIG::TestPulsePeriod);
|
||||
FillSpinBoxValueFromMemory(dsbTestPusleWidth[ID], PHA::DIG::TestPulseWidth);
|
||||
FillSpinBoxValueFromMemory(spbTestPusleLowLevel[ID], PHA::DIG::TestPulseLowLevel);
|
||||
FillSpinBoxValueFromMemory(spbTestPusleHighLevel[ID], PHA::DIG::TestPulseHighLevel);
|
||||
|
||||
enableSignalSlot = true;
|
||||
|
||||
});
|
||||
|
||||
if( digi[iDigi]->GetCupVer() >= 2024041200 && digi[iDigi]->GetFPGAType() == DPPType::PSD ){ // there are expoential test pulse
|
||||
SetupSpinBox(sbIPEAmplitude[iDigi], PSD::DIG::IPEAmplitude, -1, false, "Ampuitude [LSB] :", testPulseLayout, 6, 0);
|
||||
SetupSpinBox(sbIPEBaseline[iDigi], PSD::DIG::IPEBaseline, -1, false, "Base line [LSB] :", testPulseLayout, 7, 0);
|
||||
SetupSpinBox(sbIPEDecayTime[iDigi], PSD::DIG::IPEDecayTime, -1, false, "Decay Time [ns] :", testPulseLayout, 8, 0);
|
||||
SetupSpinBox(sbIPERate[iDigi], PSD::DIG::IPERate, -1, false, "Rate [Hz] :", testPulseLayout, 9, 0);
|
||||
SetupComboBox(cbIPETimeMode[iDigi], PSD::DIG::IPETimeMode, -1, false, "Time Mode :", testPulseLayout, 10, 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{//^====================== VGA settings
|
||||
|
@ -601,7 +655,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
vgaLayout->setAlignment(Qt::AlignTop| Qt::AlignLeft);
|
||||
|
||||
for( int k = 0; k < 4; k ++){
|
||||
SetupSpinBox(VGA[iDigi][k], PHA::VGA::VGAGain, -1, false, "VGA-" + QString::number(k) + " [dB] :", vgaLayout, k, 0);
|
||||
SetupSpinBox(VGA[iDigi][k], PHA::VGA::VGAGain, k, false, "VGA-" + QString::number(k) + " [dB] :", vgaLayout, k, 0);
|
||||
VGA[iDigi][k]->setSingleStep(0.5);
|
||||
VGA[iDigi][k]->setFixedWidth(100);
|
||||
VGA[iDigi][k]->SetToolTip();
|
||||
|
@ -665,7 +719,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
cLayout->addWidget(horizontalSeparator, 3, 0, 1, 33);
|
||||
|
||||
|
||||
for( int i = 0; i < 64; i++){
|
||||
for( int i = 0; i < digi[iDigi]->GetNChannels() ; i++){
|
||||
chITLConnect[iDigi][i][0] = new QPushButton(bdITL[iDigi]);
|
||||
chITLConnect[iDigi][i][0]->setFixedSize(15, 15);
|
||||
cLayout->addWidget(chITLConnect[iDigi][i][0], 1 + i/32, i%32 + 1);
|
||||
|
@ -779,6 +833,22 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
|
||||
}
|
||||
|
||||
{//^====================== Group = InputDelay
|
||||
if( digi[iDigi]->GetModelName() != "VX2730") {
|
||||
bdGroup[iDigi] = new QWidget(this);
|
||||
bdTab->addTab(bdGroup[iDigi], "Input Delay");
|
||||
QGridLayout * groupLayout = new QGridLayout(bdGroup[iDigi]);
|
||||
groupLayout->setAlignment(Qt::AlignTop );
|
||||
//LVDSLayout->setSpacing(2);
|
||||
|
||||
for(int k = 0; k < MaxNumberOfGroup; k ++){
|
||||
SetupSpinBox(spbInputDelay[iDigi][k], PHA::GROUP::InputDelay, k, false, "ch : " + QString::number(4*k) + " - " + QString::number(4*k+3) + " [ns] ", groupLayout, k/4, 2*(k%4));
|
||||
}
|
||||
|
||||
bdGroup[iDigi]->setEnabled(digi[iDigi]->GetCupVer() >= MIN_VERSION_GROUP);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{//^====================== Group channel settings
|
||||
|
@ -998,8 +1068,6 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
enableSignalSlot = true;
|
||||
});
|
||||
|
||||
|
@ -1038,7 +1106,10 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
|
||||
QPushButton * bnRead = new QPushButton("Read", ICTab);
|
||||
inquiryLayout->addWidget(bnRead, rowID, 5, 2, 1);
|
||||
connect(bnRead, &QPushButton::clicked, this, [=](){ ReadBoardSetting(cbBdSettings->currentIndex()); ReadChannelSetting(cbChSettings->currentIndex()); });
|
||||
connect(bnRead, &QPushButton::clicked, this, [=](){
|
||||
ReadBoardSetting(cbBdSettings->currentIndex());
|
||||
ReadChannelSetting(cbChSettings->currentIndex());
|
||||
});
|
||||
|
||||
cbBdAns = new RComboBox(ICTab);
|
||||
cbBdAns->setFixedWidth(200);
|
||||
|
@ -1055,7 +1126,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
|
||||
msg += " = " + cbBdAns->currentData().toString();
|
||||
if( digi[ID]->WriteValue(para, value) ){
|
||||
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
cbBdAns->setStyleSheet("");
|
||||
UpdatePanelFromMemory();
|
||||
|
@ -1085,7 +1156,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
|
||||
msg += " = " + QString::number(sbBdSettingsWrite->value());
|
||||
if( digi[ID]->WriteValue(para, std::to_string(sbBdSettingsWrite->value()))){
|
||||
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sbBdSettingsWrite->setStyleSheet("");
|
||||
UpdatePanelFromMemory();
|
||||
|
@ -1111,7 +1182,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
|
||||
msg += " = " + QString::number(sbBdSettingsWrite->value());
|
||||
if( digi[ID]->WriteValue(para, value)){
|
||||
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sbBdSettingsWrite->setStyleSheet("");
|
||||
UpdatePanelFromMemory();
|
||||
|
@ -1181,7 +1252,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
msg += ",CH:" + QString::number(ch_index);
|
||||
msg += " = " + cbChSettingsWrite->currentData().toString();
|
||||
if( digi[ID]->WriteValue(para, value, ch_index) ){
|
||||
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
cbChSettingsWrite->setStyleSheet("");
|
||||
UpdatePanelFromMemory();
|
||||
|
@ -1205,15 +1276,18 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
sbChSettingsWrite->setValue( (std::round(value/step) * step) );
|
||||
}
|
||||
|
||||
Reg para = PHA::CH::AllSettings[cbChSettings->currentIndex()];
|
||||
ID = cbIQDigi->currentIndex();
|
||||
Reg para ;
|
||||
if ( digi[ID]->GetFPGAType() == DPPType::PHA) para = PHA::CH::AllSettings[cbChSettings->currentIndex()];
|
||||
if ( digi[ID]->GetFPGAType() == DPPType::PSD) para = PSD::CH::AllSettings[cbChSettings->currentIndex()];
|
||||
|
||||
int ch_index = cbIQCh->currentIndex();
|
||||
QString msg;
|
||||
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
|
||||
msg += ",CH:" + QString::number(ch_index);
|
||||
msg += " = " + QString::number(sbChSettingsWrite->value());
|
||||
if( digi[ID]->WriteValue(para, std::to_string(sbChSettingsWrite->value()), ch_index)){
|
||||
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sbChSettingsWrite->setStyleSheet("");
|
||||
UpdatePanelFromMemory();
|
||||
|
@ -1239,7 +1313,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
|
||||
msg += " = " + QString::number(sbChSettingsWrite->value());
|
||||
if( digi[ID]->WriteValue(para, value, ch_index)){
|
||||
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sbChSettingsWrite->setStyleSheet("");
|
||||
UpdatePanelFromMemory();
|
||||
|
@ -1466,7 +1540,7 @@ void DigiSettingsPanel::SetupPHAChannels(unsigned short digiID){
|
|||
FillSpinBoxValueFromMemory(spbCoinLength[ID][ch], PHA::CH::CoincidenceLength, index);
|
||||
FillSpinBoxValueFromMemory(spbADCVetoWidth[ID][ch], PHA::CH::ADCVetoWidth, index);
|
||||
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
|
||||
leTriggerMask[ID][ch]->setText("0x" + QString::number(mask, 16).toUpper());
|
||||
|
||||
//-------- PHA
|
||||
|
@ -1672,12 +1746,12 @@ void DigiSettingsPanel::SetupPHAChannels(unsigned short digiID){
|
|||
|
||||
for( int ch = 0; ch < digi[digiID]->GetNChannels(); ch++){
|
||||
//Set color of some combox
|
||||
cbbOnOff[digiID][ch]->setItemData(1, QBrush(Qt::green), Qt::ForegroundRole);
|
||||
connect(cbbOnOff[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbOnOff[ID][ch]->setStyleSheet(index == 1 ? "color : green;" : "");});
|
||||
cbbParity[digiID][ch]->setItemData(1, QBrush(Qt::green), Qt::ForegroundRole);
|
||||
connect(cbbParity[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbParity[ID][ch]->setStyleSheet(index == 1 ? "color : green;" : "");});
|
||||
cbbLowFilter[digiID][ch]->setItemData(1, QBrush(Qt::green), Qt::ForegroundRole);
|
||||
connect(cbbLowFilter[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbLowFilter[ID][ch]->setStyleSheet(index == 1 ? "color : green;": "");});
|
||||
cbbOnOff[digiID][ch]->setItemData(1, QBrush(orangeColor), Qt::ForegroundRole);
|
||||
connect(cbbOnOff[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbOnOff[ID][ch]->setStyleSheet(index == 1 ? "color : orange;" : "");});
|
||||
cbbParity[digiID][ch]->setItemData(1, QBrush(orangeColor), Qt::ForegroundRole);
|
||||
connect(cbbParity[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbParity[ID][ch]->setStyleSheet(index == 1 ? "color : orange;" : "");});
|
||||
cbbLowFilter[digiID][ch]->setItemData(1, QBrush(orangeColor), Qt::ForegroundRole);
|
||||
connect(cbbLowFilter[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbLowFilter[ID][ch]->setStyleSheet(index == 1 ? "color : orange;": "");});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1854,7 +1928,7 @@ void DigiSettingsPanel::SetupPSDChannels(unsigned short digiID){
|
|||
FillSpinBoxValueFromMemory(spbCoinLength[ID][ch], PHA::CH::CoincidenceLength, index);
|
||||
FillSpinBoxValueFromMemory(spbADCVetoWidth[ID][ch], PHA::CH::ADCVetoWidth, index);
|
||||
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
|
||||
leTriggerMask[ID][ch]->setText("0x" + QString::number(mask, 16).toUpper());
|
||||
|
||||
//-------- PSD
|
||||
|
@ -2093,10 +2167,10 @@ void DigiSettingsPanel::SetupPSDChannels(unsigned short digiID){
|
|||
|
||||
for( int ch = 0; ch < digi[digiID]->GetNChannels(); ch++){
|
||||
//Set color of some combox
|
||||
cbbOnOff[digiID][ch]->setItemData(1, QBrush(Qt::green), Qt::ForegroundRole);
|
||||
connect(cbbOnOff[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbOnOff[ID][ch]->setStyleSheet(index == 1 ? "color : green;" : "");});
|
||||
cbbParity[digiID][ch]->setItemData(1, QBrush(Qt::green), Qt::ForegroundRole);
|
||||
connect(cbbParity[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbParity[ID][ch]->setStyleSheet(index == 1 ? "color : green;" : "");});
|
||||
cbbOnOff[digiID][ch]->setItemData(1, QBrush(orangeColor), Qt::ForegroundRole);
|
||||
connect(cbbOnOff[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbOnOff[ID][ch]->setStyleSheet(index == 1 ? "color : orange;" : "");});
|
||||
cbbParity[digiID][ch]->setItemData(1, QBrush(orangeColor), Qt::ForegroundRole);
|
||||
connect(cbbParity[digiID][ch], &RComboBox::currentIndexChanged, this, [=](int index){ cbbParity[ID][ch]->setStyleSheet(index == 1 ? "color : orange;" : "");});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2284,8 +2358,8 @@ void DigiSettingsPanel::ReadTriggerMap(){
|
|||
|
||||
for( int ch = 0; ch < (int) digi[ID]->GetNChannels(); ch ++){
|
||||
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, ch));
|
||||
//printf("Trigger Mask of ch-%2d : 0x%s |%s| \n", ch, QString::number(mask, 16).toStdString().c_str(), digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, ch).c_str());
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, ch));
|
||||
//printf("Trigger Mask of ch-%2d : 0x%s |%s| \n", ch, QString::number(mask, 16).toStdString().c_str(), digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, ch).c_str());
|
||||
|
||||
for( int k = 0; k < (int) digi[ID]->GetNChannels(); k ++ ){
|
||||
trgMapClickStatus[ID][ch][k] = ( (mask >> k) & 0x1 );
|
||||
|
@ -2315,10 +2389,14 @@ void DigiSettingsPanel::UpdateStatus(){
|
|||
digi[ID]->ReadValue(PHA::DIG::LED_status);
|
||||
digi[ID]->ReadValue(PHA::DIG::ACQ_status);
|
||||
|
||||
if( digi[ID]->GetModelName() == "VX2740" ) {
|
||||
digi[ID]->ReadValue(PHA::DIG::TempSensADC[0]);
|
||||
}else{
|
||||
for( int i = 0; i < (int) PHA::DIG::TempSensADC.size(); i++){
|
||||
if( digi[ID]->GetModelName() != "VX2745" && i > 0 ) continue;
|
||||
digi[ID]->ReadValue(PHA::DIG::TempSensADC[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for( int i = 0; i < (int) PHA::DIG::TempSensOthers.size(); i++){
|
||||
digi[ID]->ReadValue(PHA::DIG::TempSensOthers[i]);
|
||||
}
|
||||
|
@ -2339,7 +2417,7 @@ void DigiSettingsPanel::EnableControl(){
|
|||
//if( ckbGlbTrgSource[id][3]->isChecked() ) testPulseBox[id]->setEnabled(enable);
|
||||
|
||||
bdCfg[id]->setEnabled(enable);
|
||||
bdTestPulse[id]->setEnabled(enable);
|
||||
// bdTestPulse[id]->setEnabled(enable);
|
||||
bdVGA[id]->setEnabled(enable);
|
||||
bdLVDS[id]->setEnabled(enable);
|
||||
bdITL[id]->setEnabled(enable);
|
||||
|
@ -2361,7 +2439,7 @@ void DigiSettingsPanel::EnableControl(){
|
|||
bnSoftwareStart[id]->setEnabled(enable);
|
||||
bnSoftwareStop[id]->setEnabled(enable);
|
||||
|
||||
if( digi[id]->GetFPGAType() != "DPP_PHA" || digi[id]->GetModelName() != "VX2745" ) bdVGA[id]->setEnabled(false);
|
||||
if( digi[id]->GetModelName() != "VX2745" ) bdVGA[id]->setEnabled(false);
|
||||
|
||||
QVector<QTabWidget*> tempArray = {inputTab[id], trapTab[id], probeTab[id], otherTab[id] };
|
||||
|
||||
|
@ -2392,7 +2470,12 @@ void DigiSettingsPanel::SaveSettings(){
|
|||
QDir dir(digiSettingPath);
|
||||
if( !dir.exists() ) dir.mkpath(".");
|
||||
|
||||
QString filePath = QFileDialog::getSaveFileName(this, "Save Settings File", digiSettingPath, "Data file (*.dat);;Text files (*.txt);;All files (*.*)");
|
||||
QString defaultFileName = "setting_" + QString::number(digi[ID]->GetSerialNumber()) + "_" + QString::fromStdString(digi[ID]->GetFPGAType().substr(4)) + ".dat";
|
||||
|
||||
QString filePath = QFileDialog::getSaveFileName(this,
|
||||
"Save Settings File",
|
||||
QDir::toNativeSeparators(digiSettingPath + "/" + defaultFileName),
|
||||
"Data file (*.dat);;Text files (*.txt);;All files (*.*)");
|
||||
|
||||
if (!filePath.isEmpty()) {
|
||||
|
||||
|
@ -2449,7 +2532,7 @@ void DigiSettingsPanel::LoadSettings(){
|
|||
}
|
||||
|
||||
void DigiSettingsPanel::SetDefaultPHASettigns(){
|
||||
SendLogMsg("Program Digitizer-" + QString::number(digi[ID]->GetSerialNumber()) + " to default PHA.");
|
||||
SendLogMsg("Program Digitizer-" + QString::number(digi[ID]->GetSerialNumber()) + " to default " + QString::fromStdString(digi[ID]->GetFPGAType()));
|
||||
digi[ID]->ProgramBoard();
|
||||
digi[ID]->ProgramChannels();
|
||||
RefreshSettings();
|
||||
|
@ -2468,7 +2551,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
}
|
||||
|
||||
//--------- LED Status
|
||||
unsigned int ledStatus = atoi(digi[ID]->GetSettingValue(PHA::DIG::LED_status).c_str());
|
||||
unsigned int ledStatus = atoi(digi[ID]->GetSettingValueFromMemory(PHA::DIG::LED_status).c_str());
|
||||
for( int i = 0; i < 19; i++){
|
||||
if( (ledStatus >> i) & 0x1 ) {
|
||||
LEDStatus[ID][i]->setStyleSheet("background-color:green;");
|
||||
|
@ -2478,7 +2561,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
}
|
||||
|
||||
//--------- ACQ Status
|
||||
unsigned int acqStatus = atoi(digi[ID]->GetSettingValue(PHA::DIG::ACQ_status).c_str());
|
||||
unsigned int acqStatus = atoi(digi[ID]->GetSettingValueFromMemory(PHA::DIG::ACQ_status).c_str());
|
||||
for( int i = 0; i < 7; i++){
|
||||
if( (acqStatus >> i) & 0x1 ) {
|
||||
ACQStatus[ID][i]->setStyleSheet("background-color:green;");
|
||||
|
@ -2489,7 +2572,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
|
||||
//-------- temperature
|
||||
for( int i = 0; i < 8; i++){
|
||||
leTemp[ID][i]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::TempSensADC[i])));
|
||||
leTemp[ID][i]->setText(QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::DIG::TempSensADC[i]))); // same for PSD
|
||||
}
|
||||
|
||||
if( onlyStatus ) {
|
||||
|
@ -2498,13 +2581,18 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
}
|
||||
|
||||
for (unsigned short j = 0; j < (unsigned short) infoIndex.size(); j++){
|
||||
leInfo[ID][j]->setText(QString::fromStdString(digi[ID]->GetSettingValue(infoIndex[j].second)));
|
||||
Reg reg = infoIndex[j].second;
|
||||
QString text = QString::fromStdString(digi[ID]->ReadValue(reg));
|
||||
if( reg.GetPara() == PHA::DIG::ADC_SampleRate.GetPara() ) {
|
||||
text += " = " + QString::number(digi[ID]->GetTick2ns(), 'f', 1) + " ns" ;
|
||||
}
|
||||
leInfo[ID][j]->setText(text);
|
||||
}
|
||||
|
||||
//-------- board settings
|
||||
FillComboBoxValueFromMemory(cbbClockSource[ID], PHA::DIG::ClockSource);
|
||||
|
||||
QString result = QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::StartSource));
|
||||
QString result = QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::DIG::StartSource));
|
||||
QStringList resultList = result.remove(QChar(' ')).split("|");
|
||||
//qDebug() << resultList << "," << resultList.count();
|
||||
for( int j = 0; j < (int) PHA::DIG::StartSource.GetAnswers().size(); j++){
|
||||
|
@ -2515,15 +2603,15 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
}
|
||||
}
|
||||
|
||||
result = QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::GlobalTriggerSource));
|
||||
result = QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::DIG::GlobalTriggerSource));
|
||||
resultList = result.remove(QChar(' ')).split("|");
|
||||
bdTestPulse[ID]->setEnabled(false);
|
||||
// bdTestPulse[ID]->setEnabled(false);
|
||||
for( int j = 0; j < (int) PHA::DIG::GlobalTriggerSource.GetAnswers().size(); j++){
|
||||
ckbGlbTrgSource[ID][j]->setChecked(false);
|
||||
for( int i = 0; i < resultList.count(); i++){
|
||||
if( resultList[i] == QString::fromStdString((PHA::DIG::GlobalTriggerSource.GetAnswers())[j].first) ) {
|
||||
ckbGlbTrgSource[ID][j]->setChecked(true);
|
||||
if( resultList[i] == "TestPulse" || cbDACoutMode[ID]->currentData().toString().toStdString() == "Square" ) bdTestPulse[ID]->setEnabled(true);
|
||||
// if( resultList[i] == "TestPulse" || cbDACoutMode[ID]->currentData().toString().toStdString() == "Square" ) bdTestPulse[ID]->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2567,7 +2655,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
FillComboBoxValueFromMemory(cbLVDSMode[ID][k], PHA::LVDS::LVDSMode, k);
|
||||
FillComboBoxValueFromMemory(cbLVDSDirection[ID][k], PHA::LVDS::LVDSDirection, k);
|
||||
}
|
||||
leLVDSIOReg[ID]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::LVDSIOReg)));
|
||||
leLVDSIOReg[ID]->setText(QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::DIG::LVDSIOReg)));
|
||||
|
||||
//------------- DAC
|
||||
FillComboBoxValueFromMemory(cbDACoutMode[ID], PHA::DIG::DACoutMode);
|
||||
|
@ -2586,12 +2674,19 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
sbDACoutChSelect[ID]->setEnabled(false);
|
||||
}
|
||||
|
||||
//------------ Group
|
||||
if( digi[ID]->GetModelName() != "VX2730" && digi[ID]->GetCupVer() >= MIN_VERSION_GROUP ){
|
||||
for( int k = 0 ; k < MaxNumberOfGroup; k++){
|
||||
FillSpinBoxValueFromMemory(spbInputDelay[ID][k], PHA::GROUP::InputDelay, k); // PHA = PSD
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//@============================== Channel setting/ status
|
||||
|
||||
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){
|
||||
|
||||
unsigned int status = atoi(digi[ID]->GetSettingValue(PHA::CH::ChannelStatus).c_str());
|
||||
unsigned int status = atoi(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelStatus).c_str());
|
||||
for( int i = 0; i < 9; i++){
|
||||
if( (status >> i) & 0x1 ) {
|
||||
chStatus[ID][ch][i]->setStyleSheet("background-color:green;");
|
||||
|
@ -2599,8 +2694,8 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
chStatus[ID][ch][i]->setStyleSheet("");
|
||||
}
|
||||
}
|
||||
chGainFactor[ID][ch]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::CH::GainFactor, ch)));
|
||||
chADCToVolts[ID][ch]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::CH::ADCToVolts, ch)));
|
||||
chGainFactor[ID][ch]->setText(QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::CH::GainFactor, ch)));
|
||||
chADCToVolts[ID][ch]->setText(QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::CH::ADCToVolts, ch)));
|
||||
|
||||
FillComboBoxValueFromMemory(cbbOnOff[ID][ch], PHA::CH::ChannelEnable, ch);
|
||||
FillSpinBoxValueFromMemory(spbRecordLength[ID][ch], PHA::CH::RecordLength, ch);
|
||||
|
@ -2634,7 +2729,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
FillComboBoxValueFromMemory(cbbDigProbe2[ID][ch], PHA::CH::WaveDigitalProbe2, ch);
|
||||
FillComboBoxValueFromMemory(cbbDigProbe3[ID][ch], PHA::CH::WaveDigitalProbe3, ch);
|
||||
|
||||
std::string itlConnect = digi[ID]->GetSettingValue(PHA::CH::ITLConnect, ch);
|
||||
std::string itlConnect = digi[ID]->GetSettingValueFromMemory(PHA::CH::ITLConnect, ch);
|
||||
if( itlConnect == "Disabled" ) {
|
||||
ITLConnectStatus[ID][ch] = 0;
|
||||
chITLConnect[ID][ch][0]->setStyleSheet("");
|
||||
|
@ -2702,21 +2797,21 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
|
|||
|
||||
//------ Trigger Mask
|
||||
if( cbChPick[ID]->currentData().toInt() < 0 ) {
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, 0));
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, 0));
|
||||
|
||||
bool isSame = true;
|
||||
for(int ch = 1; ch < digi[ID]->GetNChannels() ; ch ++){
|
||||
unsigned long haha = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, ch));
|
||||
unsigned long haha = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, ch));
|
||||
if( mask != haha) {
|
||||
isSame = false;
|
||||
leTriggerMask[ID][MaxNumberOfChannel]->setText("Diff. value");
|
||||
leTriggerMask[ID][digi[ID]->GetNChannels()]->setText("Diff. value");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( isSame ) leTriggerMask[ID][MaxNumberOfChannel]->setText("0x" + QString::number(mask, 16).toUpper());
|
||||
if( isSame ) leTriggerMask[ID][digi[ID]->GetNChannels()]->setText("0x" + QString::number(mask, 16).toUpper());
|
||||
}else{
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
|
||||
leTriggerMask[ID][digi[ID]->GetNChannels()]->setText("0x" + QString::number(mask, 16).toUpper());
|
||||
leTriggerMask[ID][digi[ID]->GetNChannels()]->setStyleSheet("");
|
||||
}
|
||||
|
@ -2844,13 +2939,13 @@ void DigiSettingsPanel::SetGlobalTriggerSource(){
|
|||
if( !enableSignalSlot ) return;
|
||||
|
||||
std::string value = "";
|
||||
if( cbDACoutMode[ID]->currentData().toString().toStdString() != "Square") bdTestPulse[ID]->setEnabled(false);
|
||||
// if( cbDACoutMode[ID]->currentData().toString().toStdString() != "Square") bdTestPulse[ID]->setEnabled(false);
|
||||
for( int i = 0; i < (int) PHA::DIG::GlobalTriggerSource.GetAnswers().size(); i++){
|
||||
if( ckbGlbTrgSource[ID][i]->isChecked() ){
|
||||
//printf("----- %s \n", DIGIPARA::DIG::StartSource.GetAnswers()[i].first.c_str());
|
||||
if( value != "" ) value += " | ";
|
||||
value += PHA::DIG::GlobalTriggerSource.GetAnswers()[i].first;
|
||||
if( PHA::DIG::GlobalTriggerSource.GetAnswers()[i].first == "TestPulse" ) bdTestPulse[ID]->setEnabled(true);
|
||||
// if( PHA::DIG::GlobalTriggerSource.GetAnswers()[i].first == "TestPulse" ) bdTestPulse[ID]->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2952,6 +3047,23 @@ void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_inde
|
|||
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara()) ;
|
||||
if( para.GetType() == TYPE::CH ) msg += ",CH:" + (index == -1 ? "All" : QString::number(index));
|
||||
msg += " = " + QString::number(spb->value());
|
||||
|
||||
if( para.GetPara() == PHA::GROUP::InputDelay.GetPara() ){
|
||||
|
||||
if( digi[ID]->WriteValue(para, std::to_string(spb->value()/8), index)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
spb->setStyleSheet("");
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
spb->setStyleSheet("color:red;");
|
||||
}
|
||||
|
||||
// printf("============%d| %s \n", index, digi[ID]->GetSettingValueFromMemory(PHA::GROUP::InputDelay, index).c_str());
|
||||
|
||||
|
||||
}else{
|
||||
if( digi[ID]->WriteValue(para, std::to_string(spb->value()), index)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
spb->setStyleSheet("");
|
||||
|
@ -2961,6 +3073,7 @@ void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_inde
|
|||
SendLogMsg(msg + "|Fail.");
|
||||
spb->setStyleSheet("color:red;");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3049,7 +3162,7 @@ void DigiSettingsPanel::SetupComboBoxTab(RComboBox *(&cbb)[][MaxNumberOfChannel
|
|||
}
|
||||
|
||||
void DigiSettingsPanel::FillComboBoxValueFromMemory(RComboBox *&cbb, const Reg para, int ch_index){
|
||||
QString result = QString::fromStdString(digi[ID]->GetSettingValue(para, ch_index));
|
||||
QString result = QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para, ch_index));
|
||||
//printf("%s === %s, %d, %p\n", __func__, result.toStdString().c_str(), ID, cbb);
|
||||
int index = cbb->findData(result);
|
||||
if( index >= 0 && index < cbb->count()) {
|
||||
|
@ -3060,10 +3173,15 @@ void DigiSettingsPanel::FillComboBoxValueFromMemory(RComboBox *&cbb, const Reg p
|
|||
}
|
||||
|
||||
void DigiSettingsPanel::FillSpinBoxValueFromMemory(RSpinBox *&spb, const Reg para, int ch_index){
|
||||
QString result = QString::fromStdString(digi[ID]->GetSettingValue(para, ch_index));
|
||||
QString result = QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para, ch_index));
|
||||
//printf("%s === %s, %d, %p\n", __func__, result.toStdString().c_str(), ID, spb);
|
||||
|
||||
if( para.GetPara() == PHA::GROUP::InputDelay.GetPara() && digi[ID]->GetCupVer() >= MIN_VERSION_GROUP) {
|
||||
spb->setValue(result.toDouble()*8);
|
||||
}else{
|
||||
spb->setValue(result.toDouble());
|
||||
}
|
||||
}
|
||||
|
||||
void DigiSettingsPanel::ReadBoardSetting(int cbIndex){
|
||||
|
||||
|
@ -3121,7 +3239,7 @@ void DigiSettingsPanel::ReadBoardSetting(int cbIndex){
|
|||
}
|
||||
if( haha == ANSTYPE::FLOAT) sbBdSettingsWrite->setDecimals(3);
|
||||
//===== combo Box
|
||||
if( haha == ANSTYPE::LIST){
|
||||
if( haha == ANSTYPE::COMBOX){
|
||||
cbBdAns->setEnabled(true);
|
||||
cbBdAns->clear();
|
||||
int ansIndex = -1;
|
||||
|
@ -3227,7 +3345,7 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
|
|||
sbChSettingsWrite->setDecimals(3);
|
||||
}
|
||||
if( haha == ANSTYPE::INTEGER) sbBdSettingsWrite->setDecimals(0);
|
||||
if( haha == ANSTYPE::LIST){
|
||||
if( haha == ANSTYPE::COMBOX){
|
||||
cbChSettingsWrite->setEnabled(true);
|
||||
cbChSettingsWrite->clear();
|
||||
int ansIndex = -1;
|
||||
|
@ -3316,7 +3434,7 @@ bool DigiSettingsPanel::CopyChannelSettings(int digiFrom, int chFrom, int digiTo
|
|||
SendLogMsg("Copy Settings from DIG:" + QString::number(digi[digiFrom]->GetSerialNumber()) + ", CH:" + QString::number(chFrom) + " ---> DIG:" + QString::number(digi[digiTo]->GetSerialNumber()) + ", CH:" + QString::number(chTo));
|
||||
for( int k = 0; k < (int) PHA::CH::AllSettings.size(); k ++){
|
||||
if( PHA::CH::AllSettings[k].ReadWrite() != RW::ReadWrite ) continue;
|
||||
std::string haha = digi[digiFrom]->GetSettingValue(PHA::CH::AllSettings[k], chFrom);
|
||||
std::string haha = digi[digiFrom]->GetSettingValueFromMemory(PHA::CH::AllSettings[k], chFrom);
|
||||
if( !digi[digiTo]->WriteValue( PHA::CH::AllSettings[k], haha , chTo ) ){
|
||||
SendLogMsg("something wrong when copying setting : " + QString::fromStdString( PHA::CH::AllSettings[k].GetPara())) ;
|
||||
return false;
|
||||
|
@ -3338,7 +3456,7 @@ bool DigiSettingsPanel::CopyBoardSettings(){
|
|||
//Copy setting
|
||||
for( int k = 0; k < (int) PHA::DIG::AllSettings.size(); k ++){
|
||||
if( PHA::DIG::AllSettings[k].ReadWrite() != RW::ReadWrite ) continue;
|
||||
if( ! digi[digiToIndex]->WriteValue( PHA::DIG::AllSettings[k], digi[digiFromIndex]->GetSettingValue(PHA::DIG::AllSettings[k])) ){
|
||||
if( ! digi[digiToIndex]->WriteValue( PHA::DIG::AllSettings[k], digi[digiFromIndex]->GetSettingValueFromMemory(PHA::DIG::AllSettings[k])) ){
|
||||
SendLogMsg("something wrong when copying setting : " + QString::fromStdString( PHA::DIG::AllSettings[k].GetPara())) ;
|
||||
return false;
|
||||
break;
|
||||
|
|
|
@ -65,6 +65,7 @@ private:
|
|||
QWidget * bdVGA[MaxNumberOfDigitizer];
|
||||
QWidget * bdLVDS[MaxNumberOfDigitizer];
|
||||
QWidget * bdITL[MaxNumberOfDigitizer];
|
||||
QWidget * bdGroup[MaxNumberOfDigitizer];
|
||||
|
||||
|
||||
QGroupBox * box0[MaxNumberOfDigitizer];
|
||||
|
@ -163,6 +164,12 @@ private:
|
|||
RSpinBox * spbTestPusleLowLevel[MaxNumberOfDigitizer];
|
||||
RSpinBox * spbTestPusleHighLevel[MaxNumberOfDigitizer];
|
||||
|
||||
RSpinBox * sbIPEAmplitude[MaxNumberOfDigitizer];
|
||||
RSpinBox * sbIPEBaseline[MaxNumberOfDigitizer];
|
||||
RSpinBox * sbIPEDecayTime[MaxNumberOfDigitizer];
|
||||
RSpinBox * sbIPERate[MaxNumberOfDigitizer];
|
||||
RComboBox * cbIPETimeMode[MaxNumberOfDigitizer];
|
||||
|
||||
//-------------- VGA
|
||||
RSpinBox * VGA[MaxNumberOfDigitizer][4];
|
||||
|
||||
|
@ -206,6 +213,9 @@ private:
|
|||
QLineEdit * chGainFactor[MaxNumberOfDigitizer][MaxNumberOfChannel];
|
||||
QLineEdit * chADCToVolts[MaxNumberOfDigitizer][MaxNumberOfChannel];
|
||||
|
||||
//--------------- Group settings
|
||||
RSpinBox * spbInputDelay[MaxNumberOfDigitizer][MaxNumberOfGroup];
|
||||
|
||||
//--------------- Channel settings
|
||||
RComboBox * cbChPick[MaxNumberOfDigitizer];
|
||||
|
||||
|
|
37
firmwares/compareJSON.py
Normal file
37
firmwares/compareJSON.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
import json
|
||||
|
||||
# Load the two JSON files
|
||||
with open("x2745_DPP-PHA_2023091800_parameters.json") as f1:
|
||||
old_params = json.load(f1)
|
||||
|
||||
with open("x2745_DPP-PHA_2025012205_parameters.json") as f2:
|
||||
new_params = json.load(f2)
|
||||
|
||||
# Index by parameter name for easy lookup
|
||||
old_dict = {param["name"]: param for param in old_params}
|
||||
new_dict = {param["name"]: param for param in new_params}
|
||||
|
||||
# 1. Find new parameter names
|
||||
new_names = set(new_dict.keys()) - set(old_dict.keys())
|
||||
print("🆕 New parameters in new version:")
|
||||
for name in sorted(new_names):
|
||||
print(f" - {name}")
|
||||
|
||||
# 2. Compare allowed values for common parameters
|
||||
print("\n🔍 Parameters with changed allowed values:")
|
||||
for name in sorted(set(old_dict.keys()) & set(new_dict.keys())):
|
||||
old_vals = {v["value"]: v["description"] for v in old_dict[name].get("allowed_values", [])}
|
||||
new_vals = {v["value"]: v["description"] for v in new_dict[name].get("allowed_values", [])}
|
||||
|
||||
if old_vals != new_vals:
|
||||
print(f" - {name}")
|
||||
removed = set(old_vals) - set(new_vals)
|
||||
added = set(new_vals) - set(old_vals)
|
||||
changed = {k for k in old_vals if k in new_vals and old_vals[k] != new_vals[k]}
|
||||
|
||||
if added:
|
||||
print(f" ➕ Added: {sorted(added)}")
|
||||
if removed:
|
||||
print(f" ➖ Removed: {sorted(removed)}")
|
||||
if changed:
|
||||
print(f" 🔄 Modified descriptions: {sorted(changed)}")
|
1
firmwares/firmware_backup_webpage.txt
Normal file
1
firmwares/firmware_backup_webpage.txt
Normal file
|
@ -0,0 +1 @@
|
|||
https://fsunuc.physics.fsu.edu/wiki/index.php/FSU_SOLARIS_DAQ#Firmware
|
76
firmwares/web2JSON.py
Normal file
76
firmwares/web2JSON.py
Normal file
|
@ -0,0 +1,76 @@
|
|||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
url = "http://192.168.0.102/documentation/a00103.html"
|
||||
response = requests.get(url)
|
||||
soup = BeautifulSoup(response.content, 'html.parser')
|
||||
|
||||
print(url)
|
||||
|
||||
# print(soup)
|
||||
|
||||
# Get the entire div
|
||||
project_div = soup.find('div', id='projectname')
|
||||
print("Full Text:", project_div.get_text(strip=True))
|
||||
|
||||
# Get just the main project name (excluding the span)
|
||||
project_name = project_div.contents[0].strip()
|
||||
print("Name:", project_name)
|
||||
|
||||
# Get the project number from the span
|
||||
project_number = project_div.find('span', id='projectnumber').get_text(strip=True)
|
||||
print("Number:", project_number)
|
||||
|
||||
safe_name = project_name.replace(" ", "_")
|
||||
filename = f"{safe_name}_{project_number}_parameters.json"
|
||||
|
||||
import json
|
||||
|
||||
data = []
|
||||
|
||||
# Iterate through all <h2> blocks which denote parameters
|
||||
for h2 in soup.find_all("h2"):
|
||||
param = {}
|
||||
name = h2.get_text(strip=True)
|
||||
param['name'] = name
|
||||
|
||||
# Description is usually the next <p>
|
||||
desc_tag = h2.find_next_sibling('p')
|
||||
if desc_tag:
|
||||
param['description'] = desc_tag.get_text(strip=True)
|
||||
|
||||
# Get the next two blockquotes: one for options, one for allowed values
|
||||
blockquotes = desc_tag.find_all_next('blockquote', class_='doxtable', limit=2)
|
||||
|
||||
# Parse Options
|
||||
if len(blockquotes) > 0:
|
||||
options = {}
|
||||
for li in blockquotes[0].find_all('li'):
|
||||
text = li.get_text(strip=True)
|
||||
if ':' in text:
|
||||
key, val = text.split(':', 1)
|
||||
options[key.strip()] = val.strip()
|
||||
param['options'] = options
|
||||
|
||||
# Parse Allowed Values
|
||||
if len(blockquotes) > 1:
|
||||
allowed_values = []
|
||||
for li in blockquotes[1].find_all('li'):
|
||||
b_tag = li.find('b')
|
||||
em_tag = li.find('em')
|
||||
if b_tag and em_tag:
|
||||
allowed_values.append({
|
||||
'value': b_tag.get_text(strip=True),
|
||||
'description': em_tag.get_text(strip=True)
|
||||
})
|
||||
param['allowed_values'] = allowed_values
|
||||
|
||||
data.append(param)
|
||||
|
||||
|
||||
# print(parameters)
|
||||
|
||||
|
||||
# Output as JSON
|
||||
with open(filename, 'w') as f:
|
||||
json.dump(data, f, indent=2)
|
157
influxdb.cpp
157
influxdb.cpp
|
@ -1,157 +0,0 @@
|
|||
#include "influxdb.h"
|
||||
|
||||
|
||||
InfluxDB::InfluxDB(std::string url, bool verbose){
|
||||
|
||||
curl = curl_easy_init();
|
||||
if( verbose) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||
SetURL(url);
|
||||
respondCode = 0;
|
||||
dataPoints = "";
|
||||
}
|
||||
|
||||
InfluxDB::~InfluxDB(){
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
void InfluxDB::SetURL(std::string url){
|
||||
// check the last char of url is "/"
|
||||
if( url.back() != '/') {
|
||||
this->databaseIP = url + "/";
|
||||
}else{
|
||||
this->databaseIP = url;
|
||||
}
|
||||
}
|
||||
|
||||
bool InfluxDB::TestingConnection(){
|
||||
CheckDatabases();
|
||||
if( respond != CURLE_OK ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string InfluxDB::CheckDatabases(){
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "query").c_str());
|
||||
|
||||
std::string postFields="q=Show databases";
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(postFields.length()));
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postFields.c_str());
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallBack);
|
||||
std::string readBuffer;
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
||||
|
||||
Execute();
|
||||
|
||||
//printf("|%s|\n", readBuffer.c_str());
|
||||
|
||||
if( respond != CURLE_OK) return "";
|
||||
|
||||
databaseList.clear();
|
||||
|
||||
size_t pos = readBuffer.find("values");
|
||||
|
||||
if( pos > 0 ){
|
||||
std::string kaka = readBuffer.substr(pos+8);
|
||||
|
||||
pos = kaka.find("}");
|
||||
kaka = kaka.substr(0, pos);
|
||||
|
||||
int len = kaka.length();
|
||||
bool startFlag = false;
|
||||
std::string lala;
|
||||
|
||||
char yaya = '"';
|
||||
|
||||
for( int i = 0; i < len; i++){
|
||||
|
||||
if( startFlag == false && kaka[i] == yaya ) {
|
||||
startFlag = true;
|
||||
lala = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
if( startFlag && kaka[i] == yaya ){
|
||||
startFlag = false;
|
||||
databaseList.push_back(lala);
|
||||
continue;
|
||||
}
|
||||
if( startFlag ) lala += kaka[i];
|
||||
}
|
||||
}
|
||||
|
||||
return readBuffer;
|
||||
}
|
||||
|
||||
std::string InfluxDB::Query(std::string databaseName, std::string query){
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "query?db=" + databaseName).c_str());
|
||||
|
||||
std::string postFields = "q=" + query;
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(postFields.length()));
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postFields.c_str());
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallBack);
|
||||
std::string readBuffer;
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
|
||||
|
||||
Execute();
|
||||
|
||||
//printf("|%s|\n", readBuffer.c_str());
|
||||
|
||||
return readBuffer;
|
||||
}
|
||||
|
||||
void InfluxDB::CreateDatabase(std::string databaseName){
|
||||
curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "query").c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||
|
||||
std::string postFields = "q=CREATE DATABASE " + databaseName;
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(postFields.length()));
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postFields.c_str());
|
||||
|
||||
Execute();
|
||||
}
|
||||
|
||||
void InfluxDB::AddDataPoint(std::string fullString){
|
||||
dataPoints += fullString + "\n";
|
||||
}
|
||||
|
||||
void InfluxDB::ClearDataPointsBuffer(){
|
||||
dataPoints = "";
|
||||
}
|
||||
|
||||
void InfluxDB::PrintDataPoints(){
|
||||
printf("%s\n", dataPoints.c_str());
|
||||
}
|
||||
|
||||
void InfluxDB::WriteData(std::string databaseName){
|
||||
if( dataPoints.length() == 0 ) return;
|
||||
//printf("|%s|\n", (databaseIP + "write?db=" + databaseName).c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_URL, (databaseIP + "write?db=" + databaseName).c_str());
|
||||
curl_easy_setopt(curl, CURLOPT_POST, 1L);
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(dataPoints.length()));
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, dataPoints.c_str());
|
||||
Execute();
|
||||
}
|
||||
|
||||
|
||||
void InfluxDB::Execute(){
|
||||
try{
|
||||
respond = curl_easy_perform(curl);
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &respondCode);
|
||||
//printf("==== respond %d (OK = %d)\n", respond, CURLE_OK);
|
||||
if( respond != CURLE_OK) printf("############# InfluxDB::Execute fail\n");
|
||||
} catch (std::exception& e){ // in case of unexpected error
|
||||
printf("%s\n", e.what());
|
||||
respond = CURLE_SEND_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
size_t InfluxDB::WriteCallBack(char *contents, size_t size, size_t nmemb, void *userp){
|
||||
((std::string*)userp)->append((char*)contents, size * nmemb);
|
||||
return size * nmemb;
|
||||
}
|
2
macro.h
2
macro.h
|
@ -5,6 +5,8 @@
|
|||
#define DAQLockFile "DAQLock.dat"
|
||||
#define PIDFile "pid.dat"
|
||||
|
||||
#include <QString>
|
||||
|
||||
//^=================================
|
||||
namespace Utility{
|
||||
/// either haha is "0xFFF" or "12435", convert to 10-base
|
||||
|
|
3
main.cpp
3
main.cpp
|
@ -8,6 +8,8 @@
|
|||
|
||||
int main(int argc, char *argv[]){
|
||||
|
||||
printf("######### Starting SOLARIS DAQ....\n");
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
||||
bool isLock = false;
|
||||
|
@ -60,6 +62,7 @@ int main(int argc, char *argv[]){
|
|||
pidFile.write( QString::number(QCoreApplication::applicationPid() ).toStdString().c_str() );
|
||||
pidFile.close();
|
||||
|
||||
printf("######### Open Main Window...\n");
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
|
|
880
mainwindow.cpp
880
mainwindow.cpp
File diff suppressed because it is too large
Load Diff
57
mainwindow.h
57
mainwindow.h
|
@ -22,7 +22,8 @@
|
|||
|
||||
#include "macro.h"
|
||||
#include "ClassDigitizer2Gen.h"
|
||||
#include "influxdb.h"
|
||||
// #include "influxdb.h"
|
||||
#include "ClassInfluxDB.h"
|
||||
|
||||
#include "CustomThreads.h"
|
||||
|
||||
|
@ -70,11 +71,13 @@ private slots:
|
|||
void OpenDirectory(int id);
|
||||
|
||||
void SetupNewExpPanel();
|
||||
bool LoadExpSettings();
|
||||
bool LoadExpNameSh();
|
||||
void CreateNewExperiment(const QString newExpName);
|
||||
void ChangeExperiment(const QString newExpName);
|
||||
void WriteExpNameSh();
|
||||
void CreateRawDataFolderAndLink();
|
||||
void CreateFolder(QString path, QString AdditionalMsg);
|
||||
void CreateRawDataFolder();
|
||||
void CreateDataSymbolicLink();
|
||||
|
||||
void closeEvent(QCloseEvent * event){
|
||||
if( digiSetting ) digiSetting->close();
|
||||
|
@ -86,7 +89,7 @@ private slots:
|
|||
void WriteElog(QString htmlText, QString subject = "", QString category = "", int runNumber = 0);
|
||||
void AppendElog(QString appendHtmlText, int screenID = -1);
|
||||
|
||||
void WriteRunTimeStampDat(bool isStartRun);
|
||||
void WriteRunTimeStampDat(bool isStartRun, QString timeStr);
|
||||
|
||||
signals :
|
||||
|
||||
|
@ -95,6 +98,7 @@ private:
|
|||
static Digitizer2Gen ** digi;
|
||||
unsigned short nDigi;
|
||||
unsigned short nDigiConnected = 0;
|
||||
int maxNumChannelAcrossDigitizer = 0;
|
||||
|
||||
//@----- log msg
|
||||
QPlainTextEdit * logInfo;
|
||||
|
@ -113,6 +117,7 @@ private:
|
|||
QPushButton * bnDigiSettings;
|
||||
QPushButton * bnSOLSettings;
|
||||
|
||||
|
||||
//@----- scope
|
||||
Scope * scope;
|
||||
QPushButton * bnOpenScope;
|
||||
|
@ -122,6 +127,7 @@ private:
|
|||
QGridLayout * scalarLayout;
|
||||
TimingThread * scalarThread;
|
||||
QPushButton * bnOpenScalar;
|
||||
QLabel ** lbFileSize;// need to delete manually
|
||||
QLineEdit *** leTrigger; // need to delete manually
|
||||
QLineEdit *** leAccept; // need to delete manually
|
||||
QLabel * lbLastUpdateTime;
|
||||
|
@ -144,11 +150,13 @@ private:
|
|||
QString stopComment;
|
||||
QString appendComment;
|
||||
bool needManualComment;
|
||||
bool isRunning;
|
||||
bool isACQRunning;
|
||||
QTimer * runTimer;
|
||||
QElapsedTimer elapsedTimer;
|
||||
unsigned int autoRunStartRunID;
|
||||
|
||||
bool ACQStopButtonPressed;
|
||||
|
||||
//@----- digi Setting panel
|
||||
DigiSettingsPanel * digiSetting;
|
||||
|
||||
|
@ -161,32 +169,43 @@ private:
|
|||
QStringList detGroupName;
|
||||
|
||||
//@----- Program settings
|
||||
QLineEdit * lSaveSettingPath; // only live in ProgramSettigns()
|
||||
QLineEdit * lAnalysisPath; // only live in ProgramSettigns()
|
||||
QLineEdit * lDataPath; // only live in ProgramSettigns()
|
||||
QLineEdit * lRootDataPath; // only live in ProgramSettigns()
|
||||
QLineEdit * lAnalysisPath; //for git
|
||||
QLineEdit * lExpDataPath;
|
||||
|
||||
QLineEdit * lExpName;
|
||||
|
||||
QLineEdit * lIPDomain;
|
||||
QLineEdit * lDatbaseIP;
|
||||
QLineEdit * lDatbaseName;
|
||||
QLineEdit * lDatbaseToken;
|
||||
QLineEdit * lElogIP;
|
||||
QLineEdit * lElogUser;
|
||||
QLineEdit * lElogPWD;
|
||||
|
||||
QString programSettingsPath;
|
||||
QCheckBox * chkSaveSubFolder;
|
||||
bool isSaveSubFolder;
|
||||
|
||||
QStringList existGitBranches;
|
||||
|
||||
QString programPath;
|
||||
QString analysisPath;
|
||||
QString dataPath;
|
||||
QString masterExpDataPath;
|
||||
QString expDataPath;
|
||||
QString rawDataPath;
|
||||
QString rootDataPath;
|
||||
QString IPListStr;
|
||||
QStringList IPList;
|
||||
QString DatabaseIP;
|
||||
QString DatabaseName;
|
||||
QString DatabaseToken;
|
||||
QString ElogIP;
|
||||
QString ElogUser;
|
||||
QString ElogPWD;
|
||||
|
||||
//@------ experiment settings
|
||||
bool isGitExist;
|
||||
bool useGit;
|
||||
QString expName;
|
||||
QString rawDataFolder;
|
||||
QString rootDataFolder;
|
||||
int runID;
|
||||
QString runIDStr;
|
||||
int elogID; // 0 = ready, -1 = disable, >1 = elogID
|
||||
|
@ -202,6 +221,18 @@ private:
|
|||
QPushButton * bnComment;
|
||||
void AppendComment();
|
||||
|
||||
QString maskText(const QString &password) {
|
||||
if (password.length() <= 3) {
|
||||
return password; // No masking needed for short passwords
|
||||
} else if (password.length() <= 10) {
|
||||
QString maskedPassword = password.left(3);
|
||||
maskedPassword += QString("*").repeated(password.length() - 3);
|
||||
return maskedPassword;
|
||||
} else {
|
||||
return password.left(3) + QString("*").repeated(7);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
32
makeTest
32
makeTest
|
@ -1,32 +0,0 @@
|
|||
CC = g++
|
||||
COPTS = -fPIC -DLINUX -O2 -std=c++17 -lpthread -g
|
||||
CAENLIBS = -lCAEN_FELib
|
||||
CURLLIBS = -lcurl
|
||||
|
||||
OBJS= ClassDigitizer2Gen.o influxdb.o
|
||||
|
||||
#
|
||||
#
|
||||
################################################################
|
||||
all : test windowID
|
||||
|
||||
#
|
||||
test : test.cpp ClassDigitizer2Gen.o influxdb.o
|
||||
@echo "------- test"
|
||||
$(CC) $(COPTS) $(OBJS) -o test test.cpp $(CAENLIBS) $(CURLLIBS)
|
||||
#
|
||||
ClassDigitizer2Gen.o : ClassDigitizer2Gen.cpp ClassDigitizer2Gen.h Hit.h DigiParameters.h
|
||||
@echo "------- ClassDigitizer2Gen.o"
|
||||
$(CC) $(COPTS) -c ClassDigitizer2Gen.cpp $(CAENLIBS)
|
||||
#
|
||||
influxdb.o : influxdb.cpp influxdb.h
|
||||
@echo "------- influxdb.o"
|
||||
$(CC) $(COPTS) -c influxdb.cpp $(CURLLIBS)
|
||||
#
|
||||
windowID : windowID.cpp
|
||||
@echo "------- windowID"
|
||||
${CC} ${COPTS} -o windowID windowID.cpp -lX11 -lpng
|
||||
|
||||
|
||||
clean :
|
||||
rm -f $(ALL) $(OBJS)
|
94
scope.cpp
94
scope.cpp
|
@ -12,7 +12,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
|||
this->digi = digi;
|
||||
this->nDigi = nDigi;
|
||||
if( nDigi > MaxNumberOfDigitizer ) {
|
||||
this->nDigi = MaxNumberOfChannel;
|
||||
this->nDigi = MaxNumberOfDigitizer;
|
||||
qDebug() << "Please increase the MaxNumberOfChannel";
|
||||
}
|
||||
this->readDataThread = readDataThread;
|
||||
|
@ -87,9 +87,16 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
|||
connect(cbScopeCh, &RComboBox::currentIndexChanged, this, [=](){
|
||||
if( !allowChange ) return;
|
||||
int iDigi = cbScopeDigi->currentIndex();
|
||||
int ch = cbScopeCh->currentIndex();
|
||||
digiMTX[iDigi].lock();
|
||||
ReadScopeSettings();
|
||||
RestoreSettings(false);
|
||||
if( digi[iDigi]->IsAcqOn()){
|
||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
|
||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
|
||||
}
|
||||
digiMTX[iDigi].unlock();
|
||||
|
||||
});
|
||||
|
||||
bnScopeReset = new QPushButton("ReProgram Channels", this);
|
||||
|
@ -273,6 +280,18 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
|||
|
||||
UpdateSettingsFromMemeory();
|
||||
|
||||
oldDigi = cbScopeDigi->currentIndex();
|
||||
oldCh = cbScopeCh->currentIndex();;
|
||||
waveSaving = digi[oldDigi]->ReadValue(PHA::CH::WaveSaving, oldCh);
|
||||
waveTriggerSource = digi[oldDigi]->ReadValue(PHA::CH::WaveTriggerSource, oldCh);
|
||||
clockSource = digi[oldDigi]->ReadValue(PHA::DIG::ClockSource);
|
||||
startSource = digi[oldDigi]->ReadValue(PHA::DIG::StartSource);
|
||||
syncOutMode = digi[oldDigi]->ReadValue(PHA::DIG::SyncOutMode);
|
||||
|
||||
for( int ch2 = 0 ; ch2 < digi[oldDigi]->GetNChannels(); ch2 ++){
|
||||
channelEnable[oldDigi][ch2] = digi[oldDigi]->ReadValue(PHA::CH::ChannelEnable, ch2);
|
||||
}
|
||||
originalValueSet = true;
|
||||
}
|
||||
|
||||
Scope::~Scope(){
|
||||
|
@ -315,7 +334,8 @@ void Scope::ChangeDigitizer(){
|
|||
digiProbeList.push_back(PSD::CH::WaveDigitalProbe0);
|
||||
digiProbeList.push_back(PSD::CH::WaveDigitalProbe1);
|
||||
digiProbeList.push_back(PSD::CH::WaveDigitalProbe2);
|
||||
digiProbeList.push_back(PSD::CH::WaveDigitalProbe3); }
|
||||
digiProbeList.push_back(PSD::CH::WaveDigitalProbe3);
|
||||
}
|
||||
|
||||
cbAnaProbe[0]->clear();
|
||||
cbAnaProbe[1]->clear();
|
||||
|
@ -347,6 +367,11 @@ void Scope::ChangeDigitizer(){
|
|||
|
||||
digiMTX[index].lock();
|
||||
ReadScopeSettings();
|
||||
|
||||
if( digi[index]->IsAcqOn() ){
|
||||
digi[index]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
|
||||
digi[index]->WriteValue(PHA::CH::ChannelEnable, "True", cbScopeCh->currentIndex());
|
||||
}
|
||||
digiMTX[index].unlock();
|
||||
allowChange = true;
|
||||
|
||||
|
@ -553,6 +578,34 @@ void Scope::UpdateSettingsFromMemeory(){
|
|||
allowChange = true;
|
||||
}
|
||||
|
||||
void Scope::RestoreSettings(bool changeBoard){
|
||||
|
||||
if( !originalValueSet) return;
|
||||
|
||||
//restore for old digi and old ch
|
||||
if( changeBoard ){
|
||||
digi[oldDigi]->WriteValue(PHA::DIG::ClockSource, clockSource);
|
||||
digi[oldDigi]->WriteValue(PHA::DIG::StartSource, startSource);
|
||||
digi[oldDigi]->WriteValue(PHA::DIG::SyncOutMode, syncOutMode);
|
||||
}
|
||||
digi[oldDigi]->WriteValue(PHA::CH::WaveSaving, waveSaving, oldCh);
|
||||
digi[oldDigi]->WriteValue(PHA::CH::WaveTriggerSource, waveTriggerSource, oldCh);
|
||||
|
||||
// back up data for new digi and ch
|
||||
int iDigi = cbScopeDigi->currentIndex();
|
||||
int ch = cbScopeCh->currentIndex();
|
||||
|
||||
waveSaving = digi[iDigi]->ReadValue(PHA::CH::WaveSaving, ch);
|
||||
waveTriggerSource = digi[iDigi]->ReadValue(PHA::CH::WaveTriggerSource, ch);
|
||||
if( changeBoard ){
|
||||
clockSource = digi[iDigi]->ReadValue(PHA::DIG::ClockSource);
|
||||
startSource = digi[iDigi]->ReadValue(PHA::DIG::StartSource);
|
||||
syncOutMode = digi[iDigi]->ReadValue(PHA::DIG::SyncOutMode);
|
||||
}
|
||||
oldDigi = iDigi;
|
||||
oldCh = ch;
|
||||
}
|
||||
|
||||
void Scope::StartScope(){
|
||||
|
||||
if( !digi ) return;
|
||||
|
@ -569,23 +622,29 @@ void Scope::StartScope(){
|
|||
ReadScopeSettings();
|
||||
|
||||
/// the settings are the same for PHA and PSD
|
||||
|
||||
for( int ch2 = 0 ; ch2 < digi[iDigi]->GetNChannels(); ch2 ++){
|
||||
channelEnable[iDigi][ch2] = digi[iDigi]->ReadValue(PHA::CH::ChannelEnable, ch2);
|
||||
}
|
||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
|
||||
|
||||
if( iDigi == cbScopeDigi->currentIndex() ){
|
||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
|
||||
|
||||
clockSource = digi[iDigi]->ReadValue(PHA::DIG::ClockSource);
|
||||
startSource = digi[iDigi]->ReadValue(PHA::DIG::StartSource);
|
||||
syncOutMode = digi[iDigi]->ReadValue(PHA::DIG::SyncOutMode);
|
||||
waveSaving = digi[iDigi]->ReadValue(PHA::CH::WaveSaving, ch);
|
||||
digi[iDigi]->WriteValue(PHA::CH::WaveSaving, "Always", ch);
|
||||
|
||||
waveTriggerSource = digi[iDigi]->ReadValue(PHA::CH::WaveTriggerSource, ch);
|
||||
digi[iDigi]->WriteValue(PHA::CH::WaveTriggerSource, "ChSelfTrigger", ch);
|
||||
}
|
||||
oldDigi = iDigi;
|
||||
oldCh = ch;
|
||||
|
||||
originalValueSet = true;
|
||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
|
||||
digi[iDigi]->WriteValue(PHA::CH::WaveSaving, "Always", ch);
|
||||
digi[iDigi]->WriteValue(PHA::CH::WaveTriggerSource, "ChSelfTrigger", ch);
|
||||
|
||||
digi[iDigi]->WriteValue(PHA::DIG::ClockSource, "Internal");
|
||||
digi[iDigi]->WriteValue(PHA::DIG::StartSource, "SWcmd");
|
||||
digi[iDigi]->WriteValue(PHA::DIG::SyncOutMode, "Disabled");
|
||||
|
||||
}
|
||||
|
||||
digi[iDigi]->SetDataFormat(DataFormat::ALL);
|
||||
digi[iDigi]->StartACQ();
|
||||
|
@ -622,23 +681,16 @@ void Scope::StopScope(){
|
|||
|
||||
digiMTX[i].lock();
|
||||
digi[i]->StopACQ();
|
||||
if( originalValueSet ){
|
||||
for( int ch2 = 0 ; ch2 < digi[i]->GetNChannels(); ch2 ++){
|
||||
digi[i]->WriteValue(PHA::CH::ChannelEnable, channelEnable[i][ch2], ch2);
|
||||
}
|
||||
if( i == cbScopeDigi->currentIndex() ) {
|
||||
digi[i]->WriteValue(PHA::CH::WaveTriggerSource, waveTriggerSource, cbScopeCh->currentIndex());
|
||||
digi[i]->WriteValue(PHA::CH::WaveSaving, waveSaving, cbScopeCh->currentIndex());
|
||||
}
|
||||
originalValueSet = false;
|
||||
}
|
||||
RestoreSettings(true);
|
||||
digiMTX[i].unlock();
|
||||
}
|
||||
|
||||
emit TellACQOnOff(false);
|
||||
}
|
||||
|
||||
|
||||
ScopeControlOnOff(true);
|
||||
emit TellSettingsPanelControlOnOff();
|
||||
|
||||
|
@ -663,7 +715,7 @@ void Scope::UpdateScope(){
|
|||
leTriggerRate->setText(QString::fromStdString(haha));
|
||||
|
||||
//unsigned int traceLength = qMin((int) digi[iDigi]->hit->traceLenght, MaxDisplayTraceDataLength);
|
||||
unsigned int traceLength = qMin( atoi(digi[iDigi]->GetSettingValue(PHA::CH::RecordLength, ch).c_str())/sample2ns, MaxDisplayTraceDataLength );
|
||||
unsigned int traceLength = qMin( atoi(digi[iDigi]->GetSettingValueFromMemory(PHA::CH::RecordLength, ch).c_str())/sample2ns, MaxDisplayTraceDataLength );
|
||||
|
||||
if( atoi(haha.c_str()) == 0 ) {
|
||||
digiMTX[iDigi].unlock();
|
||||
|
@ -792,12 +844,12 @@ void Scope::ScopeControlOnOff(bool on){
|
|||
}
|
||||
|
||||
void Scope::ScopeReadSpinBoxValue(int iDigi, int ch, RSpinBox *sb, const Reg digPara){
|
||||
std::string ans = digi[iDigi]->GetSettingValue(digPara, ch);
|
||||
std::string ans = digi[iDigi]->GetSettingValueFromMemory(digPara, ch);
|
||||
sb->setValue(atoi(ans.c_str()));
|
||||
}
|
||||
|
||||
void Scope::ScopeReadComboBoxValue(int iDigi, int ch, RComboBox *cb, const Reg digPara){
|
||||
std::string ans = digi[iDigi]->GetSettingValue(digPara, ch);
|
||||
std::string ans = digi[iDigi]->GetSettingValueFromMemory(digPara, ch);
|
||||
int index = cb->findData(QString::fromStdString(ans));
|
||||
if( index >= 0 && index < cb->count()) {
|
||||
cb->setCurrentIndex(index);
|
||||
|
|
8
scope.h
8
scope.h
|
@ -240,11 +240,19 @@ private:
|
|||
void SetupPSD();
|
||||
|
||||
// remembee setting, once the scope stop, restore it.
|
||||
|
||||
void RestoreSettings(bool changeBoard); // except channelEnable
|
||||
bool originalValueSet;
|
||||
|
||||
short oldCh, oldDigi;
|
||||
std::string channelEnable[MaxNumberOfDigitizer][MaxNumberOfChannel];
|
||||
std::string waveSaving;
|
||||
std::string waveTriggerSource;
|
||||
|
||||
std::string clockSource;
|
||||
std::string startSource;
|
||||
std::string syncOutMode;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,8 +1,19 @@
|
|||
#!/bin/bash -l
|
||||
|
||||
echo "################# end Run Script"
|
||||
echo "################# End-Run Script"
|
||||
|
||||
#xterm -T endRunScript -hold -geometry 100x20+0+0 -sb -sl 1000 -e "Process_Run" "lastRun"
|
||||
xterm -T endRunScript -geometry 100x20+0+0 -sb -sl 1000 -e "source ~/Analysis/SOLARIS.sh; Process_Run lastRun 2 0"
|
||||
#xterm -T endRunScript -geometry 100x20+0+0 -sb -sl 1000 -e "source ~/Analysis/SOLARIS.sh; Process_Run lastRun 2 0"
|
||||
|
||||
#master data path
|
||||
dataPath=~/ExpData/SOLARISDAQ/Haha/
|
||||
|
||||
#load the runID from expName
|
||||
source $dataPath/data_raw/expName.sh
|
||||
|
||||
#format runID to 3 digit
|
||||
runIDStr=$(printf "run%03d" $runID)
|
||||
|
||||
cp $dataPath/ExpSetup.txt $dataPath/data_raw/$runIDStr/.
|
||||
|
||||
echo "################# done"
|
Loading…
Reference in New Issue
Block a user