checked all PHA parameters. added DataClass.h and macro.h

This commit is contained in:
athena 2022-08-05 18:15:50 -04:00
parent c0f9aa5eba
commit cb722ba86b
11 changed files with 191 additions and 85 deletions

54
DataClass.h Normal file
View File

@ -0,0 +1,54 @@
#ifndef DATA_H
#define DATA_H
#include <stdio.h>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring> ///memset
#include <iostream> ///cout
#include <bitset>
#include "CAENDigitizer.h"
#include "CAENDigitizerType.h"
#include "macro.h"
class Data{
public:
int nByte; /// number of byte
char *buffer; /// readout buffer
uint32_t NumEvents[MaxNChannels];
uint32_t AllocatedSize;
uint32_t BufferSize;
CAEN_DGTZ_DPP_PHA_Event_t *Events[MaxNChannels]; /// events buffer
CAEN_DGTZ_DPP_PHA_Waveforms_t *Waveform[MaxNChannels]; /// waveforms buffer
public:
Data(){
nByte = 0;
buffer = NULL;
AllocatedSize = 0;
BufferSize = 0;
for( int i = 0 ; i < MaxNChannels; i++){
NumEvents[i] = 0;
Events[i] = NULL;
Waveform[i] = NULL;
}
}
~Data(){
for( int i = 0 ; i < MaxNChannels; i++){
delete Events [i];
delete Waveform [i];
}
}
};
#endif

View File

