StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RC_Config.h
1 #ifndef RC_CONFIG_HH
2 #define RC_CONFIG_HH
3 
4 /***********************************************************************************
5  * Configuration files for online
6  *
7  * The configuration files are organized into tiers
8  *
9  * TIER 1 - Internal trigger configuration (named)
10  * DICT - Dictionary structure for trigger configurations
11  * SETUP - Sets of parameters that can be choosen as a group
12  * RUN - Parameters that are set independently each run
13  *
14  ************************************************************************************/
15 
16 #include <stdio.h>
17 #include <string.h>
18 
19 #define CONFIG_VERSION 902
20 #define RC_PARAM_FILE_BASE_PATH "/RTS/conf/handler/"
21 #define TRG_CONFIG_FILE_NAME ""
22 #define DAQ_CONFIG_FILE_NAME ""
23 #define SC_CONFIG_FILE_NAME ""
24 #define L3_CONFIG_FILE_NAME ""
25 
26 #define TRG_BASE_PATH "/home/startrg/trg/handler/conf"
27 #define DAQ_BASE_PATH "/RTS/conf/handler"
28 
29 #define MAX_TRG_DICT_ENTRIES 200
30 #define MAX_L0_DSM 16
31 #define MAX_TW 100
32 #define MAX_NUMBER_L1_ALG 20 /* Total Algorithms */
33 #define MAX_NUMBER_L2_ALG 20
34 #define MAX_L1_TRG 10 /* At a time */
35 #define MAX_L2_TRG 10
36 #define MAX_TRG_ALG_PARAM 10 /* Number of parameters for an algorithm */
37 #define N_SPEC_TRG 20 /* For TCD's */
38 #define GL3_ALG_MAX_NUM 20
39 
40 #define MAX_ID 16
41 #define MAX_SUB 4
42 #define MAX_INST 100
43 #define MAX_NODES 200
44 #define MAX_THREADS 400
45 
46 #define MAX_STR_LEN 40
47 
48 #define RTS_STAT_TOKENS_DONE 8
49 #define RTS_STAT_FORCE 9
50 #define RTS_STAT_REQUEST 10
51 
52 #define RTS_ICCP_MSG_LEN 120
53 
54 #define TRG_INVALID_WORD 0xffffffff
55 
56 #define RTS_STARTRUN_FLAG 1
57 #define RTS_STOPRUN_FLAG 2
58 #define RTS_SENDCONFIG_FLAG 4
59 
60 //
61 // What systems are in the run
62 //
63 struct TASK
64 {
65  uint16_t node;
66  uint8_t task;
67  uint8_t inrun; // Is the system in the run?
68  uint8_t stoprun; // Is the system allowed to stop the run?
69  uint8_t start_order; // start order
70  uint8_t typically_inrun;
71  uint8_t res2;
72 };
73 
75 {
76  TASK nodes[MAX_NODES];
77 };
78 
79 //
80 // Global configuration
81 //
82 struct GLB_CAL // Eventually to be passed from evp or similar?
83 {
84  float t0;
85  float driftVelocity;
86  float driftLength;
87  float szError; // sz hit average error
88  float xyError; // xy hit average error
89  float xVertex; // x position primary vertex
90  float yVertex; // y position primary vertex
91  float dxVertex; // error in vertex position
92  float dyVertex;
93 };
94 
95 struct GLB_SETUP
96 {
97  char filename_base[MAX_STR_LEN]; // base filename for datafiles
98  char GLB_SETUP_name[MAX_STR_LEN];
99  char TRG_SETUP_name[MAX_STR_LEN];
100  char DAQ_SETUP_name[MAX_STR_LEN];
101  char L3_SETUP_name[MAX_STR_LEN];
102  char SC_SETUP_name[MAX_STR_LEN];
103 };
104 
105 struct GLB_RUN
106 {
107  int run_number;
108  int run_type; // copied from daq_setup
109  GLB_CAL cal;
110  char GLB_SETUP_name[MAX_STR_LEN];
111  float bField;
112 };
113 
114 //
115 // Trigger configuration
116 //
117 
119 {
120  char field[MAX_STR_LEN];
121  int objectIdx;
122  int registerIdx;
123  char label[MAX_STR_LEN];
124 };
125 
126 struct TRG_DICT
127 {
128  char name[MAX_STR_LEN]; // Name of this dict file
129  TRG_DICT_ENTRY entry[MAX_TRG_DICT_ENTRIES];
130  char comment[2000];
131 };
132 
133 
134 struct TW_DEF
135 {
136  char trgLabel[MAX_STR_LEN];
137  int TW;
138  int AW;
139  int PS;
140  int nPre;
141  int nPost;
142  int off;
143  int on;
144  int enabled;
145 };
146 
147 struct TRG_ALG
148 {
149  int trgId;
150  int preScale;
151  int inputParam[MAX_TRG_ALG_PARAM];
152  int threshold[MAX_TRG_ALG_PARAM];
153 };
154 
155 struct TCD_SETUP
156 {
157  int tcdId;
158  int trgCmd;
159  int seconds;
160 };
161 
162 struct TRG_SETUP
163 {
164  char name[MAX_STR_LEN]; // Name of this setup file
165  char TIER1_name[MAX_STR_LEN]; // Tier 1 filename
166  char TRG_DICT_name[MAX_STR_LEN]; // Name of corresponding dict
167 
168  int L1_DSM_Reg_Data_values[MAX_L0_DSM][32];
169  int DC_DSM_Reg_Data_values[MAX_L0_DSM][32];
170  int CTB_DSM_Reg_Data_values[MAX_L0_DSM][32];
171  int BEMC_DSM_Reg_Data_values[MAX_L0_DSM][32];
172  int MWC_DSM_Reg_Data_values[MAX_L0_DSM][32];
173 
174  TRG_ALG L1trg[MAX_L1_TRG];
175  TRG_ALG L2trg[MAX_L2_TRG];
176 
177  TCD_SETUP special[N_SPEC_TRG];
178 
179  TW_DEF tw_def[MAX_TW]; // Trigger word definitions
180 };
181 
182 struct TRG_RUN
183 {
184  // L1CTL_User_Params
185  int configOpt; // Force configuration depth
186 
187  int l1LogOpt; // Where log messages are written
188  int l1LogThr; // Severity of saved log messages
189 
190  int dcLogOpt; // Where log messages are written
191  int dcLogThr; // Severity of saved log messages
192 
193  int ctbLogOpt; // Where log messages are written
194  int ctbLogThr; // Severity of saved log messages
195 
196  int bemcLogOpt; // Where log messages are written
197  int bemcLogThr; // Severity of saved log messages
198 
199  int l2LogOpt; // Where log messages are written
200  int l2LogThr; // Severity of saved log messages
201 
202  int mwcLogOpt;
203  int mwcLogThr;
204 
205  int rccLogOpt;
206  int rccLogThr;
207 
208  int tcdLogThr; // Severity of saved log messages
209 
210  int nTokenReturn; // Number of tokens to time
211  int maxTknInSystem; // Max token value allowed in system
212  int minTknInSystem; // Min token value allowed in system
213  int tokenMod; // Skip every n tokens
214  int tokenTimer; // turns of/on timing n tokens
215 
216  int clockSource; // Clock source
217  int numClockTicks; // number of clock tick errors before setting flag
218  int stopRunOnError; // set to stop run/restart clock on error
219 
220  int l2DataWrite; // L2 data writing switch
221  int dataWriteTimer; // L2 clock ticks between data writing
222  int everyNEvents; // how many events to skip when writing
223  int nAbort; // Frequency of test aborts
224 };
225 
226 //
227 // DAQ configuration
228 //
229 
230 struct DAQ_DAQ
231 {
232  int force_reset;
233  int evp_suppression;
234  int event_suppression;
235  int evb_log_level;
236  int myri_log_level;
237  int bb_log_level;
238  int gb_log_level;
239  int destination;
240  int test_run;
241  int write_pedestals; // write pedestal events to evb?
242  int force_det_announce; // for dets to send det_announce token
243 };
244 
246 {
247  int ped_mode;
248  int gain_mode;
249  int analysis;
250  int default_format;
251 
252  uint8_t asic_seq_hi;
253  uint8_t asic_seq_lo;
254  uint8_t asic_thr_hi;
255  uint8_t asic_thr_lo;
256  int time_bin_lo;
257  int time_bin_hi;
258  int clust_charge_lo;
259 };
260 
262 {
263  uint32_t rb_mask;
264 };
265 
266 struct DAQ_DET
267 {
268  int log_level;
269  int use_sl3;
270 
271  int res1;
272  int res2;
273  int res3;
274  int res4;
275 
276  DAQ_SUBDET sub[24];
277 };
278 
279 
280 
281 struct DAQ_SETUP
282 {
283  char DAQ_SETUP_name[MAX_STR_LEN];
284  int run_type;
285 
286  DAQ_DET_SETUP detectors[MAX_ID];
287 };
288 
289 struct DAQ_RUN
290 {
291  DAQ_DAQ daq;
292 
293  DAQ_DET detectors[MAX_ID];
294 };
295 
296 //
297 // Level 3 configuration
298 //
300 {
301  int write_daq; // 0 means no, N means write the data every n'th accepted event
302  int write_local; // 0 means no, N means every nth event
303  int log_level;
304 
305  int accept_triggered; // Accept every N events that satisfy the gl3 algorithms
306  int accept_automatic; // Accept every N events whether they satisfy the gl3 algorithm or not
307 };
308 
310 {
311  int formats; // Bitfield. 0 means Gl3 decides
312  int formats_local;
313 };
314 
316 {
317  int alg_id;
318  int preScale;
319  int postScale;
320  int GI1; // Algorithm parameters
321  int GI2;
322  int GI3;
323  int GI4;
324  int GI5;
325  float GF1;
326  float GF2;
327  float GF3;
328  float GF4;
329  float GF5;
330 };
331 
333 {
334  int algorithm; // What tracker?
335  int version; // What version of the tracker?
336 
337  short minHitsPerTrack; // Minimum hits for a track
338  short nEta; // # volumes in eta
339  short nPhi; // # volumes in phi
340  short padding; //-------------------------
341  float maxChi2Primary; // Maximum chi2 for a track to be primary
342  short rowInnerMost; // Innermost row considered
343  short rowOuterMost; // Outermost row considered
344  short rowStart; // Where to start the track search
345  short rowEnd; // Where to stop the track search
346  float hitChi2Cut; // Maximum chi2 for a hit to be part of a track
347  float goodHitChi2; // Chi2 to stop looking for next hit
348  float trackChi2Cut; // Maximum track chi2
349  float deta; // Eta search range
350  float dphi; // Phi search range
351  float ptMinHelixFit; // Minimum pt to apply helix fit
352  float maxTime; // Maximum time tracker may run
353 
354  int TX0; // Expansion parameters
355  int TX1;
356  int TX2;
357  int TX3;
358  int TX4;
359  int TX5;
360  int TX6;
361  int TX7;
362  int TX8;
363  int TX9;
364 };
365 
367 {
368  int log_level;
369 };
370 
371 struct L3_SETUP
372 {
373  char name[MAX_STR_LEN];
374  L3_GL3_SETUP gl3;
375  L3_ALGORITHMS gl3_algorithms[GL3_ALG_MAX_NUM];
376  L3_SL3_SETUP sl3;
377 };
378 
379 
380 struct L3_RUN
381 {
382  L3_GL3_RUN gl3;
383  L3_SL3_RUN sl3;
384 };
385 
386 struct SC_SETUP {
387  char name[MAX_STR_LEN];
388 };
389 struct SC_RUN
390 {
391  int reserved;
392 };
393 
394 /************************************************************************************
395  * STAR_CFG fully defines the STAR run
396  ************************************************************************************/
397 
398 struct STAR_CFG
399 {
400  SUBSYS_TASKS subsys_tasks;
401 
402  GLB_SETUP glb_setup; // Modified the order so that referenced
403  GLB_RUN glb_run;
404 
405  TRG_DICT trg_dict;
406  TRG_SETUP trg_setup; // structs follow struct referencing
407  TRG_RUN trg_run;
408 
409  DAQ_SETUP daq_setup;
410  DAQ_RUN daq_run;
411 
412  L3_SETUP l3_setup;
413  L3_RUN l3_run;
414 
415  SC_SETUP sc_setup;
416  SC_RUN sc_run;
417 };
418 
419 /***********************************************************************************
420  * TRG_CFG is the config file to be read by trigger
421  ***********************************************************************************/
422 
423 struct TRG_CFG
424 {
425  SUBSYS_TASKS subsys_tasks;
426  GLB_RUN glb_run;
427  GLB_SETUP glb_setup;
428  TRG_RUN trg_run;
429  TRG_SETUP trg_setup;
430 };
431 
432 /***********************************************************************************
433  * DAQ_CFG is the config file to be read by DAQ
434  ***********************************************************************************/
435 
436 struct DAQ_CFG
437 {
438  SUBSYS_TASKS subsys_tasks;
439  GLB_RUN glb_run;
440  GLB_SETUP glb_setup;
441  DAQ_RUN daq_run;
442  DAQ_SETUP daq_setup;
443 };
444 
445 /***********************************************************************************
446  * L3_CFG is the config file to be read by L3
447  ***********************************************************************************/
448 
449 struct L3_CFG
450 {
451  SUBSYS_TASKS subsys_tasks;
452  GLB_RUN glb_run;
453  GLB_SETUP glb_setup;
454  L3_RUN l3_run;
455  L3_SETUP l3_setup;
456 };
457 
458 /***********************************************************************************
459  * SC_CFG is the config file to be read by SC
460  ***********************************************************************************/
461 
462 struct SC_CFG
463 {
464  SUBSYS_TASKS subsys_tasks;
465  GLB_RUN glb_run;
466  GLB_SETUP glb_setup;
467  SC_RUN sc_run;
468  SC_SETUP sc_setup;
469 };
470 #endif
471 
472 
473 
474 
475 
Definition: RC_Config.h:63
Definition: RC_Config.h:118