add A4818 support in ClassDigitizer.cpp, not implemented in FSU DAQ
This commit is contained in:
parent
491a5be496
commit
4304a4bd05
|
@ -27,12 +27,12 @@ int getch(void);
|
|||
//^======================================
|
||||
int main(int argc, char* argv[]){
|
||||
|
||||
Digitizer * digi = new Digitizer(0, 0, false, true);
|
||||
Digitizer * digi = new Digitizer(0, 26006, false, true);
|
||||
digi->Reset();
|
||||
|
||||
digi->ProgramBoard_PHA();
|
||||
//digi->ProgramBoard_PHA();
|
||||
|
||||
digi->WriteRegister(DPP::SoftwareClear_W, 1);
|
||||
//digi->WriteRegister(DPP::SoftwareClear_W, 1);
|
||||
|
||||
// digi->WriteRegister(DPP::QDC::RecordLength, 31, -1); // T = N * 8 * 16
|
||||
// digi->WriteRegister(DPP::QDC::PreTrigger, 60, -1);
|
||||
|
@ -52,6 +52,7 @@ int main(int argc, char* argv[]){
|
|||
|
||||
// digi->SetBits(DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::Polarity, 0, -1);
|
||||
|
||||
/*
|
||||
digi->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableExtra2, 1, -1);
|
||||
digi->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 0, -1);
|
||||
|
||||
|
@ -91,6 +92,7 @@ int main(int argc, char* argv[]){
|
|||
data->PrintAllData();
|
||||
|
||||
builder->PrintAllEvent(); // TODO
|
||||
*/
|
||||
|
||||
digi->CloseDigitizer();
|
||||
delete digi;
|
||||
|
|
|
@ -175,7 +175,8 @@ int main(int argc, char* argv[]){
|
|||
int handle;
|
||||
|
||||
printf("======== open board\n");
|
||||
int ret = CAEN_DGTZ_OpenDigitizer(CAEN_DGTZ_OpticalLink, 1, 0, 0, &handle);
|
||||
//int ret = CAEN_DGTZ_OpenDigitizer(CAEN_DGTZ_OpticalLink, 1, 0, 0, &handle);
|
||||
int ret = CAEN_DGTZ_OpenDigitizer(CAEN_DGTZ_USB_A4818, 26006, 0, 0, &handle);
|
||||
|
||||
CAEN_DGTZ_BoardInfo_t BoardInfo;
|
||||
ret = (int) CAEN_DGTZ_GetInfo(handle, &BoardInfo);
|
||||
|
@ -188,11 +189,12 @@ int main(int argc, char* argv[]){
|
|||
}
|
||||
unsigned int ADCbits = BoardInfo.ADC_NBits;
|
||||
|
||||
if( ret != 0 ) { printf("==== open digitizer\n"); return 0;}
|
||||
if( ret != 0 ) { printf("==== open digitizer fail.\n"); return 0;}
|
||||
|
||||
///======= reset
|
||||
ret = CAEN_DGTZ_Reset(handle);
|
||||
|
||||
/*
|
||||
printf("======== program board\n");
|
||||
|
||||
///ret |= CAEN_DGTZ_SetDPPAcquisitionMode(handle, CAEN_DGTZ_DPP_ACQ_MODE_List, CAEN_DGTZ_DPP_SAVE_PARAM_EnergyAndTime);
|
||||
|
@ -213,12 +215,13 @@ int main(int argc, char* argv[]){
|
|||
/// Set the I/O level (CAEN_DGTZ_IOLevel_NIM or CAEN_DGTZ_IOLevel_TTL)
|
||||
ret |= CAEN_DGTZ_SetIOLevel(handle, CAEN_DGTZ_IOLevel_NIM);
|
||||
|
||||
/** Set the digitizer's behaviour when an external trigger arrives:
|
||||
CAEN_DGTZ_TRGMODE_DISABLED: do nothing
|
||||
CAEN_DGTZ_TRGMODE_EXTOUT_ONLY: generate the Trigger Output signal
|
||||
CAEN_DGTZ_TRGMODE_ACQ_ONLY = generate acquisition trigger
|
||||
CAEN_DGTZ_TRGMODE_ACQ_AND_EXTOUT = generate both Trigger Output and acquisition trigger
|
||||
see CAENDigitizer user manual, chapter "Trigger configuration" for details */
|
||||
// Set the digitizer's behaviour when an external trigger arrives:
|
||||
// CAEN_DGTZ_TRGMODE_DISABLED: do nothing
|
||||
// CAEN_DGTZ_TRGMODE_EXTOUT_ONLY: generate the Trigger Output signal
|
||||
// CAEN_DGTZ_TRGMODE_ACQ_ONLY = generate acquisition trigger
|
||||
// CAEN_DGTZ_TRGMODE_ACQ_AND_EXTOUT = generate both Trigger Output and acquisition trigger
|
||||
// see CAENDigitizer user manual, chapter "Trigger configuration" for details
|
||||
|
||||
ret |= CAEN_DGTZ_SetExtTriggerInputMode(handle, CAEN_DGTZ_TRGMODE_ACQ_ONLY);
|
||||
if( ret != 0 ) { printf("==== CAEN_DGTZ_SetExtTriggerInputMode.\n"); return 0;}
|
||||
|
||||
|
@ -232,8 +235,8 @@ int main(int argc, char* argv[]){
|
|||
//if( ret != 0 ) { printf("==== CAEN_DGTZ_SetDPPEventAggregation. %d\n", ret); return 0;}
|
||||
|
||||
|
||||
/** Set the mode used to syncronize the acquisition between different boards.
|
||||
In this example the sync is disabled */
|
||||
// Set the mode used to syncronize the acquisition between different boards.
|
||||
// In this example the sync is disabled
|
||||
ret = CAEN_DGTZ_SetRunSynchronizationMode(handle, CAEN_DGTZ_RUN_SYNC_Disabled);
|
||||
if( ret != 0 ) { printf("==== set board error.\n"); return 0;}
|
||||
|
||||
|
@ -464,14 +467,14 @@ int main(int argc, char* argv[]){
|
|||
}
|
||||
nw++;
|
||||
}while(true);
|
||||
|
||||
*/
|
||||
|
||||
printf("=========== close Digitizer \n");
|
||||
CAEN_DGTZ_SWStopAcquisition(handle);
|
||||
CAEN_DGTZ_CloseDigitizer(handle);
|
||||
CAEN_DGTZ_FreeReadoutBuffer(&buffer);
|
||||
CAEN_DGTZ_FreeDPPEvents(handle, reinterpret_cast<void**>(&Events));
|
||||
CAEN_DGTZ_FreeDPPWaveforms(handle, Waveform);
|
||||
//CAEN_DGTZ_FreeReadoutBuffer(&buffer);
|
||||
//CAEN_DGTZ_FreeDPPEvents(handle, reinterpret_cast<void**>(&Events));
|
||||
//CAEN_DGTZ_FreeDPPWaveforms(handle, Waveform);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -86,17 +86,19 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose
|
|||
if( verbose) printf("============= Opening Digitizer at Board %d, Port %d \n", boardID, portID);
|
||||
|
||||
///-------- try USB first
|
||||
if( portID < 4){
|
||||
LinkType = CAEN_DGTZ_USB; /// Link Type
|
||||
ret = (int) CAEN_DGTZ_OpenDigitizer(LinkType, boardID, 0, VMEBaseAddress, &handle);
|
||||
if (ret != 0){ ///---------- try Optical link
|
||||
LinkType = CAEN_DGTZ_OpticalLink ;
|
||||
ret = (int) CAEN_DGTZ_OpenDigitizer(LinkType, portID, boardID, VMEBaseAddress, &handle);
|
||||
}
|
||||
if (ret != 0){ ///---------- try A4818
|
||||
LinkType = CAEN_DGTZ_USB_A4818 ;
|
||||
ret = (int) CAEN_DGTZ_OpenDigitizer(LinkType, portID, boardID, VMEBaseAddress, &handle);
|
||||
}
|
||||
ErrorMsg("=== Open Digitizer port " +std::to_string(portID) + " board " + std::to_string(boardID));
|
||||
}else{
|
||||
LinkType = CAEN_DGTZ_USB_A4818 ; // portID = A4818 PID
|
||||
ret = (int) CAEN_DGTZ_OpenDigitizer(LinkType, portID, boardID, VMEBaseAddress, &handle);
|
||||
ErrorMsg("=== Open Digitizer port " +std::to_string(portID) + " board " + std::to_string(boardID) + " using A4818.");
|
||||
}
|
||||
|
||||
if( ret == 0 ){
|
||||
if( LinkType == CAEN_DGTZ_USB ) printf("Open digitizer via USB, board : %d\n", boardID);
|
||||
|
|
Loading…
Reference in New Issue
Block a user