@ -11,7 +11,6 @@ Digitizer::Digitizer(){
ADCFullSize = 0;
ch2ns = 0;
BoardInfo = {};
DPPControl2Adress = Register::DPP::PHA::DPPAlgorithmControl2;
VMEBaseAddress = 0;
LinkType = CAEN_DGTZ_USB; /// default USB
@ -20,6 +19,8 @@ Digitizer::Digitizer(){
channelMask = 0xFFFF;
data = new Data();
ret = -1;
isConnected = false;
@ -32,6 +33,8 @@ Digitizer::Digitizer(int boardID, int portID){
Digitizer::~Digitizer(){
CloseDigitizer();
delete data;
}
void Digitizer::Reset(){
@ -107,8 +110,8 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool verbose){
case 0x85: printf("\tDPP-ZLE for x751 boards \n"); break;
case 0x86: printf("\tDPP-PSD for x743 boards \n"); break;
case 0x87: printf("\tDPP-QDC for x740 boards \n"); break;
case 0x88: printf("\tDPP-PSD for x730 boards \n"); DPPControl2Adress = Register::DPP::PSD::DPPAlgorithmControl2; break;
case 0x8B: printf("\tDPP-PHA for x730 boards \n"); DPPControl2Adress = Register::DPP::PHA::DPPAlgorithmControl2; break;
case 0x88: printf("\tDPP-PSD for x730 boards \n"); break;
case 0x8B: printf("\tDPP-PHA for x730 boards \n"); break;
case 0x8C: printf("\tDPP-ZLE for x730 boards \n"); break;
case 0x8D: printf("\tDPP-DAW for x730 boards \n"); break;
}
@ -298,8 +301,8 @@ void Digitizer::SetChannelMask(uint32_t mask){
ErrorMsg("SetChannelMask");
}
void Digitizer::SetRecordLength(unsigned int ns, int ch) { WriteRegister( Register::DPP::RecordLength, ns / ch2ns / 8 , ch); ErrorMsg("SetRecordLength"); }
void Digitizer::SetEventAggregation(unsigned int numEvent, int ch) { WriteRegister( Register::DPP::NumberEventsPerAggregate, numEvent, ch); ErrorMsg("SetEventAggregation"); }
void Digitizer::SetRecordLength(unsigned int ns, int ch) { WriteRegister( Register::DPP::RecordLength_G, ns / ch2ns / 8 , ch); ErrorMsg("SetRecordLength"); }
void Digitizer::SetEventAggregation(unsigned int numEvent, int ch) { WriteRegister( Register::DPP::NumberEventsPerAggregate_G,numEvent, ch); ErrorMsg("SetEventAggregation"); }
void Digitizer::SetInputDynamicRange(unsigned int TwoVol_0_or_halfVol_1, int ch){ WriteRegister( Register::InputDynamicRange, TwoVol_0_or_halfVol_1, ch); ErrorMsg("SetInputDynamicRange");}
void Digitizer::SetPreTriggerSample(unsigned int nSample, int ch) { WriteRegister( Register::DPP::PreTrigger, nSample / 4, ch); ErrorMsg("SetPreTriggerSample");}
void Digitizer::SetPreTriggerDuration(unsigned int ns, int ch) { WriteRegister( Register::DPP::PreTrigger, ns / ch2ns / 4, ch); ErrorMsg("SetPreTriggerSample");}
@ -307,6 +310,7 @@ void Digitizer::SetDCOffset(float offsetPrecentage, int ch)
void Digitizer::SetVetoWidth(uint32_t bit, int ch) { WriteRegister( Register::DPP::VetoWidth, bit, ch); ErrorMsg("SetVetoWidth");}
void Digitizer::SetTriggerPolarity(bool RiseingIsZero, int ch ){
if ( DPPType >= 128 ) return; /// do thing for DPP firmware
if( ch < 0 ) {
ret = 0;
for (int i = 0; i < NChannel; i++){
@ -366,7 +370,7 @@ void Digitizer::SetBits(uint32_t address, unsigned int bitValue, unsigned int bi
uint32_t bit ;
uint32_t bitmask = (uint(pow(2, bitLength)-1) << bitSmallestPos);
if (ch < 0 ) ch = 0; /// take ch-0
bit = ReadRegister(address, 0);
bit = ReadRegister(address, ch);
bit = (bit & ~bitmask) | (bitValue << bitSmallestPos);
WriteRegister(address, bit, ch);
if( ret != 0 ) ErrorMsg("SetBits");

View File

@ -9,16 +9,13 @@
#include <iostream> ///cout
#include <bitset>
//#include <TQObject.h>
//#include <RQ_OBJECT.h>
#include "CAENDigitizer.h"
#include "CAENDigitizerType.h"
#include "macro.h"
#include "DataClass.h"
#include "RegisterAddress.h"
#define MaxNChannels 16
#define MaxRecordLength 0x3fff * 8
using namespace std;
@ -65,7 +62,7 @@ class Digitizer{
void SetPreTriggerDuration(unsigned int ns, int ch = -1 );
void SetDCOffset(float offsetPrecentage, int ch = -1);
void SetVetoWidth(uint32_t bit, int ch = -1); /// See manual
void SetTriggerPolarity(bool RiseingIsZero, int ch = -1);
void SetTriggerPolarity(bool RiseingIsZero, int ch = -1); ///not used for DPP firmware
void SetBits(uint32_t address, unsigned int bitValue, unsigned int bitLength, unsigned int bitSmallestPos, int ch = -1);
void SetDPPAlgorithmControl(uint32_t bit, int ch = -1);
@ -96,20 +93,20 @@ class Digitizer{
int boardID; /// board identity
int handle; /// i don't know why, but better separete the handle from boardID
int NChannel; /// number of channel
int ADCbits; /// ADC bit
int DPPType; /// DPP verion
int ADCbits; /// ADC bit
int DPPType; /// DPP verion
unsigned int ADCFullSize; /// pow(2, ADCbits) - 1
float ch2ns; /// channel to ns
CAEN_DGTZ_BoardInfo_t BoardInfo;
uint32_t DPPControl2Adress;
///----- adjustable parameters
uint32_t channelMask ; /// the channel mask from NChannel
uint32_t VMEBaseAddress; /// For direct USB or Optical-link connection, VMEBaseAddress must be 0
CAEN_DGTZ_ConnectionType LinkType;
CAEN_DGTZ_IOLevel_t IOlev; /// TTL signal (1 = 1.5 to 5V, 0 = 0 to 0.7V ) or NIM signal (1 = -1 to -0.8V, 0 = 0V)
CAEN_DGTZ_DPP_AcqMode_t AcqMode;
uint32_t channelMask ; /// the channel mask from NChannel
Data * data;
///------- other parameters
int ret; /// return value, refer to CAEN_DGTZ_ErrorCode

View File

@ -43,11 +43,12 @@ void DigitizerPHA::SetBaselineSampling(unsigned int bit, int ch) {
void DigitizerPHA::SetRollOverFlag(bool isRollOver, int ch) { SetBits(Register::DPP::DPPAlgorithmControl, isRollOver, 1, 26, ch); ErrorMsg("SetRollOverFlag");}
void DigitizerPHA::SetPileUpFlag(bool isPileUpFlag, int ch) { SetBits(Register::DPP::DPPAlgorithmControl, isPileUpFlag, 1, 27, ch); ErrorMsg("SetPileUpFlag");}
void DigitizerPHA::SetExtra2WordOption(unsigned int bit, int ch) { SetBits(Register::DPP::PHA::DPPAlgorithmControl2, bit, 3, 8, ch); ErrorMsg("PHA-SetExtra2WordOption");}
void DigitizerPHA::SetExtra2WordOption(unsigned int bit, int ch) { SetBits(Register::DPP::PHA::DPPAlgorithmControl2_G, bit, 3, 8, ch); ErrorMsg("PHA-SetExtra2WordOption");}
void DigitizerPHA::SetTriggerThreshold(unsigned int threshold, int ch ) { WriteRegister(Register::DPP::PHA::TriggerThreshold, threshold & 0x03FF, ch); ErrorMsg("PHA-SetTriggerThreshold");}
void DigitizerPHA::SetTriggerHoldOff(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::TriggerHoldOffWidth, nSample & 0x03FF, ch); ErrorMsg("PHA-SetTriggerHoldOff"); }
void DigitizerPHA::SetTriggerSmoothingFactor(unsigned int bit, int ch ) { WriteRegister(Register::DPP::PHA::RCCR2SmoothingFactor, bit & 0x0001, ch); ErrorMsg("PHA-SetTriggerSmoothingFactor");}
void DigitizerPHA::SetTriggerSmoothingFactor(unsigned int bit, int ch ) { WriteRegister(Register::DPP::PHA::RCCR2SmoothingFactor, bit & 0x001F, ch); ErrorMsg("PHA-SetTriggerSmoothingFactor");}
void DigitizerPHA::SetTriggerOutputWidth(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::ShapedTriggerWidth, nSample & 0x03FF, ch); ErrorMsg("PHA-SetTriggerOutputWidth");}
void DigitizerPHA::SetInputRiseTime(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::InputRiseTime, nSample & 0x00FF, ch); ErrorMsg("PHA-SetInputRiseTime");}
void DigitizerPHA::SetTrapezoidRiseTime(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::TrapezoidRiseTime, nSample & 0x0FFF, ch); ErrorMsg("PHA-SetTrapezoidRiseTime");}
void DigitizerPHA::SetTrapezoidFlatTop(unsigned int nSample, int ch ) { WriteRegister(Register::DPP::PHA::TrapezoidFlatTop, nSample & 0x0FFF, ch); ErrorMsg("PHA-SetTrapezoidFlatTop");}
@ -116,7 +117,7 @@ void DigitizerPHA::GetChannelSettingFromDigitizer(int ch){
int pileUp = int(value[0] >> 27) & 0x1;
///DPP algorithm Control 2
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::DPPAlgorithmControl2 + (ch << 8), value);
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::DPPAlgorithmControl2_G + (ch << 8), value);
cout <<" DPP algorithm Control 2: 0b" << bitset<32>(value[0]) << endl;
int extras2WordOption = int(value[0] >> 8) & 0x3;
@ -132,14 +133,12 @@ void DigitizerPHA::GetChannelSettingFromDigitizer(int ch){
printf(" ch2ns : %.0f ns\n", ch2ns);
printf("==========----- input \n");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::RecordLength + (ch << 8), value); printf("%24s %5d samples = %5.0f ns \n", "Record Length", ((value[0] * 8) & MaxRecordLength), ((value[0] * 8) & MaxRecordLength) * ch2ns); ///Record length
CAEN_DGTZ_ReadRegister(handle, Register::DPP::RecordLength_G + (ch << 8), value); printf("%24s %5d samples = %5.0f ns \n", "Record Length", ((value[0] * 8) & MaxRecordLength), ((value[0] * 8) & MaxRecordLength) * ch2ns); ///Record length
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PreTrigger + (ch << 8), value); printf("%24s %5d samples = %5.0f ns \n", "Pre-tigger", value[0] * 4, value[0] * 4 * ch2ns); ///Pre-trigger
printf("%24s %5.0f samples, DPP-[20:22]\n", "baseline mean", pow(4, 1 + baseline)); ///Ns baseline
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelDCOffset + (ch << 8), value); printf("%24s %.2f %% of %d\n", "DC offset", value[0] * 100./ ADCFullSize, ADCFullSize); ///DC offset
CAEN_DGTZ_ReadRegister(handle, Register::DPP::InputDynamicRange + (ch << 8), value); printf("%24s %.1f Vpp \n", "input Dynamic", value[0] == 0 ? 2 : 0.5); ///InputDynamic
printf("%24s %s, DPP-[16]\n", "polarity", polarity == 0 ? "Positive" : "negative"); ///Polarity
CAEN_DGTZ_TriggerPolarity_t * triggerPolarity;
CAEN_DGTZ_GetTriggerPolarity(handle, ch, triggerPolarity); printf("%24s %s \n", "trigger polarity", triggerPolarity[0] == 0 ? "Positive" : "negative"); ///Polarity
printf("==========----- discriminator \n");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::TriggerThreshold + (ch << 8), value); printf("%24s %4d LSB\n", "Threshold", value[0]); ///Threshold
@ -162,7 +161,7 @@ void DigitizerPHA::GetChannelSettingFromDigitizer(int ch){
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::FineGain + (ch << 8), value); printf("%24s %d \n", "Energy fine gain", value[0]); ///Energy fine gain
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelADCTemperature + (ch << 8), value); printf("%24s %d C\n", "Temperature", value[0]); ///Temperature
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::RiseTimeValidationWindow + (ch << 8), value); printf("%24s %.0f ns \n", "RiseTime Vaild Win.", value[0] * ch2ns);
CAEN_DGTZ_ReadRegister(handle, Register::DPP::NumberEventsPerAggregate + (ch << 8), value); printf("%24s %d \n", "Event Aggregate", value[0] & 0x3FF);
CAEN_DGTZ_ReadRegister(handle, Register::DPP::NumberEventsPerAggregate_G + (ch << 8), value); printf("%24s %d \n", "Event Aggregate", value[0] & 0x3FF);
CAEN_DGTZ_ReadRegister(handle, Register::DPP::PHA::ChannelStopAcquisition + (ch << 8), value); printf("%24s %d = %s \n", "Stop Acq bit", value[0] & 1 , (value[0] & 1 ) == 0 ? "Run" : "Stop");
CAEN_DGTZ_ReadRegister(handle, Register::DPP::ChannelStatus + (ch << 8), value); printf("%24s 0x%x \n", "Status bit", (value[0] & 0xff) );
CAEN_DGTZ_ReadRegister(handle, Register::DPP::AMCFirmwareRevision + (ch << 8), value); printf("%24s 0x%x \n", "AMC firmware rev.", value[0] );

View File

@ -32,6 +32,7 @@ class DigitizerPHA : public Digitizer {
void SetTriggerHoldOff(unsigned int nSample, int ch = -1 );
void SetTriggerSmoothingFactor(unsigned int bit, int ch = -1 );
void SetInputRiseTime(unsigned int nSample, int ch = -1);
void SetTriggerOutputWidth(unsigned int nSample, int ch = -1);
void SetTrapezoidRiseTime(unsigned int nSample, int ch = -1 );
void SetTrapezoidFlatTop(unsigned int nSample, int ch = -1 );

View File

@ -1,7 +1,6 @@
// Do NOT change. Changes will be lost next time file is generated
#define R__DICTIONARY_FILENAME FSUDAQDict
#define R__NO_DEPRECATION
/*******************************************************************/
#include <stddef.h>
@ -34,14 +33,14 @@
#include "TDataMember.h"
// Since CINT ignores the std namespace, we need to do so in this file.
namespace std {} using namespace std;
// Header files passed as explicit arguments
#include "FSUDAQ.h"
// Header files passed via #pragma extra_include
// The generated code does not explicitly qualify STL entities
namespace std {} using namespace std;
namespace ROOT {
static TClass *MainWindow_Dictionary();
static void MainWindow_TClassManip(TClass*);
@ -52,7 +51,7 @@ namespace ROOT {
// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const ::MainWindow*)
{
::MainWindow *ptr = nullptr;
::MainWindow *ptr = 0;
static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(::MainWindow));
static ::ROOT::TGenericClassInfo
instance("MainWindow", "FSUDAQ.h", 25,
@ -66,14 +65,14 @@ namespace ROOT {
}
TGenericClassInfo *GenerateInitInstance(const ::MainWindow*)
{
return GenerateInitInstanceLocal((::MainWindow*)nullptr);
return GenerateInitInstanceLocal((::MainWindow*)0);
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const ::MainWindow*)nullptr); R__UseDummy(_R__UNIQUE_DICT_(Init));
static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const ::MainWindow*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init));
// Dictionary for non-ClassDef classes
static TClass *MainWindow_Dictionary() {
TClass* theClass =::ROOT::GenerateInitInstanceLocal((const ::MainWindow*)nullptr)->GetClass();
TClass* theClass =::ROOT::GenerateInitInstanceLocal((const ::MainWindow*)0x0)->GetClass();
MainWindow_TClassManip(theClass);
return theClass;
}
@ -101,40 +100,42 @@ namespace {
void TriggerDictionaryInitialization_FSUDAQDict_Impl() {
static const char* headers[] = {
"FSUDAQ.h",
nullptr
0
};
static const char* includePaths[] = {
"/home/splitpole/cern/root/include/",
"/home/splitpole/FSUDAQ/",
nullptr
"/usr/local/cern/include",
"/home/catrina/FSUDAQ/",
0
};
static const char* fwdDeclCode = R"DICTFWDDCLS(
#line 1 "FSUDAQDict dictionary forward declarations' payload"
#pragma clang diagnostic ignored "-Wkeyword-compat"
#pragma clang diagnostic ignored "-Wignored-attributes"
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
extern int __Cling_AutoLoading_Map;
extern int __Cling_Autoloading_Map;
class __attribute__((annotate("$clingAutoload$FSUDAQ.h"))) MainWindow;
)DICTFWDDCLS";
static const char* payloadCode = R"DICTPAYLOAD(
#line 1 "FSUDAQDict dictionary payload"
#ifndef G__VECTOR_HAS_CLASS_ITERATOR
#define G__VECTOR_HAS_CLASS_ITERATOR 1
#endif
#define _BACKWARD_BACKWARD_WARNING_H
// Inline headers
#include "FSUDAQ.h"
#undef _BACKWARD_BACKWARD_WARNING_H
)DICTPAYLOAD";
static const char* classesHeaders[] = {
static const char* classesHeaders[]={
"MainWindow", payloadCode, "@",
nullptr
};
nullptr};
static bool isInitialized = false;
if (!isInitialized) {
TROOT::RegisterModule("FSUDAQDict",
headers, includePaths, payloadCode, fwdDeclCode,
TriggerDictionaryInitialization_FSUDAQDict_Impl, {}, classesHeaders, /*hasCxxModule*/false);
TriggerDictionaryInitialization_FSUDAQDict_Impl, {}, classesHeaders, /*has no C++ module*/false);
isInitialized = true;
}
}

