2022-12-02 17:33:02 -05:00
|
|
|
#ifndef DIGITIZER_CLASS_H
|
|
|
|
#define DIGITIZER_CLASS_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <CAEN_FELib.h>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <string>
|
|
|
|
|
2023-01-11 16:14:12 -05:00
|
|
|
#include "Event.h"
|
2022-12-02 17:33:02 -05:00
|
|
|
//#include "Parameter.h"
|
|
|
|
|
2023-01-10 16:58:35 -05:00
|
|
|
#define MaxOutFileSize 2*1024*1024*1024
|
2023-01-13 16:12:43 -05:00
|
|
|
#define MaxNumberOfChannel 64
|
2023-01-09 18:22:33 -05:00
|
|
|
|
2022-12-02 17:33:02 -05:00
|
|
|
class Digitizer2Gen {
|
|
|
|
private:
|
|
|
|
uint64_t handle;
|
|
|
|
uint64_t ep_handle; ///end point handle
|
|
|
|
uint64_t ep_folder_handle; ///end point folder handle
|
2023-01-13 16:12:43 -05:00
|
|
|
|
|
|
|
uint64_t stat_handle;
|
|
|
|
//uint64_t stat_folder_handle;
|
|
|
|
|
2022-12-02 17:33:02 -05:00
|
|
|
bool isConnected;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
char retValue[256];
|
|
|
|
|
|
|
|
std::string modelName;
|
|
|
|
std::string cupVersion;
|
|
|
|
std::string DPPVersion;
|
|
|
|
std::string DPPType;
|
|
|
|
unsigned short serialNumber;
|
|
|
|
unsigned short adcBits;
|
|
|
|
unsigned short nChannels;
|
|
|
|
unsigned short adcRate;
|
|
|
|
unsigned short ch2ns;
|
|
|
|
|
|
|
|
std::string IPAddress;
|
|
|
|
std::string netMask;
|
|
|
|
std::string gateway;
|
|
|
|
|
|
|
|
void Initialization();
|
2023-01-09 18:22:33 -05:00
|
|
|
|
2023-01-13 16:12:43 -05:00
|
|
|
uint64_t realTime[MaxNumberOfChannel];
|
|
|
|
uint64_t deadTime[MaxNumberOfChannel];
|
|
|
|
uint64_t liveTime[MaxNumberOfChannel];
|
|
|
|
uint32_t triggerCount[MaxNumberOfChannel];
|
|
|
|
uint32_t savedEventCount[MaxNumberOfChannel];
|
|
|
|
|
2023-01-09 18:22:33 -05:00
|
|
|
unsigned short outFileIndex;
|
2023-01-10 16:58:35 -05:00
|
|
|
unsigned short dataStartIndetifier;
|
|
|
|
std::string outFileNameBase;
|
|
|
|
char outFileName[100];
|
|
|
|
FILE * outFile;
|
|
|
|
unsigned int outFileSize;
|
2023-01-18 18:10:31 -05:00
|
|
|
|
|
|
|
bool acqON;
|
2022-12-02 17:33:02 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
Digitizer2Gen();
|
|
|
|
~Digitizer2Gen();
|
|
|
|
|
|
|
|
int OpenDigitizer(const char * url);
|
|
|
|
int CloseDigitizer();
|
|
|
|
|
2023-01-13 16:12:43 -05:00
|
|
|
std::string ReadValue(const char * parameter, bool verbose);
|
|
|
|
void WriteValue(const char * parameter, std::string value);
|
2022-12-02 17:33:02 -05:00
|
|
|
void SendCommand(const char * parameter);
|
|
|
|
|
|
|
|
uint64_t GetHandle(const char * parameter);
|
|
|
|
uint64_t GetParentHandle(uint64_t handle);
|
|
|
|
std::string GetPath(uint64_t handle);
|
|
|
|
|
2023-01-13 16:12:43 -05:00
|
|
|
std::string ErrorMsg(const char * funcName);
|
|
|
|
|
2022-12-02 17:33:02 -05:00
|
|
|
void StartACQ();
|
|
|
|
void StopACQ();
|
2023-01-18 18:10:31 -05:00
|
|
|
bool IsAcqOn() {return acqON;}
|
2022-12-02 17:33:02 -05:00
|
|
|
|
2023-01-11 17:53:37 -05:00
|
|
|
void SetPHADataFormat(unsigned short dataFormat); // 0 = all data,
|
2023-01-11 16:14:12 -05:00
|
|
|
// 1 = analog trace-0 only + flags
|
|
|
|
// 2 = no trace, only ch, energy, timestamp, fine_timestamp + flags
|
|
|
|
// 3 = only ch, energy, timestamp, minimum
|
|
|
|
// 15 = raw data
|
2023-01-09 18:22:33 -05:00
|
|
|
int ReadData();
|
2023-01-13 16:12:43 -05:00
|
|
|
int ReadStat();
|
|
|
|
void PrintStat();
|
2023-01-09 18:22:33 -05:00
|
|
|
|
|
|
|
void ProgramPHA(bool testPulse = false);
|
2023-01-13 16:12:43 -05:00
|
|
|
void ReadDigitizerSettings();
|
2022-12-02 17:33:02 -05:00
|
|
|
|
|
|
|
unsigned short GetNChannels() {return nChannels;}
|
|
|
|
unsigned short GetCh2ns() {return ch2ns;}
|
|
|
|
uint64_t GetHandle() {return handle;}
|
|
|
|
|
2023-01-13 16:12:43 -05:00
|
|
|
Event *evt; // should be evt[MaxNumber], when full or stopACQ, save into file
|
2023-01-10 16:58:35 -05:00
|
|
|
void OpenOutFile(std::string fileName);
|
|
|
|
void CloseOutFile();
|
|
|
|
void SaveDataToFile();
|
2023-01-09 18:22:33 -05:00
|
|
|
|
2022-12-02 17:33:02 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|