Commit d0f6f1b3 authored by Paolo Mutti's avatar Paolo Mutti
Browse files

No commit message

No commit message
parent d1f2f582
......@@ -60,6 +60,10 @@ CAENAdcController::CAENAdcController(const string& name) : ExperimentController(
curve3.init(this, NOSAVE, "curve3_table");
curve4.init(this, NOSAVE, "curve4_table");
enableCoincidence.init(this, NOSAVE, "enable_coincidence");
coincidenceWindow.init(this, NOSAVE, "coincidence_window");
coincidenceMask.init(this, NOSAVE, "coincidence_mask");
registerFunction(TYPE);
}
......
......@@ -97,6 +97,11 @@ public:
ArrayProperty<int32> curve3;
ArrayProperty<int32> curve4;
// Coincidence properties
Property<int32> enableCoincidence;
Property<int32> coincidenceWindow;
Property<int32> coincidenceMask;
protected:
virtual void refreshNbChannelsProperty(int32 aValue) throw (CannotSetValue) = 0;
......
......@@ -44,6 +44,7 @@ DPPAcquisitionController::DPPAcquisitionController(const string& name) :
nbBits.init(this, SAVE, "nb_bits");
gateWidth.init(this, SAVE, "gate_width");
scopeChannel.init(this, NOSAVE, "scope_channel");
useWaveForm.init(this, NOSAVE, "waveform_mode");
useScope.init(this, NOSAVE, "scope_mode");
totalChannels.init(this, NOSAVE, "total_channels");
useScopeStr.init(this, NOSAVE, "scope_mode_str");
......@@ -92,8 +93,8 @@ void DPPAcquisitionController::postConfiguration() {
registerRefresher(nbBits, &DPPAcquisitionController::refreshNbBitsProperty, this);
for (int32 i = 0; i < nbAdcControllers(); ++i) {
registerUpdater(adcController[i]->dppAcqMode, &DPPAcquisitionController::updateUseScopeProperty, this, i);
registerUpdater(adcController[i]->displayChannel, &DPPAcquisitionController::updateUseScopeProperty, this, i);
registerUpdater(adcController[i]->dppAcqMode, &DPPAcquisitionController::updateAcqModeProperty, this, i);
registerUpdater(adcController[i]->displayChannel, &DPPAcquisitionController::updateAcqModeProperty, this, i);
registerUpdater(adcController[i]->channels, &DPPAcquisitionController::setChannelsPerBoard, this);
registerUpdater(adcController[i]->recordLength, &DPPAcquisitionController::updateRecordLengthProperty, this, i);
}
......@@ -206,7 +207,7 @@ void DPPAcquisitionController::updateCurve4ArrayProperty(int32 index) {
/*
* updateUseScopeProperty
*/
void DPPAcquisitionController::updateUseScopeProperty(int32 index) {
void DPPAcquisitionController::updateAcqModeProperty(int32 index) {
int32 boardChannel = 0;
int32 aValue = adcController[index]->dppAcqMode();
......@@ -217,6 +218,7 @@ void DPPAcquisitionController::updateUseScopeProperty(int32 index) {
adcController[i]->dppAcqMode = acquisition::DPPAcquisitionCommon::LISTMODE_MODE;
}
}
adcController[index]->dppAcqMode = acquisition::DPPAcquisitionCommon::SCOPE_MODE;
useScope = 1;
useScopeStr = "Active";
for (int32 i=0; i<index; ++i) {
......@@ -225,8 +227,7 @@ void DPPAcquisitionController::updateUseScopeProperty(int32 index) {
boardChannel += adcController[index]->displayChannel();
useListMode = 0;
usePn1Coincidence = 0;
}
else if (aValue == acquisition::DPPAcquisitionCommon::LISTMODE_MODE) {
} else if (aValue == acquisition::DPPAcquisitionCommon::LISTMODE_MODE) {
useScope = 0;
useScopeStr = "Inactive";
}
......@@ -237,20 +238,20 @@ void DPPAcquisitionController::updateUseScopeProperty(int32 index) {
dppDriver[board]->scopeChannel = boardChannel;
dppDriver[board]->scopeCardActivated = adcController[index]->modelName();
dppDriver[board]->recordLength = adcController[index]->recordLength();
dppDriver[board]->useListMode = useListMode();
dppDriver[board]->useListMode = (useListMode() == true ? 1 : 0);
dppDriver[board]->usePn1Coincidence = usePn1Coincidence();
}
/*
* refreshUseListModeProperty
*/
void DPPAcquisitionController::refreshUseListModeProperty(int32 aValue) throw (CannotSetValue) {
void DPPAcquisitionController::refreshUseListModeProperty(bool aValue) throw (CannotSetValue) {
for (int32 board=0; board<nDrivers(); ++board) {
dppDriver[board]->useListMode = aValue;
dppDriver[board]->useListMode = (aValue == true ? 1 : 0);
}
if (aValue == 1) {
if (aValue == true) {
for (int32 adc = 0; adc < nbAdcControllers(); ++adc) {
adcController[adc]->dppAcqMode = acquisition::DPPAcquisitionCommon::LISTMODE_MODE;
}
......@@ -267,7 +268,10 @@ void DPPAcquisitionController::refreshUsePn1CoincidenceModeProperty(int32 aValue
dppDriver[board]->gateWidth = gateWidth();
}
adcController[0]->enableCoincidence = aValue;
if (aValue == 1) {
adcController[0]->coincidenceWindow = gateWidth();
adcController[0]->coincidenceMask = 0x103;
for (int32 adc = 0; adc < nbAdcControllers(); ++adc) {
adcController[adc]->dppAcqMode = acquisition::DPPAcquisitionCommon::LISTMODE_MODE;
}
......@@ -340,7 +344,7 @@ void DPPAcquisitionController::writeParams() {
dppDriver[i]->scopeChannel = scopeChannel();
dppDriver[i]->gateWidth = gateWidth();
dppDriver[i]->usePn1Coincidence = usePn1Coincidence();
dppDriver[i]->useListMode = useListMode();
dppDriver[i]->useListMode = (useListMode() == true ? 1 : 0);
dppDriver[i]->useScope = useScope();
/*
......@@ -493,8 +497,8 @@ void DPPAcquisitionController::setContext() {
}
}
cout << "context before live process" << endl;
cout << listModeContext << endl;
// cout << "context before live process" << endl;
// cout << listModeContext << endl;
}
}
......@@ -92,6 +92,7 @@ public:
Property<int32> scopeChannel; // Scope channel
Property<int32> totalChannels; // Total nb of channels
Property<int32> usePn1Coincidence;
Property<int32> useWaveForm;
Property<int32> useScope;
Property<std::string> useScopeStr;
......@@ -115,11 +116,11 @@ private:
void updateCurve2ArrayProperty(int32 index);
void updateCurve3ArrayProperty(int32 index);
void updateCurve4ArrayProperty(int32 index);
void updateUseScopeProperty(int32 index);
void updateAcqModeProperty(int32 index);
void updateRecordLengthProperty(int32 index);
void refreshNbAdcControllersProperty(int32 aValue) throw (CannotSetValue);
virtual void refreshUseListModeProperty(int32 aValue) throw (CannotSetValue);
virtual void refreshUseListModeProperty(bool aValue) throw (CannotSetValue);
void refreshUsePn1CoincidenceModeProperty(int32 aValue) throw (CannotSetValue);
void refreshNbBitsProperty(int32 value) throw (CannotSetValue);
......
/*
* HistoEAEDetectorElement.cpp
*
* Created on: Mar 30, 2016
* Author: acq
*/
#include "ETotDetectorElement.h"
namespace npp {
const string ETotDetectorElement::TYPE = "etot_detector_element";
/*
* Constructor
*/
ETotDetectorElement::ETotDetectorElement(const string& name) : acquisition::DetectorElement(name) {
registerFunction(TYPE);
m_Driver.init(this, "driver");
}
/*
* Destructor
*/
ETotDetectorElement::~ETotDetectorElement() {
}
/*
* postConfiguration
*/
void ETotDetectorElement::postConfiguration() {
acquisition::DetectorElement::postConfiguration();
registerUpdater(m_Driver->histo_e_de, &ETotDetectorElement::updateData, this);
}
/*
* updateData
*/
void ETotDetectorElement::updateData() {
detSize = m_Driver->histo_e_de.getSize();
int32* ldata = m_Driver->histo_e_de();
data.update(ldata);
data.setSize(detSize());
data.sendEvent();
calculateDetectorSum();
}
}
/*
* HistoEAEDetectorElement.h
*
* Created on: Mar 30, 2016
* Author: acq
*/
#ifndef ETOTDETECTORELEMENT_H_
#define ETOTDETECTORELEMENT_H_
#include "controllers/common/acquisition/detector/DetectorElement.h"
#include "drivers/ioxos/mpda_dpp/MpdaDPPDriver.h"
namespace npp {
/*!
* \class EDEDetectorElement
* \brief EDEDetectorElement class
*
* \par
* This class overload. DetectorElement class. It creates a new data array for plot window.
* The data have to be rotated for the plot.
*/
class ETotDetectorElement: public acquisition::DetectorElement {
public:
//! Type of controller
static const std::string TYPE;
/*!
* \brief Constructor
* \param[in] name the name of the experiment controller
*/
ETotDetectorElement(const std::string& name);
/*!
* \brief Destructor
*/
virtual ~ETotDetectorElement();
/*!
* \brief Method called before changing the property value
*
* This method is called after setting configuration during the creation of controller.
*/
virtual void postConfiguration();
private:
DriverPtr<mpda_dpp::MpdaDPPDriver> m_Driver; //! Pointer on histo data
void updateData();
};
}
#endif
......@@ -8,6 +8,8 @@
<controller class="npp::DPPCoincidence"/>
<controller class="npp::DPPLiveProcessCountRelay"/>
<controller class="npp::BidimHistoDetectorElement"/>
<controller class="npp::PN1CoincidenceDetectorElement"/>
<controller class="npp::ETotDetectorElement"/>
<include path="$(NOMAD_HOME)/../NomadModules/src"/>
......
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include "PN1CoincidenceDetectorElement.h"
namespace npp {
const string PN1CoincidenceDetectorElement::TYPE = "pn1_coincidence_detector_element";
/*
* Constructor
*/
PN1CoincidenceDetectorElement::PN1CoincidenceDetectorElement(const string& name) :
acquisition::DetectorElement(name) {
registerFunction(TYPE);
m_Driver.init(this, "driver");
}
/*
* Destructor
*/
PN1CoincidenceDetectorElement::~PN1CoincidenceDetectorElement() {
}
/*
* postConfiguration
*/
void PN1CoincidenceDetectorElement::postConfiguration() {
acquisition::DetectorElement::postConfiguration();
registerUpdater(m_Driver->pn1ConicidenceZData, &PN1CoincidenceDetectorElement::updateData, this);
}
/*
* updateData
*/
void PN1CoincidenceDetectorElement::updateData() {
detSize = m_Driver->pn1ConicidenceZData.getSize();
int32* ldata = m_Driver->pn1ConicidenceZData();
data.update(ldata);
data.setSize(detSize());
data.sendEvent();
calculateDetectorSum();
}
}
/*
* Nomad Instrument Control Software
*
* Copyright 2011 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
/*!
* \brief PN1Coincidence Detector Element class
* \author J. Locatelli
* \date 10-01-2010
*/
#ifndef PN1COINCIDENCEDETECTORELEMENT_H
#define PN1COINCIDENCEDETECTORELEMENT_H
#include "controllers/common/acquisition/detector/DetectorElement.h"
#include "drivers/ioxos/mpda_dpp/MpdaDPPDriver.h"
namespace npp {
/*!
* \class PN1CoincidenceDetectorElement
* \brief PN1CoincidenceDetectorElement class
*
* \par
* This class overload. DetectorElement class. It creates a new data array for plot window.
* The data have to be rotated for the plot.
*/
class PN1CoincidenceDetectorElement: public acquisition::DetectorElement {
public:
//! Type of controller
static const std::string TYPE;
/*!
* \brief Constructor
* \param[in] name the name of the experiment controller
*/
PN1CoincidenceDetectorElement(const std::string& name);
/*!
* \brief Destructor
*/
virtual ~PN1CoincidenceDetectorElement();
/*!
* \brief Method called before changing the property value
*
* This method is called after setting configuration during the creation of controller.
*/
virtual void postConfiguration();
private:
DriverPtr<mpda_dpp::MpdaDPPDriver> m_Driver; //! Pointer on histo data
void updateData();
};
}
#endif
......@@ -20,8 +20,8 @@ dppacquisition_setup.scopeMode=Scope mode:
dppacquisition_setup.scopeChannel=Scope channel:
dppacquisition_setup.listMode=List Mode
dppacquisition_setup.listmodeCheckedValue=1
dppacquisition_setup.listmodeUncheckedValue=0
dppacquisition_setup.listmodeCheckedValue=true
dppacquisition_setup.listmodeUncheckedValue=false
dppacquisition_setup.pn1Coincidence=PN1 Coincidence
dppacquisition_setup.coincidenceCheckedValue=1
......
......@@ -22,7 +22,7 @@
<label role="dppacquisition_setup1" property="scope_channel" prefix="dppacquisition_setup.scopeChannel"/>
</switchable_composite>
<newLine/>
<check role="dppacquisition_setup1" property="list_mode" prefix="dppacquisition_setup.listMode" checkBoxValues="dppacquisition_setup.listmode"/>
<check role="dppacquisition_setup1" property="use_listmode" prefix="dppacquisition_setup.listMode" checkBoxValues="dppacquisition_setup.listmode"/>
<newLine/>
<check role="dppacquisition_setup1" property="pn1_coincidence" prefix="dppacquisition_setup.pn1Coincidence" checkBoxValues="dppacquisition_setup.coincidence"/>
<switchable_composite switch_values="1" switcher_key="pn1CoincidenceSwitcher">
......
......@@ -111,6 +111,8 @@ pha_controller.oscilloscopeValue=0
pha_controller.oscilloscopeLabel=Oscilloscope
pha_controller.histogramValue=1
pha_controller.histogramLabel=Histogram
pha_controller.waveformValue=2
pha_controller.waveformLabel=Wave Form
# Plot group
pha_controller.histogranPlotTitle=Energy histogram
......
<plugin>
<controller type="pha_controller" role="pha_controller1"/>
<property_switcher role="pha_controller1" property="dpp_acq_mode" switcher_key="useScopeSwitcher"/>
<property_switcher role="pha_controller1" property="dpp_acq_mode" switcher_key="acqModeSwitcher"/>
<group title="pha_controller.boardParamsTitle">
<text role="pha_controller1" property="nb_channels" prefix="pha_controller.nbChannels"/>
<label role="pha_controller1" property="nb_bits" prefix="pha_controller.nbBits"/>
<newLine/>
<combo role="pha_controller1" property="dpp_acq_mode" prefix="pha_controller.acqMode" valuesAndLabels="pha_controller.oscilloscope,pha_controller.histogram"/>
<switchable_composite switcher_key="useScopeSwitcher" switch_values="0">
<combo role="pha_controller1" property="dpp_acq_mode" prefix="pha_controller.acqMode" valuesAndLabels="pha_controller.oscilloscope,pha_controller.histogram,pha_controller.waveform"/>
<switchable_composite switcher_key="acqModeSwitcher" switch_values="0">
<text role="pha_controller1" property="record_length" prefix="pha_controller.recordLength"/>
<plot_launcher role="pha_controller1" data="pha_input_plot,pha_trapezoid_plot,pha_trigger_plot,pha_peaking_plot" title="pha_controller.inputPlotTitle" height="20"/>
</switchable_composite>
<switchable_composite switcher_key="acqModeSwitcher" switch_values="2">
<text role="pha_controller1" property="record_length" prefix="pha_controller.recordLength"/>
</switchable_composite>
</group>
<newLine/>
......
......@@ -63,6 +63,12 @@ CAENPhaDriver::CAENPhaDriver(const string& name) {
triggerMode.init(this, SAVE, "trigger_mode");
channelMask.init(this, SAVE, "channel_mask");
enableCoincidence.init(this, NOSAVE, "enable_coincidence");
coincidenceWindow.init(this, NOSAVE, "coincidence_window");
coincidenceMask.init(this, NOSAVE, "coincidence_mask");
usePn1Coincidence.init(this, SAVE, "use_Pn1_Coincidence");
// Channels properties
signalDecayTime.init(this, SAVE, "decay_time");
trapezoidFlatTop.init(this, SAVE, "trapezoid_flat");
......
......@@ -81,6 +81,13 @@ public:
Property<int32> triggerMode;
Property<int32> channelMask;
// Coincidence properties
Property<int32> enableCoincidence;
Property<int32> coincidenceWindow;
Property<int32> coincidenceMask;
Property<int32> usePn1Coincidence;
// Channels properties in dppParams
DynamicProperty<int32> signalDecayTime; // M - range 0:65535
DynamicProperty<int32> trapezoidFlatTop; // m - range 0:1023
......
......@@ -86,8 +86,9 @@ void RealCAENPhaDriver::init() {
// Set acquisition mode
if (owner()->dppAcqMode() == acquisition::DPPAcquisitionCommon::LISTMODE_MODE) {
boardParams.DPPAcqMode = CAEN_DGTZ_DPP_ACQ_MODE_List;
}
else if (owner()->dppAcqMode() == acquisition::DPPAcquisitionCommon::SCOPE_MODE) {
} else if (owner()->dppAcqMode() == acquisition::DPPAcquisitionCommon::SCOPE_MODE) {
boardParams.DPPAcqMode = CAEN_DGTZ_DPP_ACQ_MODE_Oscilloscope;
} else if (owner()->dppAcqMode() == acquisition::DPPAcquisitionCommon::WAVEFORM_MODE) {
boardParams.DPPAcqMode = CAEN_DGTZ_DPP_ACQ_MODE_Oscilloscope;
}
boardParams.SaveMode = (CAEN_DGTZ_DPP_SaveParam_t)owner()->saveMode();
......@@ -154,6 +155,7 @@ void RealCAENPhaDriver::init() {
boardParams.EventAggr = 0;
ret = CAEN_DGTZ_SetDPPEventAggregation(m_boardHandle, boardParams.EventAggr, 0);
if (ret) {
cout << "1724 error" << endl;
cerr << "Error CAEN_DGTZ_SetDPPEventAggregation: " << ret << endl;
close();
return;
......@@ -193,6 +195,20 @@ void RealCAENPhaDriver::init() {
return;
}
// PN1 COINCIDENCE MODE =====> HACK EMILIO
if (owner()->usePn1Coincidence() == 1) {
// Channel CTRL register (individual trigger, sequencial readout)
ret = CAEN_DGTZ_WriteRegister(m_boardHandle, 0x8000, 0x01000114);
if (ret) {
cerr << "Error CAEN_DGTZ_WriteRegister: " << ret << endl;
close();
return;
}
}
//
close();
writeParam();
......@@ -259,6 +275,7 @@ void RealCAENPhaDriver::writeParam() {
}
open();
// Write channels parameters
ret = CAEN_DGTZ_SetDPPParameters(m_boardHandle, boardParams.ChannelMask, &dppParams);
if (ret) {
......@@ -355,4 +372,58 @@ void RealCAENPhaDriver::readInfos() {
owner()->amcFirmware = boardInfo.AMC_FirmwareRel;
}
/*!
* \brief Enable Coincidence command implementation
*/
void RealCAENPhaDriver::useCoincidence() {
open();
uint32_t val;
uint32_t addr = 0x1180;
ret = CAEN_DGTZ_ReadRegister(m_boardHandle, addr, &val);
if (ret) {
cerr << "Error CAEN_DGTZ_ReadRegister" << endl;
close();
return;
}
if (owner()->enableCoincidence() == 0) {
val = val & 0x80000;
} else {
val = val | (1 << 19);
}
ret = CAEN_DGTZ_WriteRegister(m_boardHandle, addr, val);
if (ret) {
cerr << "Error CAEN_DGTZ_WriteRegister" << endl;
close();
return;
}
if (owner()->enableCoincidence() == 1) {
val = owner()->coincidenceWindow();
addr = 0x1184;
ret = CAEN_DGTZ_WriteRegister(m_boardHandle, addr, val);
if (ret) {
cerr << "Error CAEN_DGTZ_WriteRegister" << endl;
close();
return;
}
uint32_t addr = 0x8184;
ret = CAEN_DGTZ_ReadRegister(m_boardHandle, addr, &val);
if (ret) {
cerr << "Error CAEN_DGTZ_ReadRegister" << endl;
close();
return;
}
val = (val & 0x3FF) + owner()->coincidenceMask();
ret = CAEN_DGTZ_WriteRegister(m_boardHandle, addr, val);
if (ret) {
cerr << "Error CAEN_DGTZ_WriteRegister" << endl;
close();
return;
}
}
close();