mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 18:10:40 +02:00
Commandline (#66)
* WIP * WIP * removed status to string from defs * WIP * WIP * WIP removed unused functions in multi * WIP * print hex in a terrible way * WIP, loadconfig error * WIP, type to string * WIP * fix to conversion * WIP, hostname doesnt work * WIP * WIP * WIP * WIP, threshold * WIP, threshold * WIP * WIP, triggers * WIP, cycles to triggers * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * rx_udsocksize fx, WIP * WIP * WIP * WIP * file index (64 bit), WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * merge * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * New python mod
This commit is contained in:
parent
eebc1109b0
commit
995f0924e5
@ -1670,7 +1670,7 @@ void ctbAcquisition::toggleAcquisition() {
|
||||
} else {
|
||||
StopFlag=1;
|
||||
try{
|
||||
myDet->stopAcquisition();
|
||||
myDet->stopDetector();
|
||||
} CATCH_DISPLAY ("Could not stop acquisition", "ctbAcquisition::toggleAcquisition")
|
||||
stop=1;
|
||||
bStatus->SetText("Start");
|
||||
|
@ -116,7 +116,7 @@ void ctbDac::setValue() {
|
||||
cout << "setting dac! "<< id << " value " << dacsEntry->GetIntNumber() << " units " << dacsUnit->IsOn() << endl;
|
||||
|
||||
try {
|
||||
myDet->setDAC(dacsEntry->GetIntNumber(), static_cast<slsDetectorDefs::dacIndex>(id), dacsUnit->IsOn());
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber(), dacsUnit->IsOn());
|
||||
} CATCH_DISPLAY ("Could not set dac " + to_string(id) + ".", "ctbDac::setValue")
|
||||
|
||||
getValue();
|
||||
@ -128,7 +128,7 @@ void ctbDac::setOn(Bool_t b) {
|
||||
setValue();
|
||||
} else {
|
||||
try {
|
||||
myDet->setDAC(-100, static_cast<slsDetectorDefs::dacIndex>(id), false);
|
||||
myDet->setDAC(static_cast<slsDetectorDefs::dacIndex>(id), -100, false);
|
||||
} CATCH_DISPLAY ("Could not power off dac " + to_string(id) + ".", "ctbDac::setOn")
|
||||
}
|
||||
getValue();
|
||||
|
@ -455,7 +455,7 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, sls::Detector *det)
|
||||
hframe->MapWindow();
|
||||
|
||||
|
||||
sprintf(tit, "Number of cycles: ");
|
||||
sprintf(tit, "Number of triggers: ");
|
||||
|
||||
label= new TGLabel(hframe, tit);
|
||||
hframe->AddFrame(label,new TGLayoutHints(kLHintsTop | kLHintsLeft| kLHintsExpandX, 1, 1, 1, 1));
|
||||
@ -465,14 +465,14 @@ ctbPattern::ctbPattern(TGVerticalFrame *page, sls::Detector *det)
|
||||
|
||||
|
||||
|
||||
eCycles = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
eTriggers = new TGNumberEntry(hframe, 0, 9,999, TGNumberFormat::kNESInteger,
|
||||
TGNumberFormat::kNEANonNegative,
|
||||
TGNumberFormat::kNELNoLimits);
|
||||
hframe->AddFrame( eCycles,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eCycles->MapWindow();
|
||||
eCycles->Resize(150,30);
|
||||
e= eCycles->TGNumberEntry::GetNumberEntry();
|
||||
e->Connect("ReturnPressed()","ctbPattern",this,"setCycles()");
|
||||
hframe->AddFrame( eTriggers,new TGLayoutHints(kLHintsTop | kLHintsExpandX, 1, 1, 1, 1));
|
||||
eTriggers->MapWindow();
|
||||
eTriggers->Resize(150,30);
|
||||
e= eTriggers->TGNumberEntry::GetNumberEntry();
|
||||
e->Connect("ReturnPressed()","ctbPattern",this,"setTriggers()");
|
||||
|
||||
|
||||
// sprintf(tit, "Number of measurements: ");
|
||||
@ -821,7 +821,7 @@ void ctbPattern::update() {
|
||||
|
||||
try{
|
||||
auto retval = myDet->getNumberOfTriggers().tsquash("Different values");
|
||||
eCycles->SetNumber(retval);
|
||||
eTriggers->SetNumber(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of triggers.", "ctbPattern::update")
|
||||
|
||||
try{
|
||||
@ -934,10 +934,10 @@ void ctbPattern::setFrames() {
|
||||
} CATCH_DISPLAY ("Could not set number of frames", "ctbPattern::setFrames")
|
||||
}
|
||||
|
||||
void ctbPattern::setCycles() {
|
||||
void ctbPattern::setTriggers() {
|
||||
try{
|
||||
myDet->setNumberOfTriggers(eCycles->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of triggers", "ctbPattern::setCycles")
|
||||
myDet->setNumberOfTriggers(eTriggers->GetNumber());
|
||||
} CATCH_DISPLAY ("Could not set number of triggers", "ctbPattern::setTriggers")
|
||||
}
|
||||
|
||||
void ctbPattern::setPeriod() {
|
||||
|
@ -102,7 +102,7 @@ private:
|
||||
TGNumberEntry *eStopAddr;
|
||||
TGNumberEntry *eFrames;
|
||||
TGNumberEntry *ePeriod;
|
||||
TGNumberEntry *eCycles;
|
||||
TGNumberEntry *eTriggers;
|
||||
// TGNumberEntry *eMeasurements;
|
||||
TGNumberEntry *eAdcPipeline;
|
||||
TGNumberEntry *eDBitPipeline;
|
||||
@ -141,7 +141,7 @@ public:
|
||||
void setAdcPipeline();
|
||||
void setDBitPipeline();
|
||||
void setFrames();
|
||||
void setCycles();
|
||||
void setTriggers();
|
||||
// void setMeasurements();
|
||||
void setPeriod();
|
||||
|
||||
|
@ -99,7 +99,7 @@ void ctbPower::setValue() {
|
||||
cout << "***************************Setting power " << dacsEntry->GetIntNumber() << " " << id << " " << 1 << endl;
|
||||
|
||||
try {
|
||||
myDet->setVoltage(dacsEntry->GetIntNumber(), static_cast<slsDetectorDefs::dacIndex>(id));
|
||||
myDet->setVoltage(static_cast<slsDetectorDefs::dacIndex>(id), dacsEntry->GetIntNumber());
|
||||
} CATCH_DISPLAY ("Could not set power " + to_string(id) + ".", "ctbPower::setValue")
|
||||
|
||||
getValue();
|
||||
|
@ -8,7 +8,7 @@ period 0.000024984
|
||||
delay 0.999999968
|
||||
gates 1
|
||||
frames 300000.000000000
|
||||
cycles 1.000000000
|
||||
triggers 1.000000000
|
||||
timing auto
|
||||
fineoff 0.000000
|
||||
startscript none
|
||||
|
@ -163,12 +163,12 @@ TEST_CASE("Set settings", "[.integration][.single]"){
|
||||
|
||||
TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
// FRAME_NUMBER, /**< number of real time frames: total number of
|
||||
// acquisitions is number or frames*number of cycles */ ACQUISITION_TIME,
|
||||
// acquisitions is number or frames*number of triggers */ ACQUISITION_TIME,
|
||||
// /**< exposure time */ FRAME_PERIOD, /**< period between exposures */
|
||||
// DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or
|
||||
// readout (in triggered mode) */ GATES_NUMBER, /**< number of gates per
|
||||
// frame (in gated mode) */ CYCLES_NUMBER, /**< number of cycles: total
|
||||
// number of acquisitions is number or frames*number of cycles */
|
||||
// frame (in gated mode) */ TRIGGER_NUMBER, /**< number of triggers: total
|
||||
// number of acquisitions is number or frames*number of triggers */
|
||||
// ACTUAL_TIME, /**< Actual time of the detector's internal timer */
|
||||
// MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo)
|
||||
// */
|
||||
@ -214,9 +214,9 @@ TEST_CASE("Timer functions", "[.integration][cli]") {
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER) == gates);
|
||||
}
|
||||
|
||||
auto cycles = 2;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER, cycles);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER) == cycles);
|
||||
auto triggers = 2;
|
||||
d.setTimer(slsDetectorDefs::timerIndex::TRIGGER_NUMBER, triggers);
|
||||
CHECK(d.setTimer(slsDetectorDefs::timerIndex::TRIGGER_NUMBER) == triggers);
|
||||
|
||||
if (test::type == dt::EIGER) {
|
||||
auto subtime = 200;
|
||||
|
@ -50,7 +50,7 @@ TEST_CASE("Set and read timers", "[.integration][.multi]") {
|
||||
|
||||
// DELAY_AFTER_TRIGGER,
|
||||
// GATES_NUMBER,
|
||||
// CYCLES_NUMBER,
|
||||
// TRIGGER_NUMBER,
|
||||
// ACTUAL_TIME
|
||||
// MEASUREMENT_TIME
|
||||
|
||||
|
@ -609,17 +609,17 @@ The detector can be setup such to receive external triggers. Connect a LEMO sign
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [auto/trigger/burst_trigger/gating]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_acquire 0-
|
||||
\end{verbatim}
|
||||
No timeout is expected between the start of the acquisition and the arrival of the first trigger.
|
||||
|
||||
Here are the implemented options so far:
|
||||
\begin{itemize}
|
||||
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of cycles (i.e. triggers) to 1 using {\tt{cycles}}. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{cycles}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{cycles}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{cycles}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
\item {\tt{auto}} is the software controlled acquisition (does not use triggers), where {\tt{exptime}} and {\tt{period}} have to be set. Set number of triggers (i.e. triggers) to 1 using {\tt{triggers}}. Set number of frames using {\tt{frames}}.
|
||||
\item {\tt{trigger}} 1 frame taken for 1 trigger. Your {\tt{frames}} needs to be 1 always, {\tt{triggers}} can be changed and defines how many triggers are considered. {\tt{exptime}} needs to be set. In the GUI this is called trigger exposure series.
|
||||
\item {\tt{burst\_trigger}} gets only 1 trigger, but allows to take many frames. With {\tt{frames}} one can change the number of frames. {\tt{triggers}} needs to be 1. {\tt{exptime}} and {\tt{period}} have to be set. In the gui it is called trigger readout.
|
||||
\item{\tt{gating}} allows to get a frame only when the trigger pulse is gating. Note that in this case the exp time and period only depend on the gating signal. {\tt{triggers}} allows to select how many gates to consider. Set number of frames to 1 using {\tt{frames}}. IMPORTANT: Up to firmware 23, the last subframe is oblige to finish being taken, despite the gate signal going down. This will be configurable from later fw and software version. Also, in gating mode, due to timimg of the state machine, you need to leave 500~$\mu$s deadtime between the end on an acquisition and the next. This is as the state machine is unable to check for changes in the status in the first 500~$\mu$s. ATTENTION: if you are in 16 bit mode and you are applying online rate corrections, as now the exptime is generated by the trigger, you might not have correct rate corrections. If you know what the exposure time is in the gating signal, then you can set the {\tt{exptime}} once and the rate corrections will be correct. In 32 bit mode, it does not matter as the rate corrections depends on the {\tt{subexptime}} which is software set independently from the gate exptime.
|
||||
|
||||
When using 32-bit mode, by default the acquisition ends the last complete subframe that was started when still the acquisition time was valid. This has been chosen as many people wants to know the exact acquisition time for when the detector was taking data and also, if {\tt{ratecorr}} are active, the last subframe will be correctly corrected, while otherwise it will be corrected with a wrong subdeadtime.
|
||||
However, from 4.1.0, in gating mode, an option to immediately terminate the subframe when the gate signal goes down it is implemented to stop the acquisition at the same time. This option is {\tt{./sls\_detector\_put interruptsubframe 1}} while the default option is {\tt{./sls\_detector\_put interruptsubframe 0}}.
|
||||
@ -628,13 +628,13 @@ However, from 4.1.0, in gating mode, an option to immediately terminate the subf
|
||||
|
||||
Hardware-wise, the ENABLE OUT signal outputs when the chips are really acquiring. This means that the single subframes will be output in 32 bit mode. The TRIGGER OUT outputs the sum-up-signal at the moment (which is useless). This will be changed in the future to output the envelop of the enable signal.
|
||||
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{cycles}} configurable at the same time.
|
||||
We are planning to change some functionality, i.e. unify the {\tt{trigger}} and {\tt{burst\_trigger}} trigger modes and make both {\tt{frames}} and {\tt{triggers}} configurable at the same time.
|
||||
|
||||
There is the possibility to use {\tt{timing trigger/burst\_trigger}} and send software single commands to fake the trigger. This is done with:
|
||||
\begin{verbatim}
|
||||
sls_detector_put 0-timing [trigger/burst_trigger]
|
||||
sls_detector_put 0-frames x
|
||||
sls_detector_put 0-cycles y
|
||||
sls_detector_put 0-triggers y
|
||||
sls_detector_status trigger
|
||||
\end{verbatim}
|
||||
Note that this functionality is very (!) useful if you need to do something between and acquisition and the next. This can be used to do a fast threshold scan for example. See section~\ref{sec:fastthresholdscan}.
|
||||
@ -715,7 +715,7 @@ If \textbf{dr} is 32 and \textbf{clkdivider} is not 2, whatever the detector get
|
||||
Here is a list of parameters that should be reset:
|
||||
\begin{enumerate}
|
||||
\item \textbf{resetframescaught} should be reset to zero after every acquisition taken with {\tt{receiver start}},{\tt{status start}},{\tt{receiver stop}}. If the acquisition is taken with {\tt{sls\_detector\_acquire}}, there is no need to reset this.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{cycles}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{cycles} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
\item After changing the {\tt{timing}} mode of the detector, one should reset to '1' the unused value, in that specific timing mode, between \textbf{frames} and \textbf{triggers}. See section~\ref{triggering} for how to use the timing. At the present moment the detector will acquire more frames than planned if the variable not used between \textbf{frames} and \textbf{triggers} is not reset. In future releases, the unused variable will be ignored. Still resetting is a good practice.
|
||||
|
||||
\end{enumerate}
|
||||
|
||||
@ -1257,7 +1257,7 @@ We have also been requested if we could speed up the threshold scan. At the mome
|
||||
./sls_detector_put enablefwrite 0
|
||||
./sls_detector_put resetframescaught 0
|
||||
./sls_detector_put index 0
|
||||
./sls_detector_put cycles 21
|
||||
./sls_detector_put triggers 21
|
||||
./sls_detector_put receiver start
|
||||
./sls_detector_put status start
|
||||
for i in $(seq 0 20);
|
||||
@ -1515,8 +1515,8 @@ frames number
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
\item \begin{verbatim}
|
||||
sls_detector_get cycles
|
||||
cycles number
|
||||
sls_detector_get triggers
|
||||
triggers number
|
||||
\end{verbatim}
|
||||
where {\tt{number}} is a string to be interpreted as an integer.
|
||||
|
||||
|
@ -111,7 +111,7 @@
|
||||
"delay"; // sets/gets delay after trigger in s
|
||||
"gates"; // sets/gets number of gates per frame in gated mode
|
||||
"frames"; // sets/gets number of frames
|
||||
"cycles"; // sets/gets number of cycles (use in trigger mode)
|
||||
"triggers"; // sets/gets number of triggers (use in trigger mode)
|
||||
"probes"; // sets/gets number of probes (advanced!)
|
||||
"measurements"; // sets/gets number of non-real time measurements
|
||||
/* read only timers */
|
||||
@ -120,7 +120,7 @@
|
||||
"delayl"; // gets delay left
|
||||
"gatesl"; // gets number of gates left
|
||||
"framesl"; // gets number of frames left
|
||||
"cyclesl"; // gets number of cycles left
|
||||
"triggersl"; // gets number of triggers left
|
||||
"now"; // gets time stamp from the dteector
|
||||
"timestamp"; // gets time stamp for the frames (fifo-style)
|
||||
"framescaught";// gets the entire frames caught by receiver
|
||||
|
@ -94,7 +94,7 @@ where: \\
|
||||
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
|
||||
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
|
||||
\textit{p} is the position index, if different positions are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
|
||||
\textit{i} is the file index;\\
|
||||
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN and \E raw data, \textit{.dat} for MYTHEN processed data.
|
||||
\item[index i] Sets the starting index of the file i at the beginning of the acquisition (automatically incremented for each measurement).
|
||||
@ -115,10 +115,10 @@ Sets the number of gates per frame in gated (stroboscopic) mode.\\
|
||||
Refer to the detailed documentation to understand how the different timing modes work.
|
||||
\item[frames n]
|
||||
Sets the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). The frame index in the output file name will automatically be incremented.\\
|
||||
Note that the total number of images will be frames times cycles. Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Sets the number of cycles (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times cycles. Refer to the detailed documentation to understand how the different timing modes work.
|
||||
Note that the total number of images will be frames times triggers. Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[triggers n]
|
||||
Sets the number of triggers (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times triggers. Refer to the detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Sets the number of probes to accumulate for stroboscopic measurements. \\
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[measurements] Sets the number of repetitions of the acquisitions (non real time!). The file index in the file name will be automatically incremented.\\
|
||||
@ -231,7 +231,7 @@ It is normally recommended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
%\item[delayl]
|
||||
%\item[gatesl]
|
||||
%\item[framesl]
|
||||
%\item[cyclesl]
|
||||
%\item[triggersl]
|
||||
%\item[frameindex]
|
||||
%\item[now]
|
||||
\end{description}
|
||||
@ -430,11 +430,11 @@ Returns the number of gates per frame in gated (stroboscopic) mode.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[frames]
|
||||
Returns the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). Returned as a string to be interpreted as an integer ``frames integer''
|
||||
Note that the total number of images is frames times cycles.
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Returns the number of cycles (e.g. number of triggers). Returned as atring to be interpreted as an integer ``cycles integer''
|
||||
Note that the total number of images is frames times cycles.
|
||||
\item[triggers n]
|
||||
Returns the number of triggers (e.g. number of triggers). Returned as atring to be interpreted as an integer ``triggers integer''
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Returns the number of probes to accumulate for stroboscopic measurements.
|
||||
Refer to detailed documentation to understand how the different timing modes work.
|
||||
@ -556,7 +556,7 @@ It is normally recommended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
\item[delayl] Returns the delay after trigger left for the current frame.
|
||||
\item[gatesl] Returns the number of gates left for the current frame.
|
||||
\item[framesl] Returns the number of frames left for the current cycle.
|
||||
\item[cyclesl] Returns the number of cycles left for the current acquisition.
|
||||
\item[triggersl] Returns the number of triggers left for the current acquisition.
|
||||
\item[now] Returns the current timestamp of the detector clock.
|
||||
\item[timestamp] Returns the timestamp of the acquisitions in a First-In/First-Out mode i.e. every time it is called it returns the timestamp of the first acquisition start of readout. The FIFO is reset everytime the acquisition is started.
|
||||
\end{description}
|
||||
|
@ -217,7 +217,7 @@ is used to configure the detector parameter var
|
||||
\item[delay t] Sets the delay after trigger (in s)
|
||||
\item[gates n] Sets the number of gates per frame
|
||||
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
|
||||
\item[probes n] Sets the number of probes to accumulate (max 3)
|
||||
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
|
||||
\item[flags mode] Sets the readout flags - can be none or storeinram
|
||||
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
|
||||
\item[delay] Gets the delay after trigger (in s)
|
||||
\item[gates] Gets the number of gates per frame
|
||||
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles] Gets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers] Gets the number of triggers (e.g. number of triggers)
|
||||
\item[probes] Gets the number of probes to accumulate (max 3)
|
||||
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
|
||||
\item[dr] Gets the dynamic range
|
||||
|
@ -372,7 +372,7 @@ gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
/Times-Roman ff 450.00 scf sf
|
||||
11325 9150 m
|
||||
gs 1 -1 sc (Number of cycles) col0 sh gr
|
||||
gs 1 -1 sc (Number of triggers) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
5325 4950 m
|
||||
gs 1 -1 sc (Readout) col0 sh gr
|
||||
|
@ -118,7 +118,7 @@ Single
|
||||
21900 2700 22050 2700
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -95,7 +95,7 @@ Single
|
||||
4 0 0 50 0 0 30 0.0000 4 405 2580 9450 6600 Exposure time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 1050 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 1050 5550 Dead time\001
|
||||
|
@ -341,7 +341,7 @@ gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
/Times-Roman ff 450.00 scf sf
|
||||
11325 9150 m
|
||||
gs 1 -1 sc (Number of cycles) col0 sh gr
|
||||
gs 1 -1 sc (Number of triggers) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
5325 4950 m
|
||||
gs 1 -1 sc (Readout) col0 sh gr
|
||||
|
@ -79,7 +79,7 @@ Single
|
||||
4200 5850 4650 5850
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -118,7 +118,7 @@ Single
|
||||
21900 2700 22050 2700
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -401,7 +401,7 @@ gs 1 -1 sc (External trigger) col0 sh gr
|
||||
gs 1 -1 sc (Number of frames) col0 sh gr
|
||||
/Times-Roman ff 450.00 scf sf
|
||||
12600 9150 m
|
||||
gs 1 -1 sc (Number of cycles) col0 sh gr
|
||||
gs 1 -1 sc (Number of triggers) col0 sh gr
|
||||
/Times-Roman ff 240.00 scf sf
|
||||
6600 4950 m
|
||||
gs 1 -1 sc (Readout) col0 sh gr
|
||||
|
@ -111,7 +111,7 @@ Single
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 2760 825 2700 External trigger\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 8250 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 12600 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 12600 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 6600 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 2580 4575 6225 Exposure time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1140 9525 6225 Period\001
|
||||
|
@ -79,7 +79,7 @@ Single
|
||||
4200 5850 4650 5850
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 6975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 3225 15975 7800 Number of frames\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of cycles\001
|
||||
4 0 0 50 0 0 30 0.0000 4 405 3090 11325 9150 Number of triggers\001
|
||||
4 0 0 50 0 0 16 0.0000 4 165 810 5325 4950 Readout\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 2565 825 4125 Detection time\001
|
||||
4 0 0 50 0 0 30 0.0000 4 300 1785 825 5550 Dead time\001
|
||||
|
@ -217,7 +217,7 @@ is used to configure the detector parameter var
|
||||
\item[delay t] Sets the delay after trigger (in s)
|
||||
\item[gates n] Sets the number of gates per frame
|
||||
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
|
||||
\item[probes n] Sets the number of probes to accumulate (max 3)
|
||||
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
|
||||
\item[flags mode] Sets the readout flags - can be none or storeinram
|
||||
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
|
||||
\item[delay] Gets the delay after trigger (in s)
|
||||
\item[gates] Gets the number of gates per frame
|
||||
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles] Gets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers] Gets the number of triggers (e.g. number of triggers)
|
||||
\item[probes] Gets the number of probes to accumulate (max 3)
|
||||
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
|
||||
\item[dr] Gets the dynamic range
|
||||
|
@ -127,7 +127,7 @@ where: \\
|
||||
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
|
||||
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
|
||||
\textit{p} is the position index, if different positions are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
|
||||
\textit{i} is the file index;\\
|
||||
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN raw data, \textit{.dat} for MYTHEN processed data.
|
||||
|
||||
@ -241,7 +241,7 @@ Figure~\ref{eq:acqflow} shows in which sequence the various scripts and loops ar
|
||||
|
||||
|
||||
If you prefere to handle the acquisition from your acquisition enviroment, simply leave al scripts and scans disabled and call the acquition from your acquisition enviroment. \\
|
||||
Only the frames and cycles loops are defined in firmware and guarantee a precise timing of the acquisition which cannot replaced by any other method (you can synchronize to your beamline by hardware connection of the IO signals as described in~\ref{sec:timing}).
|
||||
Only the frames and triggers loops are defined in firmware and guarantee a precise timing of the acquisition which cannot replaced by any other method (you can synchronize to your beamline by hardware connection of the IO signals as described in~\ref{sec:timing}).
|
||||
|
||||
Hereafter a description of the meaning of the various loops:
|
||||
\begin{description}
|
||||
@ -259,11 +259,11 @@ Hereafter a description of the meaning of the various loops:
|
||||
The detector is moved in the angular positions specified by the positions command.\\
|
||||
The command for moving the detector should be defined as described in~\ref{sec:usersFunc}.\\
|
||||
All data acquired during a position loop will be merged together, unless the number of positions is set to 0. In this case single frames will be converted to angle without merging.\\
|
||||
Avoid using the position loop together with many frames/cycles.
|
||||
Avoid using the position loop together with many frames/triggers.
|
||||
|
||||
\item[Cycles loop] is executed in real time and defines e.g. the number of triggers that will be accepted. The total number of images will be given by frames times cycles.
|
||||
\item[Triggers loop] is executed in real time and defines e.g. the number of triggers that will be accepted. The total number of images will be given by frames times triggers.
|
||||
|
||||
\item[Frames loop] is executed in real time and defines e.g. the images acquired per trigger. The total number of images will be given by frames times cycles.
|
||||
\item[Frames loop] is executed in real time and defines e.g. the images acquired per trigger. The total number of images will be given by frames times triggers.
|
||||
\end{description}
|
||||
|
||||
Executing a script simply consists in a system call with the arguments specified below. The various scripts are executed only if they are enabled and different than \textit{none}. \\
|
||||
@ -332,11 +332,11 @@ In the following is a list of the main parameters involved in the acquisition ti
|
||||
\item[Period] is the period of the images acquired. If it is shorter than the exposure time plus readout time, it will be ignored.
|
||||
\item[Delay after trigger] can be set as a delay between the trigger signal and the start of the detection time.
|
||||
\item[Number of gates] is used only in \textit{gating} mode and is the number of times that the gate is toggled before the detector is read out. Useful for stroboscopic measurements with gate period shorter than the minim acquisition period of the detector, otherwise can be left to 1.
|
||||
\item[Number of frames] is the number of images to be acquired per cycle. Frames and cycles have the same meaning except in trigger mode, when frames means the number of images per trigger. The total number of images is frames time cycles.
|
||||
\item[Number of cycles] is the number of times that the frames are acquired. Frames and cycles have the same meaning except in trigger mode, when cycles means the number of triggers that will be accepted. The total number of images is frames time cycles.
|
||||
\item[Number of frames] is the number of images to be acquired per cycle. Frames and triggers have the same meaning except in trigger mode, when frames means the number of images per trigger. The total number of images is frames time triggers.
|
||||
\item[Number of triggers] is the number of times that the frames are acquired. Frames and triggers have the same meaning except in trigger mode, when triggers means the number of triggers that will be accepted. The total number of images is frames time triggers.
|
||||
\item[Number of probes] is used in stoboscopic measurements when the period is longer than the minimum acquisition period, but shorter than the frame rate.\\
|
||||
In this case the data can be summed in firmware. \\
|
||||
Currently it is implemented for Mythen only. If probes is set to 0, works normallyreturning an image for each readout, otherwise set number of cycles to 1. The maximum number of probes that can be set is 3. The detector will return a number of image equal to the number of probes, where all frames are going to be accumulated. The total number of readouts is number of frames time probes and for probes=1 the detector will return one image where all frames have been summed, for probes=2 two images where every second frame has been summed (each image accumulates the number of frames), for probes=3 three images where every third image has been summed (each image accumulates the number of frames).\\
|
||||
Currently it is implemented for Mythen only. If probes is set to 0, works normallyreturning an image for each readout, otherwise set number of triggers to 1. The maximum number of probes that can be set is 3. The detector will return a number of image equal to the number of probes, where all frames are going to be accumulated. The total number of readouts is number of frames time probes and for probes=1 the detector will return one image where all frames have been summed, for probes=2 two images where every second frame has been summed (each image accumulates the number of frames), for probes=3 three images where every third image has been summed (each image accumulates the number of frames).\\
|
||||
The returned images will always have 32~bit dynamic range, while the dynamic range if the detector defines the bit depth of the counters in rder to limit the readout time, if necessary.\\
|
||||
The probes counter waorks also in trigger and gating modes.
|
||||
\end{description}
|
||||
@ -349,14 +349,14 @@ The probes counter waorks also in trigger and gating modes.
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/normal_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Auto timing: the detection time is defined by the exposure time and the period by period (if longer than exposure time plus readout time). The total number of images is frames (in the example 3) times cycles (in the example 2), and in this case there is no difference between the acquisition of the two.}\label{fig:autotiming}
|
||||
\caption{Auto timing: the detection time is defined by the exposure time and the period by period (if longer than exposure time plus readout time). The total number of images is frames (in the example 3) times triggers (in the example 2), and in this case there is no difference between the acquisition of the two.}\label{fig:autotiming}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/gated_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Gating mode: the detector acquires for a number of gates define by the user (in this case 4) before being read out, independently on the timing of the gates. The detector remains insensitive during the readout time and then starts being active again. External gates given during the readout time are ignored. The total number of images is frames (in the example 3) times cycles (in the example 2), and in this case there is no difference between the acquisition of the two. The polarity of the external gate signal can be defined by the user through the \textit{external signal flag} (in the example active high).}\label{fig:gating}
|
||||
\caption{Gating mode: the detector acquires for a number of gates define by the user (in this case 4) before being read out, independently on the timing of the gates. The detector remains insensitive during the readout time and then starts being active again. External gates given during the readout time are ignored. The total number of images is frames (in the example 3) times triggers (in the example 2), and in this case there is no difference between the acquisition of the two. The polarity of the external gate signal can be defined by the user through the \textit{external signal flag} (in the example active high).}\label{fig:gating}
|
||||
\end{figure}
|
||||
|
||||
|
||||
@ -365,7 +365,7 @@ The probes counter waorks also in trigger and gating modes.
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/trigger_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Trigger mode: the external trigger signal defines the start of the beginning of the acquisition, which starts after the delay set by the user. For each trigger, the number of frames is acquired (in the example 3) and all trigger signals ignored. The number of trigger accepted is given by the number of cycles (in the example 2). The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\caption{Trigger mode: the external trigger signal defines the start of the beginning of the acquisition, which starts after the delay set by the user. For each trigger, the number of frames is acquired (in the example 3) and all trigger signals ignored. The number of trigger accepted is given by the number of triggers (in the example 2). The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\end{figure}
|
||||
|
||||
|
||||
@ -373,7 +373,7 @@ The probes counter waorks also in trigger and gating modes.
|
||||
\begin{center}
|
||||
\includegraphics[width=\textwidth]{images/ro_trigger_acquisition.eps}
|
||||
\end{center}
|
||||
\caption{Read Out Trigger mode: the external trigger signal defines the beginning of the readout. The exposure time works as a time out for the waiting time for the trigger signal. The number of trigger accepted is given by the number of cycles (in the example 3) and it does not make sense to program more than one frame. The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\caption{Read Out Trigger mode: the external trigger signal defines the beginning of the readout. The exposure time works as a time out for the waiting time for the trigger signal. The number of trigger accepted is given by the number of triggers (in the example 3) and it does not make sense to program more than one frame. The polarity of the external trigger signal can be defined by the user through the \textit{external signal flag} (in the example rising edge).}\label{fig:trig}
|
||||
\end{figure}
|
||||
|
||||
|
||||
|
@ -91,7 +91,7 @@ where: \\
|
||||
\textit{v0} is the scan0 variable with the desired precision, if scan0 is enabled;\\
|
||||
\textit{v1} is the scan1 variable with the desired precision, if scan1 is enabled;\\
|
||||
\textit{p} is the position index, if different positions are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and cycles are configured;\\
|
||||
\textit{f} is the frame index of the first frame stored in the file, if many frames and triggers are configured;\\
|
||||
\textit{i} is the file index;\\
|
||||
\textit{ext} is the file extension e.g. \textit{.raw} for MYTHEN raw data, \textit{.dat} for MYTHEN processed data.
|
||||
\item[index i] Sets the starting index of the file i at the beginning of the acquisition (automatically incremented for each measurement).
|
||||
@ -110,10 +110,10 @@ Sets the number of gates per frame in gated (stroboscopic) mode.\\
|
||||
Refere to the detailed documentation to understand how the different timing modes work.
|
||||
\item[frames n]
|
||||
Sets the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode). The frame index in the output file name will automatically be incremented.\\
|
||||
Note that the total number of images will be frames times cycles. Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Sets the number of cycles (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times cycles. Refere to the detailed documentation to understand how the different timing modes work.
|
||||
Note that the total number of images will be frames times triggers. Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[triggers n]
|
||||
Sets the number of triggers (e.g. number of triggers). The frame index in the output file name will automatically be incremented. \\
|
||||
Note that the total number of images will be by frames times triggers. Refere to the detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Sets the number of probes to accumulate for stroboscopic measurements. \\
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[measurements] Sets the number of repetitions of the acquisitions (non real time!). The file index in the file name will be automotically incremented.\\
|
||||
@ -234,7 +234,7 @@ It is normally reccomended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
%\item[delayl]
|
||||
%\item[gatesl]
|
||||
%\item[framesl]
|
||||
%\item[cyclesl]
|
||||
%\item[triggersl]
|
||||
%\item[frameindex]
|
||||
%\item[now]
|
||||
\end{description}
|
||||
@ -393,11 +393,11 @@ Returns the number of gates per frame in gated (stroboscopic) mode.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[frames]
|
||||
Returns the number of frames acquired sequentially per cycle (e.g. after each trigger), with the exposure time defined by exptime and the period defined by period (unless in gated mode).
|
||||
Note that the total number of images is frames times cycles.
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[cycles n]
|
||||
Returns the number of cycles (e.g. number of triggers).
|
||||
Note that the total number of images is frames times cycles.
|
||||
\item[triggers n]
|
||||
Returns the number of triggers (e.g. number of triggers).
|
||||
Note that the total number of images is frames times triggers.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
\item[probes] Returns the number of probes to accumulate for stroboscopic measurements.
|
||||
Refere to detailed documentation to understand how the different timing modes work.
|
||||
@ -518,7 +518,7 @@ It is normally reccomended to use \verb=sls\_detector\_acquire [j-]=, which take
|
||||
\item[delayl] Returns the delay after trigger left for the current frame.
|
||||
\item[gatesl] Returns the number of gates left for the current frame.
|
||||
\item[framesl] Returns the number of frames left for the current cycle.
|
||||
\item[cyclesl] Returns the number of cycles left for the current acquisition.
|
||||
\item[triggersl] Returns the number of triggers left for the current acquisition.
|
||||
\item[now] Returns the current timestamp of the detector clock.
|
||||
\item[timestamp] Returns the timestamp of the acquisitions in a First-In/First-Out mode i.e. every time it is called it returns the timestamp of the first acquisition start of readout. The FIFO is reset everytime the acquisition is started.
|
||||
\end{description}
|
||||
|
@ -217,7 +217,7 @@ is used to configure the detector parameter var
|
||||
\item[delay t] Sets the delay after trigger (in s)
|
||||
\item[gates n] Sets the number of gates per frame
|
||||
\item[frames n] Sets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles n] Sets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers n] Sets the number of triggers (e.g. number of triggers)
|
||||
\item[probes n] Sets the number of probes to accumulate (max 3)
|
||||
\item[dr n] Sets the dynamic range - can be (1,) 4, 8,16 or 24 bits
|
||||
\item[flags mode] Sets the readout flags - can be none or storeinram
|
||||
@ -298,7 +298,7 @@ is used to retrieve the detector parameter var
|
||||
\item[delay] Gets the delay after trigger (in s)
|
||||
\item[gates] Gets the number of gates per frame
|
||||
\item[frames] Gets the number of frames per cycle (e.g. after each trigger)
|
||||
\item[cycles] Gets the number of cycles (e.g. number of triggers)
|
||||
\item[triggers] Gets the number of triggers (e.g. number of triggers)
|
||||
\item[probes] Gets the number of probes to accumulate (max 3)
|
||||
\item[timestamp] Gets the internal time stamp of the nex frame acquired (i.e. during an acquisition, all timestamps of the frames are stored in a FIFO which can be read after the acquisition - returns -1 if the FIFO is empty)
|
||||
\item[dr] Gets the dynamic range
|
||||
|
@ -5,8 +5,6 @@ pybind11_add_module(_sls_detector
|
||||
src/experimental.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
target_link_libraries(_sls_detector PUBLIC
|
||||
slsDetectorShared
|
||||
slsReceiverShared
|
||||
@ -26,12 +24,12 @@ set( PYTHON_FILES
|
||||
dacs.py
|
||||
decorators.py
|
||||
detector_property.py
|
||||
detector.py
|
||||
eiger.py
|
||||
# detector.py
|
||||
# eiger.py
|
||||
errors.py
|
||||
experimental.py
|
||||
jungfrau_ctb.py
|
||||
jungfrau.py
|
||||
# jungfrau_ctb.py
|
||||
# jungfrau.py
|
||||
registers.py
|
||||
utils.py
|
||||
|
||||
|
@ -2,12 +2,9 @@ import os
|
||||
import sys
|
||||
import numpy as np
|
||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||
from sls_detector import Eiger, Jungfrau, Detector, defs
|
||||
from sls_detector import ExperimentalDetector
|
||||
|
||||
from _sls_detector.io import read_my302_file
|
||||
|
||||
# from sls_detector import Eiger, Jungfrau, Detector, defs
|
||||
from sls_detector import Detector
|
||||
from sls_detector import dacIndex
|
||||
d = Detector()
|
||||
e = ExperimentalDetector()
|
||||
j = Jungfrau()
|
||||
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
from .detector import Detector, DetectorError, free_shared_memory
|
||||
from .eiger import Eiger
|
||||
from .experimental import ExperimentalDetector
|
||||
from .jungfrau import Jungfrau
|
||||
from .jungfrau_ctb import JungfrauCTB
|
||||
from _sls_detector import DetectorApi
|
||||
# from .detector import Detector, DetectorError, free_shared_memory
|
||||
# from .eiger import Eiger
|
||||
from .experimental import Detector
|
||||
|
||||
# from .jungfrau import Jungfrau
|
||||
# from .jungfrau_ctb import JungfrauCTB
|
||||
# from _sls_detector import DetectorApi
|
||||
|
||||
import _sls_detector
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -54,7 +54,7 @@ def freeze(cls):
|
||||
|
||||
|
||||
@freeze
|
||||
class ExperimentalDetector(CppDetectorApi):
|
||||
class Detector(CppDetectorApi):
|
||||
"""
|
||||
This class is the base for detector specific
|
||||
interfaces. Most functions exists in two versions
|
||||
@ -425,54 +425,88 @@ class ExperimentalDetector(CppDetectorApi):
|
||||
def zmqip(self, ip):
|
||||
self.setClientZmqIp(ip)
|
||||
|
||||
#TODO! Change to dst
|
||||
|
||||
@property
|
||||
def rx_udpip(self):
|
||||
def udp_dstip(self):
|
||||
return element_if_equal(self.getDestinationUDPIP())
|
||||
|
||||
@rx_udpip.setter
|
||||
def rx_udpip(self, ip):
|
||||
@udp_dstip.setter
|
||||
def udp_dstip(self, ip):
|
||||
self.getDestinationUDPIP(ip)
|
||||
|
||||
@property
|
||||
def rx_udpip2(self):
|
||||
def udp_dstip2(self):
|
||||
return element_if_equal(self.getDestinationUDPIP2())
|
||||
|
||||
@rx_udpip2.setter
|
||||
def rx_udpip2(self, ip):
|
||||
@udp_dstip2.setter
|
||||
def udp_dstip2(self, ip):
|
||||
self.getDestinationUDPIP2(ip)
|
||||
|
||||
@property
|
||||
def rx_udpmac(self):
|
||||
def udp_dstmac(self):
|
||||
return element_if_equal(self.getDestinationUDPMAC())
|
||||
|
||||
@rx_udpmac.setter
|
||||
def rx_udpmac(self, mac):
|
||||
@udp_dstmac.setter
|
||||
def udp_dstmac(self, mac):
|
||||
self.getDestinationUDPMAC2(mac)
|
||||
|
||||
@property
|
||||
def rx_udpmac2(self):
|
||||
def udp_dstmac2(self):
|
||||
return element_if_equal(self.getDestinationUDPMAC2())
|
||||
|
||||
@rx_udpmac2.setter
|
||||
def rx_udpmac2(self, mac):
|
||||
@udp_dstmac2.setter
|
||||
def udp_dstmac2(self, mac):
|
||||
self.getDestinationUDPMAC2(mac)
|
||||
|
||||
|
||||
@property
|
||||
def detectormac(self):
|
||||
return element_if_equal(self.getSourceUDPMAC())
|
||||
def udp_dstport(self):
|
||||
return element_if_equal(self.getDestinationUDPPort())
|
||||
|
||||
@detectormac.setter
|
||||
def detectormac(self, mac):
|
||||
self.setSourceUDPMAC()
|
||||
@udp_dstport.setter
|
||||
def udp_dstport(self, port):
|
||||
self.setDestinationUDPPort(port)
|
||||
|
||||
@property
|
||||
def detectormac2(self):
|
||||
def udp_dstport2(self):
|
||||
return element_if_equal(self.getDestinationUDPPort2())
|
||||
|
||||
@udp_dstport2.setter
|
||||
def udp_dstport2(self, port):
|
||||
self.setDestinationUDPPort2(port)
|
||||
|
||||
@property
|
||||
def src_udpmac(self):
|
||||
return element_if_equal(self.getSourceUDPMAC())
|
||||
|
||||
@src_udpmac.setter
|
||||
def src_udpmac(self, mac):
|
||||
self.setSourceUDPMAC(mac)
|
||||
|
||||
@property
|
||||
def src_udpip2(self):
|
||||
return element_if_equal(self.getSourceUDPIP())
|
||||
|
||||
@src_udpip2.setter
|
||||
def src_udpip2(self, ip):
|
||||
self.setSourceUDPIP(ip)
|
||||
|
||||
@property
|
||||
def src_udpip(self):
|
||||
return element_if_equal(self.getSourceUDPIP())
|
||||
|
||||
@src_udpip.setter
|
||||
def src_udpip(self, ip):
|
||||
self.setSourceUDPIP(ip)
|
||||
|
||||
|
||||
@property
|
||||
def src_udpmac2(self):
|
||||
return element_if_equal(self.getSourceUDPMAC2())
|
||||
|
||||
@detectormac2.setter
|
||||
def detectormac2(self, mac):
|
||||
self.setSourceUDPMAC2()
|
||||
@src_udpmac2.setter
|
||||
def src_udpmac2(self, mac):
|
||||
self.setSourceUDPMAC2(mac)
|
||||
|
||||
@property
|
||||
def vhighvoltage(self):
|
||||
@ -487,12 +521,12 @@ class ExperimentalDetector(CppDetectorApi):
|
||||
return self.getUserDetails()
|
||||
|
||||
@property
|
||||
def settingsdir(self):
|
||||
return element_if_equal(self.getSettingsDir())
|
||||
def settingspath(self):
|
||||
return element_if_equal(self.getSettingsPath())
|
||||
|
||||
@settingsdir.setter
|
||||
def settingsdir(self, dir):
|
||||
self.setSettingsDir(dir)
|
||||
@settingspath.setter
|
||||
def settingspath(self, path):
|
||||
self.setSettingsPath(path)
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
|
@ -1,259 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Jungfrau detector class and support functions.
|
||||
Inherits from Detector.
|
||||
"""
|
||||
from .adcs import Adc, DetectorAdcs
|
||||
from .detector import Detector
|
||||
from .dacs import DetectorDacs
|
||||
from .utils import element_if_equal
|
||||
|
||||
|
||||
class JungfrauDacs(DetectorDacs):
|
||||
_dacs = [('vb_comp', 0, 4000, 1220),
|
||||
('vdd_prot', 0, 4000, 3000),
|
||||
('vin_com', 0, 4000, 1053),
|
||||
('vref_prech', 0, 4000, 1450),
|
||||
('vb_pixbuff', 0, 4000, 750),
|
||||
('vb_ds', 0, 4000, 1000),
|
||||
('vref_ds', 0, 4000, 480),
|
||||
('vref_comp', 0, 4000, 420),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
class Jungfrau(Detector):
|
||||
"""
|
||||
Class used to control a Jungfrau detector. Inherits from the Detector class but a specialized
|
||||
class is needed to provide the correct dacs and unique functions.
|
||||
|
||||
"""
|
||||
_detector_dynamic_range = [4, 8, 16, 32]
|
||||
|
||||
_settings = ['dynamichg0',
|
||||
'dynamicgain',
|
||||
'fixgain1',
|
||||
'fixgain2',
|
||||
'forceswitchg1',
|
||||
'forceswitchg2']
|
||||
"""Available settings for Jungfrau"""
|
||||
|
||||
def __init__(self, multi_id=0):
|
||||
#Init on base calss
|
||||
super().__init__(multi_id)
|
||||
self._dacs = JungfrauDacs(self)
|
||||
|
||||
#Jungfrau specific temps, this can be reduced to a single value?
|
||||
self._temp = DetectorAdcs()
|
||||
self._temp.fpga = Adc('temp_fpga', self)
|
||||
# self._register = Register(self)
|
||||
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#Jungfrau
|
||||
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
@property
|
||||
def power_chip(self):
|
||||
"""Power on or off the ASICs, True for on False for off"""
|
||||
return self._api.isChipPowered()
|
||||
|
||||
@power_chip.setter
|
||||
def power_chip(self, value):
|
||||
self._api.powerChip(value)
|
||||
|
||||
@property
|
||||
def delay(self):
|
||||
"""Delay after trigger [s]"""
|
||||
return self._api.getDelay()/1e9
|
||||
|
||||
@delay.setter
|
||||
def delay(self, t):
|
||||
ns_time = int(t * 1e9)
|
||||
self._api.setDelay(ns_time)
|
||||
|
||||
@property
|
||||
def n_gates(self):
|
||||
return self._api.getNumberOfGates()
|
||||
|
||||
@n_gates.setter
|
||||
def n_gates(self, n):
|
||||
self._api.setNumberOfGates(n)
|
||||
|
||||
@property
|
||||
def n_probes(self):
|
||||
return self._api.getNumberOfProbes()
|
||||
|
||||
@n_probes.setter
|
||||
def n_probes(self, n):
|
||||
self._api.setNumberOfProbes(n)
|
||||
|
||||
@property
|
||||
def storagecell_start(self):
|
||||
"""
|
||||
First storage cell
|
||||
"""
|
||||
return self._api.getStoragecellStart()
|
||||
|
||||
@storagecell_start.setter
|
||||
def storagecell_start(self, value):
|
||||
self._api.setStoragecellStart(value)
|
||||
|
||||
|
||||
@property
|
||||
def n_storagecells(self):
|
||||
"""
|
||||
number of storage cells used for the measurements
|
||||
"""
|
||||
return self._api.getNumberOfStorageCells()
|
||||
|
||||
@n_storagecells.setter
|
||||
def n_storagecells(self, value):
|
||||
self._api.setNumberOfStorageCells(value)
|
||||
|
||||
@property
|
||||
def temp(self):
|
||||
"""
|
||||
An instance of DetectorAdcs used to read the temperature
|
||||
of different components
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
detector.temp
|
||||
>>
|
||||
temp_fpga : 36.90°C, 45.60°C
|
||||
|
||||
a = detector.temp.fpga[:]
|
||||
a
|
||||
>> [36.568, 45.542]
|
||||
|
||||
|
||||
"""
|
||||
return self._temp
|
||||
|
||||
@property
|
||||
def temperature_threshold(self):
|
||||
"""Threshold for switching of chips"""
|
||||
return self._api.getThresholdTemperature()
|
||||
|
||||
@temperature_threshold.setter
|
||||
def temperature_threshold(self, t):
|
||||
self._api.setThresholdTemperature(t)
|
||||
|
||||
@property
|
||||
def temperature_control(self):
|
||||
"""
|
||||
Monitor the temperature of the detector and switch off chips if temperature_threshold is
|
||||
crossed
|
||||
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#activate
|
||||
detector.temperature_control = True
|
||||
|
||||
#deactivate
|
||||
detector.temperature_control = False
|
||||
|
||||
|
||||
"""
|
||||
return self._api.getTemperatureControl()
|
||||
|
||||
@temperature_control.setter
|
||||
def temperature_control(self, v):
|
||||
self._api.setTemperatureControl(v)
|
||||
|
||||
@property
|
||||
def temperature_event(self):
|
||||
"""Have the temperature threshold been crossed?
|
||||
|
||||
Returns
|
||||
---------
|
||||
|
||||
:py:obj:`True` if the threshold have been crossed and temperature_control is active
|
||||
otherwise :py:obj:`False`
|
||||
|
||||
"""
|
||||
return self._api.getTemperatureEvent()
|
||||
|
||||
def reset_temperature_event(self):
|
||||
"""Reset the temperature_event. After reset temperature_event is False"""
|
||||
self._api.resetTemperatureEvent()
|
||||
|
||||
@property
|
||||
def rx_udpport(self):
|
||||
"""
|
||||
UDP port for the receiver. Each module have one port.
|
||||
Note! Eiger has two ports
|
||||
|
||||
::
|
||||
|
||||
[0:rx_udpport]
|
||||
|
||||
Examples
|
||||
-----------
|
||||
|
||||
::
|
||||
|
||||
d.rx_udpport
|
||||
>> [50010]
|
||||
|
||||
d.rx_udpport = [50010]
|
||||
|
||||
"""
|
||||
return self._api.getNetworkParameter('rx_udpport')
|
||||
|
||||
|
||||
@rx_udpport.setter
|
||||
def rx_udpport(self, ports):
|
||||
"""Requires iterating over elements two and two for setting ports"""
|
||||
for i, p in enumerate(ports):
|
||||
self._api.setNetworkParameter('rx_udpport', str(p), i)
|
||||
|
||||
@property
|
||||
def detector_mac(self):
|
||||
s = self._api.getNetworkParameter('detectormac')
|
||||
return element_if_equal(s)
|
||||
|
||||
|
||||
@detector_mac.setter
|
||||
def detector_mac(self, mac):
|
||||
if isinstance(mac, list):
|
||||
for i, m in enumerate(mac):
|
||||
self._api.setNetworkParameter('detectormac', m, i)
|
||||
else:
|
||||
self._api.setNetworkParameter('detectormac', mac, -1)
|
||||
|
||||
|
||||
@property
|
||||
def detector_ip(self):
|
||||
s = self._api.getNetworkParameter('detectorip')
|
||||
return element_if_equal(s)
|
||||
|
||||
@detector_ip.setter
|
||||
def detector_ip(self, ip):
|
||||
if isinstance(ip, list):
|
||||
for i, addr in enumerate(ip):
|
||||
self._api.setNetworkParameter('detectorip', addr, i)
|
||||
else:
|
||||
self._api.setNetworkParameter('detectorip', ip, -1)
|
@ -1,178 +0,0 @@
|
||||
from functools import partial
|
||||
from collections.abc import Iterable
|
||||
from collections import namedtuple
|
||||
import socket
|
||||
|
||||
from .detector import Detector
|
||||
from .utils import element_if_equal
|
||||
from .adcs import DetectorAdcs, Adc
|
||||
from .dacs import DetectorDacs
|
||||
from .detector_property import DetectorProperty
|
||||
from .registers import Register, Adc_register
|
||||
|
||||
class JungfrauCTBDacs(DetectorDacs):
|
||||
_dacs = [('dac0', 0, 4000, 1400),
|
||||
('dac1', 0, 4000, 1200),
|
||||
('dac2', 0, 4000, 900),
|
||||
('dac3', 0, 4000, 1050),
|
||||
('dac4', 0, 4000, 1400),
|
||||
('dac5', 0, 4000, 655),
|
||||
('dac6', 0, 4000, 2000),
|
||||
('dac7', 0, 4000, 1400),
|
||||
('dac8', 0, 4000, 850),
|
||||
('dac9', 0, 4000, 2000),
|
||||
('dac10', 0, 4000, 2294),
|
||||
('dac11', 0, 4000, 983),
|
||||
('dac12', 0, 4000, 1475),
|
||||
('dac13', 0, 4000, 1200),
|
||||
('dac14', 0, 4000, 1600),
|
||||
('dac15', 0, 4000, 1455),
|
||||
('dac16', 0, 4000, 0),
|
||||
('dac17', 0, 4000, 1000),
|
||||
]
|
||||
_dacnames = [_d[0] for _d in _dacs]
|
||||
|
||||
|
||||
|
||||
class JungfrauCTB(Detector):
|
||||
def __init__(self, id = 0):
|
||||
super().__init__(id)
|
||||
self._dacs = JungfrauCTBDacs(self)
|
||||
self._register = Register(self)
|
||||
self._adc_register = Adc_register(self)
|
||||
|
||||
@property
|
||||
def v_a(self):
|
||||
return self._api.getDac_mV('v_a', -1)
|
||||
|
||||
@v_a.setter
|
||||
def v_a(self, value):
|
||||
self._api.setDac_mV('v_a', -1, value)
|
||||
|
||||
@property
|
||||
def v_b(self):
|
||||
return self._api.getDac_mV('v_b', -1)
|
||||
|
||||
@v_b.setter
|
||||
def v_b(self, value):
|
||||
self._api.setDac_mV('v_b', -1, value)
|
||||
|
||||
|
||||
@property
|
||||
def v_c(self):
|
||||
return self._api.getDac_mV('v_c', -1)
|
||||
|
||||
@v_c.setter
|
||||
def v_c(self, value):
|
||||
self._api.setDac_mV('v_c', -1, value)
|
||||
|
||||
@property
|
||||
def v_d(self):
|
||||
return self._api.getDac_mV('v_d', -1)
|
||||
|
||||
@v_d.setter
|
||||
def v_d(self, value):
|
||||
self._api.setDac_mV('v_d', -1, value)
|
||||
|
||||
@property
|
||||
def v_io(self):
|
||||
return self._api.getDac_mV('v_io', -1)
|
||||
|
||||
@v_io.setter
|
||||
def v_io(self, value):
|
||||
self._api.setDac_mV('v_io', -1, value)
|
||||
|
||||
@property
|
||||
def v_limit(self):
|
||||
return self._api.getDac_mV('v_limit', -1)
|
||||
|
||||
@v_limit.setter
|
||||
def v_limit(self, value):
|
||||
self._api.setDac_mV('v_limit', -1, value)
|
||||
|
||||
@property
|
||||
def adc_register(self):
|
||||
return self._adc_register
|
||||
|
||||
# @property
|
||||
# def register(self):
|
||||
# return self._register
|
||||
|
||||
def adcOFF(self):
|
||||
"""Switch off the ADC"""
|
||||
self.adc_register[0x8] = 1
|
||||
|
||||
|
||||
|
||||
@property
|
||||
def dacs(self):
|
||||
"""
|
||||
|
||||
An instance of DetectorDacs used for accessing the dacs of a single
|
||||
or multi detector.
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
#JungfrauCTB
|
||||
|
||||
|
||||
"""
|
||||
return self._dacs
|
||||
|
||||
@property
|
||||
def dbitpipeline(self):
|
||||
return self._api.getDbitPipeline()
|
||||
|
||||
@dbitpipeline.setter
|
||||
def dbitpipeline(self, value):
|
||||
self._api.setDbitPipeline(value)
|
||||
|
||||
|
||||
@property
|
||||
def dbitphase(self):
|
||||
return self._api.getDbitPhase()
|
||||
|
||||
@dbitphase.setter
|
||||
def dbitphase(self, value):
|
||||
self._api.setDbitPhase(value)
|
||||
|
||||
@property
|
||||
def dbitclock(self):
|
||||
return self._api.getDbitClock()
|
||||
|
||||
@dbitclock.setter
|
||||
def dbitclock(self, value):
|
||||
self._api.setDbitClock(value)
|
||||
|
||||
@property
|
||||
def samples(self):
|
||||
return self._api.getJCTBSamples()
|
||||
|
||||
@samples.setter
|
||||
def samples(self, value):
|
||||
self._api.setJCTBSamples(value)
|
||||
|
||||
@property
|
||||
def readout_clock(self):
|
||||
"""
|
||||
Speed of the readout clock relative to the full speed
|
||||
|
||||
|
||||
Examples
|
||||
---------
|
||||
|
||||
::
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
return self._api.getReadoutClockSpeed()
|
||||
|
||||
|
||||
@readout_clock.setter
|
||||
def readout_clock(self, value):
|
||||
self._api.setReadoutClockSpeed(value)
|
@ -1,992 +0,0 @@
|
||||
#ifndef DETECTOR_H
|
||||
#define DETECTOR_H
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "slsDetector.h"
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
class DetectorPythonInterface {
|
||||
public:
|
||||
DetectorPythonInterface(int i) : det(i), multi_detector_id(i) {
|
||||
// Disable output from std::cout
|
||||
// std::cout.setstate(std::ios_base::failbit);
|
||||
}
|
||||
|
||||
int getMultiDetectorId() { return multi_detector_id; }
|
||||
|
||||
|
||||
|
||||
|
||||
// blocking command, acquire set number of frames
|
||||
void acquire() { det.acquire(); }
|
||||
|
||||
// for Eiger check status of the module
|
||||
// true active false deactivated
|
||||
bool getActive(int i) { return det.activate(-1, i); }
|
||||
// activate or deactivate a module
|
||||
void setActive(int i, bool value) { det.activate(value, i); }
|
||||
|
||||
int getFramesCaughtByReceiver() {
|
||||
return det.getFramesCaughtByReceiver();
|
||||
// return det.getFramesCaughtByReceiver();
|
||||
}
|
||||
int getFramesCaughtByReceiver(int i) {
|
||||
return det.getFramesCaughtByReceiver(i);
|
||||
}
|
||||
|
||||
void setReceiverFifoDepth(int n_frames) {
|
||||
det.setReceiverFifoDepth(n_frames);
|
||||
}
|
||||
|
||||
void setNumberOfStorageCells(const int64_t num) {
|
||||
det.setTimer(slsDetectorDefs::timerIndex::STORAGE_CELL_NUMBER, num);
|
||||
}
|
||||
int getNumberOfStorageCells() {
|
||||
return det.setTimer(slsDetectorDefs::timerIndex::STORAGE_CELL_NUMBER,
|
||||
-1);
|
||||
}
|
||||
|
||||
void setStoragecellStart(int cell) { det.setStoragecellStart(cell); }
|
||||
|
||||
int getStoragecellStart() { return det.setStoragecellStart(); }
|
||||
|
||||
int getReceiverFifoDepth() { return det.setReceiverFifoDepth(); }
|
||||
|
||||
void resetFramesCaught() { det.resetFramesCaught(); }
|
||||
|
||||
int getReceiverCurrentFrameIndex() {
|
||||
return det.getReceiverCurrentFrameIndex();
|
||||
}
|
||||
|
||||
std::string getReceiverHostname(int det_id = -1) const {
|
||||
return det.getReceiverHostname(det_id);
|
||||
}
|
||||
|
||||
void setReceiverHostname(std::string hostname, int det_id = -1) {
|
||||
det.setReceiverHostname(hostname, det_id);
|
||||
}
|
||||
|
||||
// std::string getReceiverUDPIP(int det_id = -1) const {
|
||||
// return det.getReceiverUDPIP(det_id);
|
||||
// }
|
||||
|
||||
// void setReceiverUDPIP(std::string ip, int det_id = -1) {
|
||||
// det.setReceiverUDPIP(ip, det_id);
|
||||
// }
|
||||
|
||||
// std::string getReceiverUDPMAC(int det_id = -1) {
|
||||
// return det.getReceiverUDPMAC(det_id);
|
||||
// }
|
||||
|
||||
// void setReceiverUDPMAC(std::string mac, int det_id = -1) {
|
||||
// det.setReceiverUDPMAC(mac, det_id);
|
||||
// }
|
||||
|
||||
void startReceiver() { det.startReceiver(); }
|
||||
void stopReceiver() { det.stopReceiver(); }
|
||||
|
||||
bool getTenGigabitEthernet() { return det.enableTenGigabitEthernet(); }
|
||||
void setTenGigabitEthernet(bool value) {
|
||||
det.enableTenGigabitEthernet(value);
|
||||
}
|
||||
|
||||
void setFileFormat(const std::string &format);
|
||||
std::string getFileFormat();
|
||||
|
||||
// std::string checkOnline() { return det.checkOnline(); }
|
||||
|
||||
bool isChipPowered() { return det.powerChip(); }
|
||||
void powerChip(const bool value) { det.powerChip(value); }
|
||||
|
||||
// read register from readout system, used for low level control
|
||||
uint32_t readRegister(const uint32_t addr) {
|
||||
return det.readRegister(addr);
|
||||
}
|
||||
|
||||
// directly write to register in readout system
|
||||
void writeRegister(const uint32_t addr, const uint32_t value) {
|
||||
det.writeRegister(addr, value);
|
||||
}
|
||||
|
||||
// directly write to the ADC register
|
||||
// should this also be unsigned? Probably...
|
||||
void writeAdcRegister(const int addr, const int value) {
|
||||
det.writeAdcRegister(addr, value);
|
||||
}
|
||||
|
||||
void setBitInRegister(const uint32_t reg_addr, const int bit_number) {
|
||||
det.setBit(reg_addr, bit_number);
|
||||
}
|
||||
void clearBitInRegister(const uint32_t reg_addr, const int bit_number) {
|
||||
det.clearBit(reg_addr, bit_number);
|
||||
}
|
||||
|
||||
bool getAcquiringFlag() { return det.getAcquiringFlag(); }
|
||||
|
||||
void setAcquiringFlag(const bool flag) { det.setAcquiringFlag(flag); }
|
||||
|
||||
bool getCounterBit() { return det.setCounterBit(); }
|
||||
void setCounterBit(bool b) { det.setCounterBit(b); }
|
||||
|
||||
slsDetectorDefs::dacIndex dacNameToEnum(std::string dac_name);
|
||||
|
||||
|
||||
|
||||
int getNumberOfDetectors() { return det.size(); }
|
||||
|
||||
std::string getRunStatus() {
|
||||
auto s = det.getRunStatus();
|
||||
return det.runStatusType(s);
|
||||
}
|
||||
|
||||
void startAcquisition() { det.startAcquisition(); }
|
||||
void stopAcquisition() { det.stopAcquisition(); }
|
||||
|
||||
std::string getHostname() { return det.getHostname(); }
|
||||
|
||||
void setHostname(std::string hostname) {
|
||||
det.setHostname(hostname.c_str());
|
||||
}
|
||||
|
||||
int getDynamicRange() { return det.setDynamicRange(-1); }
|
||||
void setDynamicRange(const int dr) { det.setDynamicRange(dr); }
|
||||
|
||||
void pulseChip(const int n) { det.pulseChip(n); }
|
||||
void pulseAllPixels(const int n);
|
||||
void pulseDiagonal(const int n);
|
||||
|
||||
void readConfigurationFile(std::string fname) {
|
||||
det.readConfigurationFile(fname);
|
||||
}
|
||||
void readParametersFile(std::string fname) {
|
||||
det.retrieveDetectorSetup(fname);
|
||||
}
|
||||
|
||||
int64_t getFirmwareVersion() {
|
||||
return det.getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION);
|
||||
}
|
||||
int64_t getServerVersion() {
|
||||
return det.getId(slsDetectorDefs::DETECTOR_SOFTWARE_VERSION);
|
||||
}
|
||||
int64_t getClientVersion() {
|
||||
return det.getId(slsDetectorDefs::THIS_SOFTWARE_VERSION);
|
||||
}
|
||||
int64_t getReceiverVersion() {
|
||||
return det.getId(slsDetectorDefs::RECEIVER_VERSION);
|
||||
}
|
||||
|
||||
std::vector<int64_t> getDetectorNumber() { return det.getDetectorNumber(); }
|
||||
|
||||
int getReadoutClockSpeed() {
|
||||
return det.setSpeed(slsDetectorDefs::CLOCK_DIVIDER, -1);
|
||||
}
|
||||
void setReadoutClockSpeed(const int speed) {
|
||||
det.setSpeed(slsDetectorDefs::CLOCK_DIVIDER, speed);
|
||||
}
|
||||
|
||||
int getSyncClkSpeed(int det_id=-1){
|
||||
return det.setSpeed(slsDetectorDefs::SYNC_CLOCK, -1, 0, det_id);
|
||||
}
|
||||
|
||||
void setDbitPipeline(const int value) {
|
||||
det.setSpeed(slsDetectorDefs::DBIT_PIPELINE, value);
|
||||
}
|
||||
int getDbitPipeline() {
|
||||
return det.setSpeed(slsDetectorDefs::DBIT_PIPELINE, -1);
|
||||
}
|
||||
void setDbitPhase(const int value) {
|
||||
det.setSpeed(slsDetectorDefs::DBIT_PHASE, value);
|
||||
}
|
||||
int getDbitPhase() { return det.setSpeed(slsDetectorDefs::DBIT_PHASE, -1); }
|
||||
void setDbitClock(const int value) {
|
||||
det.setSpeed(slsDetectorDefs::DBIT_CLOCK, value);
|
||||
}
|
||||
int getDbitClock() { return det.setSpeed(slsDetectorDefs::DBIT_CLOCK, -1); }
|
||||
|
||||
int getReceiverPort() const { return det.getReceiverPort(); }
|
||||
|
||||
void setReceiverPort(int det_id, int value) {
|
||||
det.setReceiverPort(value, det_id);
|
||||
}
|
||||
|
||||
void setRateCorrection(std::vector<double> tau) {
|
||||
for (size_t i = 0; i < det.size(); ++i)
|
||||
det.setRateCorrection(tau[i], i);
|
||||
}
|
||||
|
||||
std::vector<double> getRateCorrection();
|
||||
|
||||
void setPatternLoops(int level, int start, int stop,
|
||||
int n, int detPos) {
|
||||
det.setPatternLoops(level, start, stop, n, detPos);
|
||||
}
|
||||
|
||||
|
||||
std::array<int, 3> getPatternLoops(int level, int detPos) {
|
||||
return det.getPatternLoops(level, detPos);
|
||||
}
|
||||
|
||||
void setPatternWord(int addr, uint64_t word, int detPos) {
|
||||
det.setPatternWord(addr, word, detPos);
|
||||
}
|
||||
|
||||
uint64_t getPatternWord(int addr, int detPos){
|
||||
return det.setPatternWord(addr, -1, detPos);
|
||||
}
|
||||
|
||||
uint64_t setPatternIOControl(uint64_t word, int detPos){
|
||||
return det.setPatternIOControl(word, detPos);
|
||||
}
|
||||
|
||||
uint64_t setPatternClockControl(uint64_t word, int detPos){
|
||||
return det.setPatternClockControl(word, detPos);
|
||||
}
|
||||
|
||||
void setPatternWaitAddr(int level, int addr, int detPos){
|
||||
det.setPatternWaitAddr(level, addr, detPos);
|
||||
}
|
||||
|
||||
int getPatternWaitAddr(int level, int detPos){
|
||||
return det.setPatternWaitAddr(level, -1, detPos);
|
||||
}
|
||||
|
||||
void setPatternWaitTime(int level, uint64_t duration, int detPos){
|
||||
det.setPatternWaitTime(level, duration, detPos);
|
||||
}
|
||||
|
||||
uint64_t getPatternWaitTime(int level, int detPos){
|
||||
return det.setPatternWaitTime(level, -1, detPos);
|
||||
}
|
||||
|
||||
bool getFlippedDataX(int i) {
|
||||
return det.getFlippedDataX(i);
|
||||
}
|
||||
|
||||
// bool getFlippedDataY(int i) {
|
||||
// return det.getFlippedData(slsDetectorDefs::dimension::Y, i);
|
||||
// }
|
||||
|
||||
void setFlippedDataX(int i, bool value) {
|
||||
det.setFlippedDataX(value, i);
|
||||
}
|
||||
|
||||
// void setFlippedDataY(int i, bool value) {
|
||||
// det.setFlippedData(slsDetectorDefs::dimension::Y, value, i);
|
||||
// }
|
||||
|
||||
/*** Frame and file settings ***/
|
||||
void setFileName(std::string fname) { det.setFileName(fname); }
|
||||
std::string getFileName() { return det.getFileName(); }
|
||||
void setFilePath(std::string path) { det.setFilePath(path); }
|
||||
void setFilePath(std::string path, int i) { det.setFilePath(path, i); }
|
||||
std::string getFilePath() { return det.getFilePath(); }
|
||||
std::string getFilePath(int i) { return det.getFilePath(i); }
|
||||
|
||||
std::string getUserDetails() { return det.getUserDetails(); }
|
||||
|
||||
void setFramesPerFile(const int n_frames) {
|
||||
det.setFramesPerFile(n_frames);
|
||||
}
|
||||
int getFramesPerFile() { return det.setFramesPerFile(); }
|
||||
|
||||
std::string getReceiverFrameDiscardPolicy() {
|
||||
return det.getReceiverFrameDiscardPolicy(
|
||||
det.setReceiverFramesDiscardPolicy());
|
||||
}
|
||||
void setReceiverFramesDiscardPolicy(std::string f) {
|
||||
auto fdp = det.getReceiverFrameDiscardPolicy(f);
|
||||
if (fdp == slsDetectorDefs::GET_FRAME_DISCARD_POLICY) {
|
||||
throw std::invalid_argument("Coult not decode policy: nodiscard, "
|
||||
"discardempty, discardpartial");
|
||||
}
|
||||
det.setReceiverFramesDiscardPolicy(fdp);
|
||||
}
|
||||
|
||||
void setPartialFramesPadding(bool padding) {
|
||||
det.setPartialFramesPadding(padding);
|
||||
}
|
||||
|
||||
bool getPartialFramesPadding() { return det.getPartialFramesPadding(); }
|
||||
|
||||
std::vector<double> getMeasuredPeriod() {
|
||||
std::vector<double> mp;
|
||||
for (size_t i = 0; i < det.size(); ++i) {
|
||||
auto t = det.getTimeLeft(slsDetectorDefs::MEASURED_PERIOD, i);
|
||||
mp.push_back(static_cast<double>(t) * 1E-9);
|
||||
}
|
||||
return mp;
|
||||
}
|
||||
std::vector<double> getMeasuredSubPeriod() {
|
||||
std::vector<double> mp;
|
||||
for (size_t i = 0; i < det.size(); ++i) {
|
||||
auto t = det.getTimeLeft(slsDetectorDefs::MEASURED_SUBPERIOD, i);
|
||||
mp.push_back(static_cast<double>(t) * 1E-9);
|
||||
}
|
||||
return mp;
|
||||
}
|
||||
|
||||
void checkDetectorVersionCompatibility() {
|
||||
det.checkDetectorVersionCompatibility();
|
||||
}
|
||||
void checkReceiverVersionCompatibility() {
|
||||
det.checkReceiverVersionCompatibility();
|
||||
}
|
||||
|
||||
/*** END Frame and file settings ***/
|
||||
|
||||
void loadTrimbitFile(std::string fname, const int idet) {
|
||||
det.loadSettingsFile(fname, idet);
|
||||
}
|
||||
|
||||
// Eiger: set the energies where the detector is trimmed
|
||||
void setTrimEnergies(std::vector<int> energy) { det.setTrimEn(energy); }
|
||||
|
||||
std::vector<int> getTrimEnergies() { return det.getTrimEn(); }
|
||||
|
||||
/*** Temperature control functions for Jungfrau ***/
|
||||
void setThresholdTemperature(float t) {
|
||||
det.setThresholdTemperature(static_cast<int>(t * 1000), -1);
|
||||
}
|
||||
|
||||
float getThresholdTemperature() {
|
||||
return static_cast<double>(det.setThresholdTemperature(-1, -1)) /
|
||||
1000.0;
|
||||
}
|
||||
|
||||
void setTemperatureControl(bool v) { det.setTemperatureControl(v); }
|
||||
bool getTemperatureControl() { return det.setTemperatureControl(); }
|
||||
|
||||
bool getTemperatureEvent() { return det.setTemperatureEvent(); }
|
||||
void resetTemperatureEvent() { det.setTemperatureEvent(0); }
|
||||
/*** END Temperature control functions for Jungfrau ***/
|
||||
|
||||
void setThresholdEnergy(const int eV) { det.setThresholdEnergy(eV); }
|
||||
|
||||
std::string getSettingsDir() { return det.getSettingsDir(); }
|
||||
void setSettingsDir(std::string dir) { det.setSettingsDir(dir); }
|
||||
|
||||
int getThresholdEnergy() { return det.getThresholdEnergy(); }
|
||||
|
||||
std::string getSettings() {
|
||||
return det.getDetectorSettings(det.getSettings());
|
||||
}
|
||||
|
||||
void setSettings(std::string s) {
|
||||
det.setSettings(det.getDetectorSettings(s));
|
||||
}
|
||||
|
||||
// name to enum translation on the c++ side
|
||||
// should we instead expose the enum to Python?
|
||||
int getDac(std::string dac_name, const int mod_id) {
|
||||
int val = -1;
|
||||
auto dac = dacNameToEnum(dac_name);
|
||||
return det.setDAC(val, dac, 0, mod_id);
|
||||
}
|
||||
|
||||
void setDac(std::string dac_name, const int mod_id, int val) {
|
||||
auto dac = dacNameToEnum(dac_name);
|
||||
det.setDAC(val, dac, 0, mod_id);
|
||||
}
|
||||
|
||||
int getDac_mV(std::string dac_name, const int mod_id) {
|
||||
int val = -1;
|
||||
auto dac = dacNameToEnum(dac_name);
|
||||
return det.setDAC(val, dac, 1, mod_id);
|
||||
}
|
||||
|
||||
void setDac_mV(std::string dac_name, const int mod_id, int value) {
|
||||
auto dac = dacNameToEnum(dac_name);
|
||||
det.setDAC(value, dac, 1, mod_id);
|
||||
}
|
||||
|
||||
// Intended for the JungfrauCTB should we name dacs instead
|
||||
int getDacFromIndex(const int index, const int mod_id) {
|
||||
int val = -1;
|
||||
auto dac = static_cast<slsDetectorDefs::dacIndex>(0);
|
||||
return det.setDAC(val, dac, 0, mod_id);
|
||||
}
|
||||
// Intended for the JungfrauCTB should we name dacs instead
|
||||
int setDacFromIndex(const int index, const int mod_id, int value) {
|
||||
auto dac = static_cast<slsDetectorDefs::dacIndex>(0);
|
||||
return det.setDAC(value, dac, 0, mod_id);
|
||||
}
|
||||
|
||||
// Calling multi do we have a need to lock/unlock a single det?
|
||||
bool getServerLock() { return det.lockServer(-1); }
|
||||
void setServerLock(const bool value) { det.lockServer(value); }
|
||||
bool getReceiverLock() { return det.lockReceiver(-1); }
|
||||
void setReceiverLock(const bool value) { det.lockReceiver(value); }
|
||||
|
||||
int getAdc(std::string adc_name, int mod_id) {
|
||||
auto adc = dacNameToEnum(adc_name);
|
||||
return det.getADC(adc, mod_id);
|
||||
}
|
||||
|
||||
// std::vector<std::string> getReadoutFlags();
|
||||
|
||||
// // note singular
|
||||
// void setReadoutFlag(const std::string flag_name);
|
||||
|
||||
// name to enum transltion of dac
|
||||
int getDacVthreshold() {
|
||||
int val = -1;
|
||||
auto dac = slsDetectorDefs::dacIndex::THRESHOLD;
|
||||
return det.setDAC(val, dac, 0, -1);
|
||||
}
|
||||
|
||||
void setDacVthreshold(const int val) {
|
||||
auto dac = slsDetectorDefs::dacIndex::THRESHOLD;
|
||||
det.setDAC(val, dac, 0, -1);
|
||||
}
|
||||
|
||||
void setFileIndex(const int i) { det.setFileIndex(i); }
|
||||
|
||||
int getFileIndex() { return det.getFileIndex(); }
|
||||
|
||||
// time in ns
|
||||
void setExposureTime(const int64_t t) {
|
||||
det.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, t);
|
||||
}
|
||||
|
||||
// time in ns
|
||||
int64_t getExposureTime() {
|
||||
return det.setTimer(slsDetectorDefs::timerIndex::ACQUISITION_TIME, -1);
|
||||
}
|
||||
|
||||
void setSubExposureTime(const int64_t t) {
|
||||
det.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME, t);
|
||||
}
|
||||
|
||||
int64_t getSubExposureTime() {
|
||||
// time in ns
|
||||
return det.setTimer(
|
||||
slsDetectorDefs::timerIndex::SUBFRAME_ACQUISITION_TIME, -1);
|
||||
}
|
||||
|
||||
void setSubExposureDeadTime(const int64_t t) {
|
||||
det.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_DEADTIME, t);
|
||||
}
|
||||
|
||||
int64_t getSubExposureDeadTime() {
|
||||
// time in ns
|
||||
return det.setTimer(slsDetectorDefs::timerIndex::SUBFRAME_DEADTIME, -1);
|
||||
}
|
||||
|
||||
int64_t getCycles() {
|
||||
return det.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER, -1);
|
||||
}
|
||||
|
||||
void setCycles(const int64_t n_cycles) {
|
||||
det.setTimer(slsDetectorDefs::timerIndex::CYCLES_NUMBER, n_cycles);
|
||||
}
|
||||
|
||||
|
||||
// int getNumberOfGates() {
|
||||
// return det.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, -1);
|
||||
// }
|
||||
// void setNumberOfGates(const int t) {
|
||||
// det.setTimer(slsDetectorDefs::timerIndex::GATES_NUMBER, t);
|
||||
// }
|
||||
|
||||
// time in ns
|
||||
int64_t getDelay() {
|
||||
return det.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER,
|
||||
-1);
|
||||
}
|
||||
// time in ns
|
||||
void setDelay(const int64_t t) {
|
||||
det.setTimer(slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER, t);
|
||||
}
|
||||
// time in ns
|
||||
int64_t getPeriod() {
|
||||
return det.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, -1);
|
||||
}
|
||||
// time in ns
|
||||
void setPeriod(const int64_t t) {
|
||||
det.setTimer(slsDetectorDefs::timerIndex::FRAME_PERIOD, t);
|
||||
}
|
||||
|
||||
int64_t getNumberOfFrames() {
|
||||
return det.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, -1);
|
||||
}
|
||||
|
||||
void setNumberOfFrames(const int64_t nframes) {
|
||||
det.setTimer(slsDetectorDefs::timerIndex::FRAME_NUMBER, nframes);
|
||||
}
|
||||
|
||||
// std::string getTimingMode() {
|
||||
// return det.externalCommunicationType(
|
||||
// det.setExternalCommunicationMode());
|
||||
// }
|
||||
// void setTimingMode(const std::string mode) {
|
||||
// det.setExternalCommunicationMode(det.externalCommunicationType(mode));
|
||||
// }
|
||||
|
||||
void freeSharedMemory() { det.freeSharedMemory(); }
|
||||
|
||||
std::vector<std::string> getDetectorType() {
|
||||
std::vector<std::string> detector_type;
|
||||
for (size_t i = 0; i < det.size(); ++i) {
|
||||
detector_type.push_back(det.getDetectorTypeAsString(i));
|
||||
}
|
||||
return detector_type;
|
||||
}
|
||||
|
||||
void setFileWrite(bool value) { det.setFileWrite(value); }
|
||||
bool getFileWrite() { return det.getFileWrite(); }
|
||||
|
||||
void setFileOverWrite(bool value) { det.setFileOverWrite(value); }
|
||||
|
||||
bool getFileOverWrite() { return det.getFileOverWrite(); }
|
||||
|
||||
void setAllTrimbits(int tb) { det.setAllTrimbits(tb); }
|
||||
int getAllTrimbits() { return det.setAllTrimbits(-1); }
|
||||
bool getRxDataStreamStatus() {
|
||||
return det.enableDataStreamingFromReceiver();
|
||||
}
|
||||
|
||||
void setRxDataStreamStatus(bool state) {
|
||||
det.enableDataStreamingFromReceiver(state);
|
||||
}
|
||||
|
||||
// Get a network parameter for all detectors, looping over individual
|
||||
// detectors return a vector of strings
|
||||
std::vector<int> getReceiverStreamingPort() {
|
||||
std::vector<int> vec;
|
||||
vec.reserve(det.size());
|
||||
for (size_t i = 0; i < det.size(); ++i) {
|
||||
vec.push_back(det.getReceiverStreamingPort(i));
|
||||
}
|
||||
return vec;
|
||||
}
|
||||
|
||||
void setReceiverStreamingPort(int value, int det_id) {
|
||||
det.setReceiverDataStreamingOutPort(value, det_id);
|
||||
}
|
||||
|
||||
// std::vector<int> getReceiverUDPPort() {
|
||||
// std::vector<int> vec;
|
||||
// vec.reserve(det.size());
|
||||
// for (size_t i = 0; i < det.size(); ++i) {
|
||||
// vec.push_back(det.getReceiverUDPPort(i));
|
||||
// }
|
||||
// return vec;
|
||||
// }
|
||||
|
||||
// std::vector<int> getReceiverUDPPort2() {
|
||||
// std::vector<int> vec;
|
||||
// vec.reserve(det.size());
|
||||
// for (size_t i = 0; i < det.size(); ++i) {
|
||||
// vec.push_back(det.getReceiverUDPPort2(i));
|
||||
// }
|
||||
// return vec;
|
||||
// }
|
||||
|
||||
// void setReceiverUDPPort(int port, int det_id) {
|
||||
// det.setReceiverUDPPort(port, det_id);
|
||||
// }
|
||||
// void setReceiverUDPPort2(int port, int det_id) {
|
||||
// det.setReceiverUDPPort2(port, det_id);
|
||||
// }
|
||||
|
||||
|
||||
std::string getLastClientIP() { return det.getLastClientIP(); }
|
||||
std::string getReceiverLastClientIP() {
|
||||
return det.getReceiverLastClientIP();
|
||||
}
|
||||
|
||||
// get frame delay of module (det_id) in ns
|
||||
int getDelayFrame(int det_id) {
|
||||
auto r = det.setDetectorNetworkParameter(
|
||||
slsDetectorDefs::networkParameter::DETECTOR_TXN_DELAY_FRAME, -1,
|
||||
det_id);
|
||||
return r;
|
||||
}
|
||||
// set frame delay of module (det_id) in ns
|
||||
void setDelayFrame(int det_id, int delay) {
|
||||
// auto delay_str = std::to_string(delay);
|
||||
det.setDetectorNetworkParameter(
|
||||
slsDetectorDefs::networkParameter::DETECTOR_TXN_DELAY_FRAME, delay,
|
||||
det_id);
|
||||
}
|
||||
|
||||
// get delay left of module (det_id) in ns
|
||||
int getDelayLeft(int det_id) {
|
||||
auto r = det.setDetectorNetworkParameter(
|
||||
slsDetectorDefs::networkParameter::DETECTOR_TXN_DELAY_LEFT, -1,
|
||||
det_id);
|
||||
return r;
|
||||
}
|
||||
// set delay left of module (det_id) in ns
|
||||
void setDelayLeft(int det_id, int delay) {
|
||||
// auto delay_str = std::to_string(delay);
|
||||
det.setDetectorNetworkParameter(
|
||||
slsDetectorDefs::networkParameter::DETECTOR_TXN_DELAY_LEFT, delay,
|
||||
det_id);
|
||||
}
|
||||
|
||||
// get delay right of module (det_id) in ns
|
||||
int getDelayRight(const int det_id) {
|
||||
auto r = det.setDetectorNetworkParameter(
|
||||
slsDetectorDefs::networkParameter::DETECTOR_TXN_DELAY_RIGHT, -1,
|
||||
det_id);
|
||||
return r;
|
||||
}
|
||||
|
||||
// set delay right of module (det_id) in ns
|
||||
void setDelayRight(int det_id, int delay) {
|
||||
// auto delay_str = std::to_string(delay);
|
||||
det.setDetectorNetworkParameter(
|
||||
slsDetectorDefs::networkParameter::DETECTOR_TXN_DELAY_RIGHT, delay,
|
||||
det_id);
|
||||
}
|
||||
|
||||
// Check if detector if filling in gap pixels in module
|
||||
// return true if so, currently only in developer
|
||||
bool getGapPixels() { return det.enableGapPixels(-1); }
|
||||
|
||||
// Set to true to have the detector filling in gap pixels
|
||||
// false to disable, currently only in developer
|
||||
void setGapPixels(bool val) { det.enableGapPixels(val); }
|
||||
|
||||
slsDetectorDefs::networkParameter networkNameToEnum(std::string par_name);
|
||||
|
||||
private:
|
||||
multiSlsDetector det;
|
||||
slsDetector *getSlsDetector(int i) const;
|
||||
int multi_detector_id = 0;
|
||||
};
|
||||
|
||||
void DetectorPythonInterface::setFileFormat(const std::string &format) {
|
||||
if (format == "binary") {
|
||||
det.setFileFormat(slsDetectorDefs::fileFormat::BINARY);
|
||||
} else if (format == "hdf5") {
|
||||
det.setFileFormat(slsDetectorDefs::fileFormat::HDF5);
|
||||
}
|
||||
}
|
||||
|
||||
std::string DetectorPythonInterface::getFileFormat() {
|
||||
auto format =
|
||||
det.setFileFormat(slsDetectorDefs::fileFormat::GET_FILE_FORMAT, -1);
|
||||
switch (format) {
|
||||
case slsDetectorDefs::fileFormat::BINARY:
|
||||
return "binary";
|
||||
case slsDetectorDefs::fileFormat::HDF5:
|
||||
return "hdf5";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
slsDetectorDefs::networkParameter
|
||||
DetectorPythonInterface::networkNameToEnum(std::string par_name) {
|
||||
|
||||
if (par_name == "detectormac") {
|
||||
return slsDetectorDefs::networkParameter::DETECTOR_MAC;
|
||||
} else if (par_name == "detectorip") {
|
||||
return slsDetectorDefs::networkParameter::DETECTOR_IP;
|
||||
} else if (par_name == "rx_hostname") {
|
||||
return slsDetectorDefs::networkParameter::RECEIVER_HOSTNAME;
|
||||
} else if (par_name == "rx_udpip") {
|
||||
return slsDetectorDefs::networkParameter::RECEIVER_UDP_IP;
|
||||
} else if (par_name == "rx_udpport") {
|
||||
return slsDetectorDefs::networkParameter::RECEIVER_UDP_PORT;
|
||||
} else if (par_name == "rx_udpmac") {
|
||||
return slsDetectorDefs::networkParameter::RECEIVER_UDP_MAC;
|
||||
} else if (par_name == "rx_udpport2") {
|
||||
return slsDetectorDefs::networkParameter::RECEIVER_UDP_PORT2;
|
||||
} else if (par_name == "rx_udpsocksize") {
|
||||
return slsDetectorDefs::networkParameter::RECEIVER_UDP_SCKT_BUF_SIZE;
|
||||
} else if (par_name == "rx_realudpsocksize") {
|
||||
return slsDetectorDefs::networkParameter::
|
||||
RECEIVER_REAL_UDP_SCKT_BUF_SIZE;
|
||||
} else if (par_name == "rx_jsonaddheader") {
|
||||
return slsDetectorDefs::networkParameter::ADDITIONAL_JSON_HEADER;
|
||||
} else if (par_name == "delay_left") {
|
||||
return slsDetectorDefs::networkParameter::DETECTOR_TXN_DELAY_LEFT;
|
||||
} else if (par_name == "delay_right") {
|
||||
return slsDetectorDefs::networkParameter::DETECTOR_TXN_DELAY_RIGHT;
|
||||
} else if (par_name == "delay_frame") {
|
||||
return slsDetectorDefs::networkParameter::DETECTOR_TXN_DELAY_FRAME;
|
||||
} else if (par_name == "flow_control_10g") {
|
||||
return slsDetectorDefs::networkParameter::FLOW_CONTROL_10G;
|
||||
} else if (par_name == "client_zmqport") {
|
||||
return slsDetectorDefs::networkParameter::CLIENT_STREAMING_PORT;
|
||||
} else if (par_name == "rx_zmqport") {
|
||||
return slsDetectorDefs::networkParameter::RECEIVER_STREAMING_PORT;
|
||||
} else if (par_name == "rx_zmqip") {
|
||||
return slsDetectorDefs::networkParameter::RECEIVER_STREAMING_SRC_IP;
|
||||
} else if (par_name == "client_zmqip") {
|
||||
return slsDetectorDefs::networkParameter::CLIENT_STREAMING_SRC_IP;
|
||||
}
|
||||
|
||||
throw std::runtime_error("Could not decode network parameter");
|
||||
};
|
||||
|
||||
// slsDetectorDefs::fileFormat DetectorPythonInterface::file///
|
||||
|
||||
slsDetectorDefs::dacIndex DetectorPythonInterface::dacNameToEnum(std::string dac_name) {
|
||||
// to avoid uninitialised
|
||||
slsDetectorDefs::dacIndex dac = slsDetectorDefs::dacIndex::E_SvP;
|
||||
|
||||
if (dac_name == "vsvp") {
|
||||
dac = slsDetectorDefs::dacIndex::E_SvP;
|
||||
} else if (dac_name == "vtr") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vtr;
|
||||
} else if (dac_name == "vthreshold") {
|
||||
dac = slsDetectorDefs::dacIndex::THRESHOLD;
|
||||
} else if (dac_name == "vrf") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vrf;
|
||||
} else if (dac_name == "vrs") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vrs;
|
||||
} else if (dac_name == "vsvn") {
|
||||
dac = slsDetectorDefs::dacIndex::E_SvN;
|
||||
} else if (dac_name == "vtgstv") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vtgstv;
|
||||
} else if (dac_name == "vcmp_ll") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vcmp_ll;
|
||||
} else if (dac_name == "vcmp_lr") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vcmp_lr;
|
||||
} else if (dac_name == "vcall") {
|
||||
dac = slsDetectorDefs::dacIndex::E_cal;
|
||||
} else if (dac_name == "vcmp_rl") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vcmp_rl;
|
||||
} else if (dac_name == "rxb_rb") {
|
||||
dac = slsDetectorDefs::dacIndex::E_rxb_rb;
|
||||
} else if (dac_name == "rxb_lb") {
|
||||
dac = slsDetectorDefs::dacIndex::E_rxb_lb;
|
||||
} else if (dac_name == "vcmp_rr") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vcmp_rr;
|
||||
} else if (dac_name == "vcp") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vcp;
|
||||
} else if (dac_name == "vcn") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vcn;
|
||||
} else if (dac_name == "vis") {
|
||||
dac = slsDetectorDefs::dacIndex::E_Vis;
|
||||
} else if (dac_name == "iodelay") {
|
||||
dac = slsDetectorDefs::dacIndex::IO_DELAY;
|
||||
} else if (dac_name == "v_a") {
|
||||
dac = slsDetectorDefs::dacIndex::V_POWER_A;
|
||||
} else if (dac_name == "v_b") {
|
||||
dac = slsDetectorDefs::dacIndex::V_POWER_B;
|
||||
} else if (dac_name == "v_c") {
|
||||
dac = slsDetectorDefs::dacIndex::V_POWER_C;
|
||||
} else if (dac_name == "v_d") {
|
||||
dac = slsDetectorDefs::dacIndex::V_POWER_D;
|
||||
} else if (dac_name == "v_io") {
|
||||
dac = slsDetectorDefs::dacIndex::V_POWER_IO;
|
||||
} else if (dac_name == "v_chip") {
|
||||
dac = slsDetectorDefs::dacIndex::V_POWER_CHIP;
|
||||
} else if (dac_name == "v_limit") {
|
||||
dac = slsDetectorDefs::dacIndex::V_LIMIT;
|
||||
} else if (dac_name == "temp_fpga") {
|
||||
dac = slsDetectorDefs::dacIndex::TEMPERATURE_FPGA;
|
||||
} else if (dac_name == "temp_fpgaext") {
|
||||
dac = slsDetectorDefs::dacIndex::TEMPERATURE_FPGAEXT;
|
||||
} else if (dac_name == "temp_10ge") {
|
||||
dac = slsDetectorDefs::dacIndex::TEMPERATURE_10GE;
|
||||
} else if (dac_name == "temp_dcdc") {
|
||||
dac = slsDetectorDefs::dacIndex::TEMPERATURE_DCDC;
|
||||
} else if (dac_name == "temp_sodl") {
|
||||
dac = slsDetectorDefs::dacIndex::TEMPERATURE_SODL;
|
||||
} else if (dac_name == "temp_sodr") {
|
||||
dac = slsDetectorDefs::dacIndex::TEMPERATURE_SODR;
|
||||
} else if (dac_name == "temp_fpgafl") {
|
||||
dac = slsDetectorDefs::dacIndex::TEMPERATURE_FPGA2;
|
||||
} else if (dac_name == "temp_fpgafr") {
|
||||
dac = slsDetectorDefs::dacIndex::TEMPERATURE_FPGA3;
|
||||
} else if (dac_name == "vhighvoltage") {
|
||||
dac = slsDetectorDefs::dacIndex::HIGH_VOLTAGE;
|
||||
} else if (dac_name == "vb_comp") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(0);
|
||||
} else if (dac_name == "vdd_prot") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(1);
|
||||
} else if (dac_name == "vin_com") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(2);
|
||||
} else if (dac_name == "vref_prech") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(3);
|
||||
} else if (dac_name == "vb_pixbuff") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(4);
|
||||
} else if (dac_name == "vb_ds") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(5);
|
||||
} else if (dac_name == "vref_ds") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(6);
|
||||
} else if (dac_name == "vref_comp") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(7);
|
||||
} else if (dac_name == "dac0") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(0);
|
||||
} else if (dac_name == "dac1") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(1);
|
||||
} else if (dac_name == "dac2") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(2);
|
||||
} else if (dac_name == "dac3") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(3);
|
||||
} else if (dac_name == "dac4") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(4);
|
||||
} else if (dac_name == "dac5") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(5);
|
||||
} else if (dac_name == "dac6") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(6);
|
||||
} else if (dac_name == "dac7") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(7);
|
||||
} else if (dac_name == "dac8") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(8);
|
||||
} else if (dac_name == "dac9") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(9);
|
||||
} else if (dac_name == "dac10") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(10);
|
||||
} else if (dac_name == "dac11") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(11);
|
||||
} else if (dac_name == "dac12") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(12);
|
||||
} else if (dac_name == "dac13") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(13);
|
||||
} else if (dac_name == "dac14") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(14);
|
||||
} else if (dac_name == "dac15") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(15);
|
||||
} else if (dac_name == "dac16") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(16);
|
||||
} else if (dac_name == "dac17") {
|
||||
dac = static_cast<slsDetectorDefs::dacIndex>(17);
|
||||
}
|
||||
|
||||
return dac;
|
||||
}
|
||||
|
||||
// enum readOutFlags {
|
||||
// GET_READOUT_FLAGS = -1, /**< return readout flags */
|
||||
// NORMAL_READOUT = 0, /**< no flag */
|
||||
// STORE_IN_RAM = 0x1, /**< data are stored in ram and sent only after end
|
||||
// of acquisition for faster frame rate */
|
||||
// READ_HITS = 0x2, /**< return only the number of the channel which
|
||||
// counted ate least one */
|
||||
// ZERO_COMPRESSION = 0x4, /**< returned data are 0-compressed */
|
||||
// PUMP_PROBE_MODE = 0x8, /**<pump-probe mode */
|
||||
// BACKGROUND_CORRECTIONS = 0x1000, /**<background corrections */
|
||||
// TOT_MODE = 0x2000, /**< pump-probe mode */
|
||||
// CONTINOUS_RO = 0x4000, /**< pump-probe mode */
|
||||
// PARALLEL = 0x10000, /**< eiger parallel mode */
|
||||
// NONPARALLEL = 0x20000, /**< eiger serial mode */
|
||||
// DIGITAL_ONLY = 0x80000, /** chiptest board read only digital bits (not
|
||||
// adc values)*/
|
||||
// ANALOG_AND_DIGITAL = 0x100000, /** chiptest board read adc values and
|
||||
// digital bits digital bits */
|
||||
// DUT_CLK = 0x200000, /** chiptest board fifo clock comes from device
|
||||
// under test */
|
||||
// SHOW_OVERFLOW = 0x400000, /** eiger 32 bit mode, show saturated for
|
||||
// overflow of single subframes */
|
||||
// NOOVERFLOW = 0x800000 /** eiger 32 bit mode, do not show saturated for
|
||||
// overflow of single subframes */
|
||||
// };
|
||||
|
||||
// std::vector<std::string> DetectorPythonInterface::getReadoutFlags() {
|
||||
// std::vector<std::string> flags;
|
||||
// auto r = det.setReadOutFlags();
|
||||
// if (r & slsDetectorDefs::readOutFlags::STORE_IN_RAM)
|
||||
// flags.push_back("storeinram");
|
||||
// if (r & slsDetectorDefs::readOutFlags::READ_HITS)
|
||||
// flags.push_back("readhits");
|
||||
// if (r & slsDetectorDefs::readOutFlags::ZERO_COMPRESSION)
|
||||
// flags.push_back("zerocompression");
|
||||
// if (r & slsDetectorDefs::readOutFlags::PUMP_PROBE_MODE)
|
||||
// flags.push_back("pumpprobe");
|
||||
// if (r & slsDetectorDefs::readOutFlags::BACKGROUND_CORRECTIONS)
|
||||
// flags.push_back("backgroundcorrections");
|
||||
// if (r & slsDetectorDefs::readOutFlags::TOT_MODE)
|
||||
// flags.push_back("tot");
|
||||
// if (r & slsDetectorDefs::readOutFlags::CONTINOUS_RO)
|
||||
// flags.push_back("continous");
|
||||
// if (r & slsDetectorDefs::readOutFlags::PARALLEL)
|
||||
// flags.push_back("parallel");
|
||||
// if (r & slsDetectorDefs::readOutFlags::NONPARALLEL)
|
||||
// flags.push_back("nonparallel");
|
||||
// if (r & slsDetectorDefs::readOutFlags::DIGITAL_ONLY)
|
||||
// flags.push_back("digital");
|
||||
// if (r & slsDetectorDefs::readOutFlags::ANALOG_AND_DIGITAL)
|
||||
// flags.push_back("analog_digital");
|
||||
// if (r & slsDetectorDefs::readOutFlags::DUT_CLK)
|
||||
// flags.push_back("dutclk");
|
||||
// if (r & slsDetectorDefs::readOutFlags::NOOVERFLOW)
|
||||
// flags.push_back("nooverflow");
|
||||
// if (r & slsDetectorDefs::readOutFlags::SHOW_OVERFLOW)
|
||||
// flags.push_back("overflow");
|
||||
// return flags;
|
||||
// }
|
||||
|
||||
// // note singular
|
||||
// void DetectorPythonInterface::setReadoutFlag(const std::string flag_name) {
|
||||
// if (flag_name == "none")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::NORMAL_READOUT);
|
||||
// else if (flag_name == "storeinram")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::STORE_IN_RAM);
|
||||
// else if (flag_name == "readhits")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::READ_HITS);
|
||||
// else if (flag_name == "zerocompression")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::ZERO_COMPRESSION);
|
||||
// else if (flag_name == "pumpprobe")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::PUMP_PROBE_MODE);
|
||||
// else if (flag_name == "backgroundcorrections")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::BACKGROUND_CORRECTIONS);
|
||||
// else if (flag_name == "tot")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::TOT_MODE);
|
||||
// else if (flag_name == "continous")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::CONTINOUS_RO);
|
||||
// else if (flag_name == "parallel")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::PARALLEL);
|
||||
// else if (flag_name == "nonparallel")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::NONPARALLEL);
|
||||
// else if (flag_name == "digital")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::DIGITAL_ONLY);
|
||||
// else if (flag_name == "analog_digital")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::ANALOG_AND_DIGITAL);
|
||||
// else if (flag_name == "dutclk")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::DUT_CLK);
|
||||
// else if (flag_name == "nooverflow")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::NOOVERFLOW);
|
||||
// else if (flag_name == "overflow")
|
||||
// det.setReadOutFlags(slsDetectorDefs::readOutFlags::SHOW_OVERFLOW);
|
||||
// else
|
||||
// throw std::runtime_error("Flag name not recognized");
|
||||
// }
|
||||
|
||||
std::vector<double> DetectorPythonInterface::getRateCorrection() {
|
||||
std::vector<double> rate_corr;
|
||||
for (size_t i = 0; i < det.size(); ++i) {
|
||||
rate_corr.push_back(det.getRateCorrection(i));
|
||||
}
|
||||
return rate_corr;
|
||||
}
|
||||
|
||||
void DetectorPythonInterface::pulseAllPixels(int n) {
|
||||
// int pulsePixelNMove(int n=0,int x=0,int y=0);
|
||||
// int pulsePixel(int n=0,int x=0,int y=0);
|
||||
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
det.pulsePixel(0, -255 + j, 0);
|
||||
for (int i = 0; i < 256; ++i) {
|
||||
det.pulsePixelNMove(n, 0, 1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
void DetectorPythonInterface::pulseDiagonal(int n) {
|
||||
// int pulsePixelNMove(int n=0,int x=0,int y=0);
|
||||
// int pulsePixel(int n=0,int x=0,int y=0);
|
||||
|
||||
for (int j = 20; j < 232; j += 16) {
|
||||
det.pulsePixel(0, -255, j);
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
det.pulsePixelNMove(n, 1, 1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#endif // DETECTOR_H
|
@ -10,7 +10,7 @@ namespace py = pybind11;
|
||||
void init_enums(py::module &m) {
|
||||
py::class_<slsDetectorDefs> Defs(m, "slsDetectorDefs");
|
||||
py::class_<slsDetectorDefs::xy> xy(m, "xy");
|
||||
xy.def(py::init());
|
||||
xy.def(py::init());
|
||||
xy.def(py::init<int,int>());
|
||||
xy.def_readwrite("x", &slsDetectorDefs::xy::x);
|
||||
xy.def_readwrite("y", &slsDetectorDefs::xy::y);
|
||||
@ -32,7 +32,7 @@ py::enum_<slsDetectorDefs::timerIndex>(Defs, "timerIndex")
|
||||
.value("ACQUISITION_TIME", slsDetectorDefs::timerIndex::ACQUISITION_TIME)
|
||||
.value("FRAME_PERIOD", slsDetectorDefs::timerIndex::FRAME_PERIOD)
|
||||
.value("DELAY_AFTER_TRIGGER", slsDetectorDefs::timerIndex::DELAY_AFTER_TRIGGER)
|
||||
.value("CYCLES_NUMBER", slsDetectorDefs::timerIndex::CYCLES_NUMBER)
|
||||
.value("TRIGGER_NUMBER", slsDetectorDefs::timerIndex::TRIGGER_NUMBER)
|
||||
.value("ACTUAL_TIME", slsDetectorDefs::timerIndex::ACTUAL_TIME)
|
||||
.value("MEASUREMENT_TIME", slsDetectorDefs::timerIndex::MEASUREMENT_TIME)
|
||||
.value("PROGRESS", slsDetectorDefs::timerIndex::PROGRESS)
|
||||
@ -217,6 +217,20 @@ py::enum_<slsDetectorDefs::dacIndex>(Defs, "dacIndex")
|
||||
.value("M_cas", slsDetectorDefs::dacIndex::M_cas)
|
||||
.value("M_vIcin", slsDetectorDefs::dacIndex::M_vIcin)
|
||||
.value("M_vIpreOut", slsDetectorDefs::dacIndex::M_vIpreOut)
|
||||
.value("VREF_H_ADC", slsDetectorDefs::dacIndex::VREF_H_ADC)
|
||||
.value("VB_COMP_FE", slsDetectorDefs::dacIndex::VB_COMP_FE)
|
||||
.value("VB_COMP_ADC", slsDetectorDefs::dacIndex::VB_COMP_ADC)
|
||||
.value("VCOM_CDS", slsDetectorDefs::dacIndex::VCOM_CDS)
|
||||
.value("VREF_RESTORE", slsDetectorDefs::dacIndex::VREF_RESTORE)
|
||||
.value("VB_OPA_1ST", slsDetectorDefs::dacIndex::VB_OPA_1ST)
|
||||
.value("VREF_COMP_FE", slsDetectorDefs::dacIndex::VREF_COMP_FE)
|
||||
.value("VCOM_ADC1", slsDetectorDefs::dacIndex::VCOM_ADC1)
|
||||
.value("VREF_PRECH", slsDetectorDefs::dacIndex::VREF_PRECH)
|
||||
.value("VREF_L_ADC", slsDetectorDefs::dacIndex::VREF_L_ADC)
|
||||
.value("VREF_CDS", slsDetectorDefs::dacIndex::VREF_CDS)
|
||||
.value("VB_CS", slsDetectorDefs::dacIndex::VB_CS)
|
||||
.value("VB_OPA_FD", slsDetectorDefs::dacIndex::VB_OPA_FD)
|
||||
.value("VCOM_ADC2", slsDetectorDefs::dacIndex::VCOM_ADC2)
|
||||
.value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A)
|
||||
.value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B)
|
||||
.value("V_POWER_C", slsDetectorDefs::dacIndex::V_POWER_C)
|
||||
|
@ -99,8 +99,10 @@ void init_experimental(py::module &m) {
|
||||
|
||||
// ACQUISITION
|
||||
.def("acquire", &Detector::acquire)
|
||||
.def("startAcquisition", &Detector::startAcquisition)
|
||||
.def("stopAcquisition", &Detector::stopAcquisition)
|
||||
.def("startDetector", &Detector::startDetector)
|
||||
.def("stopDetector", &Detector::stopDetector)
|
||||
.def("startReceiver", &Detector::startReceiver)
|
||||
.def("stopReceiver", &Detector::stopReceiver)
|
||||
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
||||
.def("getDetectorStatus", &Detector::getDetectorStatus,
|
||||
py::arg() = Positions{})
|
||||
@ -412,11 +414,11 @@ void init_experimental(py::module &m) {
|
||||
.def("setThresholdEnergy", &Detector::setThresholdEnergy, py::arg(),
|
||||
py::arg() = defs::STANDARD, py::arg() = true,
|
||||
py::arg() = Positions{})
|
||||
.def("getSettingsDir", &Detector::getSettingsDir,
|
||||
.def("getSettingsPath", &Detector::getSettingsPath,
|
||||
py::arg() = Positions{})
|
||||
.def("setSettingsDir", &Detector::setSettingsDir, py::arg(),
|
||||
.def("setSettingsPath", &Detector::setSettingsPath, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("loadTrimbits", &Detector::setSettingsDir, py::arg(),
|
||||
.def("loadTrimbits", &Detector::loadTrimbits, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRxAddGapPixels", &Detector::getRxAddGapPixels,
|
||||
py::arg() = Positions{})
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "Detector.h"
|
||||
#include "DetectorPythonInterface.h"
|
||||
#include "Result.h"
|
||||
#include "mythenFileIO.h"
|
||||
#include <chrono>
|
||||
@ -12,14 +11,6 @@
|
||||
|
||||
#include "typecaster.h"
|
||||
|
||||
// // Add type_typecaster to pybind for our wrapper type
|
||||
// namespace pybind11 {
|
||||
// namespace detail {
|
||||
// template <typename Type, typename Alloc>
|
||||
// struct type_caster<sls::Result<Type, Alloc>>
|
||||
// : list_caster<sls::Result<Type, Alloc>, Type> {};
|
||||
// } // namespace detail
|
||||
// } // namespace pybind11
|
||||
|
||||
using ds = std::chrono::duration<double>;
|
||||
|
||||
@ -39,303 +30,6 @@ PYBIND11_MODULE(_sls_detector, m) {
|
||||
|
||||
init_enums(m);
|
||||
init_experimental(m);
|
||||
|
||||
py::class_<DetectorPythonInterface> DetectorApi(m, "DetectorApi", R"pbdoc(
|
||||
Interface to the multiSlsDetector class through Detector.h These functions
|
||||
are used by the python classes Eiger and Jungfrau and normally it is better
|
||||
to use them than to directly access functions here.
|
||||
|
||||
However it is possible to access these functions...
|
||||
|
||||
::
|
||||
|
||||
#Using the python class
|
||||
from sls_detector import Eiger
|
||||
d = Eiger()
|
||||
d._api.getThresholdEnergy()
|
||||
|
||||
from _sls_detector import DetectorApi
|
||||
api = DetectorApi(0)
|
||||
api.getNumberOfFrames()
|
||||
|
||||
#But the Pythonic way is almost alway simpler
|
||||
d = Eiger()
|
||||
d.n_frames
|
||||
>> 10
|
||||
|
||||
)pbdoc");
|
||||
DetectorApi.def(py::init<int>())
|
||||
.def("freeSharedMemory", &DetectorPythonInterface::freeSharedMemory)
|
||||
.def("getMultiDetectorId", &DetectorPythonInterface::getMultiDetectorId)
|
||||
.def("acq", &DetectorPythonInterface::acquire)
|
||||
.def("getAcquiringFlag", &DetectorPythonInterface::getAcquiringFlag)
|
||||
.def("setAcquiringFlag", &DetectorPythonInterface::setAcquiringFlag)
|
||||
|
||||
.def("setAllTrimbits", &DetectorPythonInterface::setAllTrimbits)
|
||||
.def("getAllTrimbits", &DetectorPythonInterface::getAllTrimbits)
|
||||
.def("setCounterBit", &DetectorPythonInterface::setCounterBit)
|
||||
.def("getCounterBit", &DetectorPythonInterface::getCounterBit)
|
||||
|
||||
.def("getAdc", &DetectorPythonInterface::getAdc)
|
||||
.def("getDac", &DetectorPythonInterface::getDac)
|
||||
.def("getDac_mV", &DetectorPythonInterface::getDac_mV)
|
||||
.def("setDac", &DetectorPythonInterface::setDac)
|
||||
.def("setDac_mV", &DetectorPythonInterface::setDac_mV)
|
||||
.def("getDacFromIndex", &DetectorPythonInterface::getDacFromIndex)
|
||||
.def("setDacFromIndex", &DetectorPythonInterface::setDacFromIndex)
|
||||
|
||||
.def("getDbitPipeline", &DetectorPythonInterface::getDbitPipeline)
|
||||
.def("setDbitPipeline", &DetectorPythonInterface::setDbitPipeline)
|
||||
.def("getDbitPhase", &DetectorPythonInterface::getDbitPhase)
|
||||
.def("setDbitPhase", &DetectorPythonInterface::setDbitPhase)
|
||||
.def("getDbitClock", &DetectorPythonInterface::getDbitClock)
|
||||
.def("setDbitClock", &DetectorPythonInterface::setDbitClock)
|
||||
|
||||
.def("setThresholdEnergy", &DetectorPythonInterface::setThresholdEnergy)
|
||||
.def("getThresholdEnergy", &DetectorPythonInterface::getThresholdEnergy)
|
||||
|
||||
.def("getSettings", &DetectorPythonInterface::getSettings)
|
||||
.def("setSettings", &DetectorPythonInterface::setSettings)
|
||||
.def("getSettingsDir", &DetectorPythonInterface::getSettingsDir)
|
||||
.def("setSettingsDir", &DetectorPythonInterface::setSettingsDir)
|
||||
|
||||
.def("loadTrimbitFile", &DetectorPythonInterface::loadTrimbitFile)
|
||||
.def("setTrimEnergies", &DetectorPythonInterface::setTrimEnergies)
|
||||
.def("getTrimEnergies", &DetectorPythonInterface::getTrimEnergies)
|
||||
|
||||
.def("pulseChip", &DetectorPythonInterface::pulseChip)
|
||||
.def("pulseAllPixels", &DetectorPythonInterface::pulseAllPixels)
|
||||
.def("pulseDiagonal", &DetectorPythonInterface::pulseDiagonal)
|
||||
.def("getRunStatus", &DetectorPythonInterface::getRunStatus)
|
||||
.def("readConfigurationFile",
|
||||
&DetectorPythonInterface::readConfigurationFile)
|
||||
.def("readParametersFile", &DetectorPythonInterface::readParametersFile)
|
||||
// .def("checkOnline", &DetectorPythonInterface::checkOnline)
|
||||
.def("setReadoutClockSpeed",
|
||||
&DetectorPythonInterface::setReadoutClockSpeed)
|
||||
.def("getReadoutClockSpeed",
|
||||
&DetectorPythonInterface::getReadoutClockSpeed)
|
||||
.def("getSyncClkSpeed", &DetectorPythonInterface::getSyncClkSpeed)
|
||||
.def("getHostname", &DetectorPythonInterface::getHostname)
|
||||
.def("setHostname", &DetectorPythonInterface::setHostname)
|
||||
|
||||
.def("getReceiverPort", &DetectorPythonInterface::getReceiverPort)
|
||||
.def("setReceiverPort", &DetectorPythonInterface::setReceiverPort)
|
||||
|
||||
.def("isChipPowered", &DetectorPythonInterface::isChipPowered)
|
||||
.def("powerChip", &DetectorPythonInterface::powerChip)
|
||||
|
||||
.def("readRegister", &DetectorPythonInterface::readRegister)
|
||||
.def("writeRegister", &DetectorPythonInterface::writeRegister)
|
||||
.def("writeAdcRegister", &DetectorPythonInterface::writeAdcRegister)
|
||||
.def("setBitInRegister", &DetectorPythonInterface::setBitInRegister)
|
||||
.def("clearBitInRegister", &DetectorPythonInterface::clearBitInRegister)
|
||||
|
||||
.def("setDynamicRange", &DetectorPythonInterface::setDynamicRange)
|
||||
.def("getDynamicRange", &DetectorPythonInterface::getDynamicRange)
|
||||
.def("getFirmwareVersion", &DetectorPythonInterface::getFirmwareVersion)
|
||||
.def("getServerVersion", &DetectorPythonInterface::getServerVersion)
|
||||
.def("getClientVersion", &DetectorPythonInterface::getClientVersion)
|
||||
.def("getReceiverVersion", &DetectorPythonInterface::getReceiverVersion)
|
||||
.def("getDetectorNumber", &DetectorPythonInterface::getDetectorNumber)
|
||||
.def("getRateCorrection", &DetectorPythonInterface::getRateCorrection)
|
||||
.def("setRateCorrection", &DetectorPythonInterface::setRateCorrection)
|
||||
|
||||
.def("startAcquisition", &DetectorPythonInterface::startAcquisition)
|
||||
.def("stopAcquisition", &DetectorPythonInterface::stopAcquisition)
|
||||
.def("startReceiver", &DetectorPythonInterface::startReceiver)
|
||||
.def("stopReceiver", &DetectorPythonInterface::stopReceiver)
|
||||
|
||||
.def("getFilePath",
|
||||
(std::string(DetectorPythonInterface::*)()) &
|
||||
DetectorPythonInterface::getFilePath,
|
||||
"Using multiSlsDetector")
|
||||
.def("getFilePath",
|
||||
(std::string(DetectorPythonInterface::*)(int)) &
|
||||
DetectorPythonInterface::getFilePath,
|
||||
"File path for individual detector")
|
||||
.def("setFilePath", (void (DetectorPythonInterface::*)(std::string)) &
|
||||
DetectorPythonInterface::setFilePath)
|
||||
|
||||
.def("setFileName", &DetectorPythonInterface::setFileName)
|
||||
.def("getFileName", &DetectorPythonInterface::getFileName)
|
||||
.def("setFileIndex", &DetectorPythonInterface::setFileIndex)
|
||||
.def("getFileIndex", &DetectorPythonInterface::getFileIndex)
|
||||
.def("getNumberOfDetectors", &DetectorPythonInterface::getNumberOfDetectors)
|
||||
|
||||
.def("setExposureTime", &DetectorPythonInterface::setExposureTime)
|
||||
.def("getExposureTime", &DetectorPythonInterface::getExposureTime)
|
||||
.def("setSubExposureTime", &DetectorPythonInterface::setSubExposureTime)
|
||||
.def("getSubExposureTime", &DetectorPythonInterface::getSubExposureTime)
|
||||
.def("setPeriod", &DetectorPythonInterface::setPeriod)
|
||||
.def("getPeriod", &DetectorPythonInterface::getPeriod)
|
||||
.def("setSubExposureDeadTime", &DetectorPythonInterface::setSubExposureDeadTime)
|
||||
.def("getSubExposureDeadTime", &DetectorPythonInterface::getSubExposureDeadTime)
|
||||
|
||||
.def("getCycles", &DetectorPythonInterface::getCycles)
|
||||
.def("setCycles", &DetectorPythonInterface::setCycles)
|
||||
// .def("getNumberOfGates", &DetectorPythonInterface::getNumberOfGates)
|
||||
// .def("setNumberOfGates", &DetectorPythonInterface::setNumberOfGates)
|
||||
.def("getDelay", &DetectorPythonInterface::getDelay)
|
||||
.def("setDelay", &DetectorPythonInterface::setDelay)
|
||||
|
||||
.def("setStoragecellStart", &DetectorPythonInterface::setStoragecellStart)
|
||||
.def("getStoragecellStart", &DetectorPythonInterface::getStoragecellStart)
|
||||
.def("setNumberOfStorageCells", &DetectorPythonInterface::setNumberOfStorageCells)
|
||||
.def("getNumberOfStorageCells", &DetectorPythonInterface::getNumberOfStorageCells)
|
||||
|
||||
// .def("getTimingMode", &DetectorPythonInterface::getTimingMode)
|
||||
// .def("setTimingMode", &DetectorPythonInterface::setTimingMode)
|
||||
|
||||
.def("getDetectorType", &DetectorPythonInterface::getDetectorType)
|
||||
|
||||
.def("setThresholdTemperature", &DetectorPythonInterface::setThresholdTemperature)
|
||||
.def("getThresholdTemperature", &DetectorPythonInterface::getThresholdTemperature)
|
||||
.def("setTemperatureControl", &DetectorPythonInterface::setTemperatureControl)
|
||||
.def("getTemperatureControl", &DetectorPythonInterface::getTemperatureControl)
|
||||
.def("getTemperatureEvent", &DetectorPythonInterface::getTemperatureEvent)
|
||||
.def("resetTemperatureEvent", &DetectorPythonInterface::resetTemperatureEvent)
|
||||
|
||||
.def("getRxDataStreamStatus", &DetectorPythonInterface::getRxDataStreamStatus)
|
||||
.def("setRxDataStreamStatus", &DetectorPythonInterface::setRxDataStreamStatus)
|
||||
|
||||
// Network stuff
|
||||
.def("getReceiverHostname",
|
||||
&DetectorPythonInterface::getReceiverHostname,
|
||||
py::arg("det_id") = -1)
|
||||
.def("setReceiverHostname",
|
||||
&DetectorPythonInterface::setReceiverHostname, py::arg("hostname"),
|
||||
py::arg("det_id") = -1)
|
||||
.def("getReceiverStreamingPort",
|
||||
&DetectorPythonInterface::getReceiverStreamingPort)
|
||||
.def("setReceiverStreamingPort",
|
||||
&DetectorPythonInterface::setReceiverStreamingPort)
|
||||
// .def("getReceiverUDPPort", &DetectorPythonInterface::getReceiverUDPPort)
|
||||
// .def("getReceiverUDPPort2",
|
||||
// &DetectorPythonInterface::getReceiverUDPPort2)
|
||||
// .def("setReceiverUDPPort", &DetectorPythonInterface::setReceiverUDPPort)
|
||||
// .def("setReceiverUDPPort2",
|
||||
// &DetectorPythonInterface::setReceiverUDPPort2)
|
||||
// .def("setReceiverUDPIP", &DetectorPythonInterface::setReceiverUDPIP)
|
||||
// .def("getReceiverUDPIP", &DetectorPythonInterface::getReceiverUDPIP)
|
||||
// .def("getReceiverUDPMAC", &DetectorPythonInterface::getReceiverUDPMAC)
|
||||
// .def("setReceiverUDPMAC", &DetectorPythonInterface::setReceiverUDPMAC)
|
||||
|
||||
.def("getReceiverPort", &DetectorPythonInterface::getReceiverPort)
|
||||
.def("setReceiverPort", &DetectorPythonInterface::setReceiverPort)
|
||||
|
||||
.def("getDelayFrame", &DetectorPythonInterface::getDelayFrame)
|
||||
.def("setDelayFrame", &DetectorPythonInterface::setDelayFrame)
|
||||
.def("getDelayLeft", &DetectorPythonInterface::getDelayLeft)
|
||||
.def("setDelayLeft", &DetectorPythonInterface::setDelayLeft)
|
||||
.def("getDelayRight", &DetectorPythonInterface::getDelayRight)
|
||||
.def("setDelayRight", &DetectorPythonInterface::setDelayRight)
|
||||
.def("getLastClientIP", &DetectorPythonInterface::getLastClientIP)
|
||||
.def("getReceiverLastClientIP",
|
||||
&DetectorPythonInterface::getReceiverLastClientIP)
|
||||
|
||||
.def("setFramesPerFile", &DetectorPythonInterface::setFramesPerFile)
|
||||
.def("getFramesPerFile", &DetectorPythonInterface::getFramesPerFile)
|
||||
.def("setReceiverFifoDepth",
|
||||
&DetectorPythonInterface::setReceiverFifoDepth)
|
||||
.def("getReceiverFifoDepth",
|
||||
&DetectorPythonInterface::getReceiverFifoDepth)
|
||||
|
||||
.def("getReceiverFrameDiscardPolicy",
|
||||
&DetectorPythonInterface::getReceiverFrameDiscardPolicy)
|
||||
.def("setReceiverFramesDiscardPolicy",
|
||||
&DetectorPythonInterface::setReceiverFramesDiscardPolicy)
|
||||
.def("setPartialFramesPadding",
|
||||
&DetectorPythonInterface::setPartialFramesPadding)
|
||||
.def("getPartialFramesPadding",
|
||||
&DetectorPythonInterface::getPartialFramesPadding)
|
||||
|
||||
.def("getUserDetails", &DetectorPythonInterface::getUserDetails)
|
||||
.def("checkDetectorVersionCompatibility",
|
||||
&DetectorPythonInterface::checkDetectorVersionCompatibility)
|
||||
.def("checkReceiverVersionCompatibility",
|
||||
&DetectorPythonInterface::checkReceiverVersionCompatibility)
|
||||
.def("getMeasuredPeriod", &DetectorPythonInterface::getMeasuredPeriod)
|
||||
.def("getMeasuredSubPeriod",
|
||||
&DetectorPythonInterface::getMeasuredSubPeriod)
|
||||
|
||||
.def("setFileWrite", &DetectorPythonInterface::setFileWrite)
|
||||
.def("getFileWrite", &DetectorPythonInterface::getFileWrite)
|
||||
.def("setFileOverWrite", &DetectorPythonInterface::setFileOverWrite)
|
||||
.def("getFileOverWrite", &DetectorPythonInterface::getFileOverWrite)
|
||||
.def("getDacVthreshold", &DetectorPythonInterface::getDacVthreshold)
|
||||
.def("setDacVthreshold", &DetectorPythonInterface::setDacVthreshold)
|
||||
.def("setNumberOfFrames", &DetectorPythonInterface::setNumberOfFrames)
|
||||
.def("getNumberOfFrames", &DetectorPythonInterface::getNumberOfFrames)
|
||||
|
||||
// Overloaded calls
|
||||
.def("getFramesCaughtByReceiver",
|
||||
(int (DetectorPythonInterface::*)()) &
|
||||
DetectorPythonInterface::getFramesCaughtByReceiver)
|
||||
.def("getFramesCaughtByReceiver",
|
||||
(int (DetectorPythonInterface::*)(int)) &
|
||||
DetectorPythonInterface::getFramesCaughtByReceiver)
|
||||
|
||||
.def("resetFramesCaught", &DetectorPythonInterface::resetFramesCaught)
|
||||
.def("getReceiverCurrentFrameIndex",
|
||||
&DetectorPythonInterface::getReceiverCurrentFrameIndex)
|
||||
.def("getGapPixels", &DetectorPythonInterface::getGapPixels)
|
||||
.def("setGapPixels", &DetectorPythonInterface::setGapPixels)
|
||||
.def("getFlippedDataX", &DetectorPythonInterface::getFlippedDataX)
|
||||
// .def("getFlippedDataY", &DetectorPythonInterface::getFlippedDataY)
|
||||
.def("setFlippedDataX", &DetectorPythonInterface::setFlippedDataX)
|
||||
// .def("setFlippedDataY", &DetectorPythonInterface::setFlippedDataY)
|
||||
|
||||
.def("getServerLock", &DetectorPythonInterface::getServerLock)
|
||||
.def("setServerLock", &DetectorPythonInterface::setServerLock)
|
||||
.def("getReceiverLock", &DetectorPythonInterface::getReceiverLock)
|
||||
.def("setReceiverLock", &DetectorPythonInterface::setReceiverLock)
|
||||
|
||||
// .def("getReadoutFlags", &DetectorPythonInterface::getReadoutFlags)
|
||||
// .def("setReadoutFlag", &DetectorPythonInterface::setReadoutFlag)
|
||||
|
||||
.def("setFileFormat", &DetectorPythonInterface::setFileFormat)
|
||||
.def("getFileFormat", &DetectorPythonInterface::getFileFormat)
|
||||
|
||||
.def("getActive", &DetectorPythonInterface::getActive)
|
||||
.def("setActive", &DetectorPythonInterface::setActive)
|
||||
|
||||
.def("getTenGigabitEthernet",
|
||||
&DetectorPythonInterface::getTenGigabitEthernet)
|
||||
.def("setTenGigabitEthernet",
|
||||
&DetectorPythonInterface::setTenGigabitEthernet)
|
||||
|
||||
.def("getPatternLoops", &DetectorPythonInterface::getPatternLoops,
|
||||
py::arg("level"), py::arg("det_id") = -1)
|
||||
.def("setPatternLoops", &DetectorPythonInterface::setPatternLoops,
|
||||
py::arg("level"), py::arg("start"), py::arg("stop"), py::arg("n"),
|
||||
py::arg("det_id") = -1)
|
||||
.def("setPatternWord", &DetectorPythonInterface::setPatternWord,
|
||||
py::arg("addr"), py::arg("word"), py::arg("det_id") = -1)
|
||||
.def("getPatternWord", &DetectorPythonInterface::getPatternWord,
|
||||
py::arg("addr"), py::arg("det_id") = -1)
|
||||
|
||||
.def("setPatternIOControl",
|
||||
&DetectorPythonInterface::setPatternIOControl, py::arg("word"),
|
||||
py::arg("det_id") = -1)
|
||||
.def("setPatternClockControl",
|
||||
&DetectorPythonInterface::setPatternClockControl, py::arg("word"),
|
||||
py::arg("det_id") = -1)
|
||||
|
||||
.def("setPatternWaitAddr", &DetectorPythonInterface::setPatternWaitAddr,
|
||||
py::arg("level"), py::arg("addr"), py::arg("det_id") = -1)
|
||||
.def("getPatternWaitAddr", &DetectorPythonInterface::getPatternWaitAddr,
|
||||
py::arg("level"), py::arg("det_id") = -1)
|
||||
|
||||
.def("setPatternWaitTime", &DetectorPythonInterface::setPatternWaitTime,
|
||||
py::arg("level"), py::arg("duration"), py::arg("det_id") = -1)
|
||||
|
||||
.def("getPatternWaitTime", &DetectorPythonInterface::getPatternWaitTime,
|
||||
py::arg("level"), py::arg("det_id") = -1);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
py::module io = m.def_submodule("io", "Submodule for io");
|
||||
|
@ -1072,7 +1072,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #cycles * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #triggers * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Storage cells:</string>
|
||||
@ -1129,7 +1129,7 @@
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #cycles * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
<string><html><head/><body><p>Number of additional storage cells. For Jungfrau only. </p><p>Default: 0. </p><p>Number of Images received: #frames * #triggers * (#storagecells+1) </p><p> #storagecells#</p><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
|
@ -438,8 +438,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#cycles#</string>
|
||||
<string><html><head/><body><p>Number of Triggers to be expected.</p><p> #triggers#</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Triggers:</string>
|
||||
@ -534,7 +533,7 @@ Frame period between exposures.
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#cycles#</string>
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
@ -620,7 +619,7 @@ Frame period between exposures.
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#cycles#</string>
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of Samples:</string>
|
||||
@ -700,7 +699,7 @@ Frame period between exposures.
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Number of Triggers to be expected.
|
||||
#cycles#</string>
|
||||
#triggers#</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string/>
|
||||
|
@ -59,7 +59,7 @@ void qDacWidget::SetDac() {
|
||||
FILE_LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() << " : " << val;
|
||||
|
||||
try {
|
||||
det->setDAC(val, index, 0, {detectorIndex});
|
||||
det->setDAC(index, val, 0, {detectorIndex});
|
||||
} CATCH_DISPLAY (std::string("Could not set dac ") + std::to_string(index), "qDacWidget::SetDac")
|
||||
|
||||
// update mV anyway
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "qTabMessages.h"
|
||||
|
||||
#include "versionAPI.h"
|
||||
#include "ToString.h"
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollArea>
|
||||
@ -231,13 +232,13 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
||||
default:
|
||||
std::ostringstream os;
|
||||
os << det->getHostname() << " has " <<
|
||||
slsDetectorDefs::detectorTypeToString(det->getDetectorType().squash()) << " detector type (" <<
|
||||
sls::ToString(det->getDetectorType().squash()) << " detector type (" <<
|
||||
std::to_string(detType) << "). Exiting GUI.";
|
||||
std::string errorMess = os.str();
|
||||
throw sls::RuntimeError(errorMess.c_str());
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << "SLS Detector GUI : " << slsDetectorDefs::detectorTypeToString(det->getDetectorType().squash())
|
||||
os << "SLS Detector GUI : " << sls::ToString(det->getDetectorType().squash())
|
||||
<< " - " << det->getHostname();
|
||||
std::string title = os.str();
|
||||
FILE_LOG(logINFO) << title;
|
||||
@ -384,7 +385,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
}
|
||||
|
||||
else if (action == actionLoadTrimbits) {
|
||||
QString fName = QString((det->getSettingsDir().squash("/tmp/")).c_str());
|
||||
QString fName = QString((det->getSettingsPath().squash("/tmp/")).c_str());
|
||||
FILE_LOG(logDEBUG) << "Loading Trimbits";
|
||||
// so that even nonexisting files can be selected
|
||||
QFileDialog *fileDialog = new QFileDialog(
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "qCloneWidget.h"
|
||||
|
||||
#include "detectorData.h"
|
||||
#include "ToString.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QPainter>
|
||||
@ -570,8 +571,11 @@ void qDrawPlot::AcquireFinished() {
|
||||
FILE_LOG(logERROR) << "Acquisition Finished with an exception: " << mess;
|
||||
qDefs::ExceptionMessage("Acquire unsuccessful.", mess, "qDrawPlot::AcquireFinished");
|
||||
try{
|
||||
det->stopAcquisition();
|
||||
} CATCH_DISPLAY("Could not stop acquisition and receiver.", "qDrawPlot::AcquireFinished");
|
||||
det->stopDetector();
|
||||
} CATCH_DISPLAY("Could not stop detector acquisition.", "qDrawPlot::AcquireFinished");
|
||||
try{
|
||||
det->stopReceiver();
|
||||
} CATCH_DISPLAY("Could not stop receiver.", "qDrawPlot::AcquireFinished");
|
||||
emit AbortSignal();
|
||||
}
|
||||
FILE_LOG(logDEBUG) << "End of Acquisition Finished";
|
||||
@ -599,7 +603,7 @@ void qDrawPlot::GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_
|
||||
|
||||
void qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus) {
|
||||
progress = currentProgress;
|
||||
std::string status = slsDetectorDefs::runStatusType(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
|
||||
std::string status = sls::ToString(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
|
||||
|
||||
if (detectorStatus == slsDetectorDefs::ERROR) {
|
||||
qDefs::Message(qDefs::WARNING, std::string("<nobr>The acquisiton has ended abruptly. Current Detector Status: ") + status + std::string(".</nobr>"), "qDrawPlot::AcquisitionFinished");
|
||||
|
@ -205,7 +205,7 @@ void qTabAdvanced::GetCltZMQIP() {
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
det->getClientZmqIp({comboDetector->currentIndex()})[0];
|
||||
det->getClientZmqIp({comboDetector->currentIndex()})[0].str();
|
||||
dispZMQIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get client zmq ip.", "qTabAdvanced::GetCltZMQIP")
|
||||
|
||||
@ -303,7 +303,7 @@ void qTabAdvanced::GetRxrZMQIP() {
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
det->getRxZmqIP({comboDetector->currentIndex()})[0];
|
||||
det->getRxZmqIP({comboDetector->currentIndex()})[0].str();
|
||||
dispRxrZMQIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "qTabDebugging.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include "ToString.h"
|
||||
|
||||
#include <QDesktopWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QTreeWidget>
|
||||
@ -65,7 +67,7 @@ void qTabDebugging::GetDetectorStatus() {
|
||||
FILE_LOG(logDEBUG) << "Getting Status";
|
||||
|
||||
try {
|
||||
std::string status = slsDetectorDefs::runStatusType(det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||
std::string status = sls::ToString(det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||
} CATCH_DISPLAY ("Could not get detector status.", "qTabDebugging::GetDetectorStatus")
|
||||
}
|
||||
@ -88,7 +90,7 @@ void qTabDebugging::GetInfo() {
|
||||
//to make sure the size is constant
|
||||
lblDetectorFirmware->setFixedWidth(100);
|
||||
layout->addWidget(dispFrame, 0, 1);
|
||||
QString detName = QString(slsDetectorDefs::detectorTypeToString(det->getDetectorType().squash()).c_str());
|
||||
QString detName = QString(sls::ToString(det->getDetectorType().squash()).c_str());
|
||||
|
||||
switch (det->getDetectorType().squash()) {
|
||||
|
||||
|
@ -524,7 +524,7 @@ void qTabMeasurement::StopAcquisition() {
|
||||
FILE_LOG(logINFORED) << "Stopping Acquisition";
|
||||
try{
|
||||
isAcquisitionStopped = true;
|
||||
det->stopAcquisition();
|
||||
det->stopDetector();
|
||||
} CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "qTabSettings.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include "ToString.h"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include <cmath>
|
||||
@ -129,8 +131,8 @@ void qTabSettings::GetSettings() {
|
||||
void qTabSettings::SetSettings(int index) {
|
||||
// settings
|
||||
auto val = static_cast<slsDetectorDefs::detectorSettings>(index);
|
||||
FILE_LOG(logINFO) << "Setting Settings to " << slsDetectorDefs::getDetectorSettings(val);
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting Settings to " << sls::ToString(val);
|
||||
det->setSettings(val);
|
||||
} CATCH_HANDLE ("Could not set settings.", "qTabSettings::SetSettings", this, &qTabSettings::GetSettings)
|
||||
// threshold
|
||||
|
@ -122,7 +122,7 @@
|
||||
#define DELAY_LEFT_LSB_REG (0x12 << MEM_MAP_SHIFT)
|
||||
#define DELAY_LEFT_MSB_REG (0x13 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Cycles Left 64 bit RO register TODO */
|
||||
/* Triggers Left 64 bit RO register TODO */
|
||||
#define CYCLES_LEFT_LSB_REG (0x14 << MEM_MAP_SHIFT)
|
||||
#define CYCLES_LEFT_MSB_REG (0x15 << MEM_MAP_SHIFT)
|
||||
|
||||
@ -450,7 +450,7 @@
|
||||
#define DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT)
|
||||
#define DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Cycles 64 bit RW register */
|
||||
/* Triggers 64 bit RW register */
|
||||
#define CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
|
||||
#define CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
|
||||
|
||||
|
Binary file not shown.
@ -560,7 +560,7 @@ void setupDetector() {
|
||||
setTimer(DIGITAL_SAMPLES, DEFAULT_NUM_SAMPLES); // update databytes and allocate ram
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
@ -904,12 +904,12 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
FILE_LOG(logINFO, ("\tGetting delay: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #cycles: %lld\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting #triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, CYCLES_LSB_REG, CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("\tGetting #cycles: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logINFO, ("\tGetting #triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ANALOG_SAMPLES:
|
||||
@ -974,9 +974,9 @@ int64_t getTimeLeft(enum timerIndex ind){
|
||||
FILE_LOG(logINFO, ("Getting delay left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(CYCLES_LEFT_LSB_REG, CYCLES_LEFT_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of cycles left: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACTUAL_TIME:
|
||||
@ -2200,7 +2200,7 @@ int startStateMachine(){
|
||||
#ifdef VIRTUAL
|
||||
void* start_timer(void* arg) {
|
||||
int wait_in_s = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(CYCLES_NUMBER, -1) *
|
||||
setTimer(TRIGGER_NUMBER, -1) *
|
||||
(setTimer(FRAME_PERIOD, -1)/(1E9)));
|
||||
FILE_LOG(logDEBUG1, ("going to wait for %d s\n", wait_in_s));
|
||||
while(!virtual_stop && (wait_in_s >= 0)) {
|
||||
|
@ -6,7 +6,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
BLACKFIN_CC = bfin-uclinux-gcc
|
||||
CROSS = powerpc-4xx-softfloat-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = eigerDetectorServer
|
||||
DESTDIR = bin
|
||||
|
Binary file not shown.
@ -64,7 +64,7 @@ int eiger_triggermode = 0;
|
||||
int eiger_extgating = 0;
|
||||
int eiger_extgatingpolarity = 0;
|
||||
int eiger_nexposures = 1;
|
||||
int eiger_ncycles = 1;
|
||||
int eiger_ntriggers = 1;
|
||||
|
||||
|
||||
#ifdef VIRTUAL
|
||||
@ -441,7 +441,7 @@ void setupDetector() {
|
||||
setTimer(SUBFRAME_ACQUISITION_TIME, DEFAULT_SUBFRAME_EXPOSURE);
|
||||
setTimer(SUBFRAME_DEADTIME, DEFAULT_SUBFRAME_DEADTIME);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setDynamicRange(DEFAULT_DYNAMIC_RANGE);
|
||||
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
|
||||
setParallelMode(DEFAULT_PARALLEL_MODE);
|
||||
@ -617,20 +617,20 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
switch(ind) {
|
||||
case FRAME_NUMBER:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG1, ("Setting number of frames: %d * %d\n", (unsigned int)val, eiger_ncycles));
|
||||
FILE_LOG(logDEBUG1, ("Setting number of frames: %d * %d\n", (unsigned int)val, eiger_ntriggers));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetNExposures((unsigned int)val*eiger_ncycles)) {
|
||||
if (Feb_Control_SetNExposures((unsigned int)val*eiger_ntriggers)) {
|
||||
eiger_nexposures = val;
|
||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfTriggers());
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
ndsts_in_use = 1;
|
||||
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
}
|
||||
#else
|
||||
eiger_nexposures = val;
|
||||
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
}return eiger_nexposures;
|
||||
|
||||
@ -714,25 +714,25 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
return eiger_virtual_period*1e9;
|
||||
#endif
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
if (val >= 0) {
|
||||
FILE_LOG(logDEBUG1, ("Setting number of triggers: %d * %d\n",
|
||||
(unsigned int)val,eiger_nexposures));
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetNExposures((unsigned int)val*eiger_nexposures)) {
|
||||
eiger_ncycles = val;
|
||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||
eiger_ntriggers = val;
|
||||
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfTriggers());
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
}
|
||||
#else
|
||||
eiger_ncycles = val;
|
||||
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||
eiger_ntriggers = val;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
}
|
||||
return eiger_ncycles;
|
||||
return eiger_ntriggers;
|
||||
default:
|
||||
FILE_LOG(logERROR, ("Timer Index not implemented for this detector: %d\n", ind));
|
||||
break;
|
||||
@ -1240,7 +1240,7 @@ int configureMAC() {
|
||||
on_dst = 0;
|
||||
|
||||
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||
nimages_per_request=eiger_nexposures * eiger_ncycles;
|
||||
nimages_per_request=eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
return OK;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@
|
||||
|
||||
/* BASE_ACQUISITION FPGA registers TODO --------------------------------------------------*/
|
||||
|
||||
/* Cycles left 64bit Register */
|
||||
/* Triggers left 64bit Register */
|
||||
#define GET_CYCLES_LSB_REG (0x10 + BASE_ACQUISITION)
|
||||
#define GET_CYCLES_MSB_REG (0x14 + BASE_ACQUISITION)
|
||||
|
||||
|
Binary file not shown.
@ -374,7 +374,7 @@ void setupDetector() {
|
||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||
setDefaultDacs();
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_PERIOD);
|
||||
}
|
||||
@ -436,12 +436,12 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
retval = set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG )/ (1E-9 * SYSTEM_C0); //TODO
|
||||
FILE_LOG(logDEBUG1, ("Getting period: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #cycles: %lld\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting #triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("Getting #cycles: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logDEBUG1, ("Getting #triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -488,9 +488,9 @@ int64_t getTimeLeft(enum timerIndex ind){
|
||||
FILE_LOG(logINFO, ("Getting number of frames left: %lld\n",(long long int)retval));
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of cycles left: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -870,7 +870,7 @@ int startStateMachine(){
|
||||
void* start_timer(void* arg) {
|
||||
int64_t periodns = setTimer(FRAME_PERIOD, -1);
|
||||
int numFrames = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(CYCLES_NUMBER, -1) );
|
||||
setTimer(TRIGGER_NUMBER, -1) );
|
||||
int64_t exp_ns = setTimer(ACQUISITION_TIME, -1);
|
||||
|
||||
|
||||
|
@ -318,11 +318,11 @@
|
||||
#define GET_DELAY_LSB_REG (0x6a << MEM_MAP_SHIFT)
|
||||
#define GET_DELAY_MSB_REG (0x6b << MEM_MAP_SHIFT)
|
||||
|
||||
/* Set Cycles 64 bit register */
|
||||
/* Set Triggers 64 bit register */
|
||||
#define SET_TRAINS_LSB_REG (0x6c << MEM_MAP_SHIFT)
|
||||
#define SET_TRAINS_MSB_REG (0x6d << MEM_MAP_SHIFT)
|
||||
|
||||
/* Get Cycles 64 bit register */
|
||||
/* Get Triggers 64 bit register */
|
||||
#define GET_TRAINS_LSB_REG (0x6e << MEM_MAP_SHIFT)
|
||||
#define GET_TRAINS_MSB_REG (0x6f << MEM_MAP_SHIFT)
|
||||
|
||||
|
Binary file not shown.
@ -421,7 +421,7 @@ void setupDetector() {
|
||||
setExtSignal(DEFAULT_TRIGGER_MODE);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
|
||||
@ -852,12 +852,12 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
}
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting Cycles: %lld\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting Triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("\tGetting Cycles: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logDEBUG1, ("\tGetting Triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -905,9 +905,9 @@ int64_t getTimeLeft(enum timerIndex ind){
|
||||
}
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(GET_TRAINS_LSB_REG, GET_TRAINS_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of cycles left: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1466,7 +1466,7 @@ int configureMAC() {
|
||||
// remember old parameters
|
||||
enum timingMode oldtiming = getTiming();
|
||||
uint64_t oldframes = setTimer(FRAME_NUMBER, -1);
|
||||
uint64_t oldcycles = setTimer(CYCLES_NUMBER, -1);
|
||||
uint64_t oldtriggers = setTimer(TRIGGER_NUMBER, -1);
|
||||
uint64_t oldPeriod = setTimer(FRAME_PERIOD, -1);
|
||||
uint64_t oldExptime = setTimer(ACQUISITION_TIME, -1);
|
||||
|
||||
@ -1474,12 +1474,12 @@ int configureMAC() {
|
||||
FILE_LOG(logINFO, ("\tSetting basic parameters\n"
|
||||
"\tTiming: auto\n"
|
||||
"\tframes: 1\n"
|
||||
"\tcycles: 1\n"
|
||||
"\ttriggers: 1\n"
|
||||
"\tperiod: 1s\n"
|
||||
"\texptime: 900ms\n"));
|
||||
setTiming(AUTO_TIMING);
|
||||
setTimer(FRAME_NUMBER, 1);
|
||||
setTimer(CYCLES_NUMBER, 1);
|
||||
setTimer(TRIGGER_NUMBER, 1);
|
||||
setTimer(FRAME_PERIOD, 1e9); // important to keep this until we have to wait for acquisition to start
|
||||
setTimer(ACQUISITION_TIME, 900 * 1000);
|
||||
|
||||
@ -1507,14 +1507,14 @@ int configureMAC() {
|
||||
FILE_LOG(logINFO, ("\tSetting previous parameters:\n"
|
||||
"\tTiming: %d\n"
|
||||
"\tframes: %lld\n"
|
||||
"\tcycles: %lld\n"
|
||||
"\ttriggers: %lld\n"
|
||||
"\tperiod: %lld ns\n"
|
||||
"\texptime:%lld ns\n",
|
||||
(int)oldtiming, (long long int)oldframes, (long long int)oldcycles,
|
||||
(int)oldtiming, (long long int)oldframes, (long long int)oldtriggers,
|
||||
(long long int)oldPeriod, (long long int)oldExptime));
|
||||
setTiming(oldtiming);
|
||||
setTimer(FRAME_NUMBER, oldframes);
|
||||
setTimer(CYCLES_NUMBER, oldcycles);
|
||||
setTimer(TRIGGER_NUMBER, oldtriggers);
|
||||
setTimer(FRAME_PERIOD, oldPeriod);
|
||||
setTimer(ACQUISITION_TIME, oldExptime);
|
||||
FILE_LOG(logINFOBLUE, ("Done sending a frame at configuration\n"));
|
||||
@ -1566,7 +1566,7 @@ int startStateMachine(){
|
||||
#ifdef VIRTUAL
|
||||
void* start_timer(void* arg) {
|
||||
int wait_in_s = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(CYCLES_NUMBER, -1) *
|
||||
setTimer(TRIGGER_NUMBER, -1) *
|
||||
(setTimer(FRAME_PERIOD, -1)/(1E9)));
|
||||
FILE_LOG(logDEBUG1, ("going to wait for %d s\n", wait_in_s));
|
||||
while(!virtual_stop && (wait_in_s >= 0)) {
|
||||
|
@ -81,7 +81,7 @@
|
||||
#define GET_DELAY_LSB_REG (0x12 << MEM_MAP_SHIFT) // different kind of delay
|
||||
#define GET_DELAY_MSB_REG (0x13 << MEM_MAP_SHIFT) // different kind of delay
|
||||
|
||||
/* Get Cycles 64 bit register */
|
||||
/* Get Triggers 64 bit register */
|
||||
#define GET_CYCLES_LSB_REG (0x14 << MEM_MAP_SHIFT)
|
||||
#define GET_CYCLES_MSB_REG (0x15 << MEM_MAP_SHIFT)
|
||||
|
||||
@ -375,7 +375,7 @@
|
||||
#define SET_DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT) // different kind of delay
|
||||
#define SET_DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT) // different kind of delay
|
||||
|
||||
/* Set Cycles 64 bit register */
|
||||
/* Set Triggers 64 bit register */
|
||||
#define SET_CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
|
||||
#define SET_CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
|
||||
|
||||
|
Binary file not shown.
@ -445,7 +445,7 @@ void setupDetector() {
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
|
||||
@ -627,12 +627,12 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
FILE_LOG(logDEBUG1, ("Getting delay: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #cycles: %lld\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting #triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("Getting #cycles: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logDEBUG1, ("Getting #triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case STORAGE_CELL_NUMBER:
|
||||
@ -690,9 +690,9 @@ int64_t getTimeLeft(enum timerIndex ind){
|
||||
FILE_LOG(logINFO, ("Getting delay left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of cycles left: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACTUAL_TIME:
|
||||
@ -1674,7 +1674,7 @@ int startStateMachine(){
|
||||
void* start_timer(void* arg) {
|
||||
int64_t periodns = setTimer(FRAME_PERIOD, -1);
|
||||
int numFrames = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(CYCLES_NUMBER, -1) *
|
||||
setTimer(TRIGGER_NUMBER, -1) *
|
||||
(setTimer(STORAGE_CELL_NUMBER, -1) + 1));
|
||||
int64_t exp_ns = setTimer(ACQUISITION_TIME, -1);
|
||||
|
||||
|
@ -123,7 +123,7 @@
|
||||
#define DELAY_LEFT_LSB_REG (0x12 << MEM_MAP_SHIFT)
|
||||
#define DELAY_LEFT_MSB_REG (0x13 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Cycles Left 64 bit RO register TODO */
|
||||
/* Triggers Left 64 bit RO register TODO */
|
||||
#define CYCLES_LEFT_LSB_REG (0x14 << MEM_MAP_SHIFT)
|
||||
#define CYCLES_LEFT_MSB_REG (0x15 << MEM_MAP_SHIFT)
|
||||
|
||||
@ -446,7 +446,7 @@
|
||||
#define DELAY_LSB_REG (0x60 << MEM_MAP_SHIFT)
|
||||
#define DELAY_MSB_REG (0x61 << MEM_MAP_SHIFT)
|
||||
|
||||
/* Cycles 64 bit RW register */
|
||||
/* Triggers 64 bit RW register */
|
||||
#define CYCLES_LSB_REG (0x62 << MEM_MAP_SHIFT)
|
||||
#define CYCLES_MSB_REG (0x63 << MEM_MAP_SHIFT)
|
||||
|
||||
|
@ -523,7 +523,7 @@ void setupDetector() {
|
||||
setTimer(SAMPLES, DEFAULT_NUM_SAMPLES); // update databytes and allocate ram
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
|
||||
setTiming(DEFAULT_TIMING_MODE);
|
||||
@ -847,12 +847,12 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
FILE_LOG(logINFO, ("\tGetting delay: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #cycles: %lld\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting #triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, CYCLES_LSB_REG, CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("\tGetting #cycles: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logINFO, ("\tGetting #triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case SAMPLES:
|
||||
@ -901,9 +901,9 @@ int64_t getTimeLeft(enum timerIndex ind){
|
||||
FILE_LOG(logINFO, ("Getting delay left: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(CYCLES_LEFT_LSB_REG, CYCLES_LEFT_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of cycles left: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case ACTUAL_TIME:
|
||||
@ -1813,7 +1813,7 @@ int startStateMachine(){
|
||||
#ifdef VIRTUAL
|
||||
void* start_timer(void* arg) {
|
||||
int wait_in_s = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(CYCLES_NUMBER, -1) *
|
||||
setTimer(TRIGGER_NUMBER, -1) *
|
||||
(setTimer(FRAME_PERIOD, -1)/(1E9)));
|
||||
FILE_LOG(logDEBUG1, ("going to wait for %d s\n", wait_in_s));
|
||||
while(!virtual_stop && (wait_in_s >= 0)) {
|
||||
|
@ -76,7 +76,7 @@
|
||||
#define GET_DELAY_LSB_REG (0x0002 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define GET_DELAY_MSB_REG (0x0003 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
/* Cycles left 64bit Register */
|
||||
/* Triggers left 64bit Register */
|
||||
#define GET_CYCLES_LSB_REG (0x0004 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
#define GET_CYCLES_MSB_REG (0x0005 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||
|
||||
|
Binary file not shown.
@ -360,7 +360,7 @@ void setupDetector() {
|
||||
|
||||
// Initialization of acquistion parameters
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(TRIGGER_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
|
||||
setTimer(ACQUISITION_TIME, DEFAULT_EXPTIME);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
@ -440,12 +440,12 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
FILE_LOG(logINFO, ("\tGetting delay: %lldns\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #cycles: %lld\n", (long long int)val));
|
||||
FILE_LOG(logINFO, ("Setting #triggers: %lld\n", (long long int)val));
|
||||
}
|
||||
retval = set64BitReg(val, SET_CYCLES_LSB_REG, SET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logDEBUG1, ("Getting #cycles: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logDEBUG1, ("Getting #triggers: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -498,9 +498,9 @@ int64_t getTimeLeft(enum timerIndex ind){
|
||||
FILE_LOG(logINFO, ("Getting number of frames left: %lld\n",(long long int)retval));
|
||||
break;
|
||||
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
retval = get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||
FILE_LOG(logINFO, ("Getting number of cycles left: %lld\n", (long long int)retval));
|
||||
FILE_LOG(logINFO, ("Getting number of triggers left: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -960,7 +960,7 @@ int startStateMachine(){
|
||||
void* start_timer(void* arg) {
|
||||
int64_t periodns = setTimer(FRAME_PERIOD, -1);
|
||||
int numFrames = (setTimer(FRAME_NUMBER, -1) *
|
||||
setTimer(CYCLES_NUMBER, -1) );
|
||||
setTimer(TRIGGER_NUMBER, -1) );
|
||||
int64_t exp_ns = setTimer(ACQUISITION_TIME, -1);
|
||||
|
||||
|
||||
|
@ -67,5 +67,11 @@ void getMacAddressinString(char* cmac, int size, uint64_t mac);
|
||||
*/
|
||||
void getIpAddressinString(char* cip, uint32_t ip);
|
||||
|
||||
/**
|
||||
* Convert string to ip address
|
||||
* @param cip string source
|
||||
* @param ip result
|
||||
*/
|
||||
void getIpAddressFromString(char* cip, uint32_t* ip);
|
||||
|
||||
#endif
|
||||
|
@ -25,8 +25,8 @@ extern int errno;
|
||||
|
||||
// Variables that will be exported
|
||||
int lockStatus = 0;
|
||||
char lastClientIP[INET_ADDRSTRLEN] = "";
|
||||
char thisClientIP[INET_ADDRSTRLEN] = "";
|
||||
uint32_t lastClientIP = 0u;
|
||||
uint32_t thisClientIP = 0u;
|
||||
int differentClients = 0;
|
||||
int isControlServer = 1;
|
||||
int ret = FAIL;
|
||||
@ -34,7 +34,7 @@ int fnum = 0;
|
||||
char mess[MAX_STR_LENGTH];
|
||||
|
||||
// Local variables
|
||||
char dummyClientIP[INET_ADDRSTRLEN] = "";
|
||||
uint32_t dummyClientIP = 0u;
|
||||
int myport = -1;
|
||||
// socket descriptor set
|
||||
fd_set readset, tempset;
|
||||
@ -220,9 +220,14 @@ int acceptConnection(int socketDescriptor) {
|
||||
}
|
||||
// accept success
|
||||
else {
|
||||
inet_ntop(AF_INET, &(addressC.sin_addr), dummyClientIP, INET_ADDRSTRLEN);
|
||||
char buf[INET_ADDRSTRLEN] = "";
|
||||
memset(buf, 0, INET_ADDRSTRLEN);
|
||||
inet_ntop(AF_INET, &(addressC.sin_addr), buf, INET_ADDRSTRLEN);
|
||||
FILE_LOG(logDEBUG3, ("%s socket accepted connection, fd= %d\n",
|
||||
(isControlServer ? "control":"stop"), file_des));
|
||||
|
||||
getIpAddressFromString(buf, &dummyClientIP);
|
||||
|
||||
// add the file descriptor from accept
|
||||
FD_SET(file_des, &readset);
|
||||
maxfd = (maxfd < file_des)?file_des:maxfd;
|
||||
@ -381,9 +386,9 @@ int receiveDataOnly(int file_des, void* buf,int length) {
|
||||
}
|
||||
|
||||
if (total_received>0)
|
||||
strcpy(thisClientIP,dummyClientIP);
|
||||
thisClientIP = dummyClientIP;
|
||||
|
||||
if (strcmp(lastClientIP,thisClientIP)) {
|
||||
if (lastClientIP == thisClientIP) {
|
||||
differentClients = 1;
|
||||
}
|
||||
else
|
||||
@ -545,7 +550,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
|
||||
}
|
||||
n = receiveData(file_des, myMod->chanregs, sizeof(int) * (myMod->nchan), INT32);
|
||||
FILE_LOG(level, ("chanregs received. %d bytes.\n", n));
|
||||
if (!n){
|
||||
if (!n && myMod->nchan != 0){
|
||||
return -1;
|
||||
}
|
||||
ts += n;
|
||||
@ -557,7 +562,9 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
|
||||
|
||||
void Server_LockedError() {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
||||
char buf[INET_ADDRSTRLEN] = "";
|
||||
getIpAddressinString(buf, dummyClientIP);
|
||||
sprintf(mess,"Detector locked by %s\n", buf);
|
||||
FILE_LOG(logWARNING, (mess));
|
||||
}
|
||||
|
||||
@ -610,3 +617,16 @@ void getIpAddressinString(char* cip, uint32_t ip) {
|
||||
memset(cip, 0, INET_ADDRSTRLEN);
|
||||
inet_ntop(AF_INET, &ip, cip, INET_ADDRSTRLEN);
|
||||
}
|
||||
|
||||
|
||||
void getIpAddressFromString(char* cip, uint32_t* ip) {
|
||||
char buf[INET_ADDRSTRLEN]="";
|
||||
memset(buf, 0, INET_ADDRSTRLEN);
|
||||
char* byte = strtok (cip,".");
|
||||
while (byte != NULL) {
|
||||
sprintf(cip,"%02x",atoi(byte));
|
||||
strcat(buf, cip);
|
||||
byte = strtok (NULL, ".");
|
||||
}
|
||||
sscanf(buf, "%x", ip);
|
||||
}
|
@ -28,8 +28,8 @@ const enum detectorType myDetectorType = GENERIC;
|
||||
|
||||
// Global variables from communication_funcs
|
||||
extern int lockStatus;
|
||||
extern char lastClientIP[INET_ADDRSTRLEN];
|
||||
extern char thisClientIP[INET_ADDRSTRLEN];
|
||||
extern uint32_t lastClientIP;
|
||||
extern uint32_t thisClientIP;
|
||||
extern int differentClients;
|
||||
extern int isControlServer;
|
||||
extern int ret;
|
||||
@ -41,7 +41,7 @@ int sockfd = 0;
|
||||
int debugflag = 0;
|
||||
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int configured = FAIL;
|
||||
char configureMessage[MAX_STR_LENGTH]="";
|
||||
char configureMessage[MAX_STR_LENGTH]="udp parameters not configured yet";
|
||||
int maxydet = -1;
|
||||
int detectorId = -1;
|
||||
|
||||
@ -71,8 +71,6 @@ void init_detector() {
|
||||
}
|
||||
else initStopServer();
|
||||
strcpy(mess,"dummy message");
|
||||
strcpy(lastClientIP,"none");
|
||||
strcpy(thisClientIP,"none1");
|
||||
lockStatus=0;
|
||||
}
|
||||
|
||||
@ -122,7 +120,7 @@ const char* getTimerName(enum timerIndex ind) {
|
||||
case ACQUISITION_TIME: return "acquisition_time";
|
||||
case FRAME_PERIOD: return "frame_period";
|
||||
case DELAY_AFTER_TRIGGER: return "delay_after_trigger";
|
||||
case CYCLES_NUMBER: return "cycles_number";
|
||||
case TRIGGER_NUMBER: return "triggers_number";
|
||||
case ACTUAL_TIME: return "actual_time";
|
||||
case MEASUREMENT_TIME: return "measurement_time";
|
||||
case PROGRESS: return "progress";
|
||||
@ -1670,7 +1668,7 @@ int start_acquisition(int file_des) {
|
||||
ret = startStateMachine();
|
||||
if (ret == FAIL) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check rx_udpip & rx_udpport.\n");
|
||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
||||
#else
|
||||
sprintf(mess, "Could not start acquisition\n");
|
||||
#endif
|
||||
@ -1778,7 +1776,7 @@ int start_and_read_all(int file_des) {
|
||||
ret = startStateMachine();
|
||||
if (ret == FAIL) {
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check rx_udpip & rx_udpport.\n");
|
||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
||||
#else
|
||||
sprintf(mess, "Could not start acquisition\n");
|
||||
#endif
|
||||
@ -1841,7 +1839,7 @@ int set_timer(int file_des) {
|
||||
case FRAME_NUMBER:
|
||||
case ACQUISITION_TIME:
|
||||
case FRAME_PERIOD:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
case ANALOG_SAMPLES:
|
||||
case DIGITAL_SAMPLES:
|
||||
@ -1911,7 +1909,7 @@ int set_timer(int file_des) {
|
||||
#else
|
||||
switch(ind) {
|
||||
case FRAME_NUMBER:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
case STORAGE_CELL_NUMBER:
|
||||
validate64(tns, retval, vtimerName, DEC); // no conversion, so all good
|
||||
break;
|
||||
@ -1983,13 +1981,13 @@ int get_time_left(int file_des) {
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif GOTTHARDD
|
||||
case ACQUISITION_TIME:
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif CHIPTESTBOARDD
|
||||
case FRAMES_FROM_START:
|
||||
case FRAMES_FROM_START_PG:
|
||||
@ -1998,7 +1996,7 @@ int get_time_left(int file_des) {
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif MOENCHD
|
||||
case FRAMES_FROM_START:
|
||||
case FRAMES_FROM_START_PG:
|
||||
@ -2007,13 +2005,13 @@ int get_time_left(int file_des) {
|
||||
case FRAME_NUMBER:
|
||||
case FRAME_PERIOD:
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif MYTHEN3D
|
||||
case FRAME_NUMBER:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
#elif GOTTHARD2D
|
||||
case FRAME_NUMBER:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
#endif
|
||||
retval = getTimeLeft(ind);
|
||||
FILE_LOG(logDEBUG1, ("Timer left index %d: %lld\n", ind, retval));
|
||||
@ -2270,15 +2268,17 @@ int lock_server(int file_des) {
|
||||
// set
|
||||
if (lock >= 0) {
|
||||
if (!lockStatus || // if it was unlocked, anyone can lock
|
||||
(!strcmp(lastClientIP, thisClientIP)) || // if it was locked, need same ip
|
||||
(!strcmp(lastClientIP,"none"))) { // if it was locked, must be by "none"
|
||||
(lastClientIP == thisClientIP) || // if it was locked, need same ip
|
||||
(lastClientIP == 0u)) { // if it was locked, must be by "none"
|
||||
lockStatus = lock;
|
||||
if (lock) {
|
||||
FILE_LOG(logINFO, ("Server lock to %s\n", lastClientIP));
|
||||
char buf[INET_ADDRSTRLEN] = "";
|
||||
getIpAddressinString(buf, lastClientIP);
|
||||
FILE_LOG(logINFO, ("Server lock to %s\n", buf));
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("Server unlocked\n"));
|
||||
}
|
||||
strcpy(lastClientIP, thisClientIP);
|
||||
lastClientIP = thisClientIP;
|
||||
} else {
|
||||
Server_LockedError();
|
||||
}
|
||||
@ -2293,7 +2293,9 @@ int lock_server(int file_des) {
|
||||
int get_last_client_ip(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
return Server_SendResult(file_des, OTHER, UPDATE, lastClientIP, sizeof(lastClientIP));
|
||||
uint32_t retval = lastClientIP;
|
||||
retval = __builtin_bswap32(retval);
|
||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
|
||||
@ -2303,7 +2305,7 @@ int set_port(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int p_number = -1;
|
||||
char oldLastClientIP[INET_ADDRSTRLEN] = {0};
|
||||
uint32_t oldLastClientIP = 0;
|
||||
|
||||
if (receiveData(file_des, &p_number, sizeof(p_number), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
@ -2320,7 +2322,7 @@ int set_port(int file_des) {
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("Setting %s port to %d\n",
|
||||
(isControlServer ? "control":"stop"), p_number));
|
||||
strcpy(oldLastClientIP, lastClientIP);
|
||||
oldLastClientIP = lastClientIP;
|
||||
sd = bindSocket(p_number);
|
||||
}
|
||||
}
|
||||
@ -2331,7 +2333,7 @@ int set_port(int file_des) {
|
||||
closeConnection(file_des);
|
||||
exitServer(sockfd);
|
||||
sockfd = sd;
|
||||
strcpy(lastClientIP, oldLastClientIP);
|
||||
lastClientIP = oldLastClientIP;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -2355,7 +2357,9 @@ int send_update(int file_des) {
|
||||
int i32 = -1;
|
||||
int64_t i64 = -1;
|
||||
|
||||
n = sendData(file_des,lastClientIP,sizeof(lastClientIP),OTHER);
|
||||
i32 = lastClientIP;
|
||||
i32 = __builtin_bswap32(i32);
|
||||
n = sendData(file_des, &i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
// dr
|
||||
@ -2421,8 +2425,8 @@ int send_update(int file_des) {
|
||||
if (n < 0) return printSocketReadError();
|
||||
#endif
|
||||
|
||||
// #cycles
|
||||
i64 = setTimer(CYCLES_NUMBER,GET_FLAG);
|
||||
// #triggers
|
||||
i64 = setTimer(TRIGGER_NUMBER,GET_FLAG);
|
||||
n = sendData(file_des,&i64,sizeof(i64),INT64);
|
||||
if (n < 0) return printSocketReadError();
|
||||
|
||||
@ -2458,7 +2462,7 @@ int send_update(int file_des) {
|
||||
#endif
|
||||
|
||||
if (lockStatus == 0) {
|
||||
strcpy(lastClientIP, thisClientIP);
|
||||
lastClientIP = thisClientIP;
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -2466,219 +2470,6 @@ int send_update(int file_des) {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
int configure_mac(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
const size_t array_size = 50;
|
||||
const size_t n_args = 14;
|
||||
const size_t n_retvals = 2;
|
||||
char args[n_args][array_size];
|
||||
char retvals[n_retvals][array_size];
|
||||
|
||||
memset(args, 0, sizeof(args));
|
||||
memset(retvals, 0, sizeof(retvals));
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), OTHER) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
FILE_LOG(logDEBUG1, ("\n Configuring MAC\n"));
|
||||
// dest port
|
||||
uint32_t dstPort = 0;
|
||||
sscanf(args[0], "%x", &dstPort);
|
||||
FILE_LOG(logDEBUG1, ("Dst Port: %x\n", dstPort));
|
||||
// dest ip
|
||||
uint32_t dstIp = 0;
|
||||
sscanf(args[1], "%x", &dstIp);
|
||||
{
|
||||
char ipstring[INET_ADDRSTRLEN];
|
||||
getIpAddressinString(ipstring, dstIp);
|
||||
FILE_LOG(logINFO, ("Dst Ip Addr: %s\n", ipstring));
|
||||
}
|
||||
|
||||
// dest mac
|
||||
uint64_t dstMac = 0;
|
||||
#ifdef VIRTUAL
|
||||
sscanf(args[2], "%lx", &dstMac);
|
||||
#else
|
||||
sscanf(args[2], "%llx", &dstMac);
|
||||
#endif
|
||||
{
|
||||
char macstring[50];
|
||||
getMacAddressinString(macstring, 50, dstMac);
|
||||
FILE_LOG(logDEBUG1, ("Dst Mac Addr: %s\n", macstring));
|
||||
}
|
||||
// source ip
|
||||
uint32_t srcIp = 0;
|
||||
sscanf(args[3], "%x", &srcIp);
|
||||
{
|
||||
char ipstring[INET_ADDRSTRLEN];
|
||||
getIpAddressinString(ipstring, srcIp);
|
||||
FILE_LOG(logINFO, ("Src Ip Addr: %s\n", ipstring));
|
||||
}
|
||||
// source mac
|
||||
uint64_t srcMac = 0;
|
||||
#ifdef VIRTUAL
|
||||
sscanf(args[4], "%lx", &srcMac);
|
||||
#else
|
||||
sscanf(args[4], "%llx", &srcMac);
|
||||
#endif
|
||||
{
|
||||
char macstring[50];
|
||||
getMacAddressinString(macstring, 50, srcMac);
|
||||
FILE_LOG(logDEBUG1, ("Src Mac Addr: %s\n", macstring));
|
||||
}
|
||||
|
||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||
// source port 2
|
||||
uint32_t dstPort2 = 0;
|
||||
sscanf(args[5], "%x", &dstPort2);
|
||||
FILE_LOG(logDEBUG1, ("Dst Port2: %x\n", dstPort2));
|
||||
#endif
|
||||
#ifdef JUNGFRAUD
|
||||
// dest ip2
|
||||
uint32_t dstIp2 = 0;
|
||||
sscanf(args[6], "%x", &dstIp2);
|
||||
{
|
||||
char ipstring[INET_ADDRSTRLEN];
|
||||
getIpAddressinString(ipstring, dstIp2);
|
||||
FILE_LOG(logDEBUG1, ("Dst Ip Addr2: %s\n", ipstring));
|
||||
}
|
||||
// dest mac2
|
||||
uint64_t dstMac2 = 0;
|
||||
#ifdef VIRTUAL
|
||||
sscanf(args[7], "%lx", &dstMac2);
|
||||
#else
|
||||
sscanf(args[7], "%llx", &dstMac2);
|
||||
#endif
|
||||
{
|
||||
char macstring[50];
|
||||
getMacAddressinString(macstring, 50, dstMac2);
|
||||
FILE_LOG(logDEBUG1, ("Dst Mac Addr2: %s\n", macstring));
|
||||
}
|
||||
// source ip2
|
||||
uint32_t srcIp2 = 0;
|
||||
sscanf(args[8], "%x", &srcIp2);
|
||||
{
|
||||
char ipstring[INET_ADDRSTRLEN];
|
||||
getIpAddressinString(ipstring, srcIp2);
|
||||
FILE_LOG(logDEBUG1, ("Src Ip Addr2: %s\n", ipstring));
|
||||
}
|
||||
// source mac2
|
||||
uint64_t srcMac2 = 0;
|
||||
#ifdef VIRTUAL
|
||||
sscanf(args[9], "%lx", &srcMac2);
|
||||
#else
|
||||
sscanf(args[9], "%llx", &srcMac2);
|
||||
#endif
|
||||
{
|
||||
char macstring[50];
|
||||
getMacAddressinString(macstring, 50, srcMac2);
|
||||
FILE_LOG(logDEBUG1, ("Src Mac Addr2: %s\n", macstring));
|
||||
}
|
||||
|
||||
// number of interfaces
|
||||
int numInterfaces = 0;
|
||||
sscanf(args[10], "%d", &numInterfaces);
|
||||
int selInterface = 1;
|
||||
sscanf(args[11], "%d", &selInterface);
|
||||
|
||||
#endif
|
||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||
int pos[2] = {0, 0};
|
||||
sscanf(args[12], "%x", &pos[X]);
|
||||
sscanf(args[13], "%x", &pos[Y]);
|
||||
FILE_LOG(logDEBUG1, ("Position: [%d, %d]\n", pos[X], pos[Y]));
|
||||
#endif
|
||||
|
||||
|
||||
// set only
|
||||
if ((Server_VerifyLock() == OK)) {
|
||||
|
||||
// stop detector if it was running
|
||||
enum runStatus status = getRunStatus();
|
||||
if (status != IDLE && status != RUN_FINISHED && status != STOPPED) {
|
||||
if (status == RUNNING)
|
||||
stopStateMachine();
|
||||
#if !defined(EIGERD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||
cleanFifos();
|
||||
#endif
|
||||
status = getRunStatus();
|
||||
if (status != IDLE && status != RUN_FINISHED && status != STOPPED) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Cannot configure mac when detector is not idle. Detector at %s state\n", getRunStateName(status));
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == OK) {
|
||||
#ifdef EIGERD
|
||||
// change mac to hardware mac
|
||||
if (srcMac != getDetectorMAC()) {
|
||||
FILE_LOG(logWARNING, ("actual detector mac address %llx does not match "
|
||||
"the one from client %llx\n",
|
||||
(long long unsigned int)getDetectorMAC(),
|
||||
(long long unsigned int)srcMac));
|
||||
srcMac = getDetectorMAC();
|
||||
FILE_LOG(logWARNING,("matched detectormac to the hardware mac now\n"));
|
||||
}
|
||||
|
||||
// always remember the ip sent from the client (could be for 10g(if not dhcp))
|
||||
if (srcIp != getDetectorIP())
|
||||
custom10gIp = srcIp;
|
||||
|
||||
//only for 1Gbe, change ip to hardware ip
|
||||
if (!enableTenGigabitEthernet(-1)) {
|
||||
FILE_LOG(logWARNING, ("Using DHCP IP for Configuring MAC\n"));
|
||||
srcIp = getDetectorIP();
|
||||
}
|
||||
// 10 gbe (use ip given from client)
|
||||
else
|
||||
srcIp = custom10gIp;
|
||||
ret = configureMAC(dstIp, dstMac, srcMac, srcIp, dstPort, dstPort2);
|
||||
#elif JUNGFRAUD
|
||||
ret = configureMAC(numInterfaces, selInterface, dstIp, dstMac, srcMac, srcIp, dstPort, dstIp2, dstMac2, srcMac2, srcIp2, dstPort2);
|
||||
#else
|
||||
ret = configureMAC(dstIp, dstMac, srcMac, srcIp, dstPort);
|
||||
#endif
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
if (ret != OK) {
|
||||
if (ret == FAIL)
|
||||
sprintf(mess,"Could not configure mac because of incorrect udp 1G destination IP and port\n");
|
||||
else if (ret == -1)
|
||||
sprintf(mess, "Could not allocate RAM\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
#else
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess,"Configure Mac failed\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
FILE_LOG(logINFO, ("\tConfigure MAC successful\n"));
|
||||
}
|
||||
#if defined(EIGERD) || defined (JUNGFRAUD)
|
||||
if (ret != FAIL) {
|
||||
ret = setDetectorPosition(pos);
|
||||
if (ret == FAIL) {
|
||||
sprintf(mess, "Could not set detector position\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// set retval vals
|
||||
if (ret != FAIL) {
|
||||
sprintf(retvals[0],"%llx", (long long unsigned int)srcMac);
|
||||
sprintf(retvals[1],"%x", srcIp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, OTHER, UPDATE, retvals, sizeof(retvals));
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
int enable_ten_giga(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
@ -3225,15 +3016,23 @@ int set_rate_correct(int file_des) {
|
||||
|
||||
// switching on in right mode
|
||||
else {
|
||||
if (tau_ns < 0)
|
||||
if (tau_ns < 0) {
|
||||
tau_ns = getDefaultSettingsTau_in_nsec();
|
||||
if (tau_ns < 0) {
|
||||
ret = FAIL;
|
||||
strcpy(mess,"Default settings file not loaded. No default tau yet\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
else if (tau_ns > 0) {
|
||||
//changing tau to a user defined value changes settings to undefined
|
||||
setSettings(UNDEFINED);
|
||||
FILE_LOG(logERROR, ("Settings has been changed to undefined (tau changed)\n"));
|
||||
}
|
||||
int64_t retval = setRateCorrection(tau_ns);
|
||||
validate64(tau_ns, retval, "set rate correction", DEC);
|
||||
if (ret == OK) {
|
||||
int64_t retval = setRateCorrection(tau_ns);
|
||||
validate64(tau_ns, retval, "set rate correction", DEC);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
set(SOURCES
|
||||
src/multiSlsDetector.cpp
|
||||
src/multiSlsDetectorClient.cpp
|
||||
src/slsDetectorUsers.cpp
|
||||
# src/slsDetectorUsers.cpp
|
||||
src/slsDetectorCommand.cpp
|
||||
src/slsDetector.cpp
|
||||
src/Detector.cpp
|
||||
@ -39,7 +39,7 @@ target_link_libraries(slsDetectorShared PUBLIC
|
||||
set(PUBLICHEADERS
|
||||
include/SharedMemory.h
|
||||
include/slsDetector.h
|
||||
include/slsDetectorUsers.h
|
||||
# include/slsDetectorUsers.h
|
||||
include/detectorData.h
|
||||
include/multiSlsDetector.h
|
||||
include/Detector.h
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,14 +52,17 @@ class Detector {
|
||||
/** Gets shared memory ID */
|
||||
int getShmId() const;
|
||||
|
||||
/** package git branch */
|
||||
std::string getPackageVersion() const;
|
||||
|
||||
int64_t getClientVersion() const;
|
||||
|
||||
Result<int64_t> getFirmwareVersion(Positions pos = {}) const;
|
||||
|
||||
Result<int64_t> getDetectorServerVersion(Positions pos = {}) const;
|
||||
|
||||
Result<int64_t> getSerialNumber(Positions pos = {}) const;
|
||||
|
||||
int64_t getClientVersion() const;
|
||||
|
||||
Result<int64_t> getReceiverVersion(Positions pos = {}) const;
|
||||
|
||||
Result<defs::detectorType> getDetectorType(Positions pos = {}) const;
|
||||
@ -197,7 +200,7 @@ class Detector {
|
||||
|
||||
Result<int> getDAC(defs::dacIndex index, bool mV, Positions pos = {}) const;
|
||||
|
||||
void setDAC(int value, defs::dacIndex index, bool mV, Positions pos = {});
|
||||
void setDAC(defs::dacIndex index, int value, bool mV, Positions pos = {});
|
||||
|
||||
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
||||
|
||||
@ -213,33 +216,33 @@ class Detector {
|
||||
* *
|
||||
* ************************************************/
|
||||
/**
|
||||
* Blocking call, starts the receiver and detector.
|
||||
* Increments file index if file write enabled.
|
||||
* Acquired the number of frames set.
|
||||
* Blocking call: Acquire the number of frames set
|
||||
* - sets acquiring flag
|
||||
* - starts the receiver listener
|
||||
* - starts detector acquisition for number of frames set
|
||||
* - monitors detector status from running to idle
|
||||
* - stops the receiver listener
|
||||
* - increments file index if file write enabled
|
||||
* - resets acquiring flag
|
||||
*/
|
||||
void acquire();
|
||||
|
||||
/** Non blocking
|
||||
* Starts the reciever (if enabled) and then the detector
|
||||
* You have to check detector status until it is idle before you call
|
||||
* stopACquisition
|
||||
*
|
||||
*/
|
||||
void startAcquisition();
|
||||
|
||||
/**
|
||||
* Stops detector acquisition and then receiver (if enabled)
|
||||
* If no receiver enabled, you can skip this for normal acquisition (no
|
||||
* abort)
|
||||
*/
|
||||
void stopAcquisition();
|
||||
|
||||
/** TODO: initially was getting acq flag, if set, check if detctor idle, then set, else exception & abort
|
||||
* Clears the acquiring flag. This has to be done manually
|
||||
* after an acquisition was aborted.
|
||||
*/
|
||||
|
||||
/** If acquisition aborted, use this to clear before starting next acquisition */
|
||||
void clearAcquiringFlag();
|
||||
|
||||
/** Non Blocking: Start receiver listener*/
|
||||
void startReceiver();
|
||||
|
||||
/** Non Blocking: Stop receiver listener */
|
||||
void stopReceiver();
|
||||
|
||||
/** Non blocking: start detector acquisition
|
||||
* detector status changes from RUNNING to IDLE when finished */
|
||||
void startDetector();
|
||||
|
||||
/** Non blocking: abort detector acquisition */
|
||||
void stopDetector();
|
||||
|
||||
Result<defs::runStatus> getDetectorStatus(Positions pos = {}) const;
|
||||
|
||||
Result<defs::runStatus> getReceiverStatus(Positions pos = {}) const;
|
||||
@ -337,8 +340,6 @@ class Detector {
|
||||
|
||||
/** module_id is -1 for all detectors, ports for each module is calculated
|
||||
* (increments) */
|
||||
// TODO if Parallel takes a vector, can send multiple vaues to set in
|
||||
// slsdetector.cp
|
||||
void setDestinationUDPPort(int port, int module_id = -1);
|
||||
|
||||
/** [Eiger right port][Jungfrau bottom half] */
|
||||
@ -397,7 +398,7 @@ class Detector {
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* RECEIVER CONFIG *
|
||||
* Receiver Config *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
@ -416,8 +417,10 @@ class Detector {
|
||||
|
||||
Result<int> getRxPort(Positions pos = {}) const;
|
||||
|
||||
/** Receiver TCP port (for client communication with Receiver) */
|
||||
void setRxPort(int value, Positions pos = {});
|
||||
/** Receiver TCP port (for client communication with Receiver)
|
||||
* module_id is -1 for all detectors, ports for each module is calculated
|
||||
* (increments) */
|
||||
void setRxPort(int port, int module_id = -1);
|
||||
|
||||
Result<int> getRxFifoDepth(Positions pos = {}) const;
|
||||
|
||||
@ -458,11 +461,11 @@ class Detector {
|
||||
/** locks receiver server to client IP */
|
||||
void setRxLock(bool value, Positions pos = {});
|
||||
|
||||
Result<std::string> getRxLastClientIP(Positions pos = {}) const;
|
||||
Result<sls::IpAddr> getRxLastClientIP(Positions pos = {}) const;
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* FILE *
|
||||
* File *
|
||||
* *
|
||||
* ************************************************/
|
||||
Result<defs::fileFormat> getFileFormat(Positions pos = {}) const;
|
||||
@ -483,9 +486,9 @@ class Detector {
|
||||
*/
|
||||
void setFileNamePrefix(const std::string &fname, Positions pos = {});
|
||||
|
||||
Result<int> getAcquisitionIndex(Positions pos = {}) const;
|
||||
Result<int64_t> getAcquisitionIndex(Positions pos = {}) const;
|
||||
|
||||
void setAcquisitionIndex(int i, Positions pos = {});
|
||||
void setAcquisitionIndex(int64_t i, Positions pos = {});
|
||||
|
||||
Result<bool> getFileWrite(Positions pos = {}) const;
|
||||
|
||||
@ -545,23 +548,23 @@ class Detector {
|
||||
*/
|
||||
void setRxZmqPort(int port, int module_id = -1);
|
||||
|
||||
Result<std::string> getRxZmqIP(Positions pos = {}) const;
|
||||
Result<IpAddr> getRxZmqIP(Positions pos = {}) const;
|
||||
|
||||
void setRxZmqIP(const std::string &ip, Positions pos = {});
|
||||
void setRxZmqIP(const IpAddr ip, Positions pos = {});
|
||||
|
||||
Result<int> getClientZmqPort(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* Needed only when using the client call back to get reconstructed data
|
||||
* from multi modules module_id is -1 for all detectors, ports for each
|
||||
* module is calculated (increments) Restarts client zmq sockets oonly if it
|
||||
* Modified only when using an intermediate process between receiver and gui/client.
|
||||
* Module_id is -1 for all detectors, ports for each
|
||||
* module is calculated (increments) Restarts client zmq sockets only if it
|
||||
* was already enabled
|
||||
*/
|
||||
void setClientZmqPort(int port, int module_id = -1);
|
||||
|
||||
Result<std::string> getClientZmqIp(Positions pos = {}) const;
|
||||
Result<IpAddr> getClientZmqIp(Positions pos = {}) const;
|
||||
|
||||
void setClientZmqIp(const std::string &ip, Positions pos = {});
|
||||
void setClientZmqIp(const IpAddr ip, Positions pos = {});
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
@ -599,10 +602,10 @@ class Detector {
|
||||
bool trimbits = true, Positions pos = {});
|
||||
|
||||
/** [Eiger] */
|
||||
Result<std::string> getSettingsDir(Positions pos = {}) const;
|
||||
Result<std::string> getSettingsPath(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger] */
|
||||
void setSettingsDir(const std::string &value, Positions pos = {});
|
||||
void setSettingsPath(const std::string &value, Positions pos = {});
|
||||
|
||||
/** [Eiger] */
|
||||
void loadTrimbits(const std::string &fname, Positions pos = {});
|
||||
@ -808,13 +811,15 @@ class Detector {
|
||||
* Can set only a single ROI at a time
|
||||
* @param module position index
|
||||
*/
|
||||
void setROI(defs::ROI value, int moduleId);
|
||||
void setROI(defs::ROI value, int module_id);
|
||||
|
||||
/** [Gotthard] TODO: check with jiaguo if he needs any of these functions //
|
||||
* TODO remove */
|
||||
/** [Gotthard] Clear ROI */
|
||||
void clearROI(Positions pos = {});
|
||||
|
||||
/** [Gotthard] */
|
||||
Result<ns> getExptimeLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard] TODO remove */
|
||||
/** [Gotthard] */
|
||||
Result<ns> getPeriodLeft(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard] */
|
||||
@ -904,12 +909,6 @@ class Detector {
|
||||
/** [CTB] */
|
||||
void setDBITPipeline(int value, Positions pos = {});
|
||||
|
||||
/** [CTB] */
|
||||
Result<int> getVrefVoltage(bool mV, Positions pos = {}) const;
|
||||
|
||||
/** [CTB] */
|
||||
void setVrefVoltage(int value, bool mV, Positions pos = {});
|
||||
|
||||
/** [CTB] */
|
||||
Result<int> getVoltage(defs::dacIndex index, Positions pos = {}) const;
|
||||
|
||||
@ -918,20 +917,17 @@ class Detector {
|
||||
* Options: V_LIMIT, V_POWER_A, V_POWER_B, V_POWER_C,
|
||||
* V_POWER_D, V_POWER_IO, V_POWER_CHIP
|
||||
*/
|
||||
void setVoltage(int value, defs::dacIndex index, Positions pos = {});
|
||||
void setVoltage(defs::dacIndex index, int value, Positions pos = {});
|
||||
|
||||
/**
|
||||
* [CTB] mV
|
||||
* Options: V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO,
|
||||
* V_POWER_CHIP
|
||||
*/
|
||||
* Options: V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO */
|
||||
Result<int> getMeasuredVoltage(defs::dacIndex index,
|
||||
Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* [CTB] mA
|
||||
* Options: I_POWER_A, I_POWER_B, I_POWER_C, I_POWER_D, I_POWER_IO
|
||||
*/
|
||||
* Options: I_POWER_A, I_POWER_B, I_POWER_C, I_POWER_D, I_POWER_IO */
|
||||
Result<int> getMeasuredCurrent(defs::dacIndex index,
|
||||
Positions pos = {}) const;
|
||||
|
||||
@ -990,7 +986,7 @@ class Detector {
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* PATTERN *
|
||||
* Pattern *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
@ -1012,6 +1008,9 @@ class Detector {
|
||||
/** [CTB] */
|
||||
void setPatternClockControl(uint64_t word, Positions pos = {});
|
||||
|
||||
/** [CTB] same as executing */
|
||||
Result<uint64_t> getPatternWord(int addr, Positions pos = {});
|
||||
|
||||
/** [CTB] Caution: If word is -1 reads the addr (same as
|
||||
* executing the pattern) */
|
||||
void setPatternWord(int addr, uint64_t word, Positions pos = {});
|
||||
@ -1178,7 +1177,7 @@ class Detector {
|
||||
void setDetectorLock(bool lock, Positions pos = {});
|
||||
|
||||
/** Get last client IP saved on detector server */
|
||||
Result<std::string> getLastClientIP(Positions pos = {}) const;
|
||||
Result<sls::IpAddr> getLastClientIP(Positions pos = {}) const;
|
||||
|
||||
/** Execute a command on the detector server console */
|
||||
void executeCommand(const std::string &value, Positions pos = {});
|
||||
|
@ -261,6 +261,12 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
|
||||
int getMultiId() const { return multiId; } // part of multi also
|
||||
|
||||
/**
|
||||
* Get package version (git branch)
|
||||
* @returns package version
|
||||
*/
|
||||
std::string getPackageVersion() const;
|
||||
|
||||
/**
|
||||
* Get Client Software version
|
||||
* @returns client software version
|
||||
@ -453,13 +459,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int lockServer(int p = -1, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Get last client IP saved on detector server
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns last client IP saved on detector server
|
||||
*/
|
||||
std::string getLastClientIP(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Exit detector server
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
@ -553,31 +552,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
void saveSettingsFile(const std::string &fname, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Get Detector run status
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns status
|
||||
*/
|
||||
runStatus getRunStatus(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Start detector acquisition (Non blocking)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void startAcquisition(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Stop detector acquisition
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void stopAcquisition(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Give an internal software trigger to the detector (Eiger only)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void sendSoftwareTrigger(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Configures in detector the destination for UDP packets
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
@ -669,12 +643,12 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
int64_t setNumberOfFrames(int64_t t = -1, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Set/get number of cycles
|
||||
* @param t number of cycles (-1 gets)
|
||||
* Set/get number of triggers
|
||||
* @param t number of triggers (-1 gets)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns number of cycles
|
||||
* @returns number of triggers
|
||||
*/
|
||||
int64_t setNumberOfCycles(int64_t t = -1, int detPos = -1); //
|
||||
int64_t setNumberOfTriggers(int64_t t = -1, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Set/get number of additional storage cells (Jungfrau)
|
||||
@ -929,45 +903,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int getReceiverStreamingPort(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* (advanced users)
|
||||
* Set/Get client streaming in ZMQ IP and restarts client sockets
|
||||
* @param i sets, empty string gets
|
||||
* By default, it is the IP of receiver hostname
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void setClientDataStreamingInIP(const std::string &ip = "",
|
||||
int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the client zmq ip
|
||||
* If detPos is -1(multi module), ip returns concatenation of all client
|
||||
* streaming ip
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the client zmq ip
|
||||
*/
|
||||
std::string getClientStreamingIP(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* (advanced users)
|
||||
* Set/Get receiver streaming out ZMQ IP and restarts receiver sockets
|
||||
* @param i sets, empty string gets
|
||||
* By default, it is the IP of receiver hostname
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void setReceiverDataStreamingOutIP(const std::string &ip = "",
|
||||
int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq ip
|
||||
* If detPos is -1(multi module), ip returns concatenation of all receiver
|
||||
* streaming ip
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the receiver zmq ip
|
||||
*/
|
||||
std::string getReceiverStreamingIP(int detPos = -1); //
|
||||
|
||||
/**
|
||||
/**
|
||||
* Sets the transmission delay for left, right or entire frame
|
||||
* (Eiger, Jungfrau(only entire frame))
|
||||
* @param index type of delay
|
||||
@ -1435,13 +1371,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int lockReceiver(int lock = -1, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Returns the IP of the last client connecting to the receiver
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns IP of last client connecting to receiver
|
||||
*/
|
||||
std::string getReceiverLastClientIP(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Turns off the receiver server!
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
@ -1541,7 +1470,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns file index
|
||||
*/
|
||||
int setFileIndex(int i, int detPos = -1); //
|
||||
int64_t setFileIndex(int64_t i, int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Get File index
|
||||
@ -1549,26 +1478,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* position
|
||||
* @returns file index
|
||||
*/
|
||||
int getFileIndex(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* Receiver starts listening to packets
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void startReceiver(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Stops the listening mode of receiver
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void stopReceiver(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Gets the status of the listening mode of receiver
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns status
|
||||
*/
|
||||
runStatus getReceiverStatus(int detPos = -1); //
|
||||
int64_t getFileIndex(int detPos = -1) const; //
|
||||
|
||||
/**
|
||||
* Gets the number of frames caught by receiver
|
||||
@ -1820,21 +1730,8 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
/**
|
||||
* Loads the detector setup from file
|
||||
* @param fname file to read from
|
||||
* @param level if 2 reads also reads trimbits, angular conversion
|
||||
* coefficients etc. from files with default extensions as generated by
|
||||
* dumpDetectorSetup
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int retrieveDetectorSetup(const std::string &fname, int level = 0);
|
||||
|
||||
/**
|
||||
* Saves the detector setup to file
|
||||
* @param fname file to write to
|
||||
* @param level if 2 reads also trimbits, flat field, angular correction
|
||||
* etc. and writes them to files with automatically added extension
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int dumpDetectorSetup(const std::string &fname, int level = 0);
|
||||
void loadParameters(const std::string &fname);
|
||||
|
||||
/**
|
||||
* register callback for accessing acquisition final data
|
||||
@ -1916,12 +1813,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
void updateUserdetails();
|
||||
|
||||
/**
|
||||
* Prepares detector for acquisition (Eiger)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void prepareAcquisition(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Check if acquiring flag is set, set error if set
|
||||
* @returns FAIL if not ready, OK if ready
|
||||
@ -1935,14 +1826,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
std::string exec(const char *cmd);
|
||||
|
||||
/**
|
||||
* Appends detectors to the end of the list in shared memory
|
||||
* Connects to them
|
||||
* @param name concatenated hostname of the sls detectors to be appended to
|
||||
* the list
|
||||
*/
|
||||
void addMultipleDetectors(const char *name); //
|
||||
|
||||
/**
|
||||
* Add sls detector
|
||||
* @param s hostname of the single detector
|
||||
@ -1960,7 +1843,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns the file index
|
||||
*/
|
||||
int incrementFileIndex(int detPos = -1);
|
||||
int64_t incrementFileIndex(int detPos = -1);
|
||||
|
||||
/**
|
||||
* add gap pixels to the image (only for Eiger in 4 bit mode)
|
||||
@ -2013,26 +1896,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
*/
|
||||
void startProcessingThread();
|
||||
|
||||
/**
|
||||
* Start detector acquisition and read all data (Blocking until end of
|
||||
* acquisition)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void startAndReadAll(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Start readout (without exposure or interrupting exposure) (Eiger store in
|
||||
* ram)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void startReadOut(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Requests and receives all data from the detector (Eiger store in ram)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
*/
|
||||
void readAll(int detPos = -1); //
|
||||
|
||||
/**
|
||||
* Check if processing thread is ready to join main thread
|
||||
* @returns true if ready, else false
|
||||
|
@ -148,7 +148,7 @@ struct sharedSlsDetector {
|
||||
char rxFileName[MAX_STR_LENGTH];
|
||||
|
||||
/** file index */
|
||||
int rxFileIndex;
|
||||
int64_t rxFileIndex;
|
||||
|
||||
/** file format */
|
||||
slsDetectorDefs::fileFormat rxFileFormat;
|
||||
@ -350,7 +350,7 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
* Get last client IP saved on detector server
|
||||
* @returns last client IP saved on detector server
|
||||
*/
|
||||
std::string getLastClientIP();
|
||||
sls::IpAddr getLastClientIP();
|
||||
|
||||
/**
|
||||
* Exit detector server
|
||||
@ -896,29 +896,32 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
|
||||
/**
|
||||
* Sets the client zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP client zmq ip
|
||||
* @param ip client zmq ip
|
||||
*/
|
||||
void setClientStreamingIP(const std::string &sourceIP);
|
||||
void setClientStreamingIP(const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* Returns the client zmq ip \sa sharedSlsDetector
|
||||
* @returns the client zmq ip, returns "none" if default setting and no
|
||||
* custom ip set
|
||||
* @returns the client zmq ip
|
||||
*/
|
||||
std::string getClientStreamingIP();
|
||||
sls::IpAddr getClientStreamingIP();
|
||||
|
||||
/**
|
||||
* Sets the receiver zmq ip\sa sharedSlsDetector
|
||||
* @param sourceIP receiver zmq ip. If empty, uses rx_hostname
|
||||
* @param ip receiver zmq ip
|
||||
*/
|
||||
void setReceiverStreamingIP(std::string sourceIP);
|
||||
void setReceiverStreamingIP(const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* Returns the receiver zmq ip \sa sharedSlsDetector
|
||||
* @returns the receiver zmq ip, returns "none" if default setting and no
|
||||
* custom ip set
|
||||
* @returns the receiver zmq ip
|
||||
*/
|
||||
std::string getReceiverStreamingIP();
|
||||
sls::IpAddr getReceiverStreamingIP();
|
||||
|
||||
/** update receiver stremaing ip from shm to receiver
|
||||
* if empty, use rx_hostname ip
|
||||
*/
|
||||
void updateReceiverStreamingIP();
|
||||
|
||||
/**
|
||||
* Sets the transmission delay for left, right or entire frame
|
||||
@ -1333,7 +1336,7 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
* Returns the IP of the last client connecting to the receiver
|
||||
* @returns the IP of the last client connecting to the receiver
|
||||
*/
|
||||
std::string getReceiverLastClientIP() const;
|
||||
sls::IpAddr getReceiverLastClientIP() const;
|
||||
|
||||
/**
|
||||
* Exits the receiver TCP server
|
||||
@ -1440,19 +1443,19 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
* @param i file index
|
||||
* @returns file index
|
||||
*/
|
||||
int setFileIndex(int file_index);
|
||||
int64_t setFileIndex(int64_t file_index);
|
||||
|
||||
/**
|
||||
* Gets the file index
|
||||
* @returns file index
|
||||
*/
|
||||
|
||||
int getFileIndex() const;
|
||||
int64_t getFileIndex() const;
|
||||
/**
|
||||
* increments file index
|
||||
* @returns the file index
|
||||
*/
|
||||
int incrementFileIndex();
|
||||
int64_t incrementFileIndex();
|
||||
|
||||
/**
|
||||
* Receiver starts listening to packets
|
||||
|
@ -42,40 +42,22 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
std::string helpLine(int narg, const char * const args[], int action=HELP_ACTION, int detPos = -1);
|
||||
static std::string helpAcquire(int action);
|
||||
static std::string helpData(int action);
|
||||
static std::string helpStatus(int action);
|
||||
static std::string helpDataStream(int action);
|
||||
static std::string helpFree(int action);
|
||||
static std::string helpHostname(int action);
|
||||
static std::string helpUser(int action);
|
||||
static std::string helpExitServer(int action);
|
||||
static std::string helpSettingsDir(int action);
|
||||
static std::string helpTrimEn(int action);
|
||||
static std::string helpOutDir(int action);
|
||||
static std::string helpFileName(int action);
|
||||
static std::string helpRateCorr(int action);
|
||||
static std::string helpThreaded(int action);
|
||||
static std::string helpNetworkParameter(int action);
|
||||
static std::string helpPort(int action);
|
||||
static std::string helpLastClient(int action);
|
||||
static std::string helpOnline(int action);
|
||||
static std::string helpDetectorSize(int action);
|
||||
static std::string helpSettings(int action);
|
||||
static std::string helpSN(int action);
|
||||
static std::string helpDigiTest(int action);
|
||||
static std::string helpRegister(int action);
|
||||
static std::string helpDAC(int action);
|
||||
static std::string helpTimer(int action);
|
||||
static std::string helpTiming(int action);
|
||||
static std::string helpTimeLeft(int action);
|
||||
static std::string helpSpeed(int action);
|
||||
static std::string helpAdvanced(int action);
|
||||
static std::string helpConfiguration(int action);
|
||||
static std::string helpCounter(int action);
|
||||
static std::string helpADC(int action);
|
||||
static std::string helpTempControl(int action);
|
||||
static std::string helpReceiver(int action);
|
||||
static std::string helpPattern(int action);
|
||||
static std::string helpPulse(int action);
|
||||
static std::string helpProcessor(int action);
|
||||
|
||||
private:
|
||||
@ -85,40 +67,22 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
std::string cmdUnknown(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdAcquire(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdData(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdStatus(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdDataStream(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdFree(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdHostname(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdUser(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdHelp(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdExitServer(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdSettingsDir(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdTrimEn(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdOutDir(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdFileName(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdRateCorr(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdNetworkParameter(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdPort(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdLastClient(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdOnline(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdDetectorSize(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdSettings(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdSN(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdDigiTest(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdRegister(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdDAC(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdTiming(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdTimer(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdTimeLeft(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdSpeed(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdAdvanced(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdConfiguration(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdCounter(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdADC(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdTempControl(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdReceiver(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdPattern(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdPulse(int narg, const char * const args[], int action, int detPos = -1);
|
||||
std::string cmdProcessor(int narg, const char * const args[], int action, int detPos = -1);
|
||||
|
||||
int numberOfCommands;
|
||||
|
@ -340,12 +340,12 @@ public:
|
||||
int64_t setNumberOfFrames(int64_t t = -1, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Set/get number of cycles
|
||||
* @param t number of cycles (-1 gets)
|
||||
* Set/get number of triggers
|
||||
* @param t number of triggers (-1 gets)
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns number of cycles
|
||||
* @returns number of triggers
|
||||
*/
|
||||
int64_t setNumberOfCycles(int64_t t = -1, int detPos = -1);
|
||||
int64_t setNumberOfTriggers(int64_t t = -1, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Set/get number of additional storage cells (Jungfrau)
|
||||
|
@ -1,54 +1,22 @@
|
||||
#include "CmdProxy.h"
|
||||
|
||||
|
||||
#include "TimeHelper.h"
|
||||
#include "ToString.h"
|
||||
#include "logger.h"
|
||||
#include "slsDetectorCommand.h"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "ToString.h"
|
||||
#include "TimeHelper.h"
|
||||
#include "container_utils.h"
|
||||
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#define TIME_COMMAND(GETFCN, SETFCN, HLPSTR) \
|
||||
std::ostringstream os; \
|
||||
os << cmd << ' '; \
|
||||
if (action == slsDetectorDefs::HELP_ACTION) \
|
||||
os << HLPSTR << '\n'; \
|
||||
else if (action == slsDetectorDefs::GET_ACTION) { \
|
||||
auto t = det->GETFCN({det_id}); \
|
||||
if (args.size() == 0) { \
|
||||
os << OutString(t) << '\n'; \
|
||||
} else if (args.size() == 1) { \
|
||||
os << OutString(t, args[0]) << '\n'; \
|
||||
} else { \
|
||||
WrongNumberOfParameters(2); \
|
||||
} \
|
||||
} else if (action == slsDetectorDefs::PUT_ACTION) { \
|
||||
if (args.size() == 1) { \
|
||||
std::string time_str(args[0]); \
|
||||
std::string unit = RemoveUnit(time_str); \
|
||||
auto t = StringTo<time::ns>(time_str, unit); \
|
||||
det->SETFCN(t, {det_id}); \
|
||||
} else if (args.size() == 2) { \
|
||||
auto t = StringTo<time::ns>(args[0], args[1]); \
|
||||
det->SETFCN(t, {det_id}); \
|
||||
} else { \
|
||||
WrongNumberOfParameters(2); \
|
||||
} \
|
||||
os << args << '\n'; \
|
||||
} else { \
|
||||
throw sls::RuntimeError("Unknown action"); \
|
||||
} \
|
||||
return os.str();
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
|
||||
namespace sls {
|
||||
|
||||
using defs = slsDetectorDefs;
|
||||
|
||||
std::ostream &operator<<(std::ostream &os,
|
||||
const std::vector<std::string> &vec) {
|
||||
if (!vec.empty()) {
|
||||
@ -121,26 +89,8 @@ void CmdProxy::WrongNumberOfParameters(size_t expected) {
|
||||
* *
|
||||
************************************************/
|
||||
|
||||
std::string CmdProxy::Period(int action) {
|
||||
TIME_COMMAND(getPeriod, setPeriod,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\tSet the period");
|
||||
}
|
||||
std::string CmdProxy::Exptime(int action) {
|
||||
TIME_COMMAND(
|
||||
getExptime, setExptime,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\tSet the exposure time");
|
||||
}
|
||||
std::string CmdProxy::SubExptime(int action) {
|
||||
TIME_COMMAND(getSubExptime, setSubExptime,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\tSet the "
|
||||
"exposure time of EIGER subframes");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
std::string CmdProxy::ListCommands(int action) {
|
||||
if (action == slsDetectorDefs::HELP_ACTION)
|
||||
if (action == defs::HELP_ACTION)
|
||||
return "list\n\tlists all available commands, list deprecated - "
|
||||
"list deprecated commands\n";
|
||||
|
||||
@ -181,7 +131,243 @@ std::string CmdProxy::ListCommands(int action) {
|
||||
}
|
||||
}
|
||||
|
||||
/* configuration */
|
||||
|
||||
std::string CmdProxy::Hostname(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "\n\tFrees shared memory and sets hostname (or IP address) of all modules concatenated by +." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getHostname({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() < 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot execute this at module level");
|
||||
}
|
||||
// only args[0], but many hostames concatenated with +
|
||||
if (args[0].find('+') != std::string::npos) {
|
||||
auto t = sls::split(args[0], '+');
|
||||
det->setHostname(t);
|
||||
os << ToString(t) << '\n';
|
||||
}
|
||||
// either hostnames separated by space, or single hostname
|
||||
else {
|
||||
det->setHostname(args);
|
||||
os << ToString(args) << '\n';
|
||||
}
|
||||
auto t = det->getHostname({det_id});
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::FirmwareVersion(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "\n\tFimware version of detector in format [0xYYMMDD] or integer for Eiger." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getFirmwareVersion({det_id});
|
||||
if (det->getDetectorType().squash() == defs::EIGER) {
|
||||
os << OutString(t) << '\n';
|
||||
} else {
|
||||
os << OutStringHex(t) << '\n';
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("cannot put");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Versions(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "\n\tPrint all versions and detector type" << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getFirmwareVersion();
|
||||
os << "\nDetector Type: " << OutString(det->getDetectorType())
|
||||
<< "\nPackage Version: " << det->getPackageVersion()
|
||||
<< std::hex
|
||||
<< "\nClient Version: 0x" << det->getClientVersion();
|
||||
if (det->getDetectorType().squash() == defs::EIGER) {
|
||||
os << "\nFirmware Version: " << OutString(t);
|
||||
} else {
|
||||
os << "\nFirmware Version: " << OutStringHex(t);
|
||||
}
|
||||
os << "\nDetector Server Version: " << OutStringHex(det->getDetectorServerVersion());
|
||||
if (det->getUseReceiverFlag().squash(true)) {
|
||||
os << "\nReceiver Version: " << OutStringHex(det->getReceiverVersion());
|
||||
}
|
||||
os << std::dec << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("cannot put");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::PackageVersion(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "\n\tPackage version (git branch)." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
os << det->getPackageVersion() << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("cannot put");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::ClientVersion(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "\n\tClient software version in format [0xYYMMDD]." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
os << ToStringHex(det->getClientVersion()) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("cannot put");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::DetectorSize(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[nx] [ny]\n\tDetector size, ie. Number of channels in x and y dim. If 0, then hostname adds all modules in y dim. This is used to calculate module coordinates included in UDP data packet header." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getDetectorSize();
|
||||
os << "[" << t.x << "," << t.y << "]\n";
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
defs::xy t;
|
||||
t.x = std::stoi(args[0]);
|
||||
t.y = std::stoi(args[1]);
|
||||
det->setDetectorSize(t);
|
||||
os << ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
std::string CmdProxy::Speed(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0 or full_speed|1 or half_speed|2 or quarter_speed]\n\t[Eiger][Jungfrau] Readout speed of chip.\n\tJungfrau also overwrites adcphase to recommended default. " << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getSpeed({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
defs::speedLevel t;
|
||||
try{
|
||||
int ival = std::stoi(args[0]);
|
||||
switch (ival) {
|
||||
case 0:
|
||||
t = defs::FULL_SPEED;
|
||||
break;
|
||||
case 1:
|
||||
t = defs::HALF_SPEED;
|
||||
break;
|
||||
case 2:
|
||||
t = defs::QUARTER_SPEED;
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError("Unknown speed " + args[0]);
|
||||
}
|
||||
} catch (...) {
|
||||
t = sls::StringTo<defs::speedLevel>(args[0]);
|
||||
}
|
||||
det->setSpeed(t, {det_id});
|
||||
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Adcphase(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_value] [(optional)deg]\n\t[Jungfrau][Ctb][Gotthard] Phase shift of ADC clock. \n\t[Jungfrau] Absolute phase shift. If deg used, then shift in degrees. Changing Speed also resets adcphase to recommended defaults.\n\t[Ctb] Absolute phase shift. If deg used, then shift in degrees. Changing adcclk also resets adcphase and sets it to previous values.\n\t[Gotthard] Relative phase shift" << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
Result<int> t;
|
||||
if (args.size() == 0) {
|
||||
t = det->getADCPhase({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
if (args[0] != "deg") {
|
||||
throw sls::RuntimeError("Unknown adcphase argument " + args[0] + ". Did you mean deg?");
|
||||
}
|
||||
t = det->getADCPhaseInDegrees({det_id});
|
||||
os << OutString(t) << " deg\n";
|
||||
} else {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setADCPhase(std::stoi(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else if (args.size() == 2) {
|
||||
if (args[1] != "deg") {
|
||||
throw sls::RuntimeError("Unknown adcphase 2nd argument " + args[1] + ". Did you mean deg?");
|
||||
}
|
||||
det->setADCPhaseInDegrees(std::stoi(args[0]), {det_id});
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::ClockFrequency(int action) {
|
||||
std::ostringstream os;
|
||||
@ -199,7 +385,6 @@ std::string CmdProxy::ClockFrequency(int action) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setClockFrequency(std::stoi(args[0]), std::stoi(args[1]));
|
||||
//TODO print args
|
||||
os << std::stoi(args[1]) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -280,11 +465,593 @@ std::string CmdProxy::ClockDivider(int action) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setClockDivider(std::stoi(args[0]), std::stoi(args[1]));
|
||||
//TODO print args
|
||||
os << std::stoi(args[1]) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* acquisition */
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
/* Receiver Config */
|
||||
/* File */
|
||||
/* ZMQ Streaming Parameters (Receiver<->Client) */
|
||||
/* Eiger Specific */
|
||||
|
||||
std::string CmdProxy::DynamicRange(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[4|8|16|32]\n\t[Eiger] Dynamic Range or number of bits per pixel in detector." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getDynamicRange({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot execute dynamic range at module level");
|
||||
}
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setDynamicRange(std::stoi(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Threshold(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[eV] [(optinal settings) standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2]\n\t[Eiger] Threshold in eV" << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getThresholdEnergy();
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setThresholdEnergy(std::stoi(args[0]), slsDetectorDefs::GET_SETTINGS, true, {det_id});
|
||||
} else if (args.size() == 2) {
|
||||
det->setThresholdEnergy(std::stoi(args[0]), sls::StringTo<slsDetectorDefs::detectorSettings>(args[1]), true, {det_id});
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
os << ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::ThresholdNoTb(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[eV] [(optional settings) standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2]\n\t[Eiger] Threshold in eV set without setting trimbits" << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setThresholdEnergy(std::stoi(args[0]), slsDetectorDefs::GET_SETTINGS, false, {det_id});
|
||||
} else if (args.size() == 2) {
|
||||
det->setThresholdEnergy(std::stoi(args[0]), sls::StringTo<slsDetectorDefs::detectorSettings>(args[1]), false, {det_id});
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
os << ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::GapPixels(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0, 1]\n\t[Eiger] Include Gap pixels in data file or data call back. 4 bit mode gap pixels only ind ata call back." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getRxAddGapPixels({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot execute dynamic range at module level");
|
||||
}
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setRxAddGapPixels(std::stoi(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::TrimEnergies(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[trim_ev1] [trim_Ev2 (optional)] [trim_ev3 (optional)] ...\n\t[Eiger] Number of trim energies and list of trim energies, where corresponding default trim files exist in corresponding trim folders." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getTrimEnergies({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() < 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
unsigned int ntrim = args.size();
|
||||
std::vector<int> t(ntrim);
|
||||
for (unsigned int i = 0; i < ntrim; ++i) {
|
||||
t[i] = std::stoi(args[i]);
|
||||
}
|
||||
det->setTrimEnergies(t, {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::RateCorrection(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_rate (in ns)]\n\t[Eiger] Dead time correction constant in ns. -1 will set to default tau of settings. 0 will unset rate correction." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getRateCorrection({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
int tau = std::stoi(args[0]);
|
||||
if (tau == -1) {
|
||||
det->setDefaultRateCorrection({det_id});
|
||||
auto t = det->getRateCorrection({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else {
|
||||
auto t = StringTo<time::ns>(args[0], "ns");
|
||||
det->setRateCorrection(t, {det_id});
|
||||
os << args.front() << "ns\n";
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Activate(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0, 1] [(optional) padding|nopadding]\n\t[Eiger] 1 is default. 0 deactivates readout and does not send data. \n\tPadding will pad data files for deactivates readouts." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getActive({det_id});
|
||||
auto p = det->getRxPadDeactivatedMode({det_id});
|
||||
Result<std::string> pResult(p.size());
|
||||
for (unsigned int i = 0; i < p.size(); ++i) {
|
||||
pResult[i] = p[i] ? "padding" : "nopadding";
|
||||
}
|
||||
os << OutString(t) << ' ' << OutString(pResult) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() < 1 || args.size() > 2 ) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
int t = std::stoi(args[0]);
|
||||
det->setActive(t, {det_id});
|
||||
os << args[0];
|
||||
if (args.size() == 2) {
|
||||
bool p = true;
|
||||
if (args[1] == "nopadding") {
|
||||
p = false;
|
||||
} else if (args[1] != "padding") {
|
||||
throw sls::RuntimeError("Unknown argument for deactivated padding.");
|
||||
}
|
||||
det->setRxPadDeactivatedMode(p, {det_id});
|
||||
os << ' ' << args[1];
|
||||
}
|
||||
os << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::PulsePixel(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_times] [x] [y]\n\t[Eiger] Pulse pixel n number of times at coordinates (x, y)." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 3) {
|
||||
WrongNumberOfParameters(3);
|
||||
}
|
||||
int n = std::stoi(args[0]);
|
||||
defs::xy c;
|
||||
c.x = std::stoi(args[1]);
|
||||
c.y = std::stoi(args[2]);
|
||||
det->pulsePixel(n, c, {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::PulsePixelAndMove(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_times] [x] [y]\n\t[Eiger] Pulse pixel n number of times and moves relatively by (x, y)." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 3) {
|
||||
WrongNumberOfParameters(3);
|
||||
}
|
||||
int n = std::stoi(args[0]);
|
||||
defs::xy c;
|
||||
c.x = std::stoi(args[1]);
|
||||
c.y = std::stoi(args[2]);
|
||||
det->pulsePixelNMove(n, c, {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::PulseChip(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_times] \n\t[Eiger] Pulse chip n times. If n is -1, resets to normal mode (reset chip completely at start of acquisition, where partialreset = 0)." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->pulseChip(std::stoi(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Quad(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0, 1]\n\t[Eiger] 0 is default. 1 sets detector size to a quad (Specific hardware required)." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getQuad({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (det_id != -1) {
|
||||
throw sls::RuntimeError("Cannot execute dynamic range at module level");
|
||||
}
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setQuad(std::stoi(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
/* Jungfrau Specific */
|
||||
|
||||
std::string CmdProxy::TemperatureEvent(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0]\n\t[Jungfrau] 1, if a temperature event occured. To clear this event, set it to 0.\n\tIf temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getTemperatureEvent({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
if (std::stoi(args[1]) != 0) {
|
||||
throw sls::RuntimeError("Unknown argument for temp event. Did you mean 0 to reset event?");
|
||||
}
|
||||
det->resetTemperatureEvent();
|
||||
os << "cleared" << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
/* Gotthard Specific */
|
||||
|
||||
std::string CmdProxy::ROI(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[xmin] [xmax] \n\t[Gotthard] Region of interest in detector. Either all channels or a single adc or 2 chips (256 channels). Default is all channels enabled (-1 -1). " << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getROI({det_id});
|
||||
for (auto &it : t) {
|
||||
os << '[' << it.xmin << ", " << it.xmax << "] \n";
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (det_id == -1) {
|
||||
throw sls::RuntimeError("Cannot execute ROI at multi module level");
|
||||
}
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
defs::ROI t;
|
||||
t.xmin = std::stoi(args[0]);
|
||||
t.xmax = std::stoi(args[1]);
|
||||
det->setROI(t, det_id);
|
||||
os << '[' << t.xmin << ", " << t.xmax << "] \n";
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::ClearROI(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "\n\t[Gotthard] Resets Region of interest in detector. All channels enabled. Default is all channels." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("Cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
det->clearROI({det_id});
|
||||
os << "[-1, -1] \n";
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/* Gotthard2 Specific */
|
||||
/* CTB Specific */
|
||||
|
||||
std::string CmdProxy::Samples(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_samples]\n\t[CTB] Number of samples (both analog and digitial) expected." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto a = det->getNumberOfAnalogSamples({det_id});
|
||||
auto d = det->getNumberOfDigitalSamples({det_id});
|
||||
int as = a.squash(-1);
|
||||
int ds = d.squash(-1);
|
||||
if (as == -1 || ds == -1 || as != ds) { // check if a == d?
|
||||
throw sls::RuntimeError("Different samples. Use asamples or dsamples.");
|
||||
}
|
||||
os << OutString(a) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setNumberOfAnalogSamples(std::stoi(args[0]));
|
||||
det->setNumberOfDigitalSamples(std::stoi(args[0]));
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Dbitphase(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_value] [(optional)deg]\n\t[Ctb] Phase shift of clock to latch digital bits. Absolute phase shift. If deg used, then shift in degrees. Changing dbitclk also resets dbitphase and sets to previous values." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
Result<int> t;
|
||||
if (args.size() == 0) {
|
||||
t = det->getDBITPhase({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
if (args[0] != "deg") {
|
||||
throw sls::RuntimeError("Unknown dbitphase argument " + args[0] + ". Did you mean deg?");
|
||||
}
|
||||
t = det->getDBITPhaseInDegrees({det_id});
|
||||
os << OutString(t) << " deg\n";
|
||||
} else {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
det->setDBITPhase(std::stoi(args[0]), {det_id});
|
||||
os << args.front() << '\n';
|
||||
} else if (args.size() == 2) {
|
||||
if (args[1] != "deg") {
|
||||
throw sls::RuntimeError("Unknown dbitphase 2nd argument " + args[1] + ". Did you mean deg?");
|
||||
}
|
||||
det->setDBITPhaseInDegrees(std::stoi(args[0]), {det_id});
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::SlowAdc(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_channel (0-7 for channel|8 for temperature)]\n\t[Ctb] Slow ADC channel." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
int nchan = std::stoi(args[0]);
|
||||
if (nchan < 0 || nchan > defs::SLOW_ADC_TEMP - defs::SLOW_ADC0) {
|
||||
throw sls::RuntimeError("Unknown adc argument " + args[0]);
|
||||
}
|
||||
if (nchan == 8) {
|
||||
auto t = det->getTemperature(defs::SLOW_ADC_TEMP, {det_id});
|
||||
os << OutString(t) << " °C\n";
|
||||
} else {
|
||||
auto t = det->getSlowADC(static_cast<defs::dacIndex>(nchan + defs::SLOW_ADC0));
|
||||
os << OutString(t) << '\n';
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw sls::RuntimeError("cannot put");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
std::string CmdProxy::ReceiverDbitList(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[all] or [i0] [i1] [i2]... \n\t[Ctb] List of digital signal bits read out. If all is used instead of a list, all digital bits (64) enabled. Each element in list can be 0 - 63 and non repetitive." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 0) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getRxDbitList({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() < 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
std::vector<int> t;
|
||||
if (args[0] == "all") {
|
||||
t.resize(64);
|
||||
for (unsigned int i = 0; i < 64; ++i) {
|
||||
t[i] = i;
|
||||
}
|
||||
} else {
|
||||
unsigned int ntrim = args.size();
|
||||
t.resize(ntrim);
|
||||
for (unsigned int i = 0; i < ntrim; ++i) {
|
||||
t[i] = std::stoi(args[i]);
|
||||
}
|
||||
}
|
||||
det->setRxDbitList(t, {det_id});
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::DigitalIODelay(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[64 bit bitmask] [0-775]\n\t[Ctb] Delay for digital IO pins selected by the bitmask. Delay is in ps and max of 775 ps. Resolution is 25 ps." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("Cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setDigitalIODelay(std::stoul(args[0]), std::stoi(args[2]));
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
/* Pattern */
|
||||
|
||||
std::string CmdProxy::Pattern(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[fname]\n\t[Ctb] Loads binary pattern file with only pattern words" << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("Cannot get");
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
det->setPattern(args[0]);
|
||||
os << args.front() << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::PatternWord(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[step or address] [64 bit mask]\n\t[Ctb] 64 bit pattern at address of pattern memory." << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getPatternWord(std::stoi(args[0]), {det_id});
|
||||
os << OutStringHex(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setPatternWord(std::stoi(args[0]), std::stoul(args[1]));
|
||||
os << sls::ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
} // namespace sls
|
@ -22,11 +22,7 @@ void Detector::loadConfig(const std::string &fname) {
|
||||
}
|
||||
|
||||
void Detector::loadParameters(const std::string &fname) {
|
||||
pimpl->retrieveDetectorSetup(fname, 0);
|
||||
}
|
||||
|
||||
void Detector::savePattern(const std::string &fname) {
|
||||
pimpl->savePattern(fname);
|
||||
pimpl->loadParameters(fname);
|
||||
}
|
||||
|
||||
Result<std::string> Detector::getHostname(Positions pos) const {
|
||||
@ -39,6 +35,14 @@ void Detector::setHostname(const std::vector<std::string> &value) {
|
||||
|
||||
int Detector::getShmId() const { return pimpl->getMultiId(); }
|
||||
|
||||
std::string Detector::getPackageVersion() const {
|
||||
return pimpl->getPackageVersion();
|
||||
}
|
||||
|
||||
int64_t Detector::getClientVersion() const {
|
||||
return pimpl->getClientSoftwareVersion();
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getFirmwareVersion(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getId, pos,
|
||||
defs::DETECTOR_FIRMWARE_VERSION);
|
||||
@ -54,10 +58,6 @@ Result<int64_t> Detector::getSerialNumber(Positions pos) const {
|
||||
defs::DETECTOR_SERIAL_NUMBER);
|
||||
}
|
||||
|
||||
int64_t Detector::getClientVersion() const {
|
||||
return pimpl->getClientSoftwareVersion();
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getReceiverVersion(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverSoftwareVersion, pos);
|
||||
}
|
||||
@ -117,11 +117,11 @@ void Detector::setNumberOfFrames(int64_t value) {
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfTriggers() const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, {}, defs::CYCLES_NUMBER, -1);
|
||||
return pimpl->Parallel(&slsDetector::setTimer, {}, defs::TRIGGER_NUMBER, -1);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfTriggers(int64_t value) {
|
||||
pimpl->Parallel(&slsDetector::setTimer, {}, defs::CYCLES_NUMBER, value);
|
||||
pimpl->Parallel(&slsDetector::setTimer, {}, defs::TRIGGER_NUMBER, value);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptime(Positions pos) const {
|
||||
@ -157,7 +157,7 @@ Result<int64_t> Detector::getNumberOfFramesLeft(Positions pos) const {
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getNumberOfTriggersLeft(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::CYCLES_NUMBER);
|
||||
return pimpl->Parallel(&slsDetector::getTimeLeft, pos, defs::TRIGGER_NUMBER);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getDelayAfterTriggerLeft(Positions pos) const {
|
||||
@ -246,7 +246,7 @@ Result<int> Detector::getDAC(defs::dacIndex index, bool mV,
|
||||
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, index, mV);
|
||||
}
|
||||
|
||||
void Detector::setDAC(int value, defs::dacIndex index, bool mV, Positions pos) {
|
||||
void Detector::setDAC(defs::dacIndex index, int value, bool mV, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDAC, pos, value, index, mV);
|
||||
}
|
||||
|
||||
@ -263,20 +263,27 @@ void Detector::setTimingMode(defs::timingMode value, Positions pos) {
|
||||
|
||||
void Detector::acquire() { pimpl->acquire(); }
|
||||
|
||||
void Detector::startAcquisition() {
|
||||
if (getUseReceiverFlag().squash(true))
|
||||
pimpl->Parallel(&slsDetector::startReceiver, {});
|
||||
void Detector::clearAcquiringFlag() { pimpl->setAcquiringFlag(0); }
|
||||
|
||||
void Detector::startReceiver() {
|
||||
pimpl->Parallel(&slsDetector::startReceiver, {});
|
||||
}
|
||||
|
||||
void Detector::stopReceiver() {
|
||||
pimpl->Parallel(&slsDetector::stopReceiver, {});
|
||||
}
|
||||
|
||||
void Detector::startDetector() {
|
||||
if (getDetectorType({}).squash() == defs::EIGER) {
|
||||
pimpl->Parallel(&slsDetector::prepareAcquisition, {});
|
||||
}
|
||||
pimpl->Parallel(&slsDetector::startAcquisition, {});
|
||||
}
|
||||
|
||||
void Detector::stopAcquisition() {
|
||||
void Detector::stopDetector() {
|
||||
pimpl->Parallel(&slsDetector::stopAcquisition, {});
|
||||
if (getUseReceiverFlag().squash(true))
|
||||
pimpl->Parallel(&slsDetector::stopReceiver, {});
|
||||
}
|
||||
|
||||
void Detector::clearAcquiringFlag() { pimpl->setAcquiringFlag(0); }
|
||||
|
||||
Result<defs::runStatus> Detector::getDetectorStatus(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getRunStatus, pos);
|
||||
}
|
||||
@ -497,8 +504,19 @@ Result<int> Detector::getRxPort(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverPort, pos);
|
||||
}
|
||||
|
||||
void Detector::setRxPort(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverPort, pos, value);
|
||||
void Detector::setRxPort(int port, int module_id) {
|
||||
if (module_id == -1) {
|
||||
std::vector<int> port_list(size());
|
||||
for (auto &it: port_list) {
|
||||
it = port++;
|
||||
}
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
pimpl->Parallel(&slsDetector::setReceiverPort, {idet},
|
||||
port_list[idet]);
|
||||
}
|
||||
} else {
|
||||
pimpl->Parallel(&slsDetector::setReceiverPort, {module_id}, port);
|
||||
}
|
||||
}
|
||||
|
||||
Result<int> Detector::getRxFifoDepth(Positions pos) const {
|
||||
@ -559,7 +577,7 @@ void Detector::setRxLock(bool value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::lockReceiver, pos, static_cast<int>(value));
|
||||
}
|
||||
|
||||
Result<std::string> Detector::getRxLastClientIP(Positions pos) const {
|
||||
Result<sls::IpAddr> Detector::getRxLastClientIP(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverLastClientIP, pos);
|
||||
}
|
||||
|
||||
@ -589,11 +607,11 @@ void Detector::setFileNamePrefix(const std::string &fname, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setFileName, pos, fname);
|
||||
}
|
||||
|
||||
Result<int> Detector::getAcquisitionIndex(Positions pos) const {
|
||||
Result<int64_t> Detector::getAcquisitionIndex(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getFileIndex, pos);
|
||||
}
|
||||
|
||||
void Detector::setAcquisitionIndex(int i, Positions pos) {
|
||||
void Detector::setAcquisitionIndex(int64_t i, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setFileIndex, pos, i);
|
||||
}
|
||||
|
||||
@ -675,11 +693,11 @@ void Detector::setRxZmqPort(int port, int module_id) {
|
||||
}
|
||||
}
|
||||
|
||||
Result<std::string> Detector::getRxZmqIP(Positions pos) const {
|
||||
Result<IpAddr> Detector::getRxZmqIP(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getReceiverStreamingIP, pos);
|
||||
}
|
||||
|
||||
void Detector::setRxZmqIP(const std::string &ip, Positions pos) {
|
||||
void Detector::setRxZmqIP(const IpAddr ip, Positions pos) {
|
||||
bool previouslyReceiverStreaming = getRxZmqDataStream(pos).squash(false);
|
||||
pimpl->Parallel(&slsDetector::setReceiverStreamingIP, pos, ip);
|
||||
if (previouslyReceiverStreaming) {
|
||||
@ -705,11 +723,11 @@ void Detector::setClientZmqPort(int port, int module_id) {
|
||||
}
|
||||
}
|
||||
|
||||
Result<std::string> Detector::getClientZmqIp(Positions pos) const {
|
||||
Result<IpAddr> Detector::getClientZmqIp(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getClientStreamingIP, pos);
|
||||
}
|
||||
|
||||
void Detector::setClientZmqIp(const std::string &ip, Positions pos) {
|
||||
void Detector::setClientZmqIp(const IpAddr ip, Positions pos) {
|
||||
int previouslyClientStreaming = pimpl->enableDataStreamingToClient(-1);
|
||||
pimpl->Parallel(&slsDetector::setClientStreamingIP, pos, ip);
|
||||
if (previouslyClientStreaming != 0) {
|
||||
@ -757,11 +775,11 @@ void Detector::setThresholdEnergy(int threshold_ev,
|
||||
settings, static_cast<int>(trimbits));
|
||||
}
|
||||
|
||||
Result<std::string> Detector::getSettingsDir(Positions pos) const {
|
||||
Result<std::string> Detector::getSettingsPath(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getSettingsDir, pos);
|
||||
}
|
||||
|
||||
void Detector::setSettingsDir(const std::string &value, Positions pos) {
|
||||
void Detector::setSettingsPath(const std::string &value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSettingsDir, pos, value);
|
||||
}
|
||||
|
||||
@ -882,7 +900,12 @@ void Detector::setRxPadDeactivatedMode(bool pad, Positions pos) {
|
||||
}
|
||||
|
||||
Result<bool> Detector::getPartialReset(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setCounterBit, pos, -1);
|
||||
auto res = pimpl->Parallel(&slsDetector::setCounterBit, pos, -1);
|
||||
Result<bool> t(res.size());
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
t[i] = !res[i];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
void Detector::setPartialReset(bool value, Positions pos) {
|
||||
@ -943,7 +966,7 @@ Result<bool> Detector::getPowerChip(Positions pos) const {
|
||||
}
|
||||
|
||||
void Detector::setPowerChip(bool on, Positions pos) {
|
||||
if (on && pimpl->size() > 3) {
|
||||
if ((pos.empty() || pos[0] == -1) && on && pimpl->size() > 3) {
|
||||
for (unsigned int i = 0; i != pimpl->size(); ++i) {
|
||||
pimpl->powerChip(static_cast<int>(on), i);
|
||||
usleep(1000 * 1000);
|
||||
@ -996,11 +1019,15 @@ Result<defs::ROI> Detector::getROI(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getROI, pos);
|
||||
}
|
||||
|
||||
void Detector::setROI(defs::ROI value, int moduleId) {
|
||||
if (moduleId < 0 && size() > 1) {
|
||||
void Detector::setROI(defs::ROI value, int module_id) {
|
||||
if (module_id < 0 && size() > 1) {
|
||||
throw RuntimeError("Cannot set ROI for all modules simultaneously");
|
||||
}
|
||||
pimpl->Parallel(&slsDetector::setROI, {moduleId}, value);
|
||||
pimpl->Parallel(&slsDetector::setROI, {module_id}, value);
|
||||
}
|
||||
|
||||
void Detector::clearROI(Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::clearROI, pos);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptimeLeft(Positions pos) const {
|
||||
@ -1136,14 +1163,6 @@ void Detector::setDBITPipeline(int value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::DBIT_PIPELINE, value, 0);
|
||||
}
|
||||
|
||||
Result<int> Detector::getVrefVoltage(bool mV, Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, defs::ADC_VPP, mV);
|
||||
}
|
||||
|
||||
void Detector::setVrefVoltage(int value, bool mV, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setDAC, pos, value, defs::ADC_VPP, mV);
|
||||
}
|
||||
|
||||
Result<int> Detector::getVoltage(defs::dacIndex index, Positions pos) const {
|
||||
switch (index) {
|
||||
case defs::V_LIMIT:
|
||||
@ -1160,7 +1179,7 @@ Result<int> Detector::getVoltage(defs::dacIndex index, Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setDAC, pos, -1, index, 1);
|
||||
}
|
||||
|
||||
void Detector::setVoltage(int value, defs::dacIndex index, Positions pos) {
|
||||
void Detector::setVoltage(defs::dacIndex index, int value, Positions pos) {
|
||||
switch (index) {
|
||||
case defs::V_LIMIT:
|
||||
case defs::V_POWER_A:
|
||||
@ -1276,6 +1295,10 @@ void Detector::setLEDEnable(bool enable, Positions pos) {
|
||||
|
||||
// Pattern
|
||||
|
||||
void Detector::savePattern(const std::string &fname) {
|
||||
pimpl->savePattern(fname);
|
||||
}
|
||||
|
||||
void Detector::setPattern(const std::string &fname, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setPattern, pos, fname);
|
||||
}
|
||||
@ -1296,6 +1319,10 @@ void Detector::setPatternClockControl(uint64_t word, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setPatternClockControl, pos, word);
|
||||
}
|
||||
|
||||
Result<uint64_t> Detector::getPatternWord(int addr, Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::setPatternWord, pos, addr, -1);
|
||||
}
|
||||
|
||||
void Detector::setPatternWord(int addr, uint64_t word, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setPatternWord, pos, addr, word);
|
||||
}
|
||||
@ -1369,7 +1396,7 @@ Result<int> Detector::getDetectorMinMaxEnergyThreshold(const bool isEmax,
|
||||
Positions pos) const {
|
||||
auto res = pimpl->Parallel(&slsDetector::getAdditionalJsonParameter, pos,
|
||||
isEmax ? "emax" : "emin");
|
||||
Result<int> intResult;
|
||||
Result<int> intResult(res.size());
|
||||
try {
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
intResult[i] = stoi(res[i]);
|
||||
@ -1391,7 +1418,7 @@ void Detector::setDetectorMinMaxEnergyThreshold(const bool isEmax,
|
||||
Result<int> Detector::getFrameMode(Positions pos) const {
|
||||
auto res = pimpl->Parallel(&slsDetector::getAdditionalJsonParameter, pos,
|
||||
"frameMode");
|
||||
Result<int> intResult;
|
||||
Result<int> intResult(res.size());
|
||||
try {
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
intResult[i] = defs::getFrameModeType(res[i]);
|
||||
@ -1411,7 +1438,7 @@ void Detector::setFrameMode(defs::frameModeType value, Positions pos) {
|
||||
Result<int> Detector::getDetectorMode(Positions pos) const {
|
||||
auto res = pimpl->Parallel(&slsDetector::getAdditionalJsonParameter, pos,
|
||||
"detectorMode");
|
||||
Result<int> intResult;
|
||||
Result<int> intResult(res.size());
|
||||
try {
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
intResult[i] = defs::getDetectorModeType(res[i]);
|
||||
@ -1516,7 +1543,7 @@ void Detector::setDetectorLock(bool lock, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::lockServer, pos, static_cast<int>(lock));
|
||||
}
|
||||
|
||||
Result<std::string> Detector::getLastClientIP(Positions pos) const {
|
||||
Result<sls::IpAddr> Detector::getLastClientIP(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getLastClientIP, pos);
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "container_utils.h"
|
||||
#include "network_utils.h"
|
||||
#include "string_utils.h"
|
||||
#include "ToString.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
@ -164,6 +165,8 @@ int64_t multiSlsDetector::getId(idMode mode, int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getPackageVersion() const { return GITBRANCH; }
|
||||
|
||||
int64_t multiSlsDetector::getClientSoftwareVersion() const { return APILIB; }
|
||||
|
||||
int64_t multiSlsDetector::getReceiverSoftwareVersion(int detPos) {
|
||||
@ -240,8 +243,7 @@ std::string multiSlsDetector::getUserDetails() {
|
||||
sstream << "\nType: ";
|
||||
// get type from multi shm
|
||||
if (multi_shm()->shmversion >= MULTI_SHMAPIVERSION) {
|
||||
sstream << slsDetectorDefs::detectorTypeToString(
|
||||
getDetectorTypeAsEnum());
|
||||
sstream << ToString(getDetectorTypeAsEnum());
|
||||
}
|
||||
// get type from slsdet shm
|
||||
else {
|
||||
@ -396,7 +398,10 @@ void multiSlsDetector::setHostname(const char *name, int detPos) {
|
||||
freeSharedMemory();
|
||||
setupMultiDetector();
|
||||
}
|
||||
addMultipleDetectors(name);
|
||||
for (const auto &hostname : sls::split(name, '+')) {
|
||||
addSlsDetector(hostname);
|
||||
}
|
||||
updateDetectorSize();
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getHostname(int detPos) const {
|
||||
@ -410,15 +415,9 @@ std::string multiSlsDetector::getHostname(int detPos) const {
|
||||
return sls::concatenateNonEmptyStrings(r);
|
||||
}
|
||||
|
||||
void multiSlsDetector::addMultipleDetectors(const char *name) {
|
||||
for (const auto &hostname : sls::split(name, '+')) {
|
||||
addSlsDetector(hostname);
|
||||
}
|
||||
updateDetectorSize();
|
||||
}
|
||||
|
||||
void multiSlsDetector::addSlsDetector(const std::string &hostname) {
|
||||
FILE_LOG(logDEBUG1) << "Adding detector " << hostname;
|
||||
FILE_LOG(logINFO) << "Adding detector " << hostname;
|
||||
|
||||
int port = DEFAULT_PORTNO;
|
||||
std::string host = hostname;
|
||||
@ -622,13 +621,6 @@ int multiSlsDetector::lockServer(int p, int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getLastClientIP(int detPos) {
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getLastClientIP();
|
||||
}
|
||||
auto r = parallelCall(&slsDetector::getLastClientIP);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
void multiSlsDetector::exitServer(int detPos) {
|
||||
if (detPos >= 0) {
|
||||
@ -650,7 +642,7 @@ void multiSlsDetector::readConfigurationFile(const std::string &fname) {
|
||||
FILE_LOG(logINFO) << "Loading configuration file: " << fname;
|
||||
|
||||
std::ifstream input_file;
|
||||
input_file.open(fname, std::ios_base::in);
|
||||
input_file.open(fname.c_str(), std::ios_base::in);
|
||||
if (!input_file.is_open()) {
|
||||
throw RuntimeError("Could not open configuration file " + fname +
|
||||
" for reading");
|
||||
@ -664,7 +656,7 @@ void multiSlsDetector::readConfigurationFile(const std::string &fname) {
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "current_line after removing comments:\n\t" << current_line;
|
||||
if (current_line.length() > 1) {
|
||||
multiSlsDetectorClient(current_line, PUT_ACTION, this);
|
||||
multiSlsDetectorClient(current_line, PUT_ACTION, nullptr);
|
||||
}
|
||||
}
|
||||
input_file.close();
|
||||
@ -787,118 +779,6 @@ void multiSlsDetector::saveSettingsFile(const std::string &fname, int detPos) {
|
||||
parallelCall(&slsDetector::saveSettingsFile, fname);
|
||||
}
|
||||
|
||||
slsDetectorDefs::runStatus multiSlsDetector::getRunStatus(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getRunStatus();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::getRunStatus);
|
||||
if (sls::allEqual(r)) {
|
||||
return r.front();
|
||||
}
|
||||
if (sls::anyEqualTo(r, ERROR)) {
|
||||
return ERROR;
|
||||
}
|
||||
for (const auto &value : r) {
|
||||
if (value != IDLE) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return IDLE;
|
||||
}
|
||||
|
||||
void multiSlsDetector::prepareAcquisition(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->prepareAcquisition();
|
||||
}
|
||||
|
||||
// multi
|
||||
parallelCall(&slsDetector::prepareAcquisition);
|
||||
}
|
||||
|
||||
void multiSlsDetector::startAcquisition(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
if (detectors[detPos]->getDetectorTypeAsEnum() == EIGER) {
|
||||
detectors[detPos]->prepareAcquisition();
|
||||
}
|
||||
detectors[detPos]->startAcquisition();
|
||||
}
|
||||
|
||||
// multi
|
||||
if (getDetectorTypeAsEnum() == EIGER) {
|
||||
prepareAcquisition();
|
||||
}
|
||||
parallelCall(&slsDetector::startAcquisition);
|
||||
}
|
||||
|
||||
void multiSlsDetector::stopAcquisition(int detPos) {
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->stopAcquisition();
|
||||
} else {
|
||||
parallelCall(&slsDetector::stopAcquisition);
|
||||
}
|
||||
}
|
||||
|
||||
void multiSlsDetector::sendSoftwareTrigger(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->sendSoftwareTrigger();
|
||||
}
|
||||
|
||||
// multi
|
||||
parallelCall(&slsDetector::sendSoftwareTrigger);
|
||||
}
|
||||
|
||||
void multiSlsDetector::startAndReadAll(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
if (detectors[detPos]->getDetectorTypeAsEnum() == EIGER) {
|
||||
detectors[detPos]->prepareAcquisition();
|
||||
}
|
||||
detectors[detPos]->startAndReadAll();
|
||||
}
|
||||
|
||||
// multi
|
||||
if (getDetectorTypeAsEnum() == EIGER) {
|
||||
prepareAcquisition();
|
||||
}
|
||||
parallelCall(&slsDetector::startAndReadAll);
|
||||
}
|
||||
|
||||
void multiSlsDetector::startReadOut(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->startReadOut();
|
||||
}
|
||||
|
||||
// multi
|
||||
parallelCall(&slsDetector::startReadOut);
|
||||
}
|
||||
|
||||
void multiSlsDetector::readAll(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->readAll();
|
||||
}
|
||||
|
||||
// multi
|
||||
parallelCall(&slsDetector::readAll);
|
||||
}
|
||||
/*
|
||||
void multiSlsDetector::configureMAC(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->configureMAC();
|
||||
}
|
||||
|
||||
// multi
|
||||
parallelCall(&slsDetector::configureMAC);
|
||||
}
|
||||
*/
|
||||
|
||||
void multiSlsDetector::setStartingFrameNumber(const uint64_t value,
|
||||
int detPos) {
|
||||
@ -994,8 +874,8 @@ int64_t multiSlsDetector::setNumberOfFrames(int64_t t, int detPos) {
|
||||
return setTimer(FRAME_NUMBER, t, detPos);
|
||||
}
|
||||
|
||||
int64_t multiSlsDetector::setNumberOfCycles(int64_t t, int detPos) {
|
||||
return setTimer(CYCLES_NUMBER, t, detPos);
|
||||
int64_t multiSlsDetector::setNumberOfTriggers(int64_t t, int detPos) {
|
||||
return setTimer(TRIGGER_NUMBER, t, detPos);
|
||||
}
|
||||
|
||||
int64_t multiSlsDetector::setNumberOfStorageCells(int64_t t, int detPos) {
|
||||
@ -1436,74 +1316,6 @@ int multiSlsDetector::getReceiverStreamingPort(int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
void multiSlsDetector::setClientDataStreamingInIP(const std::string &ip,
|
||||
int detPos) {
|
||||
if (ip.length() != 0u) {
|
||||
bool prev_streaming = enableDataStreamingToClient(-1);
|
||||
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->setClientStreamingIP(ip);
|
||||
}
|
||||
// multi
|
||||
else {
|
||||
for (auto &d : detectors) {
|
||||
d->setClientStreamingIP(ip);
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming) {
|
||||
enableDataStreamingToClient(0);
|
||||
enableDataStreamingToClient(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getClientStreamingIP(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getClientStreamingIP();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getClientStreamingIP);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
void multiSlsDetector::setReceiverDataStreamingOutIP(const std::string &ip,
|
||||
int detPos) {
|
||||
if (ip.length() != 0u) {
|
||||
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
|
||||
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->setReceiverStreamingIP(ip);
|
||||
}
|
||||
// multi
|
||||
else {
|
||||
for (auto &d : detectors) {
|
||||
d->setReceiverStreamingIP(ip);
|
||||
}
|
||||
}
|
||||
|
||||
if (prev_streaming != 0) {
|
||||
enableDataStreamingFromReceiver(0, detPos);
|
||||
enableDataStreamingFromReceiver(1, detPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getReceiverStreamingIP(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverStreamingIP();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = serialCall(&slsDetector::getReceiverStreamingIP);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setDetectorNetworkParameter(networkParameter index,
|
||||
int value, int detPos) {
|
||||
// single
|
||||
@ -2209,16 +2021,7 @@ int multiSlsDetector::lockReceiver(int lock, int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
std::string multiSlsDetector::getReceiverLastClientIP(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverLastClientIP();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::getReceiverLastClientIP);
|
||||
return sls::concatenateIfDifferent(r);
|
||||
}
|
||||
|
||||
void multiSlsDetector::exitReceiver(int detPos) {
|
||||
// single
|
||||
@ -2360,7 +2163,7 @@ slsDetectorDefs::fileFormat multiSlsDetector::setFileFormat(fileFormat f,
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::incrementFileIndex(int detPos) {
|
||||
int64_t multiSlsDetector::incrementFileIndex(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->incrementFileIndex();
|
||||
@ -2371,7 +2174,7 @@ int multiSlsDetector::incrementFileIndex(int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setFileIndex(int i, int detPos) {
|
||||
int64_t multiSlsDetector::setFileIndex(int64_t i, int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->setFileIndex(i);
|
||||
@ -2382,54 +2185,13 @@ int multiSlsDetector::setFileIndex(int i, int detPos) {
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
int multiSlsDetector::getFileIndex(int detPos) const {
|
||||
int64_t multiSlsDetector::getFileIndex(int detPos) const {
|
||||
if (detPos >= 0)
|
||||
return detectors[detPos]->getFileIndex();
|
||||
auto r = parallelCall(&slsDetector::getFileIndex);
|
||||
return sls::minusOneIfDifferent(r);
|
||||
}
|
||||
|
||||
void multiSlsDetector::startReceiver(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->startReceiver();
|
||||
}
|
||||
|
||||
// multi
|
||||
parallelCall(&slsDetector::startReceiver);
|
||||
}
|
||||
|
||||
void multiSlsDetector::stopReceiver(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
detectors[detPos]->stopReceiver();
|
||||
}
|
||||
|
||||
// multi
|
||||
parallelCall(&slsDetector::stopReceiver);
|
||||
}
|
||||
|
||||
slsDetectorDefs::runStatus multiSlsDetector::getReceiverStatus(int detPos) {
|
||||
// single
|
||||
if (detPos >= 0) {
|
||||
return detectors[detPos]->getReceiverStatus();
|
||||
}
|
||||
|
||||
// multi
|
||||
auto r = parallelCall(&slsDetector::getReceiverStatus);
|
||||
if (sls::allEqual(r)) {
|
||||
return r.front();
|
||||
}
|
||||
if (sls::anyEqualTo(r, ERROR)) {
|
||||
return ERROR;
|
||||
}
|
||||
for (const auto &value : r) {
|
||||
if (value != IDLE) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return IDLE;
|
||||
}
|
||||
|
||||
int multiSlsDetector::getFramesCaughtByReceiver(int detPos) {
|
||||
// single
|
||||
@ -2508,7 +2270,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
||||
try {
|
||||
zmqSocket.push_back(sls::make_unique<ZmqSocket>(
|
||||
detectors[iSocket / numSocketsPerDetector]
|
||||
->getClientStreamingIP()
|
||||
->getClientStreamingIP().str()
|
||||
.c_str(),
|
||||
portnum));
|
||||
FILE_LOG(logINFO) << "Zmq Client[" << iSocket << "] at "
|
||||
@ -3245,190 +3007,28 @@ void multiSlsDetector::setDigitalIODelay(uint64_t pinMask, int delay,
|
||||
parallelCall(&slsDetector::setDigitalIODelay, pinMask, delay);
|
||||
}
|
||||
|
||||
int multiSlsDetector::retrieveDetectorSetup(const std::string &fname1,
|
||||
int level) {
|
||||
|
||||
int skip = 0;
|
||||
std::string fname;
|
||||
std::string str;
|
||||
std::ifstream infile;
|
||||
int iargval;
|
||||
int interrupt = 0;
|
||||
char *args[10];
|
||||
|
||||
char myargs[10][1000];
|
||||
|
||||
std::string sargname, sargval;
|
||||
int iline = 0;
|
||||
|
||||
if (level == 2) {
|
||||
FILE_LOG(logDEBUG1) << "config file read";
|
||||
fname = fname1 + std::string(".det");
|
||||
} else {
|
||||
fname = fname1;
|
||||
void multiSlsDetector::loadParameters(const std::string &fname) {
|
||||
std::ifstream input_file;
|
||||
input_file.open(fname.c_str(), std::ios_base::in);
|
||||
if (!input_file.is_open()) {
|
||||
throw RuntimeError("Could not open parameter file " + fname +
|
||||
" for reading");
|
||||
}
|
||||
|
||||
infile.open(fname.c_str(), std::ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
auto cmd = slsDetectorCommand(this);
|
||||
while (infile.good() and interrupt == 0) {
|
||||
sargname = "none";
|
||||
sargval = "0";
|
||||
getline(infile, str);
|
||||
iline++;
|
||||
FILE_LOG(logDEBUG1) << str;
|
||||
if (str.find('#') != std::string::npos) {
|
||||
FILE_LOG(logDEBUG1) << "Line is a comment \n" << str;
|
||||
continue;
|
||||
} else {
|
||||
std::istringstream ssstr(str);
|
||||
iargval = 0;
|
||||
while (ssstr.good()) {
|
||||
ssstr >> sargname;
|
||||
// if (ssstr.good()) {
|
||||
sls::strcpy_safe(myargs[iargval], sargname.c_str());
|
||||
args[iargval] = myargs[iargval];
|
||||
FILE_LOG(logDEBUG1) << args[iargval];
|
||||
iargval++;
|
||||
// }
|
||||
skip = 0;
|
||||
}
|
||||
if (level != 2) {
|
||||
if (std::string(args[0]) == std::string("trimbits")) {
|
||||
skip = 1;
|
||||
}
|
||||
}
|
||||
if (skip == 0) {
|
||||
cmd.executeLine(iargval, args, PUT_ACTION);
|
||||
}
|
||||
}
|
||||
iline++;
|
||||
std::string current_line;
|
||||
while (input_file.good()) {
|
||||
getline(input_file, current_line);
|
||||
if (current_line.find('#') != std::string::npos) {
|
||||
current_line.erase(current_line.find('#'));
|
||||
}
|
||||
infile.close();
|
||||
|
||||
} else {
|
||||
throw RuntimeError("Error opening " + fname + " for reading");
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "current_line after removing comments:\n\t" << current_line;
|
||||
if (current_line.length() > 1) {
|
||||
multiSlsDetectorClient(current_line, PUT_ACTION, this);
|
||||
}
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "Read " << iline << " lines";
|
||||
return OK;
|
||||
input_file.close();
|
||||
}
|
||||
|
||||
int multiSlsDetector::dumpDetectorSetup(const std::string &fname, int level) {
|
||||
detectorType type = getDetectorTypeAsEnum();
|
||||
std::vector<std::string> names;
|
||||
// common config
|
||||
names.emplace_back("fname");
|
||||
names.emplace_back("index");
|
||||
names.emplace_back("enablefwrite");
|
||||
names.emplace_back("overwrite");
|
||||
names.emplace_back("dr");
|
||||
names.emplace_back("settings");
|
||||
names.emplace_back("exptime");
|
||||
names.emplace_back("period");
|
||||
names.emplace_back("frames");
|
||||
names.emplace_back("cycles");
|
||||
names.emplace_back("timing");
|
||||
|
||||
switch (type) {
|
||||
case EIGER:
|
||||
names.emplace_back("flags");
|
||||
names.emplace_back("clkdivider");
|
||||
names.emplace_back("threshold");
|
||||
names.emplace_back("ratecorr");
|
||||
names.emplace_back("trimbits");
|
||||
break;
|
||||
case GOTTHARD:
|
||||
names.emplace_back("delay");
|
||||
break;
|
||||
case JUNGFRAU:
|
||||
names.emplace_back("delay");
|
||||
names.emplace_back("clkdivider");
|
||||
break;
|
||||
case CHIPTESTBOARD:
|
||||
names.emplace_back("dac:0");
|
||||
names.emplace_back("dac:1");
|
||||
names.emplace_back("dac:2");
|
||||
names.emplace_back("dac:3");
|
||||
names.emplace_back("dac:4");
|
||||
names.emplace_back("dac:5");
|
||||
names.emplace_back("dac:6");
|
||||
names.emplace_back("dac:7");
|
||||
names.emplace_back("dac:8");
|
||||
names.emplace_back("dac:9");
|
||||
names.emplace_back("dac:10");
|
||||
names.emplace_back("dac:11");
|
||||
names.emplace_back("dac:12");
|
||||
names.emplace_back("dac:13");
|
||||
names.emplace_back("dac:14");
|
||||
names.emplace_back("dac:15");
|
||||
names.emplace_back("dac:16");
|
||||
names.emplace_back("dac:17");
|
||||
names.emplace_back("dac:18");
|
||||
names.emplace_back("dac:19");
|
||||
names.emplace_back("dac:20");
|
||||
names.emplace_back("dac:21");
|
||||
names.emplace_back("dac:22");
|
||||
names.emplace_back("dac:23");
|
||||
names.emplace_back("adcvpp");
|
||||
names.emplace_back("adcclk");
|
||||
names.emplace_back("clkdivider");
|
||||
names.emplace_back("adcphase");
|
||||
names.emplace_back("adcpipeline");
|
||||
names.emplace_back("adcinvert"); //
|
||||
names.emplace_back("adcdisable");
|
||||
names.emplace_back("patioctrl");
|
||||
names.emplace_back("patclkctrl");
|
||||
names.emplace_back("patlimits");
|
||||
names.emplace_back("patloop0");
|
||||
names.emplace_back("patnloop0");
|
||||
names.emplace_back("patwait0");
|
||||
names.emplace_back("patwaittime0");
|
||||
names.emplace_back("patloop1");
|
||||
names.emplace_back("patnloop1");
|
||||
names.emplace_back("patwait1");
|
||||
names.emplace_back("patwaittime1");
|
||||
names.emplace_back("patloop2");
|
||||
names.emplace_back("patnloop2");
|
||||
names.emplace_back("patwait2");
|
||||
names.emplace_back("patwaittime2");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Workaround to bo able to suplly ecexuteLine with char**
|
||||
const int n_arguments = 1;
|
||||
char buffer[1000]; // TODO! this should not be hardcoded!
|
||||
char *args[n_arguments] = {buffer};
|
||||
|
||||
std::string outfname;
|
||||
if (level == 2) {
|
||||
writeConfigurationFile(fname + ".config");
|
||||
outfname = fname + ".det";
|
||||
} else {
|
||||
outfname = fname;
|
||||
}
|
||||
|
||||
std::ofstream outfile;
|
||||
outfile.open(outfname.c_str(), std::ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
auto cmd = slsDetectorCommand(this);
|
||||
for (auto &name : names) {
|
||||
sls::strcpy_safe(buffer, name.c_str()); // this is...
|
||||
outfile << name << " "
|
||||
<< cmd.executeLine(n_arguments, args, GET_ACTION)
|
||||
<< std::endl;
|
||||
}
|
||||
outfile.close();
|
||||
} else {
|
||||
throw RuntimeError("Error opening parameters file " + fname +
|
||||
" for writing");
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "wrote " << names.size() << " lines to "
|
||||
<< outfname;
|
||||
return OK;
|
||||
}
|
||||
|
||||
void multiSlsDetector::registerAcquisitionFinishedCallback(
|
||||
void (*func)(double, int, void *), void *pArg) {
|
||||
@ -3455,10 +3055,10 @@ void multiSlsDetector::registerDataCallback(
|
||||
int multiSlsDetector::setTotalProgress() {
|
||||
int nf = Parallel(&slsDetector::setTimer, {}, FRAME_NUMBER, -1)
|
||||
.tsquash("Inconsistent number of frames");
|
||||
int nc = Parallel(&slsDetector::setTimer, {}, CYCLES_NUMBER, -1)
|
||||
.tsquash("Inconsistent number of cycles");
|
||||
int nc = Parallel(&slsDetector::setTimer, {}, TRIGGER_NUMBER, -1)
|
||||
.tsquash("Inconsistent number of triggers");
|
||||
if (nf == 0 || nc == 0) {
|
||||
throw RuntimeError("Number of frames or cycles is 0");
|
||||
throw RuntimeError("Number of frames or triggers is 0");
|
||||
}
|
||||
|
||||
int ns = 1;
|
||||
@ -3520,8 +3120,8 @@ int multiSlsDetector::acquire() {
|
||||
|
||||
// verify receiver is idle
|
||||
if (receiver) {
|
||||
if (getReceiverStatus() != IDLE) {
|
||||
stopReceiver();
|
||||
if (Parallel(&slsDetector::getReceiverStatus, {}).squash(ERROR) != IDLE) {
|
||||
Parallel(&slsDetector::stopReceiver, {});
|
||||
}
|
||||
}
|
||||
setTotalProgress();
|
||||
@ -3535,16 +3135,20 @@ int multiSlsDetector::acquire() {
|
||||
|
||||
// start receiver
|
||||
if (receiver) {
|
||||
startReceiver();
|
||||
Parallel(&slsDetector::startReceiver, {});
|
||||
// let processing thread listen to these packets
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
}
|
||||
|
||||
startAndReadAll();
|
||||
// start and read all
|
||||
if (getDetectorTypeAsEnum() == EIGER) {
|
||||
Parallel(&slsDetector::prepareAcquisition, {});
|
||||
}
|
||||
Parallel(&slsDetector::startAndReadAll, {});
|
||||
|
||||
// stop receiver
|
||||
if (receiver) {
|
||||
stopReceiver();
|
||||
Parallel(&slsDetector::stopReceiver, {});
|
||||
if (dataReady != nullptr) {
|
||||
sem_wait(&sem_endRTAcquisition); // waits for receiver's
|
||||
}
|
||||
@ -3560,7 +3164,12 @@ int multiSlsDetector::acquire() {
|
||||
dataProcessingThread.join();
|
||||
|
||||
if (acquisition_finished != nullptr) {
|
||||
acquisition_finished(getCurrentProgress(), getRunStatus(),
|
||||
// same status for all, else error
|
||||
int status = static_cast<int>(ERROR);
|
||||
auto t = Parallel(&slsDetector::getRunStatus, {});
|
||||
if (t.equal())
|
||||
status = t.front();
|
||||
acquisition_finished(getCurrentProgress(), status,
|
||||
acqFinished_p);
|
||||
}
|
||||
|
||||
@ -3597,7 +3206,7 @@ void multiSlsDetector::processData() {
|
||||
if (fgetc(stdin) == 'q') {
|
||||
FILE_LOG(logINFO)
|
||||
<< "Caught the command to stop acquisition";
|
||||
stopAcquisition();
|
||||
Parallel(&slsDetector::stopAcquisition, {});
|
||||
}
|
||||
}
|
||||
// get progress
|
||||
|
@ -30,7 +30,7 @@ void multiSlsDetectorClient::runCommand() {
|
||||
action_ = slsDetectorDefs::HELP_ACTION;
|
||||
bool verify = true;
|
||||
bool update = true;
|
||||
if (action_ == slsDetectorDefs::PUT_ACTION && parser.n_arguments() == 0) {
|
||||
if (action_ == slsDetectorDefs::PUT_ACTION && parser.command().empty()) {
|
||||
os << "Wrong usage - should be: " << parser.executable()
|
||||
<< "[id-][pos:]channel arg" << std::endl;
|
||||
os << std::endl;
|
||||
@ -77,8 +77,9 @@ void multiSlsDetectorClient::runCommand() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (parser.detector_id() >= static_cast<int>(detPtr->size())) {
|
||||
os << "position is out of bounds.\n";
|
||||
os << "position " << parser.detector_id() << " is out of bounds (max " << detPtr->size() << ").\n";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "string_utils.h"
|
||||
#include "versionAPI.h"
|
||||
#include "ToString.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
@ -324,7 +326,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
shm()->timerValue[ACQUISITION_TIME] = 0;
|
||||
shm()->timerValue[FRAME_PERIOD] = 0;
|
||||
shm()->timerValue[DELAY_AFTER_TRIGGER] = 0;
|
||||
shm()->timerValue[CYCLES_NUMBER] = 1;
|
||||
shm()->timerValue[TRIGGER_NUMBER] = 1;
|
||||
shm()->timerValue[ACTUAL_TIME] = 0;
|
||||
shm()->timerValue[MEASUREMENT_TIME] = 0;
|
||||
shm()->timerValue[PROGRESS] = 0;
|
||||
@ -419,34 +421,34 @@ int slsDetector::sendModule(sls_detector_module *myMod,
|
||||
n = client.Send(&(myMod->nchan), sizeof(myMod->nchan));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "nchan sent. " << n
|
||||
<< " bytes. serialno: " << myMod->nchan;
|
||||
<< " bytes. nchan: " << myMod->nchan;
|
||||
|
||||
n = client.Send(&(myMod->nchip), sizeof(myMod->nchip));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "nchip sent. " << n
|
||||
<< " bytes. serialno: " << myMod->nchip;
|
||||
<< " bytes. nchip: " << myMod->nchip;
|
||||
|
||||
n = client.Send(&(myMod->ndac), sizeof(myMod->ndac));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "ndac sent. " << n
|
||||
<< " bytes. serialno: " << myMod->ndac;
|
||||
<< " bytes. ndac: " << myMod->ndac;
|
||||
|
||||
n = client.Send(&(myMod->reg), sizeof(myMod->reg));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "reg sent. " << n << " bytes. serialno: " << myMod->reg;
|
||||
FILE_LOG(level) << "reg sent. " << n << " bytes. reg: " << myMod->reg;
|
||||
|
||||
n = client.Send(&(myMod->iodelay), sizeof(myMod->iodelay));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "iodelay sent. " << n
|
||||
<< " bytes. serialno: " << myMod->iodelay;
|
||||
<< " bytes. iodelay: " << myMod->iodelay;
|
||||
|
||||
n = client.Send(&(myMod->tau), sizeof(myMod->tau));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "tau sent. " << n << " bytes. serialno: " << myMod->tau;
|
||||
FILE_LOG(level) << "tau sent. " << n << " bytes. tau: " << myMod->tau;
|
||||
|
||||
n = client.Send(&(myMod->eV), sizeof(myMod->eV));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "ev sent. " << n << " bytes. serialno: " << myMod->eV;
|
||||
FILE_LOG(level) << "ev sent. " << n << " bytes. ev: " << myMod->eV;
|
||||
|
||||
n = client.Send(myMod->dacs, sizeof(int) * (myMod->ndac));
|
||||
ts += n;
|
||||
@ -548,7 +550,7 @@ slsDetectorDefs::detectorType slsDetector::getDetectorTypeAsEnum() const {
|
||||
}
|
||||
|
||||
std::string slsDetector::getDetectorTypeAsString() const {
|
||||
return slsDetectorDefs::detectorTypeToString(getDetectorTypeAsEnum());
|
||||
return ToString(getDetectorTypeAsEnum());
|
||||
}
|
||||
|
||||
void slsDetector::updateNumberOfChannels() {
|
||||
@ -695,8 +697,8 @@ bool slsDetector::lockServer(int lock) {
|
||||
return (retval == 1 ? true : false);
|
||||
}
|
||||
|
||||
std::string slsDetector::getLastClientIP() {
|
||||
char retval[INET_ADDRSTRLEN]{};
|
||||
sls::IpAddr slsDetector::getLastClientIP() {
|
||||
sls::IpAddr retval = 0u;
|
||||
FILE_LOG(logDEBUG1) << "Getting last client ip to detector server";
|
||||
sendToDetector(F_GET_LAST_CLIENT_IP, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Last client IP to detector: " << retval;
|
||||
@ -728,8 +730,8 @@ void slsDetector::updateCachedDetectorVariables() {
|
||||
FORCE_UPDATE) {
|
||||
int n = 0, i32 = 0;
|
||||
int64_t i64 = 0;
|
||||
char lastClientIP[INET_ADDRSTRLEN] = {0};
|
||||
n += client.Receive(lastClientIP, sizeof(lastClientIP));
|
||||
sls::IpAddr lastClientIP = 0u;
|
||||
n += client.Receive(&lastClientIP, sizeof(lastClientIP));
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Updating detector last modified by " << lastClientIP;
|
||||
|
||||
@ -787,9 +789,9 @@ void slsDetector::updateCachedDetectorVariables() {
|
||||
shm()->timerValue[STORAGE_CELL_DELAY] = i64;
|
||||
}
|
||||
|
||||
// cycles
|
||||
// triggers
|
||||
n += client.Receive(&i64, sizeof(i64));
|
||||
shm()->timerValue[CYCLES_NUMBER] = i64;
|
||||
shm()->timerValue[TRIGGER_NUMBER] = i64;
|
||||
|
||||
// readout mode
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD) {
|
||||
@ -934,7 +936,7 @@ slsDetector::setSettings(detectorSettings isettings) {
|
||||
return shm()->currentSettings;
|
||||
default:
|
||||
std::ostringstream ss;
|
||||
ss << "Unknown settings " << getDetectorSettings(isettings)
|
||||
ss << "Unknown settings " << ToString(isettings)
|
||||
<< " for this detector!";
|
||||
throw RuntimeError(ss.str());
|
||||
}
|
||||
@ -1088,7 +1090,7 @@ std::string slsDetector::getTrimbitFilename(detectorSettings s, int e_eV) {
|
||||
break;
|
||||
default:
|
||||
std::ostringstream ss;
|
||||
ss << "Unknown settings " << getDetectorSettings(s)
|
||||
ss << "Unknown settings " << ToString(s)
|
||||
<< " for this detector!";
|
||||
throw RuntimeError(ss.str());
|
||||
}
|
||||
@ -1146,7 +1148,7 @@ slsDetectorDefs::runStatus slsDetector::getRunStatus() const {
|
||||
runStatus retval = ERROR;
|
||||
FILE_LOG(logDEBUG1) << "Getting status";
|
||||
sendToDetectorStop(F_GET_RUN_STATUS, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Detector status: " << runStatusType(retval);
|
||||
FILE_LOG(logDEBUG1) << "Detector status: " << ToString(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -1202,116 +1204,6 @@ void slsDetector::readAll() {
|
||||
FILE_LOG(logDEBUG1) << "Detector successfully finished reading all frames";
|
||||
}
|
||||
|
||||
/*
|
||||
void slsDetector::configureMAC() {
|
||||
int fnum = F_CONFIGURE_MAC;
|
||||
const size_t array_size = 50;
|
||||
const size_t n_args = 14;
|
||||
const size_t n_retvals = 2;
|
||||
char args[n_args][array_size]{};
|
||||
char retvals[n_retvals][array_size]{};
|
||||
FILE_LOG(logDEBUG1) << "Configuring MAC";
|
||||
if (shm()->rxUDPIP == 0) {
|
||||
// If hostname is valid ip use that, oterwise lookup hostname
|
||||
shm()->rxUDPIP = shm()->rxHostname;
|
||||
if (shm()->rxUDPIP == 0) {
|
||||
shm()->rxUDPIP = HostnameToIp(shm()->rxHostname);
|
||||
}
|
||||
}
|
||||
|
||||
if (shm()->rxUDPMAC == 0) {
|
||||
throw RuntimeError(
|
||||
"configureMAC: Error. Receiver UDP MAC Addresses not set");
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "rx_hostname and rx_udpmac are valid ";
|
||||
|
||||
// Jungfrau second interface
|
||||
if (shm()->numUDPInterfaces == 2) {
|
||||
if (shm()->rxUDPIP2 == 0) {
|
||||
shm()->rxUDPIP2 = shm()->rxUDPIP;
|
||||
}
|
||||
if (shm()->rxUDPMAC2 == 0) {
|
||||
throw RuntimeError(
|
||||
"configureMAC: Error. Receiver UDP MAC Addresses 2 not set");
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "rx_udpmac2 is valid ";
|
||||
}
|
||||
|
||||
// copy to args and convert to hex
|
||||
snprintf(args[0], array_size, "%x", shm()->rxUDPPort);
|
||||
sls::strcpy_safe(args[1], getReceiverUDPIP().hex());
|
||||
sls::strcpy_safe(args[2], getReceiverUDPMAC().hex());
|
||||
sls::strcpy_safe(args[3], getDetectorIP().hex());
|
||||
sls::strcpy_safe(args[4], getDetectorMAC().hex());
|
||||
snprintf(args[5], array_size, "%x", shm()->rxUDPPort2);
|
||||
sls::strcpy_safe(args[6], getReceiverUDPIP2().hex());
|
||||
sls::strcpy_safe(args[7], getReceiverUDPMAC2().hex());
|
||||
sls::strcpy_safe(args[8], getDetectorIP2().hex());
|
||||
sls::strcpy_safe(args[9], getDetectorMAC2().hex());
|
||||
snprintf(args[10], array_size, "%x", shm()->numUDPInterfaces);
|
||||
snprintf(args[11], array_size, "%x", shm()->selectedUDPInterface);
|
||||
|
||||
// 2d positions to detector to put into udp header
|
||||
{
|
||||
int pos[2] = {0, 0};
|
||||
int max = shm()->multiSize.y * (shm()->numUDPInterfaces);
|
||||
// row
|
||||
pos[0] = (detId % max);
|
||||
// col for horiz. udp ports
|
||||
pos[1] = (detId / max) * ((shm()->myDetectorType == EIGER) ? 2 : 1);
|
||||
// pos[2] (z is reserved)
|
||||
FILE_LOG(logDEBUG) << "Detector [" << detId << "] - (" << pos[0] << ","
|
||||
<< pos[1] << ")";
|
||||
snprintf(args[12], array_size, "%x", pos[0]);
|
||||
snprintf(args[13], array_size, "%x", pos[1]);
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "receiver udp port:" << std::dec << args[0] << "-";
|
||||
FILE_LOG(logDEBUG1) << "receiver udp ip:" << args[1] << "-";
|
||||
FILE_LOG(logDEBUG1) << "receiver udp mac:" << args[2] << "-";
|
||||
FILE_LOG(logDEBUG1) << "detecotor udp ip:" << args[3] << "-";
|
||||
FILE_LOG(logDEBUG1) << "detector udp mac:" << args[4] << "-";
|
||||
FILE_LOG(logDEBUG1) << "receiver udp port2:" << std::dec << args[5] << "-";
|
||||
FILE_LOG(logDEBUG1) << "receiver udp ip2:" << args[6] << "-";
|
||||
FILE_LOG(logDEBUG1) << "receiver udp mac2:" << args[7] << "-";
|
||||
FILE_LOG(logDEBUG1) << "detecotor udp ip2:" << args[8] << "-";
|
||||
FILE_LOG(logDEBUG1) << "detector udp mac2:" << args[9] << "-";
|
||||
FILE_LOG(logDEBUG1) << "number of udp interfaces:" << std::dec << args[10]
|
||||
<< "-";
|
||||
FILE_LOG(logDEBUG1) << "selected udp interface:" << std::dec << args[11]
|
||||
<< "-";
|
||||
FILE_LOG(logDEBUG1) << "row:" << args[12] << "-";
|
||||
FILE_LOG(logDEBUG1) << "col:" << args[13] << "-";
|
||||
|
||||
// send to server
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
int ret = client.sendCommandThenRead(fnum, args, sizeof(args), retvals,
|
||||
sizeof(retvals));
|
||||
|
||||
// TODO!(Erik) Send as int already from detector
|
||||
uint64_t detector_mac = 0;
|
||||
uint32_t detector_ip = 0;
|
||||
sscanf(retvals[0], "%lx", &detector_mac);
|
||||
sscanf(retvals[1], "%x", &detector_ip);
|
||||
detector_ip = __builtin_bswap32(detector_ip);
|
||||
|
||||
if (shm()->detectorMAC != detector_mac) {
|
||||
shm()->detectorMAC = detector_mac;
|
||||
FILE_LOG(logINFO) << detId << ": Detector MAC updated to "
|
||||
<< getDetectorMAC();
|
||||
}
|
||||
|
||||
if (shm()->detectorIP != detector_ip) {
|
||||
shm()->detectorIP = detector_ip;
|
||||
FILE_LOG(logINFO) << detId << ": Detector IP updated to "
|
||||
<< getDetectorIP();
|
||||
}
|
||||
if (ret == FORCE_UPDATE) {
|
||||
updateCachedDetectorVariables();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void slsDetector::setStartingFrameNumber(uint64_t value) {
|
||||
FILE_LOG(logDEBUG1) << "Setting starting frame number to " << value;
|
||||
sendToDetector(F_SET_STARTING_FRAME_NUMBER, value, nullptr);
|
||||
@ -1361,7 +1253,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
||||
if (shm()->useReceiverFlag) {
|
||||
timerIndex rt[]{FRAME_NUMBER,
|
||||
FRAME_PERIOD,
|
||||
CYCLES_NUMBER,
|
||||
TRIGGER_NUMBER,
|
||||
ACQUISITION_TIME,
|
||||
SUBFRAME_ACQUISITION_TIME,
|
||||
SUBFRAME_DEADTIME,
|
||||
@ -1376,11 +1268,11 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
||||
retval = -1;
|
||||
|
||||
// rewrite args
|
||||
if ((index == FRAME_NUMBER) || (index == CYCLES_NUMBER) ||
|
||||
if ((index == FRAME_NUMBER) || (index == TRIGGER_NUMBER) ||
|
||||
(index == STORAGE_CELL_NUMBER)) {
|
||||
args[1] = shm()->timerValue[FRAME_NUMBER] *
|
||||
((shm()->timerValue[CYCLES_NUMBER] > 0)
|
||||
? (shm()->timerValue[CYCLES_NUMBER])
|
||||
((shm()->timerValue[TRIGGER_NUMBER] > 0)
|
||||
? (shm()->timerValue[TRIGGER_NUMBER])
|
||||
: 1) *
|
||||
((shm()->timerValue[STORAGE_CELL_NUMBER] > 0)
|
||||
? (shm()->timerValue[STORAGE_CELL_NUMBER]) + 1
|
||||
@ -1388,9 +1280,9 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
||||
}
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Sending "
|
||||
<< (((index == FRAME_NUMBER) || (index == CYCLES_NUMBER) ||
|
||||
<< (((index == FRAME_NUMBER) || (index == TRIGGER_NUMBER) ||
|
||||
(index == STORAGE_CELL_NUMBER))
|
||||
? "(#Frames) * (#cycles) * (#storage cells)"
|
||||
? "(#Frames) * (#triggers) * (#storage cells)"
|
||||
: getTimerType(index))
|
||||
<< " to receiver: " << args[1];
|
||||
|
||||
@ -1630,7 +1522,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "detector type:"
|
||||
<< (slsDetectorDefs::detectorTypeToString(shm()->myDetectorType))
|
||||
<< (ToString(shm()->myDetectorType))
|
||||
<< "\ndetector id:" << detId
|
||||
<< "\ndetector hostname:" << shm()->hostname
|
||||
<< "\nfile path:" << shm()->rxFilePath
|
||||
@ -1645,7 +1537,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
<< "\noverwrite enable:" << shm()->rxFileOverWrite
|
||||
<< "\nframe index needed:"
|
||||
<< ((shm()->timerValue[FRAME_NUMBER] *
|
||||
shm()->timerValue[CYCLES_NUMBER]) > 1)
|
||||
shm()->timerValue[TRIGGER_NUMBER]) > 1)
|
||||
<< "\nframe period:" << (shm()->timerValue[FRAME_PERIOD])
|
||||
<< "\nframe number:" << (shm()->timerValue[FRAME_NUMBER])
|
||||
<< "\nsub exp time:" << (shm()->timerValue[SUBFRAME_ACQUISITION_TIME])
|
||||
@ -1745,7 +1637,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
|
||||
// data streaming
|
||||
setReceiverStreamingFrequency(shm()->rxReadFreq);
|
||||
setReceiverStreamingPort(getReceiverStreamingPort());
|
||||
setReceiverStreamingIP(getReceiverStreamingIP());
|
||||
updateReceiverStreamingIP();
|
||||
setAdditionalJsonHeader(shm()->rxAdditionalJsonHeader);
|
||||
enableDataStreamingFromReceiver(
|
||||
static_cast<int>(enableDataStreamingFromReceiver(-1)));
|
||||
@ -1826,7 +1718,7 @@ sls::IpAddr slsDetector::getSourceUDPIP2() {
|
||||
|
||||
void slsDetector::setDestinationUDPIP(const IpAddr ip) {
|
||||
FILE_LOG(logDEBUG1) << "Setting destination udp ip to " << ip;
|
||||
if (ip == 0) {
|
||||
if (ip == 0) {
|
||||
throw RuntimeError("Invalid destination udp ip address");
|
||||
}
|
||||
sendToDetector(F_SET_DEST_UDP_IP, ip, nullptr);
|
||||
@ -2011,31 +1903,23 @@ void slsDetector::setReceiverStreamingPort(int port) {
|
||||
|
||||
int slsDetector::getReceiverStreamingPort() { return shm()->rxZmqport; }
|
||||
|
||||
void slsDetector::setClientStreamingIP(const std::string &sourceIP) {
|
||||
auto ip = HostnameToIp(sourceIP.c_str());
|
||||
if (ip != 0) {
|
||||
shm()->zmqip = ip;
|
||||
} else {
|
||||
throw sls::RuntimeError("Could not set zmqip");
|
||||
}
|
||||
void slsDetector::setClientStreamingIP(const sls::IpAddr ip) {
|
||||
FILE_LOG(logDEBUG1) << "Setting client zmq ip to " << ip;
|
||||
if (ip == 0) {
|
||||
throw RuntimeError("Invalid client zmq ip address");
|
||||
}
|
||||
shm()->zmqip = ip;
|
||||
}
|
||||
|
||||
std::string slsDetector::getClientStreamingIP() { return shm()->zmqip.str(); }
|
||||
sls::IpAddr slsDetector::getClientStreamingIP() { return shm()->zmqip; }
|
||||
|
||||
void slsDetector::setReceiverStreamingIP(std::string sourceIP) {
|
||||
// if empty, give rx_hostname
|
||||
if (sourceIP.empty() || sourceIP == "0.0.0.0") {
|
||||
if (strcmp(shm()->rxHostname, "none") == 0) {
|
||||
throw RuntimeError("Receiver hostname not set yet. Cannot create "
|
||||
"rx_zmqip from none");
|
||||
}
|
||||
sourceIP = shm()->rxHostname;
|
||||
void slsDetector::setReceiverStreamingIP(const sls::IpAddr ip) {
|
||||
FILE_LOG(logDEBUG1) << "Setting rx zmq ip to " << ip;
|
||||
if (ip == 0) {
|
||||
throw RuntimeError("Invalid receiver zmq ip address");
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "Sending receiver streaming IP to receiver: "
|
||||
<< sourceIP;
|
||||
shm()->rxZmqip = HostnameToIp(sourceIP.c_str());
|
||||
|
||||
shm()->rxZmqip = ip;
|
||||
|
||||
// if zmqip is empty, update it
|
||||
if (shm()->zmqip == 0) {
|
||||
shm()->zmqip = shm()->rxZmqip;
|
||||
@ -2043,19 +1927,27 @@ void slsDetector::setReceiverStreamingIP(std::string sourceIP) {
|
||||
|
||||
// send to receiver
|
||||
if (shm()->useReceiverFlag) {
|
||||
char retvals[MAX_STR_LENGTH]{};
|
||||
char args[MAX_STR_LENGTH]{};
|
||||
sls::strcpy_safe(args, shm()->rxZmqip.str()); // TODO send int
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Sending receiver streaming IP to receiver: " << args;
|
||||
sendToReceiver(F_RECEIVER_STREAMING_SRC_IP, args, retvals);
|
||||
FILE_LOG(logDEBUG1) << "Receiver streaming ip: " << retvals;
|
||||
shm()->rxZmqip = retvals;
|
||||
<< "Sending receiver streaming IP to receiver: " << ip;
|
||||
sendToReceiver(F_RECEIVER_STREAMING_SRC_IP, ip, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
std::string slsDetector::getReceiverStreamingIP() {
|
||||
return shm()->rxZmqip.str();
|
||||
sls::IpAddr slsDetector::getReceiverStreamingIP() {
|
||||
return shm()->rxZmqip;
|
||||
}
|
||||
|
||||
void slsDetector::updateReceiverStreamingIP() {
|
||||
auto ip = getReceiverStreamingIP();
|
||||
if (ip == 0) {
|
||||
// Hostname could be ip try to decode otherwise look up the hostname
|
||||
ip = shm()->rxHostname;
|
||||
if (ip == 0) {
|
||||
ip = HostnameToIp(shm()->rxHostname);
|
||||
}
|
||||
FILE_LOG(logINFO) << "Setting default receiver streaming zmq ip to " << ip;
|
||||
}
|
||||
setReceiverStreamingIP(ip);
|
||||
}
|
||||
|
||||
int slsDetector::setDetectorNetworkParameter(networkParameter index,
|
||||
@ -2834,8 +2726,8 @@ int slsDetector::lockReceiver(int lock) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::string slsDetector::getReceiverLastClientIP() const {
|
||||
char retval[INET_ADDRSTRLEN]{};
|
||||
sls::IpAddr slsDetector::getReceiverLastClientIP() const {
|
||||
sls::IpAddr retval = 0u;
|
||||
FILE_LOG(logDEBUG1) << "Getting last client ip to receiver server";
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_GET_LAST_RECEIVER_CLIENT_IP, nullptr, retval);
|
||||
@ -2871,12 +2763,13 @@ void slsDetector::updateCachedReceiverVariables() const {
|
||||
sls::ClientSocket("Receiver", shm()->rxHostname, shm()->rxTCPPort);
|
||||
receiver.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
|
||||
int n = 0, i32 = 0;
|
||||
int64_t i64 = 0;
|
||||
char cstring[MAX_STR_LENGTH]{};
|
||||
char lastClientIP[INET_ADDRSTRLEN]{};
|
||||
IpAddr ip = 0u;
|
||||
|
||||
n += receiver.Receive(lastClientIP, sizeof(lastClientIP));
|
||||
n += receiver.Receive(&ip, sizeof(ip));
|
||||
FILE_LOG(logDEBUG1)
|
||||
<< "Updating receiver last modified by " << lastClientIP;
|
||||
<< "Updating receiver last modified by " << ip;
|
||||
|
||||
// filepath
|
||||
n += receiver.Receive(cstring, sizeof(cstring));
|
||||
@ -2887,8 +2780,8 @@ void slsDetector::updateCachedReceiverVariables() const {
|
||||
sls::strcpy_safe(shm()->rxFileName, cstring);
|
||||
|
||||
// index
|
||||
n += receiver.Receive(&i32, sizeof(i32));
|
||||
shm()->rxFileIndex = i32;
|
||||
n += receiver.Receive(&i64, sizeof(i64));
|
||||
shm()->rxFileIndex = i64;
|
||||
|
||||
// file format
|
||||
n += receiver.Receive(&i32, sizeof(i32));
|
||||
@ -2931,8 +2824,8 @@ void slsDetector::updateCachedReceiverVariables() const {
|
||||
shm()->rxZmqport = i32;
|
||||
|
||||
// streaming source ip
|
||||
n += receiver.Receive(cstring, sizeof(cstring));
|
||||
shm()->rxZmqip = cstring;
|
||||
n += receiver.Receive(&ip, sizeof(ip));
|
||||
shm()->rxZmqip = ip;
|
||||
|
||||
// additional json header
|
||||
n += receiver.Receive(cstring, sizeof(cstring));
|
||||
@ -3102,9 +2995,9 @@ slsDetectorDefs::fileFormat slsDetector::getFileFormat() const {
|
||||
return shm()->rxFileFormat;
|
||||
}
|
||||
|
||||
int slsDetector::setFileIndex(int file_index) {
|
||||
int64_t slsDetector::setFileIndex(int64_t file_index) {
|
||||
if (F_SET_RECEIVER_FILE_INDEX >= 0) {
|
||||
int retval = -1;
|
||||
int64_t retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Setting file index to " << file_index;
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_SET_RECEIVER_FILE_INDEX, file_index, retval);
|
||||
@ -3115,9 +3008,9 @@ int slsDetector::setFileIndex(int file_index) {
|
||||
return getFileIndex();
|
||||
}
|
||||
|
||||
int slsDetector::getFileIndex() const { return shm()->rxFileIndex; }
|
||||
int64_t slsDetector::getFileIndex() const { return shm()->rxFileIndex; }
|
||||
|
||||
int slsDetector::incrementFileIndex() {
|
||||
int64_t slsDetector::incrementFileIndex() {
|
||||
if (shm()->rxFileWrite) {
|
||||
return setFileIndex(shm()->rxFileIndex + 1);
|
||||
}
|
||||
@ -3143,7 +3036,7 @@ slsDetectorDefs::runStatus slsDetector::getReceiverStatus() const {
|
||||
FILE_LOG(logDEBUG1) << "Getting Receiver Status";
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_GET_RECEIVER_STATUS, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Receiver Status: " << runStatusType(retval);
|
||||
FILE_LOG(logDEBUG1) << "Receiver Status: " << ToString(retval);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -143,8 +143,8 @@ int64_t slsDetectorUsers::setNumberOfFrames(int64_t t, int detPos){
|
||||
return detector.setNumberOfFrames(t, detPos);
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::setNumberOfCycles(int64_t t, int detPos){
|
||||
return detector.setNumberOfCycles(t, detPos);
|
||||
int64_t slsDetectorUsers::setNumberOfTriggers(int64_t t, int detPos){
|
||||
return detector.setNumberOfTriggers(t, detPos);
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::setNumberOfStorageCells(int64_t t, int detPos) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "ThreadObject.h"
|
||||
#include "network_utils.h"
|
||||
|
||||
class GeneralData;
|
||||
class Fifo;
|
||||
@ -107,9 +108,9 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* (throws an exception if it couldnt create zmq sockets)
|
||||
* @param nunits pointer to number of theads/ units per detector
|
||||
* @param port streaming port start index
|
||||
* @param srcip streaming source ip
|
||||
* @param ip streaming source ip
|
||||
*/
|
||||
void CreateZmqSockets(int* nunits, uint32_t port, const char* srcip);
|
||||
void CreateZmqSockets(int* nunits, uint32_t port, const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* Shuts down and deletes Zmq Sockets
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "logger.h"
|
||||
#include <cmath> //ceil
|
||||
#include <vector>
|
||||
#include "ToString.h"
|
||||
|
||||
|
||||
class GeneralData {
|
||||
@ -218,7 +219,7 @@ public:
|
||||
*/
|
||||
virtual void Print(TLogLevel level = logDEBUG1) const {
|
||||
FILE_LOG(level) << "\n\nDetector Data Variables:";
|
||||
FILE_LOG(level) << "myDetectorType: " << slsDetectorDefs::detectorTypeToString(myDetectorType);
|
||||
FILE_LOG(level) << "myDetectorType: " << sls::ToString(myDetectorType);
|
||||
FILE_LOG(level) << "Pixels X: " << nPixelsX;
|
||||
FILE_LOG(level) << "Pixels Y: " << nPixelsY;
|
||||
FILE_LOG(level) << "Header Size in Packet: " << headerSizeinPacket;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "container_utils.h"
|
||||
#include "logger.h"
|
||||
#include "receiver_defs.h"
|
||||
#include "network_utils.h"
|
||||
class GeneralData;
|
||||
class Listener;
|
||||
class DataProcessor;
|
||||
@ -352,7 +353,7 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
||||
* Get streaming source ip
|
||||
* @return streaming source ip
|
||||
*/
|
||||
std::string getStreamingSourceIP() const;
|
||||
sls::IpAddr getStreamingSourceIP() const;
|
||||
|
||||
/**
|
||||
* Get additional json header
|
||||
@ -571,7 +572,7 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
||||
* Set streaming source ip
|
||||
* @param c streaming source ip
|
||||
*/
|
||||
void setStreamingSourceIP(const char *c);
|
||||
void setStreamingSourceIP(const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* Set additional json header
|
||||
@ -974,7 +975,7 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
||||
/** streaming port */
|
||||
uint32_t streamingPort;
|
||||
/** streaming port */
|
||||
char streamingSrcIP[MAX_STR_LENGTH];
|
||||
sls::IpAddr streamingSrcIP;
|
||||
/** additional json header */
|
||||
char additionalJsonHeader[MAX_STR_LENGTH];
|
||||
|
||||
|
@ -140,11 +140,11 @@ void DataStreamer::SetFlippedDataX(int fd) {
|
||||
flippedDataX = fd;
|
||||
}
|
||||
|
||||
void DataStreamer::CreateZmqSockets(int* nunits, uint32_t port, const char* srcip) {
|
||||
void DataStreamer::CreateZmqSockets(int* nunits, uint32_t port, const sls::IpAddr ip) {
|
||||
uint32_t portnum = port + index;
|
||||
|
||||
std::string sip = ip.str();
|
||||
try {
|
||||
zmqSocket = new ZmqSocket(portnum, (strlen(srcip)?srcip:nullptr));
|
||||
zmqSocket = new ZmqSocket(portnum, (ip != 0? sip.c_str(): nullptr));
|
||||
} catch (...) {
|
||||
FILE_LOG(logERROR) << "Could not create Zmq socket on port " << portnum << " for Streamer " << index;
|
||||
throw;
|
||||
|
@ -233,7 +233,7 @@ void Listener::ShutDownUDPSocket() {
|
||||
|
||||
|
||||
int Listener::CreateDummySocketForUDPSocketBufferSize(int64_t s) {
|
||||
FILE_LOG(logINFO) << "Testing UDP Socket Buffer size with test port " << *udpPortNumber;
|
||||
FILE_LOG(logINFO) << "Testing UDP Socket Buffer size " << s << " with test port " << *udpPortNumber;
|
||||
|
||||
if (!(*activated)) {
|
||||
*actualUDPSocketBufferSize = (s*2);
|
||||
@ -256,9 +256,11 @@ int Listener::CreateDummySocketForUDPSocketBufferSize(int64_t s) {
|
||||
|
||||
// doubled due to kernel bookkeeping (could also be less due to permissions)
|
||||
*actualUDPSocketBufferSize = g.getActualUDPSocketBufferSize();
|
||||
if (*actualUDPSocketBufferSize != (s*2)) {
|
||||
*udpSocketBufferSize = temp;
|
||||
}
|
||||
if (*actualUDPSocketBufferSize == -1) {
|
||||
*udpSocketBufferSize = temp;
|
||||
} else {
|
||||
*udpSocketBufferSize = (*actualUDPSocketBufferSize) / 2;
|
||||
}
|
||||
|
||||
} catch (...) {
|
||||
FILE_LOG(logERROR) << "Could not create a test UDP socket on port " << *udpPortNumber;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "Listener.h"
|
||||
#include "ZmqSocket.h" //just for the zmq port define
|
||||
#include "file_utils.h"
|
||||
#include "ToString.h"
|
||||
|
||||
#include <cerrno> //eperm
|
||||
#include <cstdlib> //system
|
||||
@ -111,7 +112,7 @@ void slsReceiverImplementation::InitializeMembers() {
|
||||
streamingTimerInMs = DEFAULT_STREAMING_TIMER_IN_MS;
|
||||
dataStreamEnable = false;
|
||||
streamingPort = 0;
|
||||
memset(streamingSrcIP, 0, sizeof(streamingSrcIP));
|
||||
streamingSrcIP = 0u;
|
||||
memset(additionalJsonHeader, 0, sizeof(additionalJsonHeader));
|
||||
|
||||
//** class objects ***
|
||||
@ -410,9 +411,9 @@ uint32_t slsReceiverImplementation::getStreamingPort() const {
|
||||
return streamingPort;
|
||||
}
|
||||
|
||||
std::string slsReceiverImplementation::getStreamingSourceIP() const {
|
||||
sls::IpAddr slsReceiverImplementation::getStreamingSourceIP() const {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return std::string(streamingSrcIP);
|
||||
return streamingSrcIP;
|
||||
}
|
||||
|
||||
std::string slsReceiverImplementation::getAdditionalJsonHeader() const {
|
||||
@ -560,7 +561,7 @@ int slsReceiverImplementation::setReadoutMode(const readoutMode f) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO) << "Readout Mode: " << getReadoutModeType(f);
|
||||
FILE_LOG(logINFO) << "Readout Mode: " << sls::ToString(f);
|
||||
FILE_LOG(logINFO) << "Packets per Frame: "
|
||||
<< (generalData->packetsPerFrame);
|
||||
return OK;
|
||||
@ -581,7 +582,7 @@ void slsReceiverImplementation::setFileFormat(const fileFormat f) {
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetFileFormat(f);
|
||||
|
||||
FILE_LOG(logINFO) << "File Format: " << getFileFormatType(fileFormatType);
|
||||
FILE_LOG(logINFO) << "File Format: " << sls::ToString(fileFormatType);
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setFileName(const char c[]) {
|
||||
@ -624,7 +625,7 @@ void slsReceiverImplementation::setFrameDiscardPolicy(
|
||||
frameDiscardMode = i;
|
||||
|
||||
FILE_LOG(logINFO) << "Frame Discard Policy: "
|
||||
<< getFrameDiscardPolicyType(frameDiscardMode);
|
||||
<< sls::ToString(frameDiscardMode);
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setFramePaddingEnable(const bool i) {
|
||||
@ -924,9 +925,9 @@ void slsReceiverImplementation::setStreamingPort(const uint32_t i) {
|
||||
FILE_LOG(logINFO) << "Streaming Port: " << streamingPort;
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::setStreamingSourceIP(const char c[]) {
|
||||
void slsReceiverImplementation::setStreamingSourceIP(const sls::IpAddr ip) {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
strcpy(streamingSrcIP, c);
|
||||
streamingSrcIP = ip;
|
||||
FILE_LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP;
|
||||
}
|
||||
|
||||
@ -1122,7 +1123,7 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||
case JUNGFRAU:
|
||||
case CHIPTESTBOARD:
|
||||
case MOENCH:
|
||||
FILE_LOG(logINFO) << " ***** " << detectorTypeToString(d)
|
||||
FILE_LOG(logINFO) << " ***** " << sls::ToString(d)
|
||||
<< " Receiver *****";
|
||||
break;
|
||||
default:
|
||||
@ -1196,7 +1197,7 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||
it->SetGeneralData(generalData);
|
||||
SetThreadPriorities();
|
||||
|
||||
FILE_LOG(logDEBUG) << " Detector type set to " << detectorTypeToString(d);
|
||||
FILE_LOG(logDEBUG) << " Detector type set to " << sls::ToString(d);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -1275,7 +1276,7 @@ int slsReceiverImplementation::startReceiver(char *c) {
|
||||
StartRunning();
|
||||
|
||||
FILE_LOG(logINFO) << "Receiver Started";
|
||||
FILE_LOG(logINFO) << "Status: " << runStatusType(status);
|
||||
FILE_LOG(logINFO) << "Status: " << sls::ToString(status);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -1326,7 +1327,7 @@ void slsReceiverImplementation::stopReceiver() {
|
||||
}
|
||||
|
||||
status = RUN_FINISHED;
|
||||
FILE_LOG(logINFO) << "Status: " << runStatusType(status);
|
||||
FILE_LOG(logINFO) << "Status: " << sls::ToString(status);
|
||||
|
||||
{ // statistics
|
||||
uint64_t tot = 0;
|
||||
@ -1368,7 +1369,7 @@ void slsReceiverImplementation::stopReceiver() {
|
||||
status = IDLE;
|
||||
|
||||
FILE_LOG(logINFO) << "Receiver Stopped";
|
||||
FILE_LOG(logINFO) << "Status: " << runStatusType(status);
|
||||
FILE_LOG(logINFO) << "Status: " << sls::ToString(status);
|
||||
}
|
||||
|
||||
void slsReceiverImplementation::startReadout() {
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "sls_detector_exceptions.h"
|
||||
#include "string_utils.h"
|
||||
#include "versionAPI.h"
|
||||
#include "ToString.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstdlib>
|
||||
@ -318,7 +319,7 @@ int slsReceiverTCPIPInterface::lock_receiver(Interface &socket) {
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::get_last_client_ip(Interface &socket) {
|
||||
return socket.sendResult(server->getLastClient().arr());
|
||||
return socket.sendResult(server->getLastClient());
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_port(Interface &socket) {
|
||||
@ -327,7 +328,7 @@ int slsReceiverTCPIPInterface::set_port(Interface &socket) {
|
||||
throw RuntimeError("Port Number: " + std::to_string(p_number) +
|
||||
" is too low (<1024)");
|
||||
|
||||
FILE_LOG(logINFO) << "set port to " << p_number << std::endl;
|
||||
FILE_LOG(logINFO) << "TCP port set to " << p_number << std::endl;
|
||||
auto new_server = sls::make_unique<sls::ServerSocket>(p_number);
|
||||
new_server->setLockedBy(server->getLockedBy());
|
||||
new_server->setLastClient(server->getThisClient());
|
||||
@ -347,11 +348,12 @@ int slsReceiverTCPIPInterface::update_client(Interface &socket) {
|
||||
int slsReceiverTCPIPInterface::send_update(Interface &socket) {
|
||||
int n = 0;
|
||||
int i32 = -1;
|
||||
int64_t i64 = -1;
|
||||
char cstring[MAX_STR_LENGTH]{};
|
||||
|
||||
char ip[INET_ADDRSTRLEN]{};
|
||||
sls::strcpy_safe(ip, server->getLastClient().str().c_str());
|
||||
n += socket.Send(ip, sizeof(ip));
|
||||
sls::IpAddr ip = 0u;
|
||||
ip = server->getLastClient();
|
||||
n += socket.Send(&ip, sizeof(ip));
|
||||
|
||||
// filepath
|
||||
sls::strcpy_safe(cstring, receiver->getFilePath().c_str());
|
||||
@ -362,8 +364,8 @@ int slsReceiverTCPIPInterface::send_update(Interface &socket) {
|
||||
n += socket.Send(cstring, sizeof(cstring));
|
||||
|
||||
// index
|
||||
i32 = receiver->getFileIndex();
|
||||
n += socket.Send(&i32, sizeof(i32));
|
||||
i64 = receiver->getFileIndex();
|
||||
n += socket.Send(&i64, sizeof(i64));
|
||||
|
||||
// file format
|
||||
i32 = (int)receiver->getFileFormat();
|
||||
@ -406,8 +408,8 @@ int slsReceiverTCPIPInterface::send_update(Interface &socket) {
|
||||
n += socket.Send(&i32, sizeof(i32));
|
||||
|
||||
// streaming source ip
|
||||
sls::strcpy_safe(cstring, receiver->getStreamingSourceIP().c_str());
|
||||
n += socket.Send(cstring, sizeof(cstring));
|
||||
ip = receiver->getStreamingSourceIP();
|
||||
n += socket.Send(&ip, sizeof(ip));
|
||||
|
||||
// additional json header
|
||||
sls::strcpy_safe(cstring, receiver->getAdditionalJsonHeader().c_str());
|
||||
@ -542,7 +544,7 @@ int slsReceiverTCPIPInterface::set_timer(Interface &socket) {
|
||||
ret = impl()->setAcquisitionPeriod(value);
|
||||
break;
|
||||
case FRAME_NUMBER:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
case STORAGE_CELL_NUMBER:
|
||||
impl()->setNumberOfFrames(value);
|
||||
break;
|
||||
@ -583,7 +585,7 @@ int slsReceiverTCPIPInterface::set_timer(Interface &socket) {
|
||||
retval = impl()->getAcquisitionPeriod();
|
||||
break;
|
||||
case FRAME_NUMBER:
|
||||
case CYCLES_NUMBER:
|
||||
case TRIGGER_NUMBER:
|
||||
case STORAGE_CELL_NUMBER:
|
||||
retval = impl()->getNumberOfFrames();
|
||||
break;
|
||||
@ -669,16 +671,12 @@ int slsReceiverTCPIPInterface::set_streaming_frequency(Interface &socket) {
|
||||
|
||||
int slsReceiverTCPIPInterface::get_status(Interface &socket) {
|
||||
auto retval = impl()->getStatus();
|
||||
FILE_LOG(logDEBUG1) << "Status:" << runStatusType(retval);
|
||||
FILE_LOG(logDEBUG1) << "Status:" << sls::ToString(retval);
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::start_receiver(Interface &socket) {
|
||||
runStatus status = impl()->getStatus();
|
||||
if (status != IDLE) {
|
||||
throw RuntimeError("Cannot start Receiver as it is: " +
|
||||
runStatusType(status));
|
||||
} else {
|
||||
if (impl()->getStatus() == IDLE) {
|
||||
FILE_LOG(logDEBUG1) << "Starting Receiver";
|
||||
ret = impl()->startReceiver(mess);
|
||||
if (ret == FAIL) {
|
||||
@ -689,14 +687,14 @@ int slsReceiverTCPIPInterface::start_receiver(Interface &socket) {
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::stop_receiver(Interface &socket) {
|
||||
if (impl()->getStatus() != IDLE) {
|
||||
if (impl()->getStatus() == RUNNING) {
|
||||
FILE_LOG(logDEBUG1) << "Stopping Receiver";
|
||||
impl()->stopReceiver();
|
||||
}
|
||||
auto s = impl()->getStatus();
|
||||
if (s != IDLE)
|
||||
throw RuntimeError("Could not stop receiver. It as it is: " +
|
||||
runStatusType(s));
|
||||
sls::ToString(s));
|
||||
|
||||
return socket.Send(OK);
|
||||
}
|
||||
@ -740,13 +738,13 @@ int slsReceiverTCPIPInterface::set_file_name(Interface &socket) {
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_file_index(Interface &socket) {
|
||||
auto index = socket.Receive<int>();
|
||||
auto index = socket.Receive<int64_t>();
|
||||
if (index >= 0) {
|
||||
VerifyIdle(socket);
|
||||
FILE_LOG(logDEBUG1) << "Setting file index: " << index;
|
||||
impl()->setFileIndex(index);
|
||||
}
|
||||
int retval = impl()->getFileIndex();
|
||||
int64_t retval = impl()->getFileIndex();
|
||||
validate(index, retval, "set file index", DEC);
|
||||
FILE_LOG(logDEBUG1) << "file index:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
@ -956,15 +954,19 @@ int slsReceiverTCPIPInterface::set_streaming_port(Interface &socket) {
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_streaming_source_ip(Interface &socket) {
|
||||
char arg[MAX_STR_LENGTH]{};
|
||||
char retval[MAX_STR_LENGTH]{};
|
||||
sls::IpAddr arg = 0u;
|
||||
socket.Receive(arg);
|
||||
VerifyIdle(socket);
|
||||
FILE_LOG(logDEBUG1) << "Setting streaming source ip:" << arg;
|
||||
impl()->setStreamingSourceIP(arg);
|
||||
sls::strcpy_safe(retval, impl()->getStreamingSourceIP().c_str());
|
||||
FILE_LOG(logDEBUG1) << "streaming source ip:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
sls::IpAddr retval = impl()->getStreamingSourceIP();
|
||||
if (retval != arg) {
|
||||
std::ostringstream os;
|
||||
os << "Could not set streaming ip. Set " << arg
|
||||
<< ", but read " << retval << '\n';
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int slsReceiverTCPIPInterface::set_silent_mode(Interface &socket) {
|
||||
|
@ -18,11 +18,162 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace sls {
|
||||
|
||||
using defs = slsDetectorDefs;
|
||||
|
||||
inline std::string ToString(const slsDetectorDefs::runStatus s){
|
||||
return slsDetectorDefs::runStatusType(s);
|
||||
inline std::string ToString(const defs::runStatus s){
|
||||
switch (s) {
|
||||
case defs::ERROR:
|
||||
return std::string("error");
|
||||
case defs::WAITING:
|
||||
return std::string("waiting");
|
||||
case defs::RUNNING:
|
||||
return std::string("running");
|
||||
case defs::TRANSMITTING:
|
||||
return std::string("data");
|
||||
case defs::RUN_FINISHED:
|
||||
return std::string("finished");
|
||||
case defs::STOPPED:
|
||||
return std::string("stopped");
|
||||
default:
|
||||
return std::string("idle");
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string ToString(const defs::detectorType s){
|
||||
switch (s) {
|
||||
case defs::EIGER:
|
||||
return std::string("Eiger");
|
||||
case defs::GOTTHARD:
|
||||
return std::string("Gotthard");
|
||||
case defs::JUNGFRAU:
|
||||
return std::string("Jungfrau");
|
||||
case defs::CHIPTESTBOARD:
|
||||
return std::string("JungfrauCTB");
|
||||
case defs::MOENCH:
|
||||
return std::string("Moench");
|
||||
case defs::MYTHEN3:
|
||||
return std::string("Mythen3");
|
||||
case defs::GOTTHARD2:
|
||||
return std::string("Gotthard2");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string ToString(const defs::detectorSettings s){
|
||||
switch (s) {
|
||||
case defs::STANDARD:
|
||||
return std::string("standard");
|
||||
case defs::FAST:
|
||||
return std::string("fast");
|
||||
case defs::HIGHGAIN:
|
||||
return std::string("highgain");
|
||||
case defs::DYNAMICGAIN:
|
||||
return std::string("dynamicgain");
|
||||
case defs::LOWGAIN:
|
||||
return std::string("lowgain");
|
||||
case defs::MEDIUMGAIN:
|
||||
return std::string("mediumgain");
|
||||
case defs::VERYHIGHGAIN:
|
||||
return std::string("veryhighgain");
|
||||
case defs::DYNAMICHG0:
|
||||
return std::string("dynamichg0");
|
||||
case defs::FIXGAIN1:
|
||||
return std::string("fixgain1");
|
||||
case defs::FIXGAIN2:
|
||||
return std::string("fixgain2");
|
||||
case defs::FORCESWITCHG1:
|
||||
return std::string("forceswitchg1");
|
||||
case defs::FORCESWITCHG2:
|
||||
return std::string("forceswitchg2");
|
||||
case defs::VERYLOWGAIN:
|
||||
return std::string("verylowgain");
|
||||
case defs::UNDEFINED:
|
||||
return std::string("undefined");
|
||||
case defs::UNINITIALIZED:
|
||||
return std::string("uninitialized");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string ToString(const defs::speedLevel s){
|
||||
switch (s) {
|
||||
case defs::FULL_SPEED:
|
||||
return std::string("full_speed");
|
||||
case defs::HALF_SPEED:
|
||||
return std::string("half_speed");
|
||||
case defs::QUARTER_SPEED:
|
||||
return std::string("quarter_speed");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string ToString(const defs::timingMode s){
|
||||
switch (s) {
|
||||
case defs::AUTO_TIMING:
|
||||
return std::string("auto");
|
||||
case defs::TRIGGER_EXPOSURE:
|
||||
return std::string("trigger");
|
||||
case defs::GATED:
|
||||
return std::string("gating");
|
||||
case defs::BURST_TRIGGER:
|
||||
return std::string("burst_trigger");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string ToString(const defs::frameDiscardPolicy s){
|
||||
switch (s) {
|
||||
case defs::NO_DISCARD:
|
||||
return std::string("nodiscard");
|
||||
case defs::DISCARD_EMPTY_FRAMES:
|
||||
return std::string("discardempty");
|
||||
case defs::DISCARD_PARTIAL_FRAMES:
|
||||
return std::string("discardpartial");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string ToString(const defs::fileFormat s){
|
||||
switch (s) {
|
||||
case defs::HDF5:
|
||||
return std::string("hdf5");
|
||||
case defs::BINARY:
|
||||
return std::string("binary");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string ToString(const defs::externalSignalFlag s){
|
||||
switch (s) {
|
||||
case defs::TRIGGER_IN_RISING_EDGE:
|
||||
return std::string("trigger_in_rising_edge");
|
||||
case defs::TRIGGER_IN_FALLING_EDGE:
|
||||
return std::string("trigger_in_falling_edge");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string ToString(const defs::readoutMode s){
|
||||
switch (s) {
|
||||
case defs::ANALOG_ONLY:
|
||||
return std::string("analog");
|
||||
case defs::DIGITAL_ONLY:
|
||||
return std::string("digital");
|
||||
case defs::ANALOG_AND_DIGITAL:
|
||||
return std::string("analog_digital");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
// in case we already have a string
|
||||
@ -84,8 +235,37 @@ ToString(const T &value) {
|
||||
return std::to_string(value);
|
||||
}
|
||||
|
||||
/** Conversion of integer types, do not remove trailing zeros */
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_integral<T>::value, std::string>::type
|
||||
ToStringHex(const T &value) {
|
||||
std::ostringstream os;
|
||||
os << "0x" << std::hex << value << std::dec;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* hex
|
||||
* For a container loop over all elements and call ToString on the element
|
||||
* Container<std::string> is excluded
|
||||
*/
|
||||
template <typename T>
|
||||
typename std::enable_if<
|
||||
is_container<T>::value &&
|
||||
!std::is_same<typename T::value_type, std::string>::value,
|
||||
std::string>::type
|
||||
ToStringHex(const T &container) {
|
||||
std::ostringstream os;
|
||||
os << '[';
|
||||
if (!container.empty()) {
|
||||
auto it = container.cbegin();
|
||||
os << ToStringHex(*it++);
|
||||
while (it != container.cend())
|
||||
os << ", " << ToStringHex(*it++);
|
||||
}
|
||||
os << ']';
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/**
|
||||
* For a container loop over all elements and call ToString on the element
|
||||
@ -180,10 +360,120 @@ template <typename T> T StringTo(const std::string& t) {
|
||||
}
|
||||
|
||||
template <>
|
||||
inline slsDetectorDefs::detectorType StringTo(const std::string& s){
|
||||
return slsDetectorDefs::detectorTypeToEnum(s);
|
||||
inline defs::detectorType StringTo(const std::string& s){
|
||||
if (s == "Eiger")
|
||||
return defs::EIGER;
|
||||
if (s == "Gotthard")
|
||||
return defs::GOTTHARD;
|
||||
if (s == "Jungfrau")
|
||||
return defs::JUNGFRAU;
|
||||
if (s == "JungfrauCTB")
|
||||
return defs::CHIPTESTBOARD;
|
||||
if (s == "Moench")
|
||||
return defs::MOENCH;
|
||||
if (s == "Mythen3")
|
||||
return defs::MYTHEN3;
|
||||
if (s == "Gotthard2")
|
||||
return defs::GOTTHARD2;
|
||||
throw sls::RuntimeError("Unknown detector type " + s);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline defs::detectorSettings StringTo(const std::string& s){
|
||||
if (s == "standard")
|
||||
return defs::STANDARD;
|
||||
if (s == "fast")
|
||||
return defs::FAST;
|
||||
if (s == "highgain")
|
||||
return defs::HIGHGAIN;
|
||||
if (s == "dynamicgain")
|
||||
return defs::DYNAMICGAIN;
|
||||
if (s == "lowgain")
|
||||
return defs::LOWGAIN;
|
||||
if (s == "mediumgain")
|
||||
return defs::MEDIUMGAIN;
|
||||
if (s == "veryhighgain")
|
||||
return defs::VERYHIGHGAIN;
|
||||
if (s == "dynamichg0")
|
||||
return defs::DYNAMICHG0;
|
||||
if (s == "fixgain1")
|
||||
return defs::FIXGAIN1;
|
||||
if (s == "fixgain2")
|
||||
return defs::FIXGAIN2;
|
||||
if (s == "forceswitchg1")
|
||||
return defs::FORCESWITCHG1;
|
||||
if (s == "forceswitchg2")
|
||||
return defs::FORCESWITCHG2;
|
||||
if (s == "verylowgain")
|
||||
return defs::VERYLOWGAIN;
|
||||
throw sls::RuntimeError("Unknown setting " + s);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline defs::speedLevel StringTo(const std::string& s) {
|
||||
if (s == "full_speed")
|
||||
return defs::FULL_SPEED;
|
||||
if (s == "half_speed")
|
||||
return defs::HALF_SPEED;
|
||||
if (s == "quarter_speed")
|
||||
return defs::QUARTER_SPEED;
|
||||
throw sls::RuntimeError("Unknown speed " + s);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline defs::timingMode StringTo(const std::string& s) {
|
||||
if (s == "auto")
|
||||
return defs::AUTO_TIMING;
|
||||
if (s == "trigger")
|
||||
return defs::TRIGGER_EXPOSURE;
|
||||
if (s == "gating")
|
||||
return defs::GATED;
|
||||
if (s == "burst_trigger")
|
||||
return defs::BURST_TRIGGER;
|
||||
throw sls::RuntimeError("Unknown timing mode " + s);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline defs::frameDiscardPolicy StringTo(const std::string& s) {
|
||||
if (s == "nodiscard")
|
||||
return defs::NO_DISCARD;
|
||||
if (s == "discardempty")
|
||||
return defs::DISCARD_EMPTY_FRAMES;
|
||||
if (s == "discardpartial")
|
||||
return defs::DISCARD_PARTIAL_FRAMES;
|
||||
throw sls::RuntimeError("Unknown frame discard policy " + s);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline defs::fileFormat StringTo(const std::string& s) {
|
||||
if (s == "hdf5")
|
||||
return defs::HDF5;
|
||||
if (s == "binary")
|
||||
return defs::BINARY;
|
||||
throw sls::RuntimeError("Unknown file format " + s);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline defs::externalSignalFlag StringTo(const std::string& s) {
|
||||
if (s == "trigger_in_rising_edge")
|
||||
return defs::TRIGGER_IN_RISING_EDGE;
|
||||
if (s == "trigger_in_falling_edge")
|
||||
return defs::TRIGGER_IN_FALLING_EDGE;
|
||||
throw sls::RuntimeError("Unknown external signal flag " + s);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline defs::readoutMode StringTo(const std::string& s) {
|
||||
if (s == "analog")
|
||||
return defs::ANALOG_ONLY;
|
||||
if (s == "digital")
|
||||
return defs::DIGITAL_ONLY;
|
||||
if (s == "analog_digital")
|
||||
return defs::ANALOG_AND_DIGITAL;
|
||||
throw sls::RuntimeError("Unknown readout mode " + s);
|
||||
}
|
||||
|
||||
|
||||
/** For types with a .str() method use this for conversion */
|
||||
template <typename T>
|
||||
typename std::enable_if<has_str<T>::value, std::string>::type
|
||||
@ -193,6 +483,4 @@ ToString(const T &obj) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace sls
|
||||
|
@ -183,7 +183,7 @@ public:
|
||||
if (p == UDP) {
|
||||
uint64_t desired_size = buf_size;
|
||||
uint64_t real_size = desired_size * 2; // kernel doubles this value for bookkeeping overhead
|
||||
uint64_t ret_size = -1;
|
||||
uint64_t ret_size = 0;
|
||||
socklen_t optlen = sizeof(uint64_t);
|
||||
|
||||
// confirm if sufficient
|
||||
@ -192,12 +192,13 @@ public:
|
||||
"Could not get rx socket receive buffer size";
|
||||
} else if (ret_size >= real_size) {
|
||||
actual_udp_socket_buffer_size = ret_size;
|
||||
FILE_LOG(logDEBUG1) << "[Port " << port_number << "] "
|
||||
"UDP rx socket buffer size is sufficient (" << ret_size << ")";
|
||||
FILE_LOG(logINFO) << "[Port " << port_number << "] "
|
||||
"UDP rx socket real buffer size is sufficient (" << ret_size << ")";
|
||||
}
|
||||
|
||||
// not sufficient, enhance size
|
||||
else {
|
||||
FILE_LOG(logINFO) << "[Port " << port_number << "] UDP rx socket real buffer size to be modified from " << ret_size << " to " << real_size;
|
||||
// set buffer size (could not set)
|
||||
if (setsockopt(sockfd.fd, SOL_SOCKET, SO_RCVBUF,
|
||||
&desired_size, optlen) == -1) {
|
||||
@ -234,7 +235,7 @@ public:
|
||||
(ret_size/2) << " (Real size:" << ret_size << ").";
|
||||
} else {
|
||||
FILE_LOG(logINFO) << "[Port " << port_number << "] "
|
||||
"UDP rx socket buffer size modified to " << ret_size;
|
||||
"UDP rx socket buffer size (force) modified to " << ret_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,13 +107,13 @@ class slsDetectorDefs {
|
||||
*/
|
||||
enum timerIndex {
|
||||
FRAME_NUMBER, /**< number of real time frames: total number of
|
||||
acquisitions is number or frames*number of cycles */
|
||||
acquisitions is number or frames*number of triggers */
|
||||
ACQUISITION_TIME, /**< exposure time */
|
||||
FRAME_PERIOD, /**< period between exposures */
|
||||
DELAY_AFTER_TRIGGER, /**< delay between trigger and start of exposure or
|
||||
readout (in triggered mode) */
|
||||
CYCLES_NUMBER, /**< number of cycles: total number of acquisitions is
|
||||
number or frames*number of cycles */
|
||||
TRIGGER_NUMBER, /**< number of triggers: total number of acquisitions is
|
||||
number or frames*number of triggers (* number of storage cells [jungfrau]) */
|
||||
ACTUAL_TIME, /**< Actual time of the detector's internal timer */
|
||||
MEASUREMENT_TIME, /**< Time of the measurement from the detector (fifo)
|
||||
*/
|
||||
@ -578,286 +578,17 @@ format
|
||||
return std::string("disabled");
|
||||
};
|
||||
|
||||
/** returns detector type string from detector type index
|
||||
\param t string can be EIGER, GOTTHARD, JUNGFRAU, CHIPTESTBOARD, MYTHEN3, GOTTHARD2
|
||||
\returns Eiger, Gotthard, Jungfrau, JungfrauCTB, Mythen3, Gotthard2, Unknown
|
||||
*/
|
||||
static std::string detectorTypeToString(detectorType t) {
|
||||
switch (t) {
|
||||
case EIGER:
|
||||
return std::string("Eiger");
|
||||
case GOTTHARD:
|
||||
return std::string("Gotthard");
|
||||
case JUNGFRAU:
|
||||
return std::string("Jungfrau");
|
||||
case CHIPTESTBOARD:
|
||||
return std::string("JungfrauCTB");
|
||||
case MOENCH:
|
||||
return std::string("Moench");
|
||||
case MYTHEN3:
|
||||
return std::string("Mythen3");
|
||||
case GOTTHARD2:
|
||||
return std::string("Gotthard2");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
};
|
||||
|
||||
/** returns detector type index from detector type string
|
||||
\param type can be Eiger, Gotthard, Jungfrau, JungfrauCTB, Mythen3, Gotthard2
|
||||
\returns EIGER, GOTTHARD, JUNGFRAU, CHIPTESTBOARD, MYTHEN3, GOTTHARD2, GENERIC
|
||||
*/
|
||||
static detectorType detectorTypeToEnum(const std::string &type) {
|
||||
if (type == "Eiger")
|
||||
return EIGER;
|
||||
if (type == "Gotthard")
|
||||
return GOTTHARD;
|
||||
if (type == "Jungfrau")
|
||||
return JUNGFRAU;
|
||||
if (type == "JungfrauCTB")
|
||||
return CHIPTESTBOARD;
|
||||
if (type == "Moench")
|
||||
return MOENCH;
|
||||
if (type == "Mythen3")
|
||||
return MYTHEN3;
|
||||
if (type == "Gotthard2")
|
||||
return GOTTHARD2;
|
||||
return GENERIC;
|
||||
};
|
||||
|
||||
/** returns string from run status index
|
||||
\param s can be ERROR, WAITING, RUNNING, TRANSMITTING, RUN_FINISHED,
|
||||
STOPPED \returns string error, waiting, running, data, finished, stopped,
|
||||
idle
|
||||
*/
|
||||
static std::string runStatusType(runStatus s) {
|
||||
switch (s) {
|
||||
case ERROR:
|
||||
return std::string("error");
|
||||
case WAITING:
|
||||
return std::string("waiting");
|
||||
case RUNNING:
|
||||
return std::string("running");
|
||||
case TRANSMITTING:
|
||||
return std::string("data");
|
||||
case RUN_FINISHED:
|
||||
return std::string("finished");
|
||||
case STOPPED:
|
||||
return std::string("stopped");
|
||||
default:
|
||||
return std::string("idle");
|
||||
}
|
||||
};
|
||||
|
||||
/** returns string from file format index
|
||||
\param s can be BINARY, HDF5
|
||||
\returns string binary, hdf5
|
||||
*/
|
||||
static std::string getFileFormatType(fileFormat f) {
|
||||
switch (f) {
|
||||
case HDF5:
|
||||
return std::string("hdf5");
|
||||
case BINARY:
|
||||
return std::string("binary");
|
||||
default:
|
||||
return std::string("unknown");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns string of frame discard policy index
|
||||
* @param f can be NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
|
||||
* @returns No Discard, Discard Empty Frames, Discard Partial Frames,
|
||||
* unknown
|
||||
*/
|
||||
static std::string getFrameDiscardPolicyType(frameDiscardPolicy f) {
|
||||
switch (f) {
|
||||
case NO_DISCARD:
|
||||
return std::string("No Discard");
|
||||
case DISCARD_EMPTY_FRAMES:
|
||||
return std::string("Discard Empty Frames");
|
||||
case DISCARD_PARTIAL_FRAMES:
|
||||
return std::string("Discard Partial Frames");
|
||||
default:
|
||||
return std::string("unknown");
|
||||
}
|
||||
};
|
||||
|
||||
/** returns std::string from external signal type index
|
||||
\param f can be TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE,
|
||||
\returns std::string trigger_in_rising_edge, trigger_in_falling_edge, unknown
|
||||
*/
|
||||
static std::string externalSignalType(externalSignalFlag f) {
|
||||
switch (f) {
|
||||
case TRIGGER_IN_RISING_EDGE:
|
||||
return std::string("trigger_in_rising_edge");
|
||||
case TRIGGER_IN_FALLING_EDGE:
|
||||
return std::string("trigger_in_falling_edge");
|
||||
default:
|
||||
return std::string("unknown");
|
||||
}
|
||||
};
|
||||
|
||||
/** returns external signal type index from std::string
|
||||
\param sval trigger_in_rising_edge, trigger_in_falling_edge, unknown
|
||||
\returns can be TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE,
|
||||
GET_EXTERNAL_SIGNAL_FLAG (if unknown)
|
||||
*/
|
||||
|
||||
static externalSignalFlag externalSignalType(std::string sval) {
|
||||
if (sval == "trigger_in_rising_edge")
|
||||
return TRIGGER_IN_RISING_EDGE;
|
||||
if (sval == "trigger_in_falling_edge")
|
||||
return TRIGGER_IN_FALLING_EDGE;
|
||||
return GET_EXTERNAL_SIGNAL_FLAG;
|
||||
};
|
||||
|
||||
/** returns detector settings std::string from index
|
||||
\param s can be STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN,
|
||||
MEDIUMGAIN, VERYHIGHGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2,
|
||||
FORCESWITCHG1, FORCESWITCHG2, GET_SETTINGS \returns standard, fast,
|
||||
highgain, dynamicgain, lowgain, mediumgain, veryhighgain,
|
||||
dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2,
|
||||
verylowgain, undefined
|
||||
*/
|
||||
static std::string getDetectorSettings(detectorSettings s) {
|
||||
switch (s) {
|
||||
case STANDARD:
|
||||
return std::string("standard");
|
||||
case FAST:
|
||||
return std::string("fast");
|
||||
case HIGHGAIN:
|
||||
return std::string("highgain");
|
||||
case DYNAMICGAIN:
|
||||
return std::string("dynamicgain");
|
||||
case LOWGAIN:
|
||||
return std::string("lowgain");
|
||||
case MEDIUMGAIN:
|
||||
return std::string("mediumgain");
|
||||
case VERYHIGHGAIN:
|
||||
return std::string("veryhighgain");
|
||||
case DYNAMICHG0:
|
||||
return std::string("dynamichg0");
|
||||
case FIXGAIN1:
|
||||
return std::string("fixgain1");
|
||||
case FIXGAIN2:
|
||||
return std::string("fixgain2");
|
||||
case FORCESWITCHG1:
|
||||
return std::string("forceswitchg1");
|
||||
case FORCESWITCHG2:
|
||||
return std::string("forceswitchg2");
|
||||
case VERYLOWGAIN:
|
||||
return std::string("verylowgain");
|
||||
case UNINITIALIZED:
|
||||
return std::string("uninitialized");
|
||||
default:
|
||||
return std::string("undefined");
|
||||
}
|
||||
};
|
||||
|
||||
/** returns detector settings std::string from index
|
||||
\param s can be standard, fast, highgain, dynamicgain, lowgain,
|
||||
mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2,
|
||||
forceswitchg1, forceswitchg2, undefined \returns setting index
|
||||
STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN,
|
||||
VERYHIGHGAIN,DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1,
|
||||
FORCESWITCHG2, VERYLOWGAIN, GET_SETTINGS
|
||||
*/
|
||||
|
||||
static detectorSettings getDetectorSettings(std::string s) {
|
||||
if (s == "standard")
|
||||
return STANDARD;
|
||||
if (s == "fast")
|
||||
return FAST;
|
||||
if (s == "highgain")
|
||||
return HIGHGAIN;
|
||||
if (s == "dynamicgain")
|
||||
return DYNAMICGAIN;
|
||||
if (s == "lowgain")
|
||||
return LOWGAIN;
|
||||
if (s == "mediumgain")
|
||||
return MEDIUMGAIN;
|
||||
if (s == "veryhighgain")
|
||||
return VERYHIGHGAIN;
|
||||
if (s == "dynamichg0")
|
||||
return DYNAMICHG0;
|
||||
if (s == "fixgain1")
|
||||
return FIXGAIN1;
|
||||
if (s == "fixgain2")
|
||||
return FIXGAIN2;
|
||||
if (s == "forceswitchg1")
|
||||
return FORCESWITCHG1;
|
||||
if (s == "forceswitchg2")
|
||||
return FORCESWITCHG2;
|
||||
if (s == "verylowgain")
|
||||
return VERYLOWGAIN;
|
||||
return GET_SETTINGS;
|
||||
};
|
||||
|
||||
/**
|
||||
returns external communication mode std::string from index
|
||||
\param f can be AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER,
|
||||
GET_TIMING_MODE \returns auto, trigger, gating,
|
||||
burst_trigger, unknown
|
||||
*/
|
||||
|
||||
static std::string timingModeType(timingMode f) {
|
||||
switch (f) {
|
||||
case AUTO_TIMING:
|
||||
return std::string("auto");
|
||||
case TRIGGER_EXPOSURE:
|
||||
return std::string("trigger");
|
||||
case GATED:
|
||||
return std::string("gating");
|
||||
case BURST_TRIGGER:
|
||||
return std::string("burst_trigger");
|
||||
default:
|
||||
return std::string("unknown");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
returns external communication mode index from std::string
|
||||
\param sval can be auto, trigger, gating, burst_trigger
|
||||
\returns AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER,
|
||||
GET_TIMING_MODE
|
||||
*/
|
||||
|
||||
static timingMode timingModeType(std::string sval) {
|
||||
if (sval == "auto")
|
||||
return AUTO_TIMING;
|
||||
if (sval == "trigger")
|
||||
return TRIGGER_EXPOSURE;
|
||||
if (sval == "gating")
|
||||
return GATED;
|
||||
if (sval == "burst_trigger")
|
||||
return BURST_TRIGGER;
|
||||
return GET_TIMING_MODE;
|
||||
};
|
||||
|
||||
/** returns std::string from file format index
|
||||
\param s can be RAW, HDF5
|
||||
\returns std::string raw, hdf5
|
||||
*/
|
||||
static std::string fileFormats(fileFormat f) {
|
||||
switch (f) {
|
||||
case BINARY:
|
||||
return std::string("binary");
|
||||
case HDF5:
|
||||
return std::string("hdf5");
|
||||
default:
|
||||
return std::string("unknown");
|
||||
}
|
||||
};
|
||||
|
||||
/** returns std::string from timer index
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD,
|
||||
DELAY_AFTER_TRIGGER, CYCLES_NUMBER,
|
||||
DELAY_AFTER_TRIGGER, TRIGGER_NUMBER,
|
||||
ACTUAL_TIME,MEASUREMENT_TIME,
|
||||
PROGRESS,FRAMES_FROM_START,FRAMES_FROM_START_PG,ANALOG_SAMPLES,DIGITAL_SAMPLES,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER,
|
||||
SUBFRAME_DEADTIME \returns std::string
|
||||
frame_number,acquisition_time,frame_period,
|
||||
delay_after_trigger, cycles_number,
|
||||
delay_after_trigger, triggers_number,
|
||||
actual_time,measurement_time,
|
||||
progress,frames_from_start,frames_from_start_pg,analog_samples, digital_samples,subframe_acquisition_time,storage_cell_number,
|
||||
SUBFRAME_DEADTIME
|
||||
@ -872,8 +603,8 @@ format
|
||||
return std::string("frame_period");
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
return std::string("delay_after_trigger");
|
||||
case CYCLES_NUMBER:
|
||||
return std::string("cycles_number");
|
||||
case TRIGGER_NUMBER:
|
||||
return std::string("triggers_number");
|
||||
case ACTUAL_TIME:
|
||||
return std::string("actual_time");
|
||||
case MEASUREMENT_TIME:
|
||||
@ -899,83 +630,6 @@ format
|
||||
}
|
||||
};
|
||||
|
||||
/** returns string from readoutMode */
|
||||
static std::string getReadoutModeType(readoutMode mode) {
|
||||
switch(mode) {
|
||||
case ANALOG_ONLY:
|
||||
return "analog";
|
||||
case DIGITAL_ONLY:
|
||||
return "digital";
|
||||
case ANALOG_AND_DIGITAL:
|
||||
return "analog_digital";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
};
|
||||
|
||||
/** returns readoutMode from string */
|
||||
static readoutMode getReadoutModeType(std::string smode) {
|
||||
if (smode == "analog")
|
||||
return ANALOG_ONLY;
|
||||
if (smode == "digital")
|
||||
return DIGITAL_ONLY;
|
||||
if (smode == "analog_digital")
|
||||
return ANALOG_AND_DIGITAL;
|
||||
throw sls::RuntimeError("Unknown readout mode " + smode);
|
||||
};
|
||||
|
||||
/** returns string from speedLevel */
|
||||
static std::string getSpeedLevelType(speedLevel mode) {
|
||||
switch(mode) {
|
||||
case FULL_SPEED:
|
||||
return "full_speed";
|
||||
case HALF_SPEED:
|
||||
return "half_speed";
|
||||
case QUARTER_SPEED:
|
||||
return "quarter_speed";
|
||||
// default:
|
||||
// return "Unknown";
|
||||
}
|
||||
};
|
||||
|
||||
/** returns speedLevel from string */
|
||||
static speedLevel getSpeedLevelType(std::string smode) {
|
||||
if (smode == "full_speed")
|
||||
return FULL_SPEED;
|
||||
if (smode == "half_speed")
|
||||
return HALF_SPEED;
|
||||
if (smode == "quarter_speed")
|
||||
return QUARTER_SPEED;
|
||||
throw sls::RuntimeError("Unknown speed level mode " + smode);
|
||||
};
|
||||
|
||||
/**
|
||||
@short returns adc index from std::string
|
||||
\param s can be temp_fpga, temp_fpgaext, temp_10ge, temp_dcdc, temp_sodl,
|
||||
temp_sodr, temp_fpgafl, temp_fpgafr \returns TEMPERATURE_FPGA,
|
||||
TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC,
|
||||
TEMPERATURE_SODL, TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3,
|
||||
-1 when unknown mode
|
||||
*/
|
||||
static int getADCIndex(std::string s) {
|
||||
if (s == "temp_fpga")
|
||||
return TEMPERATURE_FPGA;
|
||||
if (s == "temp_fpgaext")
|
||||
return TEMPERATURE_FPGAEXT;
|
||||
if (s == "temp_10ge")
|
||||
return TEMPERATURE_10GE;
|
||||
if (s == "temp_dcdc")
|
||||
return TEMPERATURE_DCDC;
|
||||
if (s == "temp_sodl")
|
||||
return TEMPERATURE_SODL;
|
||||
if (s == "temp_sodr")
|
||||
return TEMPERATURE_SODR;
|
||||
if (s == "temp_fpgafl")
|
||||
return TEMPERATURE_FPGA2;
|
||||
if (s == "temp_fpgafr")
|
||||
return TEMPERATURE_FPGA3;
|
||||
return -1;
|
||||
};
|
||||
|
||||
/**
|
||||
@short returns dac index from std::string
|
||||
@ -1007,38 +661,6 @@ format
|
||||
return -1;
|
||||
};
|
||||
|
||||
/**
|
||||
@short returns receiver frame discard policy from std::string
|
||||
\param s can be nodiscard, discardempty, discardpartial
|
||||
\returns NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES,
|
||||
GET_FRAME_DISCARD_POLICY when unknown mode
|
||||
*/
|
||||
static frameDiscardPolicy getReceiverFrameDiscardPolicy(std::string s) {
|
||||
if (s == "nodiscard")
|
||||
return NO_DISCARD;
|
||||
if (s == "discardempty")
|
||||
return DISCARD_EMPTY_FRAMES;
|
||||
if (s == "discardpartial")
|
||||
return DISCARD_PARTIAL_FRAMES;
|
||||
return GET_FRAME_DISCARD_POLICY;
|
||||
};
|
||||
|
||||
/** returns std::string from frame discard policy
|
||||
\param f can be NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
|
||||
\returns std::string nodiscard, discardempty, discardpartial, unknown
|
||||
*/
|
||||
static std::string getReceiverFrameDiscardPolicy(frameDiscardPolicy f) {
|
||||
switch (f) {
|
||||
case NO_DISCARD:
|
||||
return std::string("nodiscard");
|
||||
case DISCARD_EMPTY_FRAMES:
|
||||
return std::string("discardempty");
|
||||
case DISCARD_PARTIAL_FRAMES:
|
||||
return std::string("discardpartial");
|
||||
default:
|
||||
return std::string("unknown");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* returns frameModeType as enum
|
||||
@ -1215,9 +837,7 @@ struct detParameters {
|
||||
nGappixelsY = 0;
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(
|
||||
"Unknown detector type! " +
|
||||
slsDetectorDefs::detectorTypeToString(type));
|
||||
throw sls::RuntimeError("Unknown detector type! " + std::to_string(type));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -4,9 +4,9 @@
|
||||
#define APIRECEIVER 0x190722
|
||||
#define APIGUI 0x190723
|
||||
#define APIMOENCH 0x190820
|
||||
#define APICTB 0x190930
|
||||
#define APIGOTTHARD 0x190930
|
||||
#define APIEIGER 0x190930
|
||||
#define APIMYTHEN3 0x191008
|
||||
#define APIJUNGFRAU 0x191008
|
||||
#define APICTB 0x191011
|
||||
#define APIGOTTHARD 0x191011
|
||||
#define APIJUNGFRAU 0x191011
|
||||
#define APIMYTHEN3 0x191011
|
||||
#define APIEIGER 0x191014
|
||||
#define APIGOTTHARD2 0x191017
|
||||
|
@ -5,6 +5,7 @@
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include "catch.hpp"
|
||||
#include "sls_detector_defs.h"
|
||||
#include "ToString.h"
|
||||
#include "tests/config.h"
|
||||
#include <string>
|
||||
|
||||
@ -38,7 +39,10 @@ int main(int argc, char *argv[]) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
test::type = slsDetectorDefs::detectorTypeToEnum(test::detector_type);
|
||||
test::type = slsDetectorDefs::GENERIC;
|
||||
if (!test::detector_type.empty()) {
|
||||
test::type = sls::StringTo<slsDetectorDefs::detectorType>(test::detector_type);
|
||||
}
|
||||
|
||||
return session.run();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user