5 #include <rtsSystems.h>
6 #include <netinet/in.h>
24 #define CONFIG_VERSION 2004
27 #define RC_PARAM_FILE_BASE_PATH "/PP/conf/handler/"
28 #define TRG_BASE_PATH "/PP/conf/handler"
29 #define DAQ_BASE_PATH "/PP/conf/handler"
31 #define RC_PARAM_FILE_BASE_PATH "/RTS/conf/handler/"
32 #define TRG_BASE_PATH "/home/startrg/trg/handler/conf"
33 #define DAQ_BASE_PATH "/RTS/conf/handler"
37 #define TRG_CONFIG_FILE_NAME ""
38 #define DAQ_CONFIG_FILE_NAME ""
39 #define SC_CONFIG_FILE_NAME ""
40 #define L3_CONFIG_FILE_NAME ""
42 #define MAX_REGISTERS 1500
44 #define CFG_MAX_LABELS_LEGACY 200
45 #define MAX_TRG_DICT_ENTRIES_LEGACY 1500
47 #define CFG_MAX_LABELS 2000
48 #define MAX_TRG_DICT_ENTRIES 6000
58 #define MAX_THREADS 400
59 #define MAX_STR_LEN 40
61 #define TRIGGERS_MAX 64
62 #define OLD_TRIGGERS_MAX 32
64 #define EVP_GROUP_MAX 32 // Number of EVP groups...
65 #define CONDPERTRG_MAX 4 // Conditions per Trigger
75 #define RTS_STAT_TOKENS_DONE 8
76 #define RTS_STAT_FORCE 9
77 #define RTS_STAT_REQUEST 10
79 #define RTS_STARTRUN_FLAG 1
80 #define RTS_STOPRUN_FLAG 2
81 #define RTS_SENDCONFIG_FLAG 4
82 #define RTS_STOPRUN_SECOND_FLAG 8
85 typedef unsigned int UINT32;
86 typedef unsigned short UINT16;
87 typedef unsigned char UINT8;
88 typedef unsigned long long int UINT64;
105 int is_set(
int bit) {
109 return (x[byt] & (1<<bit)) ? 1 : 0;
119 void clear(
int bit) {
122 x[byt] &= (~(1<<bit));
125 char *tostring(
char *out = (
char *)NULL) {
126 static char _out[70];
128 if(out == NULL) out = _out;
129 sprintf(out,
"%08x-%08x-%08x-%08x", x[3], x[2], x[1], x[0]);
136 #define L1_DSM_OBJECT 1
137 #define BC1_DSM_OBJECT 2
138 #define MXQ_QT_OBJECT 3
139 #define MIX_DSM_OBJECT 4
140 #define BCW_DSM_OBJECT 5
141 #define BCE_DSM_OBJECT 6
142 #define EQ3_QT_OBJECT 7 // Changed EPQ > EQ3. JMN 8/15/17
143 #define BBC_DSM_OBJECT 8
144 #define BBQ_QT_OBJECT 9
145 #define FMS_DSM_OBJECT 10
146 #define QT1_FMS_OBJECT 11
147 #define QT2_FMS_OBJECT 12
148 #define QT3_FMS_OBJECT 13
149 #define QT4_FMS_OBJECT 14
150 #define TRG_OBJECT 29
151 #define DAQ_OBJECT 30 // Reserved for DAQ use..
152 #define PHYSICS_BIT_OBJECT 32
153 #define DETECTOR_BIT_OBJECT 33
154 #define TCD_OBJECT 34
157 #define L3_OBJECT 37 // Reserved for L3 use...
158 #define EQ1_QT_OBJECT 38 // Changed FQ1 > EQ1. JMN 8/15/17
159 #define EQ2_QT_OBJECT 39 // Changed FQ2 > EQ2. JMN 8/15/17
160 #define FCS_OBJECT 40
161 #define DSM2_OBJECT 41
163 #define BIT_OBJECT 100 // Reserved for TCU bit labels
182 char *cmd2name(
int cmd);
183 char *getConfigBaseXml(
char *filename,
int port,
int trg);
184 char *getConfigBaseXml(
char *filename,
ic_msg *m);
185 char *getConfigBase(
char *filename,
int port,
int trg);
186 char *getConfigBase(
char *filename,
ic_msg *m);
188 SimpleXmlDoc *getConfigFileXml(SimpleXmlDoc *xml,
ic_msg *m,
int sz=0);
189 SimpleXmlDoc *getConfigFileXml(SimpleXmlDoc *xml,
char *filename,
int sz=0);
206 char *confNum2String(UINT32 conf_num);
207 int string2ConfNum(
char *str);
208 UINT32 getCrateMask4TrgDet(
int det);
209 int getConfNumForNode(
int node);
210 UINT16 getTrgDetRequiredMask(
char *node,
int board=-1);
213 void writeRCCNF(
char *fn, SimpleXmlDoc *xml);
218 bool system_inrun(
int sys, SimpleXmlDoc *xml);
219 void maskDetectorsInRun(SimpleXmlDoc *xml);
223 bool cfgBuildPS(
TrgPS *ps, SimpleXmlDoc *xml);
254 int getEthServer(
int node,
int task,
EthServer *eth,
int force_vlan=0);
255 char *ReadAllDotConf(
int node,
int task,
char *param,
char *result=(
char *)NULL,
char *paramfilename=(
char *)
"/RTS/conf/handler/all.conf");
267 EvbChooser(
int _force_vlan=0) { weights_set = 0; force_vlan=_force_vlan; };
268 void configure(SimpleXmlDoc *xml);
275 int chooseIdx(
int token);
278 int chooseIdx_proper(
int token);
283 int getIdxByNode(
int evbnode);
285 int getEvb4Token(
int token) {
return evb4token[token]; }
288 int evbNodes[MAX_EVBS][5];
289 int nevbserv[MAX_EVBS];
291 int evt_ctrs_by_server[MAX_EVBS];
292 int weights_by_evb[MAX_EVBS];
296 void clearWeightedEvbEvents();
297 int nextWeightedServer(
int seq,
int token);
305 #define RHIC_TRG "RHICTRG\0"
306 #define RHIC_TRG2 "RHICTRG2"
307 #define TRG_UDP_PORT 8060
308 #define TRG_UDP_PORT2 8061
324 float v0, v1, v2, v3;
328 float ps[TRIGGERS_MAX];
329 float measured_rate[TRIGGERS_MAX];
333 float py_ps[TRIGGERS_MAX];
334 float py_desiredRate[TRIGGERS_MAX];
335 float py_scalerRate[TRIGGERS_MAX];
336 float py_predictedRate[TRIGGERS_MAX];
338 float measuredFrequency;
341 #define HLT_UDP_PORT 8062