remove some compiler warnings, edit pro file to able to compiled with CERN ROOT

This commit is contained in:
carina@hades 2023-04-11 11:50:52 -04:00
parent a35bd6e577
commit a66033d3d8
4 changed files with 20 additions and 11 deletions

View File

@ -177,7 +177,8 @@ inline void Data::SaveBuffer(const char * fileName){
fclose(haha);
saveFileIndex ++;
sprintf(saveFileName, "%s_%03u.fsu", fileName , saveFileIndex);
FILE * haha = fopen(saveFileName, "a+");
fclose(haha);
haha = fopen(saveFileName, "a+");
}
fwrite(buffer, nByte, 1, haha);
@ -204,7 +205,7 @@ inline void Data::PrintStat() const{
inline void Data::PrintBuffer() const{
unsigned int length = sizeof(buffer);
for( int i = 0; i < length; i++){
for( unsigned int i = 0; i < length; i++){
printf("%3d | 0x%08x \n", i, buffer[i]);
}
}
@ -399,7 +400,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
}
///========== decode an event
for( int ev = 0; ev < nEvents ; ev++){
for( unsigned int ev = 0; ev < nEvents ; ev++){
if( verbose >= 2 ) printf("------ event : %d\n", ev);
nw = nw +1 ; word = ReadBuffer(nw, verbose);
bool channelTag = ((word >> 31) & 0x1);
@ -419,7 +420,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
if( fastDecode ){
nw += nSample/2;
}else{
for( int wi = 0; wi < nSample/2; wi++){
for( unsigned int wi = 0; wi < nSample/2; wi++){
nw = nw +1 ; word = ReadBuffer(nw, verbose-2);
///The CAEN manual is wrong, the bit [31:16] is anaprobe 1
bool isTrigger1 = (( word >> 31 ) & 0x1 );
@ -486,6 +487,7 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
bool pileUpOrRollOver = ((word >> 15) & 0x1);
if( verbose >= 3 ) {
printf("PileUp or RollOver : %d\n", pileUpOrRollOver);
printf("PileUp : %d , extra : 0x%03x, energy : %d \n", pileUp, extra, energy);
printf(" lost event : %d \n", ((extra >> 0) & 0x1) );
printf(" roll-over : %d (fake event)\n", ((extra >> 1) & 0x1) );
@ -601,7 +603,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
if( verbose >= 2 ) printf("----------------- nEvents : %d \n", nEvents);
///========= Decode an event
for( int ev = 0; ev < nEvents ; ev++){
for( unsigned int ev = 0; ev < nEvents ; ev++){
if( verbose >= 2 ) printf("--------------------------- event : %d\n", ev);
nw = nw +1 ; word = ReadBuffer(nw, verbose);
bool channelTag = ((word >> 31) & 0x1);
@ -620,7 +622,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
if( fastDecode ){
nw += nSample/2;
}else{
for( int wi = 0; wi < nSample/2; wi++){
for( unsigned int wi = 0; wi < nSample/2; wi++){
nw = nw +1 ; word = ReadBuffer(nw, verbose - 2);
bool dp2b = (( word >> 31 ) & 0x1 );
bool dp1b = (( word >> 30 ) & 0x1 );

View File

@ -654,7 +654,7 @@ int Digitizer::LoadSettingBinaryToMemory(std::string fileName){
uint32_t fileDPP = ((ReadSettingFromFile(Register::DPP::AMCFirmwareRevision_R, 0) >> 8) & 0xFF);
/// compare seeting DPP version;
if( isConnected && DPPType != fileDPP ){
if( isConnected && DPPType != (int) fileDPP ){
printf("DPPType in the file is %s(0x%X), but the dgitizer DPPType is %s(0x%X). \n", GetDPPString(fileDPP).c_str(), fileDPP, GetDPPString().c_str(), DPPType);
return -1;
}else{
@ -705,7 +705,7 @@ void Digitizer::SaveSettingToFile(Reg registerAddress, unsigned int value, unsig
///fseek( settingFile, address, SEEK_SET);
fseek( settingFile, index * 4, SEEK_SET);
unsigned int jaja[1] = {value};
size_t dummy = fwrite( jaja, sizeof(unsigned int), 1, settingFile);
fwrite( jaja, sizeof(unsigned int), 1, settingFile);
///printf("fwrite ret : %d, 0x%0X, 0x%0X, %d, 0x%X = %d\n", (int)dummy, registerAddress, index*4, index, jaja[0], jaja[0]);
fclose (settingFile);
}

View File

@ -6,9 +6,12 @@ TEMPLATE = app
TARGET = FSUDAQ_Qt6
INCLUDEPATH += .
QT += widgets charts
CONFIG += c++17
LIBS += -lCAENDigitizer
QT += core widgets charts
QMAKE_CXXFLAGS += `root-config --cflags --glibs`
LIBS += -lCAENDigitizer `root-config --cflags --glibs`
# You can make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
@ -20,3 +23,5 @@ LIBS += -lCAENDigitizer
# Input
HEADERS += ClassData.h ClassDigitizer.h macro.h mainWindow.h RegisterAddress.h
SOURCES += ClassDigitizer.cpp main.cpp mainWindow.C

View File

@ -2,12 +2,14 @@
#include <QWidget>
#include <TH1.h>
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
setWindowTitle("FSU DAQ");
setGeometry(500, 100, 1000, 500);
}