mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 20:37:15 +02:00
vetoalg added hits and raw
This commit is contained in:
@ -2448,10 +2448,15 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def vetoalg(self):
|
def vetoalg(self):
|
||||||
"""[Gotthard2] Algorithm used for veto
|
"""[Gotthard2] Algorithm used for veto. Enum: vetoAlgorithm, streamingInterface
|
||||||
|
Note
|
||||||
|
----
|
||||||
|
Options:
|
||||||
|
(vetoAlgorithm): ALG_HITS, ALG_RAW
|
||||||
|
(streamingInterface): ETHERNET_10GB, LOW_LATENCY_LINK
|
||||||
Example
|
Example
|
||||||
----------
|
----------
|
||||||
>>> d.vetoalg = defs.DEFAULT_ALGORITHM, defs.ETHERNET_10GB
|
>>> d.vetoalg = defs.ALG_HITS, defs.ETHERNET_10GB
|
||||||
"""
|
"""
|
||||||
result = {}
|
result = {}
|
||||||
interface = [streamingInterface.LOW_LATENCY_LINK, streamingInterface.ETHERNET_10GB]
|
interface = [streamingInterface.LOW_LATENCY_LINK, streamingInterface.ETHERNET_10GB]
|
||||||
|
@ -303,8 +303,8 @@ void init_enums(py::module &m) {
|
|||||||
&operator&));
|
&operator&));
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::vetoAlgorithm>(Defs, "vetoAlgorithm")
|
py::enum_<slsDetectorDefs::vetoAlgorithm>(Defs, "vetoAlgorithm")
|
||||||
.value("DEFAULT_ALGORITHM",
|
.value("ALG_HITS", slsDetectorDefs::vetoAlgorithm::ALG_HITS)
|
||||||
slsDetectorDefs::vetoAlgorithm::DEFAULT_ALGORITHM)
|
.value("ALG_RAW", slsDetectorDefs::vetoAlgorithm::ALG_RAW)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::gainMode>(Defs, "gainMode")
|
py::enum_<slsDetectorDefs::gainMode>(Defs, "gainMode")
|
||||||
|
@ -90,16 +90,16 @@
|
|||||||
|
|
||||||
#define CONFIG_VETO_ENBL_OFST (0)
|
#define CONFIG_VETO_ENBL_OFST (0)
|
||||||
#define CONFIG_VETO_ENBL_MSK (0x00000001 << CONFIG_VETO_ENBL_OFST)
|
#define CONFIG_VETO_ENBL_MSK (0x00000001 << CONFIG_VETO_ENBL_OFST)
|
||||||
#define CONFIG_VETO_CH_3GB_ALG_OFST (8)
|
#define CONFIG_VETO_CH_LLL_ALG_OFST (8)
|
||||||
#define CONFIG_VETO_CH_3GB_ALG_MSK (0x00000007 << CONFIG_VETO_CH_3GB_ALG_OFST)
|
#define CONFIG_VETO_CH_LLL_ALG_MSK (0x00000007 << CONFIG_VETO_CH_LLL_ALG_OFST)
|
||||||
#define CONFIG_VETO_CH_3GB_ALG_DEFAULT_VAL ((0x0 << CONFIG_VETO_CH_3GB_ALG_OFST) & CONFIG_VETO_CH_3GB_ALG_MSK)
|
#define CONFIG_VETO_CH_LLL_ENBL_OFST (11)
|
||||||
#define CONFIG_VETO_CH_3GB_ENBL_OFST (11)
|
#define CONFIG_VETO_CH_LLL_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_LLL_ENBL_OFST)
|
||||||
#define CONFIG_VETO_CH_3GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_3GB_ENBL_OFST)
|
#define CONFIG_VETO_CH_10GBE_ALG_OFST (12)
|
||||||
#define CONFIG_VETO_CH_10GB_ALG_OFST (12)
|
#define CONFIG_VETO_CH_10GBE_ALG_MSK (0x00000007 << CONFIG_VETO_CH_10GBE_ALG_OFST)
|
||||||
#define CONFIG_VETO_CH_10GB_ALG_MSK (0x00000007 << CONFIG_VETO_CH_10GB_ALG_OFST)
|
#define CONFIG_VETO_CH_10GBE_ENBL_OFST (15)
|
||||||
#define CONFIG_VETO_CH_10GB_ALG_DEFAULT_VAL ((0x0 << CONFIG_VETO_CH_10GB_ALG_OFST) & CONFIG_VETO_CH_10GB_ALG_MSK)
|
#define CONFIG_VETO_CH_10GBE_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_10GBE_ENBL_OFST)
|
||||||
#define CONFIG_VETO_CH_10GB_ENBL_OFST (15)
|
#define ALGORITHM_HITS_VAL (0x0)
|
||||||
#define CONFIG_VETO_CH_10GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_10GB_ENBL_OFST)
|
#define ALGORITHM_RAW_VAL (0x7)
|
||||||
|
|
||||||
/* Control RW register */
|
/* Control RW register */
|
||||||
#define CONTROL_REG (0x09 * REG_OFFSET + BASE_CONTROL)
|
#define CONTROL_REG (0x09 * REG_OFFSET + BASE_CONTROL)
|
||||||
|
@ -481,6 +481,8 @@ void setupDetector() {
|
|||||||
setBurstPeriod(DEFAULT_BURST_PERIOD);
|
setBurstPeriod(DEFAULT_BURST_PERIOD);
|
||||||
setTiming(DEFAULT_TIMING_MODE);
|
setTiming(DEFAULT_TIMING_MODE);
|
||||||
setCurrentSource(DEFAULT_CURRENT_SOURCE);
|
setCurrentSource(DEFAULT_CURRENT_SOURCE);
|
||||||
|
setVetoAlgorithm(DEFAULT_ALGORITHM, LOW_LATENCY_LINK);
|
||||||
|
setVetoAlgorithm(DEFAULT_ALGORITHM, ETHERNET_10GB);
|
||||||
}
|
}
|
||||||
|
|
||||||
int resetToDefaultDacs(int hardReset) {
|
int resetToDefaultDacs(int hardReset) {
|
||||||
@ -1620,12 +1622,12 @@ void setNumberofUDPInterfaces(int val) {
|
|||||||
// 2 rxr interfaces (enable debugging interface)
|
// 2 rxr interfaces (enable debugging interface)
|
||||||
if (val > 1) {
|
if (val > 1) {
|
||||||
LOG(logINFOBLUE, ("Enabling 10GbE (debugging) veto streaming\n"));
|
LOG(logINFOBLUE, ("Enabling 10GbE (debugging) veto streaming\n"));
|
||||||
bus_w(addr, bus_r(addr) | CONFIG_VETO_CH_10GB_ENBL_MSK);
|
bus_w(addr, bus_r(addr) | CONFIG_VETO_CH_10GBE_ENBL_MSK);
|
||||||
}
|
}
|
||||||
// 1 rxr interface (disable debugging interface)
|
// 1 rxr interface (disable debugging interface)
|
||||||
else {
|
else {
|
||||||
LOG(logINFOBLUE, ("Disabling 10GbE (debugging) veto streaming\n"));
|
LOG(logINFOBLUE, ("Disabling 10GbE (debugging) veto streaming\n"));
|
||||||
bus_w(addr, bus_r(addr) & ~CONFIG_VETO_CH_10GB_ENBL_MSK);
|
bus_w(addr, bus_r(addr) & ~CONFIG_VETO_CH_10GBE_ENBL_MSK);
|
||||||
}
|
}
|
||||||
LOG(logDEBUG, ("config reg:0x%x\n", bus_r(addr)));
|
LOG(logDEBUG, ("config reg:0x%x\n", bus_r(addr)));
|
||||||
}
|
}
|
||||||
@ -1633,7 +1635,7 @@ void setNumberofUDPInterfaces(int val) {
|
|||||||
int getNumberofUDPInterfaces() {
|
int getNumberofUDPInterfaces() {
|
||||||
LOG(logDEBUG, ("config reg:0x%x\n", bus_r(CONFIG_REG)));
|
LOG(logDEBUG, ("config reg:0x%x\n", bus_r(CONFIG_REG)));
|
||||||
// return 2 if 10gbps veto streaming enabled, else 1
|
// return 2 if 10gbps veto streaming enabled, else 1
|
||||||
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_10GB_ENBL_MSK) ? 2 : 1);
|
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_10GBE_ENBL_MSK) ? 2 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
|
void setupHeader(int iRxEntry, int vetoInterface, uint32_t destip,
|
||||||
@ -1756,9 +1758,9 @@ int configureMAC() {
|
|||||||
int i10gbe = (getNumberofUDPInterfaces() == 2 ? 1 : 0);
|
int i10gbe = (getNumberofUDPInterfaces() == 2 ? 1 : 0);
|
||||||
|
|
||||||
if (lll) {
|
if (lll) {
|
||||||
LOG(logINFOGREEN, ("\tVeto (3GbE) : enabled\n\n"));
|
LOG(logINFOGREEN, ("\tVeto (lll) : enabled\n\n"));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFORED, ("\tVeto (3GbE) : disabled\n\n"));
|
LOG(logINFORED, ("\tVeto (lll) : disabled\n\n"));
|
||||||
}
|
}
|
||||||
if (i10gbe) {
|
if (i10gbe) {
|
||||||
LOG(logINFOGREEN, ("\tVeto (10GbE): enabled\n"));
|
LOG(logINFOGREEN, ("\tVeto (10GbE): enabled\n"));
|
||||||
@ -2629,65 +2631,73 @@ void setVetoStream(int value) {
|
|||||||
uint32_t addr = CONFIG_REG;
|
uint32_t addr = CONFIG_REG;
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
LOG(logINFOBLUE, ("Enabling 3GbE veto streaming\n"));
|
LOG(logINFOBLUE, ("Enabling lll veto streaming\n"));
|
||||||
bus_w(addr, bus_r(addr) | CONFIG_VETO_CH_3GB_ENBL_MSK);
|
bus_w(addr, bus_r(addr) | CONFIG_VETO_CH_LLL_ENBL_MSK);
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFOBLUE, ("Disabling 3GbE veto streaming\n"));
|
LOG(logINFOBLUE, ("Disabling lll veto streaming\n"));
|
||||||
bus_w(addr, bus_r(addr) & ~CONFIG_VETO_CH_3GB_ENBL_MSK);
|
bus_w(addr, bus_r(addr) & ~CONFIG_VETO_CH_LLL_ENBL_MSK);
|
||||||
}
|
}
|
||||||
LOG(logDEBUG, ("config reg:0x%x\n", bus_r(addr)));
|
LOG(logDEBUG, ("config reg:0x%x\n", bus_r(addr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
int getVetoStream() {
|
int getVetoStream() {
|
||||||
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ENBL_MSK) ? 1 : 0);
|
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_LLL_ENBL_MSK) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum vetoAlgorithm getVetoAlgorithm(enum streamingInterface interface) {
|
enum vetoAlgorithm getVetoAlgorithm(enum streamingInterface interface) {
|
||||||
// 3gbe
|
int retval = 0;
|
||||||
if (interface == LOW_LATENCY_LINK) {
|
if (interface == LOW_LATENCY_LINK) {
|
||||||
int retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ALG_MSK) >>
|
retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_LLL_ALG_MSK) >>
|
||||||
CONFIG_VETO_CH_3GB_ALG_OFST);
|
CONFIG_VETO_CH_LLL_ALG_OFST);
|
||||||
switch (retval) {
|
} else {
|
||||||
// more to follow
|
retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_10GBE_ALG_MSK) >>
|
||||||
case CONFIG_VETO_CH_3GB_ALG_DEFAULT_VAL:
|
CONFIG_VETO_CH_10GBE_ALG_OFST);
|
||||||
return DEFAULT_ALGORITHM;
|
|
||||||
default:
|
|
||||||
LOG(logERROR, ("unknown algorithm %d for 3gbe\n", retval));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 10gbe
|
|
||||||
int retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_10GB_ALG_MSK) >>
|
|
||||||
CONFIG_VETO_CH_10GB_ALG_OFST);
|
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
// more to follow
|
case ALGORITHM_HITS_VAL:
|
||||||
case CONFIG_VETO_CH_10GB_ALG_DEFAULT_VAL:
|
return ALG_HITS;
|
||||||
return DEFAULT_ALGORITHM;
|
case ALGORITHM_RAW_VAL:
|
||||||
|
return ALG_RAW;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR, ("unknown algorithm %d for 3gbe\n", retval));
|
LOG(logERROR, ("unknown algorithm %d\n", retval));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setVetoAlgorithm(enum streamingInterface interface,
|
void setVetoAlgorithm(enum vetoAlgorithm alg,
|
||||||
enum vetoAlgorithm alg) {
|
enum streamingInterface interface) {
|
||||||
uint32_t addr = CONFIG_REG;
|
uint32_t addr = CONFIG_REG;
|
||||||
uint32_t value = bus_r(addr);
|
uint32_t value = bus_r(addr);
|
||||||
switch (alg) {
|
switch (alg) {
|
||||||
// more to follow
|
// more to follow
|
||||||
case DEFAULT_ALGORITHM:
|
case ALG_HITS:
|
||||||
if (interface == LOW_LATENCY_LINK) {
|
if (interface == LOW_LATENCY_LINK) {
|
||||||
LOG(logINFO, ("Setting default veto algorithm for 3Gbe\n"));
|
LOG(logINFO, ("Setting veto algorithm [lll]: hits\n"));
|
||||||
value &= (~CONFIG_VETO_CH_3GB_ALG_MSK);
|
value &= (~CONFIG_VETO_CH_LLL_ALG_MSK);
|
||||||
value |= CONFIG_VETO_CH_3GB_ALG_DEFAULT_VAL;
|
value |= ((ALGORITHM_HITS_VAL << CONFIG_VETO_CH_LLL_ALG_OFST) &
|
||||||
|
CONFIG_VETO_CH_LLL_ALG_MSK);
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO, ("Setting default veto algorithm for 10Gbe\n"));
|
LOG(logINFO, ("Setting veto algorithm [10Gbe]: hits\n"));
|
||||||
value &= (~CONFIG_VETO_CH_10GB_ALG_MSK);
|
value &= (~CONFIG_VETO_CH_10GBE_ALG_MSK);
|
||||||
value |= CONFIG_VETO_CH_10GB_ALG_DEFAULT_VAL;
|
value |= ((ALGORITHM_HITS_VAL << CONFIG_VETO_CH_10GBE_ALG_OFST) &
|
||||||
|
CONFIG_VETO_CH_10GBE_ALG_MSK);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ALG_RAW:
|
||||||
|
if (interface == LOW_LATENCY_LINK) {
|
||||||
|
LOG(logINFO, ("Setting veto algorithm [lll]: raw\n"));
|
||||||
|
value &= (~CONFIG_VETO_CH_LLL_ALG_MSK);
|
||||||
|
value |= ((ALGORITHM_RAW_VAL << CONFIG_VETO_CH_LLL_ALG_OFST) &
|
||||||
|
CONFIG_VETO_CH_LLL_ALG_MSK);
|
||||||
|
} else {
|
||||||
|
LOG(logINFO, ("Setting veto algorithm [10Gbe]: raw\n"));
|
||||||
|
value &= (~CONFIG_VETO_CH_10GBE_ALG_MSK);
|
||||||
|
value |= ((ALGORITHM_RAW_VAL << CONFIG_VETO_CH_10GBE_ALG_OFST) &
|
||||||
|
CONFIG_VETO_CH_10GBE_ALG_MSK);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR, ("unknown algorithm %d for 3gbe\n", alg));
|
LOG(logERROR, ("unknown algorithm %d for lll\n", alg));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bus_w(addr, value);
|
bus_w(addr, value);
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
||||||
#define DEFAULT_CURRENT_SOURCE (0)
|
#define DEFAULT_CURRENT_SOURCE (0)
|
||||||
#define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL)
|
#define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL)
|
||||||
|
#define DEFAULT_ALGORITHM (ALG_HITS)
|
||||||
|
|
||||||
#define DEFAULT_READOUT_C0 (6) //(144444448) // rdo_clk, 144 MHz
|
#define DEFAULT_READOUT_C0 (6) //(144444448) // rdo_clk, 144 MHz
|
||||||
#define DEFAULT_READOUT_C1 (6) //(144444448) // rdo_x2_clk, 144 MHz
|
#define DEFAULT_READOUT_C1 (6) //(144444448) // rdo_x2_clk, 144 MHz
|
||||||
@ -62,6 +63,10 @@
|
|||||||
#define INT_SYSTEM_C0_FREQUENCY (144000000) // 144 MHz
|
#define INT_SYSTEM_C0_FREQUENCY (144000000) // 144 MHz
|
||||||
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // 866 MHz
|
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // 866 MHz
|
||||||
#define SYSTEM_PLL_VCO_FREQ_HZ (722222224) // 722 MHz
|
#define SYSTEM_PLL_VCO_FREQ_HZ (722222224) // 722 MHz
|
||||||
|
|
||||||
|
#define ALGORITHM_HITS_VAL (0x0)
|
||||||
|
#define ALGORITHM_RAW_VAL (0x7)
|
||||||
|
|
||||||
#define VETO_DATA_SIZE (160)
|
#define VETO_DATA_SIZE (160)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t frameNumber;
|
uint64_t frameNumber;
|
||||||
|
@ -554,7 +554,8 @@ int getVeto();
|
|||||||
void setVetoStream(int value);
|
void setVetoStream(int value);
|
||||||
int getVetoStream();
|
int getVetoStream();
|
||||||
enum vetoAlgorithm getVetoAlgorithm(enum streamingInterface interface);
|
enum vetoAlgorithm getVetoAlgorithm(enum streamingInterface interface);
|
||||||
void setVetoAlgorithm(enum streamingInterface interface, enum vetoAlgorithm alg);
|
void setVetoAlgorithm(enum vetoAlgorithm alg,
|
||||||
|
enum streamingInterface interface);
|
||||||
void setBadChannels(int nch, int *channels);
|
void setBadChannels(int nch, int *channels);
|
||||||
int *getBadChannels(int *nch);
|
int *getBadChannels(int *nch);
|
||||||
#endif
|
#endif
|
||||||
|
@ -8519,7 +8519,7 @@ int get_veto_algorithm(int file_des) {
|
|||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
enum streamingInterface arg = NONE;
|
enum streamingInterface arg = NONE;
|
||||||
enum vetoAlgorithm retval = DEFAULT_ALGORITHM;
|
enum vetoAlgorithm retval = ALG_HITS;
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
|
|
||||||
@ -8551,7 +8551,7 @@ int set_veto_algorithm(int file_des) {
|
|||||||
|
|
||||||
enum vetoAlgorithm alg = args[0];
|
enum vetoAlgorithm alg = args[0];
|
||||||
enum streamingInterface interface = args[1];
|
enum streamingInterface interface = args[1];
|
||||||
LOG(logDEBUG1, ("Setting vetoalgorithm (interface: %d): %u\n", (int)interface,
|
LOG(logINFOBLUE, ("Setting vetoalgorithm (interface: %d): %u\n", (int)interface,
|
||||||
(int)alg));
|
(int)alg));
|
||||||
|
|
||||||
#ifndef GOTTHARD2D
|
#ifndef GOTTHARD2D
|
||||||
@ -8565,13 +8565,17 @@ int set_veto_algorithm(int file_des) {
|
|||||||
"Could not set vetoalgorithm. Invalid interface %d.\n",
|
"Could not set vetoalgorithm. Invalid interface %d.\n",
|
||||||
interface);
|
interface);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else if (alg != DEFAULT_ALGORITHM) {
|
|
||||||
ret = FAIL;
|
|
||||||
sprintf(mess,
|
|
||||||
"Could not set vetoalgorithm. Invalid algorithm %d.\n",
|
|
||||||
alg);
|
|
||||||
LOG(logERROR, (mess));
|
|
||||||
} else {
|
} else {
|
||||||
|
switch (alg) {
|
||||||
|
case ALG_HITS:
|
||||||
|
case ALG_RAW:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
modeNotImplemented("Veto Algorithm index", (int)alg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ret == OK) {
|
||||||
setVetoAlgorithm(alg, interface);
|
setVetoAlgorithm(alg, interface);
|
||||||
int retval = getVetoAlgorithm(interface);
|
int retval = getVetoAlgorithm(interface);
|
||||||
LOG(logDEBUG1, ("vetoalgorithm retval: %u\n", retval));
|
LOG(logDEBUG1, ("vetoalgorithm retval: %u\n", retval));
|
||||||
|
@ -1337,7 +1337,7 @@ class Detector {
|
|||||||
getVetoAlgorithm(const defs::streamingInterface value,
|
getVetoAlgorithm(const defs::streamingInterface value,
|
||||||
Positions pos = {}) const;
|
Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard2] Options(vetoAlgorithm): DEFAULT_ALGORITHM.
|
/** [Gotthard2] Options(vetoAlgorithm): ALG_HITS, ALG_RAW.
|
||||||
* Options(streamingInterface): LOW_LATENCY_LINK, ETHERNET_10GB */
|
* Options(streamingInterface): LOW_LATENCY_LINK, ETHERNET_10GB */
|
||||||
void setVetoAlgorithm(const defs::vetoAlgorithm alg,
|
void setVetoAlgorithm(const defs::vetoAlgorithm alg,
|
||||||
const defs::streamingInterface value,
|
const defs::streamingInterface value,
|
||||||
|
@ -2051,7 +2051,7 @@ std::string CmdProxy::VetoAlgorithm(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[default] [lll|10gbe]\n\t[Gotthard2] Set the veto "
|
os << "[hits|raw] [lll|10gbe]\n\t[Gotthard2] Set the veto "
|
||||||
"algorithm."
|
"algorithm."
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
@ -1688,6 +1688,8 @@ Detector::getVetoAlgorithm(const defs::streamingInterface interface,
|
|||||||
void Detector::setVetoAlgorithm(const defs::vetoAlgorithm alg,
|
void Detector::setVetoAlgorithm(const defs::vetoAlgorithm alg,
|
||||||
defs::streamingInterface interface,
|
defs::streamingInterface interface,
|
||||||
Positions pos) {
|
Positions pos) {
|
||||||
|
LOG(logINFOBLUE) << "alg:" << ToString(alg)
|
||||||
|
<< " interface:" << ToString(interface);
|
||||||
pimpl->Parallel(&Module::setVetoAlgorithm, pos, alg, interface);
|
pimpl->Parallel(&Module::setVetoAlgorithm, pos, alg, interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,34 +631,46 @@ TEST_CASE("vetoalg", "[.cmd]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto prev_val_3g = det.getVetoAlgorithm(defs::streamingInterface::LOW_LATENCY_LINK);
|
auto prev_val_lll =
|
||||||
|
det.getVetoAlgorithm(defs::streamingInterface::LOW_LATENCY_LINK);
|
||||||
auto prev_val_10g =
|
auto prev_val_10g =
|
||||||
det.getVetoAlgorithm(defs::streamingInterface::ETHERNET_10GB);
|
det.getVetoAlgorithm(defs::streamingInterface::ETHERNET_10GB);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"default", "lll"}, -1, PUT, oss);
|
proxy.Call("vetoalg", {"hits", "lll"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg default lll\n");
|
REQUIRE(oss.str() == "vetoalg hits lll\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"lll"}, -1, GET, oss);
|
proxy.Call("vetoalg", {"lll"}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg default lll\n");
|
REQUIRE(oss.str() == "vetoalg hits lll\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"default", "10gbe"}, -1, PUT, oss);
|
proxy.Call("vetoalg", {"hits", "10gbe"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg default 10gbe\n");
|
REQUIRE(oss.str() == "vetoalg hits 10gbe\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"10gbe"}, -1, GET, oss);
|
proxy.Call("vetoalg", {"10gbe"}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg default 10gbe\n");
|
REQUIRE(oss.str() == "vetoalg hits 10gbe\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("vetoalg", {"raw", "lll"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "vetoalg raw lll\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("vetoalg", {"raw", "10gbe"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "vetoalg raw 10gbe\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call("vetoalg", {"default", "lll", "10gbe"}, -1, PUT));
|
proxy.Call("vetoalg", {"default", "lll", "10gbe"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("vetoalg", {"default", "none"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("vetoalg", {"hits", "none"}, -1, PUT));
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setVetoAlgorithm(prev_val_3g[i], defs::streamingInterface::LOW_LATENCY_LINK,
|
det.setVetoAlgorithm(prev_val_lll[i],
|
||||||
|
defs::streamingInterface::LOW_LATENCY_LINK,
|
||||||
{i});
|
{i});
|
||||||
det.setVetoAlgorithm(prev_val_10g[i],
|
det.setVetoAlgorithm(prev_val_10g[i],
|
||||||
defs::streamingInterface::ETHERNET_10GB, {i});
|
defs::streamingInterface::ETHERNET_10GB, {i});
|
||||||
|
@ -413,7 +413,7 @@ typedef struct {
|
|||||||
ALL = LOW_LATENCY_LINK | ETHERNET_10GB
|
ALL = LOW_LATENCY_LINK | ETHERNET_10GB
|
||||||
};
|
};
|
||||||
|
|
||||||
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
enum vetoAlgorithm { ALG_HITS, ALG_RAW };
|
||||||
|
|
||||||
enum gainMode {
|
enum gainMode {
|
||||||
DYNAMIC,
|
DYNAMIC,
|
||||||
|
@ -608,8 +608,10 @@ std::string ToString(const defs::streamingInterface s) {
|
|||||||
|
|
||||||
std::string ToString(const defs::vetoAlgorithm s) {
|
std::string ToString(const defs::vetoAlgorithm s) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case defs::DEFAULT_ALGORITHM:
|
case defs::ALG_HITS:
|
||||||
return std::string("default");
|
return std::string("hits");
|
||||||
|
case defs::ALG_RAW:
|
||||||
|
return std::string("raw");
|
||||||
default:
|
default:
|
||||||
return std::string("Unknown");
|
return std::string("Unknown");
|
||||||
}
|
}
|
||||||
@ -1014,8 +1016,10 @@ template <> defs::streamingInterface StringTo(const std::string &s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <> defs::vetoAlgorithm StringTo(const std::string &s) {
|
template <> defs::vetoAlgorithm StringTo(const std::string &s) {
|
||||||
if (s == "default")
|
if (s == "hits")
|
||||||
return defs::DEFAULT_ALGORITHM;
|
return defs::ALG_HITS;
|
||||||
|
if (s == "raw")
|
||||||
|
return defs::ALG_RAW;
|
||||||
throw sls::RuntimeError("Unknown veto algorithm " + s);
|
throw sls::RuntimeError("Unknown veto algorithm " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user