Binary file not shown.

View File

@ -11,6 +11,7 @@ CAENLIBS = -lCAENDigitizer
ROOTLIBS = `root-config --cflags --glibs`
#OBJS = DataClass.o DigitizerClass.o DigitizerPHA.o DigitizerPSD.o FSUDAQ.o
OBJS = DigitizerClass.o DigitizerPHA.o DigitizerPSD.o FSUDAQ.o
#########################################################################
@ -19,8 +20,12 @@ all : test FSUDAQ
clean :
/bin/rm -f $(OBJS) test FSUDAQ FSUDAQDict.cxx *.pcm
DigitizerClass.o : DigitizerClass.cpp DigitizerClass.h RegisterAddress.h
#DataClass.o : DataClass.h macro.h
# $(CC) $(COPTS) -c DataClass.h -o DataClass.o
DigitizerClass.o : DigitizerClass.cpp DigitizerClass.h RegisterAddress.h macro.h DataClass.h
$(CC) $(COPTS) -c DigitizerClass.cpp
DigitizerPHA.o : DigitizerPHA.cpp DigitizerPHA.h DigitizerClass.o
@ -29,7 +34,7 @@ DigitizerPHA.o : DigitizerPHA.cpp DigitizerPHA.h DigitizerClass.o
DigitizerPSD.o : DigitizerPSD.cpp DigitizerPSD.h DigitizerClass.o
$(CC) $(COPTS) -c DigitizerPSD.cpp
test : test.cpp DigitizerClass.o DigitizerPHA.o DigitizerPSD.o
test : test.cpp DigitizerClass.o DigitizerPHA.o DigitizerPSD.o
$(CC) $(COPTS) -o test test.cpp DigitizerClass.o DigitizerPHA.o DigitizerPSD.o $(CAENLIBS)

