mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-02 19:00:05 +02:00
removed actions
This commit is contained in:
parent
f4cfafb2bb
commit
97934e323c
@ -1,505 +0,0 @@
|
|||||||
#include "slsDetectorActions.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
set action
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
|
|
||||||
\param fname for script ("" disable but leaves script unchanged, "none" disables and overwrites)
|
|
||||||
\returns 0 if action disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int slsDetectorActions::setAction(int iaction, string fname, string par) {
|
|
||||||
|
|
||||||
int am;
|
|
||||||
|
|
||||||
|
|
||||||
if (iaction>=0 && iaction<MAX_ACTIONS) {
|
|
||||||
|
|
||||||
if (fname=="") {
|
|
||||||
am=0;
|
|
||||||
} else if (fname=="none") {
|
|
||||||
am=0;
|
|
||||||
strcpy(actionScript[iaction],fname.c_str());
|
|
||||||
} else {
|
|
||||||
strcpy(actionScript[iaction],fname.c_str());
|
|
||||||
am=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (par!="") {
|
|
||||||
strcpy(actionParameter[iaction],par.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (am) {
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << iaction << " " << hex << (1 << iaction) << " " << *actionMask << dec;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*actionMask |= (1 << iaction);
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << " set " << hex << *actionMask << dec << endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} else {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << iaction << " " << hex << *actionMask << dec;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
*actionMask &= ~(1 << iaction);
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << " unset " << hex << *actionMask << dec << endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << iaction << " Action mask set to " << hex << *actionMask << dec << endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return am;
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetectorActions::setActionScript(int iaction, string fname) {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
|
|
||||||
#endif
|
|
||||||
return setAction(iaction,fname,"");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetectorActions::setActionParameter(int iaction, string par) {
|
|
||||||
//int am;
|
|
||||||
|
|
||||||
if (iaction>=0 && iaction<MAX_ACTIONS) {
|
|
||||||
// am= 1& ( (*actionMask) << iaction);
|
|
||||||
|
|
||||||
if (par!="") {
|
|
||||||
strcpy(actionParameter[iaction],par.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((*actionMask) & (1 << iaction))
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns action script
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
|
||||||
\returns action script
|
|
||||||
*/
|
|
||||||
string slsDetectorActions::getActionScript(int iaction){
|
|
||||||
if (iaction>=0 && iaction<MAX_ACTIONS)
|
|
||||||
return string(actionScript[iaction]);
|
|
||||||
else
|
|
||||||
return string("wrong index");
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns action parameter
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
|
||||||
\returns action parameter
|
|
||||||
*/
|
|
||||||
string slsDetectorActions::getActionParameter(int iaction){
|
|
||||||
if (iaction>=0 && iaction<MAX_ACTIONS)
|
|
||||||
return string(actionParameter[iaction]);
|
|
||||||
else
|
|
||||||
return string("wrong index");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns action mode
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
|
||||||
\returns action mode
|
|
||||||
*/
|
|
||||||
int slsDetectorActions::getActionMode(int iaction){
|
|
||||||
if (iaction>=0 && iaction<MAX_ACTIONS) {
|
|
||||||
|
|
||||||
if ((*actionMask) & (1 << iaction))
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "slsDetetctor : wrong action index " << iaction << endl;
|
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
set scan
|
|
||||||
\param index of the scan (0,1)
|
|
||||||
\param fname for script ("" disable)
|
|
||||||
\returns 0 if scan disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int slsDetectorActions::setScan(int iscan, string script, int nvalues, double *values, string par, int precision) {
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
|
||||||
|
|
||||||
// cout << "settings script to " << script <<endl;
|
|
||||||
if (script=="") {
|
|
||||||
scanMode[iscan]=noScan;
|
|
||||||
} else {
|
|
||||||
strcpy(scanScript[iscan],script.c_str());
|
|
||||||
if (script=="none") {
|
|
||||||
scanMode[iscan]=noScan;
|
|
||||||
} else if (script=="energy") {
|
|
||||||
scanMode[iscan]=energyScan;
|
|
||||||
} else if (script=="threshold") {
|
|
||||||
scanMode[iscan]=thresholdScan;
|
|
||||||
} else if (script=="trimbits") {
|
|
||||||
scanMode[iscan]=trimbitsScan;
|
|
||||||
} else if (script=="position") {
|
|
||||||
scanMode[iscan]=positionScan;
|
|
||||||
} else if (script=="dac") {
|
|
||||||
scanMode[iscan]=dacScan;
|
|
||||||
} else {
|
|
||||||
scanMode[iscan]=scriptScan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (par!="")
|
|
||||||
strcpy(scanParameter[iscan],par.c_str());
|
|
||||||
|
|
||||||
if (nvalues>=0) {
|
|
||||||
if (nvalues==0)
|
|
||||||
scanMode[iscan]=noScan;
|
|
||||||
else {
|
|
||||||
nScanSteps[iscan]=nvalues;
|
|
||||||
if (nvalues>MAX_SCAN_STEPS)
|
|
||||||
nScanSteps[iscan]=MAX_SCAN_STEPS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values && scanMode[iscan]>0 ) {
|
|
||||||
for (int iv=0; iv<nScanSteps[iscan]; iv++) {
|
|
||||||
scanSteps[iscan][iv]=values[iv];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (precision>=0)
|
|
||||||
scanPrecision[iscan]=precision;
|
|
||||||
|
|
||||||
if (scanMode[iscan]>0){
|
|
||||||
*actionMask |= 1<< (iscan+MAX_ACTIONS);
|
|
||||||
} else {
|
|
||||||
*actionMask &= ~(1 << (iscan+MAX_ACTIONS));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setTotalProgress();
|
|
||||||
|
|
||||||
return scanMode[iscan];
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsDetectorActions::setScanScript(int iscan, string script) {
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
|
||||||
if (script=="") {
|
|
||||||
scanMode[iscan]=noScan;
|
|
||||||
} else {
|
|
||||||
strcpy(scanScript[iscan],script.c_str());
|
|
||||||
if (script=="none") {
|
|
||||||
scanMode[iscan]=noScan;
|
|
||||||
} else if (script=="energy") {
|
|
||||||
scanMode[iscan]=energyScan;
|
|
||||||
} else if (script=="threshold") {
|
|
||||||
scanMode[iscan]=thresholdScan;
|
|
||||||
} else if (script=="trimbits") {
|
|
||||||
scanMode[iscan]=trimbitsScan;
|
|
||||||
} else if (script=="position") {
|
|
||||||
scanMode[iscan]=positionScan;
|
|
||||||
} else if (script=="dac") {
|
|
||||||
scanMode[iscan]=dacScan;
|
|
||||||
} else {
|
|
||||||
scanMode[iscan]=scriptScan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scanMode[iscan]>0){
|
|
||||||
*actionMask |= (1 << (iscan+MAX_ACTIONS));
|
|
||||||
} else {
|
|
||||||
*actionMask &= ~(1 << (iscan+MAX_ACTIONS));
|
|
||||||
}
|
|
||||||
|
|
||||||
setTotalProgress();
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Action mask is " << hex << actionMask << dec << endl;
|
|
||||||
#endif
|
|
||||||
return scanMode[iscan];
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetectorActions::setScanParameter(int iscan, string par) {
|
|
||||||
|
|
||||||
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
|
||||||
if (par!="")
|
|
||||||
strcpy(scanParameter[iscan],par.c_str());
|
|
||||||
return scanMode[iscan];
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetectorActions::setScanPrecision(int iscan, int precision) {
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
|
||||||
if (precision>=0)
|
|
||||||
scanPrecision[iscan]=precision;
|
|
||||||
return scanMode[iscan];
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsDetectorActions::setScanSteps(int iscan, int nvalues, double *values) {
|
|
||||||
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
|
||||||
|
|
||||||
if (nvalues>=0) {
|
|
||||||
if (nvalues==0)
|
|
||||||
scanMode[iscan]=noScan;
|
|
||||||
else {
|
|
||||||
nScanSteps[iscan]=nvalues;
|
|
||||||
if (nvalues>MAX_SCAN_STEPS)
|
|
||||||
nScanSteps[iscan]=MAX_SCAN_STEPS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values) {
|
|
||||||
for (int iv=0; iv<nScanSteps[iscan]; iv++) {
|
|
||||||
scanSteps[iscan][iv]=values[iv];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scanMode[iscan]>0){
|
|
||||||
*actionMask |= (1 << (iscan+MAX_ACTIONS));
|
|
||||||
} else {
|
|
||||||
*actionMask &= ~(1 << (iscan+MAX_ACTIONS));
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Action mask is " << hex << actionMask << dec << endl;
|
|
||||||
#endif
|
|
||||||
setTotalProgress();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return scanMode[iscan];
|
|
||||||
|
|
||||||
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns scan script
|
|
||||||
\param iscan can be (0,1)
|
|
||||||
\returns scan script
|
|
||||||
*/
|
|
||||||
string slsDetectorActions::getScanScript(int iscan){
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
|
||||||
if (scanMode[iscan])
|
|
||||||
return string(scanScript[iscan]);
|
|
||||||
else
|
|
||||||
return string("none");
|
|
||||||
} else
|
|
||||||
return string("wrong index");
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns scan parameter
|
|
||||||
\param iscan can be (0,1)
|
|
||||||
\returns scan parameter
|
|
||||||
*/
|
|
||||||
string slsDetectorActions::getScanParameter(int iscan){
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
|
||||||
if (scanMode[iscan])
|
|
||||||
return string(scanParameter[iscan]);
|
|
||||||
else
|
|
||||||
return string("none");
|
|
||||||
} else
|
|
||||||
return string("wrong index");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns scan mode
|
|
||||||
\param iscan can be (0,1)
|
|
||||||
\returns scan mode
|
|
||||||
*/
|
|
||||||
int slsDetectorActions::getScanMode(int iscan){
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS)
|
|
||||||
return scanMode[iscan];
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns scan steps
|
|
||||||
\param iscan can be (0,1)
|
|
||||||
\param v is the pointer to the scan steps
|
|
||||||
\returns scan steps
|
|
||||||
*/
|
|
||||||
int slsDetectorActions::getScanSteps(int iscan, double *v) {
|
|
||||||
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
|
||||||
if (v) {
|
|
||||||
for (int iv=0; iv<nScanSteps[iscan]; iv++) {
|
|
||||||
v[iv]=scanSteps[iscan][iv];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
setTotalProgress();
|
|
||||||
|
|
||||||
|
|
||||||
if (scanMode[iscan])
|
|
||||||
return nScanSteps[iscan];
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetectorActions::getScanPrecision(int iscan){
|
|
||||||
if (iscan>=0 && iscan<MAX_SCAN_LEVELS) {
|
|
||||||
return scanPrecision[iscan];
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetectorActions::executeScan(int level, int istep) {
|
|
||||||
int trimbit;
|
|
||||||
char cmd[MAX_STR_LENGTH];
|
|
||||||
|
|
||||||
if (level<0 || level>MAX_SCAN_LEVELS)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
currentScanVariable[level]=getScanStep(level,istep);
|
|
||||||
currentScanIndex[level]=istep;
|
|
||||||
|
|
||||||
switch(scanMode[level]) {
|
|
||||||
case energyScan:
|
|
||||||
setThresholdEnergy((int)currentScanVariable[level]); //energy scan
|
|
||||||
break;
|
|
||||||
case thresholdScan:
|
|
||||||
setDAC((dacs_t)currentScanVariable[level],THRESHOLD,0); // threshold scan
|
|
||||||
break;
|
|
||||||
case dacScan:
|
|
||||||
setDAC((dacs_t)currentScanVariable[level],(slsDetectorDefs::dacIndex)atoi(getScanParameter(level).c_str()),0);
|
|
||||||
break;
|
|
||||||
case trimbitsScan:
|
|
||||||
trimbit=(int)currentScanVariable[level];
|
|
||||||
if(getDetectorsType() == EIGER)
|
|
||||||
setAllTrimbits(trimbit);
|
|
||||||
else
|
|
||||||
setChannel((trimbit<<((int)TRIMBIT_OFF))|((int)COMPARATOR_ENABLE)); // trimbit scan
|
|
||||||
break;
|
|
||||||
case positionScan:
|
|
||||||
//check if channels are connected!
|
|
||||||
moveDetector(currentScanVariable[level]);
|
|
||||||
break;
|
|
||||||
case noScan:
|
|
||||||
currentScanVariable[level]=0;
|
|
||||||
break;
|
|
||||||
case scriptScan:
|
|
||||||
//Custom scan script level 1. The arguments are passed as nrun=n fn=filename var=v par=p"
|
|
||||||
sprintf(cmd,"%s nrun=%d fn=%s var=%f par=%s",getScanScript(level).c_str(),getFileIndex(),createFileName().c_str(),currentScanVariable[level],getScanParameter(level).c_str());
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Executing scan script "<< level << " " << cmd << endl;
|
|
||||||
#endif
|
|
||||||
system(cmd);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cout << "Scan mode unknown "<< level << " " <<scanMode[level] << endl;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsDetectorActions::executeAction(int level) {
|
|
||||||
|
|
||||||
|
|
||||||
if (*actionMask & (1 << level)) {
|
|
||||||
|
|
||||||
char cmd[MAX_STR_LENGTH];
|
|
||||||
switch (level) {
|
|
||||||
case startScript:
|
|
||||||
case stopScript:
|
|
||||||
sprintf(cmd,"%s nrun=%d par=%s",getActionScript(level).c_str(),getFileIndex(),getActionParameter(level).c_str());
|
|
||||||
break;
|
|
||||||
case scriptBefore:
|
|
||||||
case scriptAfter:
|
|
||||||
sprintf(cmd,"%s nrun=%d fn=%s par=%s sv0=%f sv1=%f p0=%s p1=%s",getActionScript(level).c_str(),getFileIndex(),getCurrentFileName().c_str(),getActionParameter(level).c_str(),currentScanVariable[0],currentScanVariable[1],getScanParameter(0).c_str(),getScanParameter(1).c_str());
|
|
||||||
break;
|
|
||||||
case headerBefore:
|
|
||||||
fName=getCurrentFileName();
|
|
||||||
nowIndex=getFileIndexFromFileName(getCurrentFileName());
|
|
||||||
case headerAfter:
|
|
||||||
|
|
||||||
// all other parameters should be taken using text client calls in the header scripts!
|
|
||||||
|
|
||||||
sprintf(cmd,"%s nrun=%d fn=%s par=%s", \
|
|
||||||
getActionScript(level).c_str(), \
|
|
||||||
nowIndex, \
|
|
||||||
fName.c_str(), \
|
|
||||||
getActionParameter(level).c_str());
|
|
||||||
break;
|
|
||||||
case enCalLog:
|
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
case angCalLog:
|
|
||||||
return 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strcpy(cmd,"");
|
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Executing script "<< level << " " << cmd << endl;
|
|
||||||
#endif
|
|
||||||
system(cmd);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,284 +0,0 @@
|
|||||||
#ifndef SLS_DETECTOR_ACTIONS_H
|
|
||||||
#define SLS_DETECTOR_ACTIONS_H
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "slsDetectorBase.h"
|
|
||||||
#include <string>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
@short class implementing the script and scan utilities of the detectors
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
class slsDetectorActions : public virtual slsDetectorBase
|
|
||||||
// : public virtual postProcessing
|
|
||||||
{
|
|
||||||
public :
|
|
||||||
|
|
||||||
enum {noScan, energyScan, thresholdScan, trimbitsScan, positionScan, scriptScan, dacScan };
|
|
||||||
|
|
||||||
|
|
||||||
/** default constructor */
|
|
||||||
slsDetectorActions(){};
|
|
||||||
|
|
||||||
/** virtual destructor */
|
|
||||||
virtual ~slsDetectorActions(){};
|
|
||||||
|
|
||||||
/**
|
|
||||||
set action
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
|
|
||||||
\param fname for script ("" disable)
|
|
||||||
\param par for script
|
|
||||||
\returns 0 if action disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int setAction(int iaction,std::string fname="",std::string par="");
|
|
||||||
|
|
||||||
/**
|
|
||||||
set action script
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
|
|
||||||
\param fname for script ("" disable)
|
|
||||||
\returns 0 if action disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int setActionScript(int iaction, std::string fname="");
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
set action
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript, MAX_ACTIONS}
|
|
||||||
\param par for script
|
|
||||||
\returns 0 if action disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int setActionParameter(int iaction, std::string par="");
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns action script
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
|
||||||
\returns action script
|
|
||||||
*/
|
|
||||||
std::string getActionScript(int iaction);
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns action parameter
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
|
||||||
\returns action parameter
|
|
||||||
*/
|
|
||||||
std::string getActionParameter(int iaction);
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns action mode
|
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
|
||||||
\returns action mode
|
|
||||||
*/
|
|
||||||
int getActionMode(int iaction);
|
|
||||||
|
|
||||||
/**
|
|
||||||
set scan
|
|
||||||
\param index of the scan (0,1)
|
|
||||||
\param script fname for script ("" disables, "none" disables and overwrites current, "threshold" threshold scan, "trimbits", trimbits scan)
|
|
||||||
\param nvalues number of steps (0 disables, -1 leaves current value)
|
|
||||||
\param values pointer to steps (if NULL leaves current values)
|
|
||||||
\param par parameter for the scan script ("" leaves unchanged)
|
|
||||||
\param precision to write the scan varaible in the scan name (-1 unchanged)
|
|
||||||
\returns 0 is scan disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int setScan(int index, std::string script="", int nvalues=-1, double *values=NULL, std::string par="", int precision=-1);
|
|
||||||
|
|
||||||
/** set scan script
|
|
||||||
\param index of the scan (0,1)
|
|
||||||
\param script fname for script ("" disables, "none" disables and overwrites current, "threshold" threshold scan, "trimbits", trimbits scan)
|
|
||||||
\returns 0 is scan disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int setScanScript(int index, std::string script="");
|
|
||||||
/** set scan script parameter
|
|
||||||
\param index of the scan (0,1)
|
|
||||||
\param script parameter for scan
|
|
||||||
\returns 0 is scan disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int setScanParameter(int index, std::string par="");
|
|
||||||
/** set scan script parameter
|
|
||||||
\param index of the scan (0,1)
|
|
||||||
\param precision scan varaible precision to be printed in file name
|
|
||||||
\returns 0 is scan disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int setScanPrecision(int index, int precision=-1);
|
|
||||||
|
|
||||||
|
|
||||||
/** set scan steps
|
|
||||||
\param index of the scan (0,1)
|
|
||||||
\param nvalues number of steps
|
|
||||||
\param values pointer to array of values
|
|
||||||
\returns 0 is scan disabled, >0 otherwise
|
|
||||||
*/
|
|
||||||
int setScanSteps(int index, int nvalues=-1, double *values=NULL);
|
|
||||||
|
|
||||||
/** get scan step
|
|
||||||
\param index of the scan (0,1)
|
|
||||||
\param istep step number
|
|
||||||
\returns value of the scan variable
|
|
||||||
*/
|
|
||||||
double getScanStep(int index, int istep){if (index<MAX_SCAN_LEVELS && index>=0 && istep>=0 && istep<MAX_SCAN_STEPS) return scanSteps[index][istep]; else return -1;};
|
|
||||||
/**
|
|
||||||
returns scan script
|
|
||||||
\param iscan can be (0,1)
|
|
||||||
\returns scan script
|
|
||||||
*/
|
|
||||||
std::string getScanScript(int iscan);
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns scan parameter
|
|
||||||
\param iscan can be (0,1)
|
|
||||||
\returns scan parameter
|
|
||||||
*/
|
|
||||||
std::string getScanParameter(int iscan);
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns scan mode
|
|
||||||
\param iscan can be (0,1)
|
|
||||||
\returns scan mode
|
|
||||||
*/
|
|
||||||
int getScanMode(int iscan);
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns scan steps
|
|
||||||
\param iscan can be (0,1)
|
|
||||||
\param v is the pointer to the scan steps
|
|
||||||
\returns number of scan steps
|
|
||||||
*/
|
|
||||||
int getScanSteps(int iscan, double *v=NULL);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
returns scan precision
|
|
||||||
\param iscan can be (0,1)
|
|
||||||
\returns scan precision
|
|
||||||
*/
|
|
||||||
int getScanPrecision(int iscan);
|
|
||||||
|
|
||||||
|
|
||||||
/** calculates the total number of steps for the acquisition
|
|
||||||
\returns total number of steps for the acquisitions
|
|
||||||
*/
|
|
||||||
virtual int setTotalProgress()=0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
\returns the action mask
|
|
||||||
*/
|
|
||||||
int getActionMask() {if (actionMask) return *actionMask; return 0;};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
\param index scan level index
|
|
||||||
\returns value of the current scan variable
|
|
||||||
*/
|
|
||||||
double getCurrentScanVariable(int index) {return currentScanVariable[index];};
|
|
||||||
// int getScanPrecision(int index) {return scanPrecision[index];};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
set dacs value
|
|
||||||
\param val value (in V)
|
|
||||||
\param index DAC index
|
|
||||||
\param mV 0 in dac units or 1 in mV
|
|
||||||
\param imod module number (if -1 alla modules)
|
|
||||||
\returns current DAC value
|
|
||||||
*/
|
|
||||||
virtual dacs_t setDAC(dacs_t val, dacIndex index , int mV, int imod=-1)=0;
|
|
||||||
|
|
||||||
/** sets all the trimbits to a particular value
|
|
||||||
\param val trimbit value
|
|
||||||
\param imod module number, -1 means all modules
|
|
||||||
\returns OK or FAIL
|
|
||||||
*/
|
|
||||||
virtual int setAllTrimbits(int val, int imod=-1)=0;
|
|
||||||
|
|
||||||
/* /\** returns the detector type */
|
|
||||||
/* \param pos position in the multi detector structure (is -1 returns type of detector with id -1) */
|
|
||||||
/* \returns type */
|
|
||||||
/* *\/ */
|
|
||||||
/* virtual detectorType getDetectorsType(int pos=-1)=0; */
|
|
||||||
|
|
||||||
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
|
|
||||||
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
|
|
||||||
|
|
||||||
|
|
||||||
int setStartIndex(int i=-1){if (i>=0) {startIndex=i; lastIndex=startIndex; nowIndex=startIndex;};return startIndex;};
|
|
||||||
int setLastIndex(int i=-1){if (i>=0 && i>lastIndex) lastIndex=i; return lastIndex;};
|
|
||||||
|
|
||||||
|
|
||||||
virtual double moveDetector(double)=0;
|
|
||||||
virtual double getDetectorPosition()=0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
int executeScan(int level, int istep);
|
|
||||||
int executeAction(int level);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** action mask */
|
|
||||||
int *actionMask;
|
|
||||||
/** array of action scripts */
|
|
||||||
mystring *actionScript;
|
|
||||||
/** array of actionparameters */
|
|
||||||
mystring *actionParameter;
|
|
||||||
|
|
||||||
/** pointer to number of steps [2] */
|
|
||||||
int *nScanSteps;
|
|
||||||
/** pointer to arrays of step values [2] */
|
|
||||||
mysteps *scanSteps;
|
|
||||||
/** pointer to array of scan mode [2] */
|
|
||||||
int *scanMode;
|
|
||||||
|
|
||||||
/** POINTER TO ARRAY OF SCAN PRECISION [2] */
|
|
||||||
int *scanPrecision;
|
|
||||||
|
|
||||||
/** pointer to array of scan scripts [2] */
|
|
||||||
mystring *scanScript;
|
|
||||||
|
|
||||||
/** pointer to array of scan parameters [2] */
|
|
||||||
mystring *scanParameter;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
current scan variable of the detector
|
|
||||||
*/
|
|
||||||
double currentScanVariable[MAX_SCAN_LEVELS];
|
|
||||||
|
|
||||||
/**
|
|
||||||
current scan variable index of the detector
|
|
||||||
*/
|
|
||||||
int currentScanIndex[MAX_SCAN_LEVELS];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
int startIndex;
|
|
||||||
int lastIndex;
|
|
||||||
int nowIndex;
|
|
||||||
std::string fName;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif
|
|
Loading…
x
Reference in New Issue
Block a user