This commit is contained in:
2019-08-12 18:57:53 +02:00
parent 99dc9bd44d
commit 25eccdffab
8 changed files with 649 additions and 654 deletions

View File

@ -24,33 +24,12 @@ class Detector {
Detector(int multi_id = 0);
~Detector();
// Acquisition
/**
* Blocking call, starts the receiver and detector. Acquired
* the number of frames set.
*/
void acquire();
void startReceiver(Positions pos = {});
void stopReceiver(Positions pos = {});
/**
* Get the acquiring flag. When true the detector blocks
* any attempt to start a new acquisition.
*/
bool getAcquiringFlag() const;
/**
* Set the acquiring flag. This might have to done manually
* after an acquisition was aborted.
*/
void setAcquiringFlag(bool value);
/** Read back the run status of the receiver */
Result<defs::runStatus> getReceiverStatus(Positions pos = {});
// Configuration
/**************************************************
* *
* CONFIG *
* *
* ************************************************/
/**
* Frees the shared memory of this detector and all modules
* belonging to it.
@ -58,45 +37,13 @@ class Detector {
void freeSharedMemory();
void setConfig(const std::string &fname);
Result<std::string> getHostname(Positions pos = {}) const;
// void setHostname(Positions pos = {});
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
void setStartingFrameNumber(uint64_t value, Positions pos);
// Bits and registers
/**************************************************
* *
* FILE, anything concerning file writing or *
* reading goes here *
* *
* ************************************************/
/**
* Returns receiver file name prefix. The actual file name
* contains module id and file index as well.
* @param pos detector positions
* @returns file name prefix
* Frees shared memory and adds detectors to the list
* Also updates local detector cache
* @param name hostnames for the positions given
*/
Result<std::string> getFileName(Positions pos = {}) const;
void setHostname(const std::vector<std::string> &value);
/**
* Sets the receiver file name prefix
* @param fname file name prefix
*/
void setFileName(const std::string &fname, Positions pos = {});
Result<std::string> getFilePath(Positions pos = {}) const;
void setFilePath(const std::string &fname, Positions pos = {});
Result<bool> getFileWrite(Positions pos = {}) const;
void setFileWrite(bool value, Positions pos = {});
Result<bool> getFileOverWrite(Positions pos = {}) const;
void setFileOverWrite(bool value, Positions pos = {});
// dhanya
/**
* Get multidetector Id
* @returns multidetector Id
@ -155,13 +102,6 @@ class Detector {
*/
std::string getUserDetails() const;
/**
* Frees shared memory and adds detectors to the list
* Also updates local detector cache
* @param name hostnames for the positions given
*/
void setHostname(const std::vector<std::string> &value);
/**
* Get Detector type as an enum
* @returns detector type
@ -505,6 +445,15 @@ class Detector {
*/
void setNumberOfStorageCells(int64_t value);
/** [Jungfrau] */
Result<int> getStorageCellStart(Positions pos = {}) const;
/**
* [Jungfrau] Sets the storage cell storing the first acquisition of the series
* Options: 0-15
*/
void setStoragecellStart(int cell, Positions pos = {});
/**
* Get number of analog samples (CTB)
* @param pos detector position
@ -1235,6 +1184,191 @@ class Detector {
/** [Eiger] Pulse chip n times */
void pulseChip(int n, Positions pos = {});
/** [Jungfrau] */
Result<int> getThresholdTemperature(Positions pos = {}) const;
/**
* [Jungfrau]Set threshold temperature
* If temperature crosses threshold temperature
* and temperature control is enabled,
* power to chip will be switched off and
* temperature event will be set
* @param val value in millidegrees TODO! Verify
*/
void setThresholdTemperature(int temp, Positions pos = {});
/** [Jungfrau] */
Result<bool> getTemperatureControl(Positions pos = {}) const;
/** [Jungfrau] */
void setTemperatureControl(bool enable, Positions pos = {});
/** [Jungfrau] */
Result<int> getTemperatureEvent(Positions pos = {}) const;
/** [Jungfrau] */
void ResetTemperatureEvent(Positions pos = {});
/** [Jungfrau][CTB] */
void programFPGA(const std::string &fname, Positions pos = {});
/** [Jungfrau][CTB] */
void resetFPGA(Positions pos = {});
/**
* Copy detector server fname from tftp folder of hostname to detector
* Also changes respawn server, which is effective after a reboot.
*/
void copyDetectorServer(const std::string &fname,
const std::string &hostname, Positions pos = {});
/** [Jungfrau][Gotthard][CTB] */
void rebootController(Positions pos = {});
/**
* [Jungfrau][Gotthard][CTB]
* Updates the firmware, detector server and then reboots detector
* controller blackfin.
* @param sname name of detector server binary found on tftp folder of host pc
* @param hostname name of pc to tftp from
* @param fname programming file name
* @param pos detector positions
*/
void updateFirmwareAndServer(const std::string &sname,
const std::string &hostname,
const std::string &fname, Positions pos = {});
/** [Jungfrau] */
Result<bool> getPowerChip(Positions pos = {}) const;
/** [Jungfrau] */
void setPowerChip(bool on, Positions pos = {});
/** [Jungfrau] */
Result<bool> getAutoCompDisable(Positions pos = {}) const;
/** [Jungfrau] TODO??? fix docs ? */
void setAutoCompDisable(bool value, Positions pos = {});
/** [Eiger]
* @returns deadtime in ns, 0 = disabled
*/
Result<int64_t> getRateCorrection(Positions pos = {}) const;
/**
* [Eiger] Set Rate correction
* 0 disable correction, <0 set to default, >0 deadtime in ns
*/
void setRateCorrection(int64_t dead_time_ns, Positions pos = {});
/** [Eiger][Jungfrau] */
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
/** [Eiger][Jungfrau] */
void setStartingFrameNumber(uint64_t value, Positions pos);
/** [Eiger] */
Result<bool> getTenGigaEnabled(Positions pos = {}) const;
/** [Eiger] */
void setTenGigaEnabled(bool value, Positions pos = {});
/** [CTB] */
Result<bool> getLEDEnable(Positions pos = {}) const;
/** [CTB] */
void setLEDEnable(bool enable, Positions pos = {});
/**
* [CTB] Set Digital IO Delay
* cannot get
* @param digital IO mask to select the pins
* @param delay delay in ps(1 bit=25ps, max of 775 ps)
*/
void setDigitalIODelay(uint64_t pinMask, int delay, Positions pos = {});
/**************************************************
* *
* FILE, anything concerning file writing or *
* reading goes here *
* *
* ************************************************/
Result<defs::fileFormat> getFileFormat(Positions pos = {}) const;
/** default binary, Options: BINARY, HDF5 (library must be compiled with this option) */
void setFileFormat(defs::fileFormat f, Positions pos = {});
Result<std::string> getFilePath(Positions pos = {}) const;
void setFilePath(const std::string &fname, Positions pos = {});
Result<std::string> getFileNamePrefix(Positions pos = {}) const;
/** default run */
void setFileNamePrefix(const std::string &fname, Positions pos = {});
Result<int> getFileIndex(Positions pos = {}) const;
void setFileIndex(int i, Positions pos = {});
Result<bool> getFileWrite(Positions pos = {}) const;
/** default writes */
void setFileWrite(bool value, Positions pos = {});
Result<bool> getMasterFileWrite(Positions pos = {}) const;
void setMasterFileWrite(bool value, Positions pos = {});
Result<bool> getFileOverWrite(Positions pos = {}) const;
/** default overwites */
void setFileOverWrite(bool value, Positions pos = {});
Result<int> getFramesPerFile(Positions pos = {}) const;
void setFramesPerFile(int n, Positions pos = {});
/**************************************************
* *
* RECEIVER CONFIG *
* *
* ************************************************/
/** true when slsReceiver is used */
Result<bool> getUseReceiverFlag(Positions pos = {}) const;
Result<std::string> printReceiverConfiguration(Positions pos = {}) const;
Result<bool> getReceiverLock(Positions pos = {});
/** locks receiver server to client IP */
void setReceiverLock(bool value, Positions pos = {});
Result<std::string> getReceiverLastClientIP(Positions pos = {}) const;
void exitReceiver(Positions pos = {});
void execReceiverCommand(const std::string &cmd, Positions pos = {});
Result<int> getReceiverStreamingFrequency(Positions pos = {}) const;
/** @param freq nth frame streamed out of receiver.
* If 0, streaming timer is the timeout,
* after which current frame sent out. Default is 0 at 200 ms.
* For every frame, set freq to 1.
*/
void setReceiverStreamingFrequency(int freq, Positions pos = {});
Result<int> getReceiverStreamingTimer(Positions pos = {}) const;
/**
* If receiver streaming frequency is 0 (default), then this timer between each
* data stream is set. Default is 200 ms.
*/
void setReceiverStreamingTimer(int time_in_ms, Positions pos = {});
bool getDataStreamingToClient() const;
void setDataStreamingToClient(bool value);
Result<bool> getDataStreamingFromReceiver(Positions pos = {}) const;
void setDataStreamingFromReceiver(bool value, Positions pos = {});
Result<int> getReceiverFifoDepth(Positions pos = {}) const;
void setReceiverFifoDepth(int nframes, Positions pos = {});
Result<bool> getReceiverSilentMode(Positions pos = {}) const;
void setReceiverSilentMode(bool value, Positions pos = {});
Result<defs::frameDiscardPolicy>
getReceiverFrameDiscardPolicy(Positions pos = {}) const;
/**
* default NO_DISCARD
* Options: NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
*/
void setReceiverFrameDiscardPolicy(defs::frameDiscardPolicy f,
Positions pos = {});
Result<bool> getPartialFramesPadding(Positions pos = {}) const;
/** padding enabled */
void setPartialFramesPadding(bool value, Positions pos = {});
/** [Eiger] */
Result<bool> getRxPadDeactivatedMod(Positions pos = {}) const;
@ -1252,271 +1386,147 @@ class Detector {
Result<int64_t>
getReceiverRealUDPSocketBufferSize(Positions pos = {}) const;
/**************************************************
* *
* ACQUISITION *
* *
* ************************************************/
/**
* Blocking call, starts the receiver and detector.
* Increments file index if file write enabled.
* Acquired the number of frames set.
*/
void acquire();
/**
* Get the acquiring flag. When true the detector blocks
* any attempt to start a new acquisition.
*/
bool getAcquiringFlag() const;
/**
* Set the acquiring flag. This might have to done manually
* after an acquisition was aborted.
*/
void setAcquiringFlag(bool value);
/** Receiver starts listening to UDP packets from detector */
void startReceiver(Positions pos = {});
/** Receiver stops listening to UDP packets from detector */
void stopReceiver(Positions pos = {});
/** Read back the run status of the receiver */
Result<defs::runStatus> getReceiverStatus(Positions pos = {});
Result<int> getFramesCaughtByReceiver(Positions pos = {}) const;
Result<uint64_t> getReceiverCurrentFrameIndex(Positions pos = {}) const;
void resetFramesCaught(Positions pos = {});
// TODO!
// int createReceivingDataSockets(const bool destroy = false);
// void readFrameFromReceiver();
void setMasterFileWrite(bool value, Positions pos = {});
Result<bool> getMasterFileWrite(Positions pos = {}) const;
void setReceiverStreamingFrequency(int freq = -1, int detPos = -1);
/**
* [All] If receiver streaming frequency is 0, then this timer between each
* data stream is set. Default is 500 ms.
*/
void setReceiverStreamingTimer(int time_in_ms = 500, Positions pos = {});
/** [All] */
Result<int> getReceiverStreamingTimer(Positions pos = {}) const;
bool getDataStreamingToClient() const;
void setDataStreamingToClient(bool value);
Result<bool> getDataStreamingFromReceiver(Positions pos = {}) const;
void setDataStreamingFromReceiver(bool value, Positions pos = {});
/** [TODO! All?] */
void setTenGigaEnabled(bool value, Positions pos = {});
/** [TODO! All?] */
Result<bool> getTenGigaEnabled(Positions pos = {}) const;
/** [All] */
void setReceiverFifoDepth(int nframes, Positions pos = {});
/** [All] */
Result<int> getReceiverFifoDepth(Positions pos = {}) const;
/** [All] */
void setReceiverSilentMode(bool value, Positions pos = {});
/** [All] */
Result<bool> getReceiverSilentMode(Positions pos = {}) const;
/**************************************************
* *
* PATTERN *
* *
* ************************************************/
/** [CTB] */
void setPattern(const std::string &fname, Positions pos = {});
/** [CTB] */
void setPatternIOControl(uint64_t word, Positions pos = {});
/** [CTB] */
Result<uint64_t> getPatternIOControl(Positions pos = {}) const;
/** [CTB] */
void setPatternClockControl(uint64_t word, Positions pos = {});
void setPatternIOControl(uint64_t word, Positions pos = {});
/** [CTB] */
Result<uint64_t> getPatternClockControl(Positions pos = {}) const;
/** [CTB] */
void setPatternClockControl(uint64_t word, Positions pos = {});
/**
* [CTB] Writes a pattern word
* @param addr address of the word
* @param word word to be written, -1 reads the addr (same as
* [CTB]
* Caution: If word is -1 reads the addr (same as
* executing the pattern)
* @param pos detector position
* @returns actual value
*/
void setPatternWord(int addr, uint64_t word, Positions pos = {});
// TODO! Does this have side effects?
// uint64_t getPatternWord()...
/**
* [CTB] Sets the pattern or loop limits.
* @param level -1 complete pattern, 0,1,2, loop level
* @param start start address for level 0-2
* @param stop stop address for level 0-2
* @param n number of loops for level 0-2
* @param pos detector position
*/
void setPatternLoops(int level, int start, int stop, int n,
Positions pos = {});
/**
* [CTB] Gets the pattern loop limits
* @param level -1 complete pattern, 0,1,2, loop level
* @param pos detector positions
* [CTB]
* Options: level: -1 (complete pattern) and 0-2 levels
* @returns array of start address, stop address and number of loops
*/
Result<std::array<int, 3>> getPatternLoops(int level,
Positions pos = {}) const;
/**
* [CTB] Sets the wait address
* @param level 0,1,2, wait level
* @param addr wait address
* @param pos detector position
* @returns actual value
* [CTB]
* Options: start, stop, n : 0-2
* level: -1 (complete pattern) and 0-2 levels
*/
void setPatternWaitAddr(int level, int addr, Positions pos = {});
void setPatternLoops(int level, int start, int stop, int n,
Positions pos = {});
/* [CTB] */
Result<int> getPatternWaitAddr(int level, Positions pos = {}) const;
/**
* [CTB] Sets the wait time
* @param level 0,1,2, wait level
* @param t wait time
* @param pos detector position
* [CTB]
* Options: level 0-2
*/
void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
void setPatternWaitAddr(int level, int addr, Positions pos = {});
/** [CTB] */
Result<uint64_t> getPatternWaitTime(int level, Positions pos = {}) const;
/** [CTB] Sets the mask applied to every pattern. */
/**
* [CTB]
* Options: level 0-2
*/
void setPatternWaitTime(int level, uint64_t t, Positions pos = {});
/** [CTB] */
Result<uint64_t> getPatternMask(Positions pos = {});
/** [CTB] Sets the mask applied to every pattern to the selected bit mask */
void setPatternMask(uint64_t mask, Positions pos = {});
/** [CTB] Gets the mask applied to every pattern. */
Result<uint64_t> getPatternMask(Positions pos = {});
/** [CTB] */
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
/**
* [CTB] Sets the bitmask that the mask will be applied to for every
* pattern.
* @param mask mask to select bits
* pattern
*/
void setPatternBitMask(uint64_t mask, Positions pos = {});
/**
* [CTB] Gets the bits that the mask will be applied to for every
* pattern
*/
Result<uint64_t> getPatternBitMask(Positions pos = {}) const;
/** [CTB] Enable or disable the LED */
void setLEDEnable(bool enable, Positions pos = {});
/** [CTB] Get LED enable. */
Result<bool> getLEDEnable(Positions pos = {}) const;
/**
* [CTB] Set Digital IO Delay
* @param digital IO mask to select the pins
* @param delay delay in ps(1 bit=25ps, max of 775 ps)
*/
void setDigitalIODelay(uint64_t pinMask, int delay, Positions pos = {});
Result<int> getFileIndex(Positions pos = {}) const;
void setFileIndex(int i, Positions pos = {});
Result<defs::fileFormat> getFileFormat(Positions pos = {}) const;
void setFileFormat(defs::fileFormat f, Positions pos = {});
Result<bool> getPartialFramesPadding(Positions pos = {}) const;
void setPartialFramesPadding(bool value, Positions pos = {});
void setReceiverFrameDiscardPolicy(defs::frameDiscardPolicy f,
Positions pos = {});
Result<defs::frameDiscardPolicy>
getReceiverFrameDiscardPolicy(Positions pos = {}) const;
void setFramesPerFile(int n, Positions pos = {});
Result<int> getFramesPerFile(Positions pos = {}) const;
// void execReceiverCommand(const std::string &cmd, int detPos = -1);
// void exitReceiver(int detPos = -1);
Result<std::string> getReceiverLastClientIP(Positions pos = {}) const;
void setReceiverLock(bool value, Positions pos = {});
Result<bool> getReceiverLock(Positions pos = {});
/** true when receiver is used otherwise false */
Result<bool> getUseReceiverFlag(Positions pos = {}) const;
void printReceiverConfiguration(Positions pos = {}) const;
/** [Eiger]
* @returns deadtime in ns, 0 = disabled
*/
Result<int64_t> getRateCorrection(Positions pos = {}) const;
/**
* [Eiger] Set Rate correction
* 0 disable correction, <0 set to default, >0 deadtime in ns
*/
void setRateCorrection(int64_t dead_time_ns, Positions pos = {});
/** [Jungfrau] TODO??? fix docs */
void setAutoCompDisable(bool value, Positions pos = {});
Result<bool> getAutoCompDisable(Positions pos = {}) const;
void setPowerChip(bool on, Positions pos = {});
Result<bool> getPowerChip(Positions pos = {}) const;
/**
* Updates the firmware, detector server and then reboots detector
* controller blackfin. (Not Eiger)
* @param sname name of detector server binary
* @param hostname name of pc to tftp from
* @param fname programming file name
* @param pos detector positions
*/
void updateFirmwareAndServer(const std::string &sname,
const std::string &hostname,
const std::string &fname, Positions pos = {});
/** [not Eiger] TODO! is this needed?*/
void rebootController(Positions pos = {});
/** Copy detector server to detector */
void copyDetectorServer(const std::string &fname,
const std::string &hostname, Positions pos = {});
/** [not Eiger] */
void resetFPGA(Positions pos = {});
/** [not Eiger] */
void programFPGA(const std::string &fname, Positions pos = {});
/**
* [Jungfrau] Set first storage cell of the series (Jungfrau)
* @param value storage cell index. Value can be 0 to 15.
*/
void setStoragecellStart(int cell, Positions pos = {});
Result<int> getStorageCellStart(Positions pos = {}) const;
/** [Jungfrau] 1 there was an temperature event */
void setTemperatureEvent(int val, Positions pos = {});
/** [Jungfrau] */
Result<int> getTemperatureEvent(Positions pos = {}) const;
/** [Jungfrau] */
void setTemperatureControl(bool enable, Positions pos = {});
/** [Jungfrau] */
Result<bool> getTemperatureControl(Positions pos = {}) const;
/**
* [Jungfrau]Set threshold temperature
* @param val value in millidegrees TODO! Verify
*/
void setThresholdTemperature(int temp, Positions pos = {});
Result<int> getThresholdTemperature(Positions pos = {}) const;