View File

@ -1,8 +1,13 @@
#ifndef REGISTERADDRESS_H
#define REGISTERADDRESS_H
///=======
/// All 0x1XXX registers are either indiviual or Group
/// Indiviual register are all independence
/// Group register, 2m and 2m+1 channels setting are shared. and the name will have _G as prefix
/// Most 0x8XXX registers are common, which share for all channel
namespace Register {
namespace Register {
static uint32_t EventReadOutBuffer = 0x0000; /// R
@ -11,7 +16,7 @@ namespace Register {
static uint32_t InputDynamicRange = 0x1028; /// R/W
static uint32_t ChannelPulseWidth = 0x1070; /// R/W
static uint32_t ChannelTriggerThreshold = 0x1080; /// R/W
static uint32_t CoupleSelfTriggerLogic = 0x1084; /// R/W
static uint32_t CoupleSelfTriggerLogic_G = 0x1084; /// R/W
static uint32_t ChannelStatus = 0x1088; /// R
static uint32_t AMCFirmwareRevision = 0x108C; /// R
static uint32_t ChannelDCOffset = 0x1098; /// R/W
@ -62,19 +67,19 @@ namespace Register {
///====== Common for PHA and PSD
namespace DPP {
static uint32_t RecordLength = 0x1020; /// R/W
static uint32_t InputDynamicRange = 0x1028; /// R/W
static uint32_t NumberEventsPerAggregate = 0x1034; /// R/W
static uint32_t PreTrigger = 0x1038; /// R/W
static uint32_t TriggerThreshold = 0x106C; /// R/W
static uint32_t TriggerHoldOffWidth = 0x1074; /// R/W
static uint32_t DPPAlgorithmControl = 0x1080; /// R/W
static uint32_t ChannelStatus = 0x1088; /// R
static uint32_t AMCFirmwareRevision = 0x108C; /// R
static uint32_t ChannelDCOffset = 0x1098; /// R/W
static uint32_t ChannelADCTemperature = 0x10A8; /// R
static uint32_t IndividualSoftwareTrigger = 0x10C0; /// W
static uint32_t VetoWidth = 0x10D4; /// R/W
static uint32_t RecordLength_G = 0x1020; /// R/W
static uint32_t InputDynamicRange = 0x1028; /// R/W
static uint32_t NumberEventsPerAggregate_G = 0x1034; /// R/W
static uint32_t PreTrigger = 0x1038; /// R/W
static uint32_t TriggerThreshold = 0x106C; /// R/W
static uint32_t TriggerHoldOffWidth = 0x1074; /// R/W
static uint32_t DPPAlgorithmControl = 0x1080; /// R/W
static uint32_t ChannelStatus = 0x1088; /// R
static uint32_t AMCFirmwareRevision = 0x108C; /// R
static uint32_t ChannelDCOffset = 0x1098; /// R/W
static uint32_t ChannelADCTemperature = 0x10A8; /// R
static uint32_t IndividualSoftwareTrigger = 0x10C0; /// W
static uint32_t VetoWidth = 0x10D4; /// R/W
static uint32_t BoardConfiguration = 0x8000; /// R/W
static uint32_t AggregateOrganization = 0x800C; /// R/W
@ -131,7 +136,7 @@ namespace Register {
static uint32_t TriggerHoldOffWidth = 0x1074; /// R/W OK
static uint32_t PeakHoldOff = 0x1078; /// R/W OK
static uint32_t ShapedTriggerWidth = 0x1084; /// R/W not sure
static uint32_t DPPAlgorithmControl2 = 0x10A0; /// R/W OK
static uint32_t DPPAlgorithmControl2_G = 0x10A0; /// R/W OK
static uint32_t FineGain = 0x10C4; /// R/W OK
}
@ -149,7 +154,7 @@ namespace Register {
static uint32_t TriggerHoldOffWidth = 0x1074; /// R/W
static uint32_t ThresholdForPSDCut = 0x1078; /// R/W
static uint32_t PureGapThreshold = 0x107C; /// R/W
static uint32_t DPPAlgorithmControl2 = 0x1084; /// R/W
static uint32_t DPPAlgorithmControl2_G = 0x1084; /// R/W
static uint32_t EarlyBaselineFreeze = 0x10D8; /// R/W
}
}

8
macro.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef MACRO_H
#define MACRO_H
#define MaxNChannels 16
#define MaxRecordLength 0x3fff * 8
#endif

View File

@ -7,45 +7,77 @@ int main(int argc, char* argv[]){
//DigitizerPSD * psd = new DigitizerPSD();
dig[0].OpenDigitizer(0,0, true);
dig[1].OpenDigitizer(1,0, true);
//dig[1].OpenDigitizer(1,0, true);
//psd->OpenDigitizer(2,0);
printf("======================= \n");
dig[0].SetRecordLength(3000);
dig[0].SetPreTriggerDuration(600);
dig[0].SetBaselineSampling(1);
dig[0].SetDCOffset(0.2);
dig[0].SetInputDynamicRange(0);
dig[0].SetPulsePolarity(0);
//dig[0].SetDCOffset(0.2);
//dig[0].SetDCOffset(0.3, 1);
//dig[0].SetRecordLength(2000);
//dig[0].SetEventAggregation(0);
//dig[0].SetInputDynamicRange(0);
//dig[0].SetPreTriggerDuration(500);
//dig[0].SetDCOffset(0.1);
//dig[0].SetTriggerPolarity(0);
dig[0].SetTriggerThreshold(320);
dig[0].SetTriggerHoldOff(20);
dig[0].SetTriggerSmoothingFactor(4);
dig[0].SetTriggerOutputWidth(50);
dig[0].SetInputRiseTime(16);
dig[0].SetTrapezoidRescaling(31);
dig[0].SetPeakSampling(3);
dig[0].SetPulsePolarity(1);
dig[0].SetBaselineSampling(4);
dig[0].SetRollOverFlag(0);
dig[0].SetPileUpFlag(1);
//dig[0].SetPulsePolarity(0, 1);
dig[0].SetTrapezoidRiseTime(100);
dig[0].SetTrapezoidFlatTop(50);
dig[0].SetDecayTime(5000);
dig[0].SetPeakingTime(20);
dig[0].SetPeakingHoldOff(100);
dig[0].SetPeakSampling(2);
//for( int ch = 0; ch < dig[0].GetNChannel(); ch++){
// uint32_t data = dig[0].ReadRegister((uint32_t) RegisterDPP::ChannelDCOffset, ch);
// printf(" %d %% \n", data );
//}
dig[0].SetEnergyFineGain(2);
dig[0].SetRiseTimeValidWindow(10);
dig[0].SetEventAggregation(3);
dig[0].SetRollOverFlag(1);
dig[0].SetPileUpFlag(1);
dig[0].SetExtra2WordOption(2);
//dig[0].SetTriggerThreshold(200);
//dig[0].SetTriggerHoldOff(100);
dig[0].SetRecordLength(1000, 2);
dig[0].SetPreTriggerDuration(400, 2);
dig[0].SetBaselineSampling(3, 2);
dig[0].SetDCOffset(0.4, 2);
dig[0].SetInputDynamicRange(1, 2);
dig[0].SetPulsePolarity(1, 2);
dig[0].SetTriggerThreshold(220, 2);
dig[0].SetTriggerHoldOff(40, 2);
dig[0].SetTriggerSmoothingFactor(2, 2);
dig[0].SetTriggerOutputWidth(100, 2);
dig[0].SetInputRiseTime(100, 2);
dig[0].SetTrapezoidRescaling(31, 2);
dig[0].SetTrapezoidRiseTime(150, 2);
dig[0].SetTrapezoidFlatTop(100, 2);
dig[0].SetDecayTime(6000, 2);
dig[0].SetPeakingTime(30, 2);
dig[0].SetPeakingHoldOff(150, 2);
dig[0].SetPeakSampling(3, 2);
dig[0].SetEnergyFineGain(5, 2);
dig[0].SetRiseTimeValidWindow(40, 2);
dig[0].SetEventAggregation(5, 2);
dig[0].SetRollOverFlag(0, 2);
dig[0].SetPileUpFlag(0, 2);
dig[0].SetExtra2WordOption(0, 2);
dig[0].PrintBoardConfiguration();
dig[0].GetChannelSettingFromDigitizer(0);
dig[0].GetChannelSettingFromDigitizer(1);
dig[0].GetChannelSettingFromDigitizer(2);
//dig[0].SetAcqMode("mixed");
dig[0].SetAcqMode("mixed");
delete [] dig;
//delete psd;