23 m_ExposuresPerFrame(-1),
24 m_ExposureFrameCount(-1),
26 m_PilatusHost (saver, this,
"pilatusHost",
"s11id-pilatus",
"Host Address of Computer running Camserver"),
27 m_PilatusPort (saver, this,
"pilatusPort", 41234,
"Camserver Port Number"),
28 m_PilatusUser (saver, this,
"pilatusUser",
"det",
"Camserver User Name"),
29 m_PilatusSSH (saver, this,
"pilatusSSH",
"ssh",
"ssh command path"),
30 m_PilatusSCP (saver, this,
"pilatusSCP",
"scp",
"scp command path"),
31 m_PilatusDataDirectory (saver, this,
"pilatusDataDirectory",
"/home/det/shareddata/test/",
"Data directory on Camserver computer"),
32 m_ReadFilesLocally (saver, this,
"readFilesLocally", true,
"Attempt to read acquired files into QXRD for further processing"),
33 m_DeleteFilesAfterReading(saver, this,
"deleteFilesAfterReading", false,
"Delete files from Camserver computer after reading"),
34 m_ExposureMode (saver, this,
"exposureMode", 0,
"Pilatus Exposure Mode = (0:No Trigger, 1:ExtTrigger, 2:ExtEnable"),
35 m_EnableFrequency (saver, this,
"enableFrequency", 1000,
"Frequency of ext enable signal"),
36 m_PilatusExtension (saver, this,
"pilatusExtension",
"cbf",
"File format to be used by camserver")
39 printf(
"QxrdDetectorPilatus::QxrdDetectorPilatus(%p)\n",
this);
46 printf(
"Deleting Pilatus detector\n");
50 printf(
"QxrdDetectorPilatus::~QxrdDetectorPilatus(%p)\n",
this);
56 if (QThread::currentThread() != thread()) {
57 QMetaObject::invokeMethod(
this,
"startDetector");
61 printMessage(tr(
"Starting Pilatus Detector at %1:%2").arg(get_PilatusHost()).arg(get_PilatusPort()));
82 if (QThread::currentThread() != thread()) {
83 QMetaObject::invokeMethod(
this,
"stopDetector");
87 printMessage(tr(
"Stopping Pilatus Detector at %1").arg(get_PilatusHost()));
95 if (QThread::currentThread() != thread()) {
96 QMetaObject::invokeMethod(
this,
"beginAcquisition", Qt::BlockingQueuedConnection, Q_ARG(
double, exposure));
101 printMessage(tr(
"QxrdDetectorPilatus::beginAcquisition(%1)").arg(exposure));
112 if (QThread::currentThread() != thread()) {
113 QMetaObject::invokeMethod(
this,
"endAcquisition", Qt::BlockingQueuedConnection);
121 if (QThread::currentThread() != thread()) {
122 QMetaObject::invokeMethod(
this,
"shutdownAcquisition", Qt::BlockingQueuedConnection);
130 if (QThread::currentThread() != thread()) {
131 QMetaObject::invokeMethod(
this,
"executeCommand", Qt::BlockingQueuedConnection, Q_ARG(QString, cmd));
149 int ind2 =
m_Buffer.indexOf(
char(24));
153 if (ind1 >= 0 && ind2 >= 0) {
159 }
else if (ind1 >= 0) {
170 printMessage(tr(
"(%1) : \"%2\"").arg(line.count()).arg(QString(line)));
185 printMessage(tr(
"QxrdDetectorPilatus::sendCommand(\"%1\")").arg(cmd));
201 int expMode = get_ExposureMode();
212 int nFrames = (int) (get_EnableFrequency()*exposure);
222 m_CurrentFile = acq->currentFileBase(get_DetectorNumber(), get_PilatusExtension());
224 if (get_ReadFilesLocally()) {
225 if (get_DeleteFilesAfterReading()) {
230 int expMode = get_ExposureMode();
244 if (QThread::currentThread() != thread()) {
245 QMetaObject::invokeMethod(
this,
"beginFrame", Qt::BlockingQueuedConnection);
260 printMessage(tr(
"QxrdDetectorPilatus::interpretReply(\"%1\")").arg(reply));
263 if (reply.startsWith(
"1 ERR")) {
265 }
else if (reply.startsWith(
"7 OK")) {
266 if (get_ReadFilesLocally() ==
false) {
273 if (get_DeleteFilesAfterReading()) {
277 }
else if (reply.startsWith(
"Image format:")) {
278 QRegExp matcher(
"Image format\\: (\\d+)\\(w\\) x (\\d+)\\(h\\) pixels(.*)");
280 if (matcher.exactMatch(reply)) {
281 int width = matcher.cap(1).toInt();
282 int height = matcher.cap(2).toInt();
284 printMessage(tr(
"Detector dimensions %1 cols x %2 rows").arg(width).arg(height));
291 printMessage(tr(
"Unmatched: %1, %2").arg(reply).arg(matcher.pattern()));
292 printMessage(tr(
"Matched Length %1").arg(matcher.matchedLength()));
327 proxy->pushProperty(
QxrdDetectorProxy::BooleanProperty,
"readFilesLocally",
"Attempt to read acquired files into QXRD for further processing", get_ReadFilesLocally());
340 set_PilatusHost (proxy->property(
"pilatusHost").toString());
341 set_PilatusUser (proxy->property(
"pilatusUser").toString());
342 set_PilatusSSH (proxy->property(
"pilatusSSH").toString());
343 set_PilatusSCP (proxy->property(
"pilatusSCP").toString());
344 set_PilatusDataDirectory (proxy->property(
"pilatusDataDirectory").toString());
345 set_ReadFilesLocally (proxy->property(
"readFilesLocally").toBool());
346 set_DeleteFilesAfterReading(proxy->property(
"deleteFilesAfterReading").toBool());
347 set_PilatusExtension (proxy->property(
"pilatusExtension").toString());
348 set_ExposureMode (proxy->property(
"exposureMode").toInt());
349 set_EnableFrequency (proxy->property(
"enableFrequency").toDouble());
355 if (QThread::currentThread() != thread()) {
356 QMetaObject::invokeMethod(
this,
"remoteConnect", Q_ARG(QString, sshCmd));
366 if (QThread::currentThread() != thread()) {
367 QMetaObject::invokeMethod(
this,
"remoteCommand", Q_ARG(QString, cmd));
377 QString cmd = tr(
"%1 -o ForwardX11=No %2@%3 rm %4/%5")
378 .arg(get_PilatusSSH())
379 .arg(get_PilatusUser())
380 .arg(get_PilatusHost())
381 .arg(get_PilatusDataDirectory()).arg(file);
387 int rc = QProcess::execute(cmd);
402 QString dest = proc->filePathInRawOutputDirectory(file);
404 QString cmd = tr(
"%1 -o ForwardX11=No %2@%3:%4/%5 %6")
405 .arg(get_PilatusSCP())
406 .arg(get_PilatusUser())
407 .arg(get_PilatusHost())
408 .arg(get_PilatusDataDirectory()).arg(file)
415 int rc = QProcess::execute(cmd);
434 QString dest = proc->filePathInRawOutputDirectory(file);
436 remoteCommand(tr(
"echo -n transfer: ; ls -la %1").arg(file));
450 QString dest = proc->filePathInRawOutputDirectory(f);
454 if (data->readImage(dest)) {
QSharedPointer< QxrdExperiment > QxrdExperimentPtr
QSharedPointer< QxrdDetectorProxy > QxrdDetectorProxyPtr
virtual void pushPropertiesToProxy(QxrdDetectorProxyPtr proxy)
QxrdExperimentWPtr m_Experiment
qint64 qcepDebug(int cond)
QxrdDetectorPilatusRemotePtr m_Remote
void criticalMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
void imagePath(QString path)
QSharedPointer< QxrdAcquisition > QxrdAcquisitionPtr
void printMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
QSharedPointer< QxrdDataProcessor > QxrdDataProcessorPtr
void pullPropertiesfromProxy(QxrdDetectorProxyPtr proxy)
virtual void pullPropertiesfromProxy(QxrdDetectorProxyPtr proxy)
QxrdAcquisitionWPtr m_Acquisition
QWeakPointer< QxrdExperiment > QxrdExperimentWPtr
QTcpSocket m_PilatusSocket
bool checkDetectorEnabled()
virtual ~QxrdDetectorPilatus()
void enqueueAcquiredFrame(QcepImageDataBasePtr img)
void remoteTransfer(QString file)
void executeCommand(QString cmd)
void beginAcquisition(double exposure)
void sendCommand(QString cmd)
virtual void beginFrame()
void beginExposure(double exposure)
virtual void startDetector()
void loadAndPush(QString f)
void interpretReply(QString reply)
virtual void stopDetector()
void pushPropertiesToProxy(QxrdDetectorProxyPtr proxy)
void remoteCommand(QString cmd)
QWeakPointer< QxrdAcquisition > QxrdAcquisitionWPtr
QSharedPointer< QcepInt32ImageData > QcepInt32ImageDataPtr
void shutdownAcquisition()
static void pushDefaultsToProxy(QxrdDetectorProxyPtr proxy, int detType)
virtual void shutdownAcquisition()
void remoteCopy(QString file)
virtual void endAcquisition()
QSharedPointer< QcepInt16ImageData > QcepInt16ImageDataPtr
static QcepInt32ImageDataPtr newInt32Image(AllocationStrategy strat, int width, int height, QcepObject *parent)
static void pushDefaultsToProxy(QxrdDetectorProxyPtr proxy)
QxrdDetectorPilatus(QcepSettingsSaverWPtr saver, QxrdExperimentWPtr expt, QxrdAcquisitionWPtr acq, int detNum, QcepObject *parent)
virtual void beginAcquisition(double exposure)
QWeakPointer< QcepSettingsSaver > QcepSettingsSaverWPtr
void remoteConnect(QString sshCmd)
void remoteDelete(QString file)