The code.ill.fr has been recreated and upgraded with the latest version this weekend, If you encounter any problem please inform the Helpdesk.

Commit 13c22fde authored by yannick legoc's avatar yannick legoc
Browse files

Added scan data in VEXPController

parent 480b56c2
......@@ -123,6 +123,8 @@ VEXPController::VEXPController(const string& name) :
a6Controller.init(this, "A6");
scanController.init(this, "scan");
vexpDetector.init(this, "vexp_detector");
}
VEXPController::VEXPController(const VEXPController& controller) :
......@@ -244,6 +246,8 @@ void VEXPController::updateScanStatus() {
updateFloat64PropertyValue(kfScan, kf());
updateInt32PropertyValue(fxScan, fx());
updateInt32PropertyValue(ssScan, ss());
m_scanData.clear();
}
}
else {
......@@ -251,6 +255,21 @@ void VEXPController::updateScanStatus() {
}
}
void VEXPController::updateDetector() {
// Update the scan data.
int i = scanController->actualStep.get(0);
if (i >= m_scanData.size()) {
m_scanData.resize(i);
}
if (i > 0) {
m_scanData[i - 1] = vexpDetector->detSum();
}
}
void VEXPController::updateProperties() {
// Copy the values.
......@@ -390,6 +409,8 @@ void VEXPController::postConfiguration() {
registerUpdater(scanController->nSteps, &VEXPController::updateNbPoints, this);
registerStatus(scanController, &VEXPController::updateScanStatus, this);
registerUpdater(vexpDetector->idata, &VEXPController::updateDetector, this);
updateProperties();
m_spyPublisher = application::Publisher::create("vexp_spy");
......@@ -553,6 +574,12 @@ std::string VEXPController::getSpyData() {
writer.Key("nameScan"); writer.Int(scanController->numor());
writer.Key("startingTime"); writer.String(scanController->startingTime().c_str());
writer.Key("dataScan"); writer.StartArray();
for (int i = 0; i < m_scanData.size(); ++i) {
writer.Double(m_scanData[i]);
}
writer.EndArray();
writer.EndObject();
return s.GetString();
......
......@@ -25,6 +25,7 @@
#include "controllers/tas/common/IncidentBeam.h"
#include "controllers/tas/common/TasScatteredBeam.h"
#include "controllers/common/scanlegacy/ParameterizableScan1D.h"
#include "VEXPDetectorSimulator.h"
#include <cameo/cameo.h>
#include <rapidjson/stringbuffer.h>
#include <memory>
......@@ -78,6 +79,8 @@ public:
void updateNbPoints(int index);
void updateScanStatus();
void updateDetector();
virtual void postConfiguration();
private:
......@@ -168,6 +171,8 @@ private:
std::mutex m_publisherMutex;
std::unique_ptr<std::thread> m_periodicUpdateThread;
std::vector<float64> m_scanData;
// Controllers.
ControllerPtr<tas::TasSettings> tasSettings;
ControllerPtr<tas::Sample> sample;
......@@ -184,6 +189,8 @@ private:
ControllerPtr<axis::AxisController> a6Controller;
ControllerPtr<scan::ParameterizableScan1D> scanController;
ControllerPtr<DetectorSimulator> vexpDetector;
};
}
......
......@@ -37,6 +37,8 @@ DetectorSimulator::DetectorSimulator(const string& name) :
simulationFile.init(this, SAVE, "simulation_file");
intensity.init(this, NOSAVE, "intensity");
detSum.init(this, NOSAVE, "detector_sum");
idata.init(this, NOSAVE, "idata");
}
DetectorSimulator::DetectorSimulator(const DetectorSimulator& controller) :
......@@ -131,13 +133,18 @@ void DetectorSimulator::updateData() {
m_accessor.querySqwTree(m_dataHandle, h, k, l, e, s);
//detector->detSum = (scattering->qh() + scattering->qk() + scattering->ql()) * 10.0;
//m_detector->detSum = 200.0 - ((m_scattering->qh() - 1.0) * 1000.0);
// Update the detector sum applying the coef.
float64 sum = s * m_coef;
detSum = sum;
m_detector->detSum = sum;
m_detector->detSum = s * m_coef;
// Increase idata to trigger VEXPController.
idata = idata() + 1;
cout << "updateData " << m_detector->detSum()
<< ", scattering " << m_scattering->qh() << ", " << m_scattering->qk() << ", " << m_scattering->ql() << ", " << m_scattering->en() << endl;
}
}
......@@ -39,6 +39,8 @@ public:
Property<std::string> simulationFile;
Property<float64> intensity;
Property<float64> detSum;
Property<int32> idata; // Incremented to trigger the updater of VEXPController.
private:
void loadSimulationFile();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment