MIDAS
Loading...
Searching...
No Matches
mana.cxx File Reference
#include <assert.h>
#include "midas.h"
#include "msystem.h"
#include "hardware.h"
#include "mdsupport.h"
#include "zlib.h"
Include dependency graph for mana.cxx:

Go to the source code of this file.

Classes

struct  EVENT_DEF
 
struct  MA_FILE
 

Macros

#define PVM_BUFFER_SIZE   (1024*1024)
 
#define HBOOK_LREC   8190
 
#define EXT_EVENT_SIZE   (2*(MAX_EVENT_SIZE+sizeof(EVENT_HEADER)))
 
#define ANALYZER_REQUEST_STR   "\Event ID = INT : 0\n\Trigger mask = INT : -1\n\Sampling type = INT : 1\n\Buffer = STRING : [32] SYSTEM\n\Enabled = BOOL : 1\n\Client name = STRING : [32] \n\Host = STRING : [32] \n\"
 
#define ANALYZER_STATS_STR   "\Events received = DOUBLE : 0\n\Events per sec. = DOUBLE : 0\n\Events written = DOUBLE : 0\n\"
 
#define STR_INC(p, base)
 
#define MA_DEVICE_DISK   1
 
#define MA_DEVICE_TAPE   2
 
#define MA_DEVICE_FTP   3
 
#define MA_DEVICE_PVM   4
 
#define MA_FORMAT_MIDAS   (1<<0)
 
#define MA_FORMAT_YBOS   (1<<2)
 
#define MA_FORMAT_GZIP   (1<<3)
 

Functions

INT analyzer_init (void)
 
INT analyzer_exit (void)
 
INT analyzer_loop (void)
 
INT ana_begin_of_run (INT run_number, char *error)
 
INT ana_end_of_run (INT run_number, char *error)
 
INT ana_pause_run (INT run_number, char *error)
 
INT ana_resume_run (INT run_number, char *error)
 
void update_stats ()
 
void odb_load (EVENT_HEADER *pevent)
 
INT getparam (int argc, char **argv)
 
void add_data_dir (char *result, char *file)
 
EVENT_DEFdb_get_event_definition (short int event_id)
 
void test_register (ANA_TEST *t)
 
void test_clear ()
 
void test_increment ()
 
void test_write (int delta_time)
 
INT load_parameters (INT run_number)
 
INT book_ntuples (void)
 
INT book_ttree (void)
 
void banks_changed (INT hDB, INT hKey, void *info)
 
INT mana_init ()
 
INT mana_exit ()
 
INT bor (INT run_number, char *error)
 
INT eor (INT run_number, char *error)
 
INT tr_start (INT rn, char *error)
 
INT tr_stop (INT rn, char *error)
 
INT tr_pause (INT rn, char *error)
 
INT tr_resume (INT rn, char *error)
 
INT write_event_ascii (FILE *file, EVENT_HEADER *pevent, ANALYZE_REQUEST *par)
 
INT write_event_midas (FILE *file, EVENT_HEADER *pevent, ANALYZE_REQUEST *par)
 
INT write_event_odb (EVENT_HEADER *pevent)
 
void correct_num_events (INT i)
 
INT process_event (ANALYZE_REQUEST *par, EVENT_HEADER *pevent)
 
void receive_event (HNDLE buffer_handle, HNDLE request_id, EVENT_HEADER *pheader, void *pevent)
 
void update_request (HNDLE hDB, HNDLE hKey, void *info)
 
void register_requests (void)
 
void lock_histo (INT id)
 
void load_last_histos ()
 
void save_last_histos ()
 
INT loop_online ()
 
INT init_module_parameters (BOOL bclose)
 
MA_FILEma_open (char *file_name)
 
int ma_close (MA_FILE *file)
 
int ma_read_event (MA_FILE *file, EVENT_HEADER *pevent, int size)
 
INT analyze_run (INT run_number, char *input_file_name, char *output_file_name)
 
INT loop_runs_offline ()
 
int main (int argc, char *argv[])
 

Variables

ANA_OUTPUT_INFO out_info
 
BOOL pvm_master = FALSE
 
BOOL pvm_slave = FALSE
 
const charbstr = " "
 
const charanalyzer_name
 
INT analyzer_loop_period
 
INT odb_size
 
HNDLE hDB
 main ODB handle
 
DWORD current_run_number
 
ANALYZE_REQUEST analyze_request []
 
BOOL ntuple_flag
 
INT lock_list [10000]
 
int QUEST [100]
 
INT pawc_size
 
static int sys_max_event_size = DEFAULT_MAX_EVENT_SIZE
 
struct { 
 
   INT   online 
 
   char   host_name [HOST_NAME_LENGTH
 
   char   exp_name [NAME_LENGTH
 
   char   input_file_name [10][256] 
 
   char   output_file_name [256] 
 
   INT   run_number [2] 
 
   DWORD   n [4] 
 
   BOOL   filter 
 
   char   config_file_name [10][256] 
 
   char   param [10][256] 
 
   char   protect [10][256] 
 
   BOOL   rwnt 
 
   INT   lrec 
 
   BOOL   debug 
 
   BOOL   verbose 
 
   BOOL   quiet 
 
   BOOL   no_load 
 
   BOOL   daemon 
 
   INT   n_task 
 
   INT   pvm_buf_size 
 
   INT   root_port 
 
   BOOL   start_rint 
 
clp 
 
struct { 
 
   char   flag_char 
 
   char   description [1000] 
 
   void *   data 
 
   INT   type 
 
   INT   n 
 
   INT   index 
 
clp_descrip [] 
 
FILEout_file
 
BOOL out_gzip
 
INT out_format
 
BOOL out_append
 
ANA_TEST ** tl
 
int n_test = 0
 
char hbook_types [][8]
 
struct { 
 
   short int   event_id 
 
   DWORD   last_time 
 
last_time_event [50] 
 
ANALYZE_REQUEST_current_par
 

Macro Definition Documentation

◆ ANALYZER_REQUEST_STR

#define ANALYZER_REQUEST_STR   "\Event ID = INT : 0\n\Trigger mask = INT : -1\n\Sampling type = INT : 1\n\Buffer = STRING : [32] SYSTEM\n\Enabled = BOOL : 1\n\Client name = STRING : [32] \n\Host = STRING : [32] \n\"

Definition at line 343 of file mana.cxx.

◆ ANALYZER_STATS_STR

#define ANALYZER_STATS_STR   "\Events received = DOUBLE : 0\n\Events per sec. = DOUBLE : 0\n\Events written = DOUBLE : 0\n\"

Definition at line 353 of file mana.cxx.

◆ EXT_EVENT_SIZE

#define EXT_EVENT_SIZE   (2*(MAX_EVENT_SIZE+sizeof(EVENT_HEADER)))

Definition at line 234 of file mana.cxx.

◆ HBOOK_LREC

#define HBOOK_LREC   8190

Definition at line 230 of file mana.cxx.

◆ MA_DEVICE_DISK

#define MA_DEVICE_DISK   1

Definition at line 3830 of file mana.cxx.

◆ MA_DEVICE_FTP

#define MA_DEVICE_FTP   3

Definition at line 3832 of file mana.cxx.

◆ MA_DEVICE_PVM

#define MA_DEVICE_PVM   4

Definition at line 3833 of file mana.cxx.

◆ MA_DEVICE_TAPE

#define MA_DEVICE_TAPE   2

Definition at line 3831 of file mana.cxx.

◆ MA_FORMAT_GZIP

#define MA_FORMAT_GZIP   (1<<3)

Definition at line 3837 of file mana.cxx.

◆ MA_FORMAT_MIDAS

#define MA_FORMAT_MIDAS   (1<<0)

Definition at line 3835 of file mana.cxx.

◆ MA_FORMAT_YBOS

#define MA_FORMAT_YBOS   (1<<2)

Definition at line 3836 of file mana.cxx.

◆ PVM_BUFFER_SIZE

#define PVM_BUFFER_SIZE   (1024*1024)

Definition at line 151 of file mana.cxx.

◆ STR_INC

#define STR_INC (   p,
  base 
)
Value:
{ p+=strlen(p); \
if (p > base+sizeof(base)) \
cm_msg(MERROR, "STR_INC", "ASCII buffer too small"); }
#define MERROR
Definition midas.h:559
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
static te_expr * base(state *s)
Definition tinyexpr.c:357

Definition at line 2091 of file mana.cxx.

2091 { p+=strlen(p); \
2092 if (p > base+sizeof(base)) \
2093 cm_msg(MERROR, "STR_INC", "ASCII buffer too small"); }

Function Documentation

◆ add_data_dir()

void add_data_dir ( char result,
char file 
)

Definition at line 424 of file mana.cxx.

425{
426 HNDLE hDB, hkey;
427 char str[256];
428 int size;
429
431 db_find_key(hDB, 0, "/Logger/Data dir", &hkey);
432
433 if (hkey) {
434 size = sizeof(str);
435 db_get_data(hDB, hkey, str, &size, TID_STRING);
436 if (str[strlen(str) - 1] != DIR_SEPARATOR)
438 strcat(str, file);
439 strcpy(result, str);
440 } else
441 strcpy(result, file);
442}
INT cm_get_experiment_database(HNDLE *hDB, HNDLE *hKeyClient)
Definition midas.cxx:3011
#define TID_STRING
Definition midas.h:346
INT db_get_data(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, DWORD type)
Definition odb.cxx:6539
INT db_find_key(HNDLE hDB, HNDLE hKey, const char *key_name, HNDLE *subhKey)
Definition odb.cxx:4079
HNDLE hDB
main ODB handle
Definition mana.cxx:207
#define DIR_SEPARATOR
Definition midas.h:193
INT HNDLE
Definition midas.h:132
#define DIR_SEPARATOR_STR
Definition midas.h:194
char str[256]
Definition odbhist.cxx:33
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ana_begin_of_run()

INT ana_begin_of_run ( INT  run_number,
char error 
)
extern

Definition at line 101 of file analyzer.c.

102{
103 return CM_SUCCESS;
104}
#define CM_SUCCESS
Definition midas.h:582
Here is the caller graph for this function:

◆ ana_end_of_run()

INT ana_end_of_run ( INT  run_number,
char error 
)
extern

Definition at line 108 of file analyzer.c.

109{
110 return CM_SUCCESS;
111}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ana_pause_run()

INT ana_pause_run ( INT  run_number,
char error 
)
extern

Definition at line 115 of file analyzer.c.

116{
117 return CM_SUCCESS;
118}
Here is the caller graph for this function:

◆ ana_resume_run()

INT ana_resume_run ( INT  run_number,
char error 
)
extern

Definition at line 122 of file analyzer.c.

123{
124 return CM_SUCCESS;
125}
Here is the caller graph for this function:

◆ analyze_run()

INT analyze_run ( INT  run_number,
char input_file_name,
char output_file_name 
)

Definition at line 4045 of file mana.cxx.

4046{
4049 INT n, size;
4051 char error[256], str[256];
4052 INT status = SUCCESS;
4053 MA_FILE *file;
4054 BOOL skip;
4055 DWORD start_time;
4056
4057 /* set output file name and flags in ODB */
4058 sprintf(str, "/%s/Output/Filename", analyzer_name);
4060#ifdef HAVE_HBOOK
4061 sprintf(str, "/%s/Output/RWNT", analyzer_name);
4062 db_set_value(hDB, 0, str, &clp.rwnt, sizeof(BOOL), 1, TID_BOOL);
4063#endif
4064
4065 assert(run_number > 0);
4066
4067 /* set run number in ODB */
4068 status = db_set_value(hDB, 0, "/Runinfo/Run number", &run_number, sizeof(run_number), 1, TID_INT);
4069 assert(status == SUCCESS);
4070
4071 /* set file name in out_info */
4073
4074 /* let changes propagate to modules */
4075 cm_yield(0);
4076
4077 /* open input file, will be changed to ma_open_file later... */
4079 if (file == NULL) {
4080 printf("Cannot open input file \"%s\"\n", input_file_name);
4081 return -1;
4082 }
4083
4085
4087 if (pevent_unaligned == NULL) {
4088 printf("Not enough memeory\n");
4089 return -1;
4090 }
4092
4093 /* call analyzer bor routines */
4094 bor(run_number, error);
4095
4097
4098 start_time = ss_millitime();
4099
4100 /* event loop */
4101 do {
4102 /* read next event */
4103 n = ma_read_event(file, pevent, ext_event_size);
4104 if (n <= 0)
4105 break;
4106
4107 num_events_in++;
4108
4109 /* copy system events (BOR, EOR, MESSAGE) to output file */
4110 if (pevent->event_id < 0) {
4111 status = process_event(NULL, pevent);
4112 if (status < 0 || status == RPC_SHUTDOWN) /* disk full/stop analyzer */
4113 break;
4114
4115 if (out_file && out_format == FORMAT_MIDAS) {
4116 size = pevent->data_size + sizeof(EVENT_HEADER);
4117 if (out_gzip)
4118 status = gzwrite((gzFile)out_file, pevent, size) == size ? SUCCESS : SS_FILE_ERROR;
4119 else
4120 status =
4121 fwrite(pevent, 1, size,
4122 out_file) == (size_t) size ? SUCCESS : SS_FILE_ERROR;
4123
4124 if (status != SUCCESS) {
4125 cm_msg(MERROR, "analyze_run", "Error writing to file (Disk full?)");
4126 return -1;
4127 }
4128
4130 }
4131
4132 /* reinit start time after BOR event */
4133 if (pevent->event_id == EVENTID_BOR)
4134 start_time = ss_millitime();
4135 }
4136
4137 /* check if event is in event limit */
4138 skip = FALSE;
4139
4140 if (!pvm_slave) {
4141 if (clp.n[0] > 0 || clp.n[1] > 0) {
4142 if (clp.n[1] == 0) {
4143 /* treat n[0] as upper limit */
4144 if (num_events_in > clp.n[0]) {
4145 num_events_in--;
4146 status = SUCCESS;
4147 break;
4148 }
4149 } else {
4150 if (num_events_in > clp.n[1]) {
4151 status = SUCCESS;
4152 break;
4153 }
4154 if (num_events_in < clp.n[0])
4155 skip = TRUE;
4156 else if (clp.n[2] > 0 && num_events_in % clp.n[2] != 0)
4157 skip = TRUE;
4158 }
4159 }
4160 }
4161
4162 if (!skip) {
4163 /* find request belonging to this event */
4165 status = SUCCESS;
4166 for (; par->event_name[0]; par++)
4167 if ((par->ar_info.event_id == EVENTID_ALL ||
4168 par->ar_info.event_id == pevent->event_id) &&
4169 (par->ar_info.trigger_mask == TRIGGER_ALL ||
4170 (par->ar_info.trigger_mask & pevent->trigger_mask))
4171 && par->ar_info.enabled) {
4172 /* analyze this event */
4173 status = process_event(par, pevent);
4174 if (status == SUCCESS)
4176 if (status < 0 || status == RPC_SHUTDOWN) /* disk full/stop analyzer */
4177 break;
4178
4179 /* check for Ctrl-C */
4180 status = cm_yield(0);
4181 }
4182 if (status < 0 || status == RPC_SHUTDOWN)
4183 break;
4184 }
4185
4186 /* update ODB statistics once every 100 events */
4187 if (num_events_in % 100 == 0) {
4188 update_stats();
4189 if (!clp.quiet) {
4190 if (out_file)
4191 printf("%s:%d %s:%d events\r", input_file_name, (int) num_events_in,
4193 else
4194 printf("%s:%d events\r", input_file_name, (int) num_events_in);
4195
4196#ifndef OS_WINNT
4197 fflush(stdout);
4198#endif
4199 }
4200 }
4201 } while (1);
4202
4203#ifdef HAVE_PVM
4204 PVM_DEBUG("analyze_run: event loop finished, status = %d", status);
4205#endif
4206
4207 /* signal EOR to slaves */
4208#ifdef HAVE_PVM
4209 if (pvm_master) {
4210 if (status == RPC_SHUTDOWN)
4211 printf("\nShutting down distributed analyzers, please wait...\n");
4213
4214 /* merge slave output files */
4215 if (out_info.filename[0] && !out_append)
4216 status = pvm_merge();
4217
4218 start_time = ss_millitime() - start_time;
4219
4220 update_stats();
4221 if (!clp.quiet) {
4222 if (out_file)
4223 printf("%s:%d %s:%d events, %1.2lfs\n", input_file_name, num_events_in,
4224 out_info.filename, num_events_out, start_time / 1000.0);
4225 else
4226 printf("%s:%d events, %1.2lfs\n", input_file_name, num_events_in,
4227 start_time / 1000.0);
4228 }
4229 } else if (pvm_slave) {
4230 start_time = ss_millitime() - start_time;
4231
4232 update_stats();
4233 if (!clp.quiet) {
4234 if (out_file)
4235 printf("%s:%d %s:%d events, %1.2lfs\n", input_file_name, num_events_in,
4236 out_info.filename, num_events_out, start_time / 1000.0);
4237 else
4238 printf("%s:%d events, %1.2lfs\n", input_file_name, num_events_in,
4239 start_time / 1000.0);
4240 }
4241
4242 eor(current_run_number, error);
4243
4244 /* send back tests */
4246
4247 for (i = 0; i < n_test; i++)
4248 pvm_pkbyte((char *) tl[i], sizeof(ANA_TEST), 1);
4249
4250 PVM_DEBUG("analyze_run: send %d tests back to master", n_test);
4251
4253 if (status < 0) {
4254 pvm_perror("pvm_send");
4255 return RPC_SHUTDOWN;
4256 }
4257 } else {
4258 start_time = ss_millitime() - start_time;
4259
4260 update_stats();
4261 if (!clp.quiet) {
4262 if (out_file)
4263 printf("%s:%d %s:%d events, %1.2lfs\n", input_file_name, num_events_in,
4264 out_info.filename, num_events_out, start_time / 1000.0);
4265 else
4266 printf("%s:%d events, %1.2lfs\n", input_file_name, num_events_in,
4267 start_time / 1000.0);
4268 }
4269
4270 /* call analyzer eor routines */
4271 eor(current_run_number, error);
4272 }
4273#else
4274
4275 start_time = ss_millitime() - start_time;
4276
4277 update_stats();
4278 if (!clp.quiet) {
4279 if (out_file)
4280 printf("%s:%d %s:%d events, %1.2lfs\n", input_file_name, (int) num_events_in,
4281 out_info.filename, (int) num_events_out, start_time / 1000.0);
4282 else
4283 printf("%s:%d events, %1.2lfs\n", input_file_name, (int) num_events_in,
4284 start_time / 1000.0);
4285 }
4286
4287 /* call analyzer eor routines */
4288 eor(current_run_number, error);
4289
4290#endif
4291
4292 ma_close(file);
4293
4294 free(pevent_unaligned);
4295
4296 return status;
4297}
#define FALSE
Definition cfortran.h:309
INT cm_yield(INT millisec)
Definition midas.cxx:5642
#define SS_FILE_ERROR
Definition midas.h:669
#define RPC_SHUTDOWN
Definition midas.h:707
unsigned int DWORD
Definition mcstd.h:51
#define SUCCESS
Definition mcstd.h:54
#define TID_BOOL
Definition midas.h:340
#define TRIGGER_ALL
Definition midas.h:538
#define EVENTID_ALL
Definition midas.h:537
#define FORMAT_MIDAS
Definition midas.h:311
#define TID_INT
Definition midas.h:338
#define ALIGN8(x)
Definition midas.h:522
DWORD ss_millitime()
Definition system.cxx:3393
INT cm_msg(INT message_type, const char *filename, INT line, const char *routine, const char *format,...)
Definition midas.cxx:915
INT db_set_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, const void *data, INT data_size, INT num_values, DWORD type)
Definition odb.cxx:5261
DWORD current_run_number
Definition mana.cxx:210
INT run_number[2]
Definition mana.cxx:246
char output_file_name[256]
Definition mana.cxx:245
static int sys_max_event_size
Definition mana.cxx:237
DWORD n[4]
Definition mana.cxx:247
INT out_format
Definition mana.cxx:335
const char * analyzer_name
Definition analyzer.c:25
int ma_close(MA_FILE *file)
Definition mana.cxx:3919
int ma_read_event(MA_FILE *file, EVENT_HEADER *pevent, int size)
Definition mana.cxx:3932
ANA_TEST ** tl
Definition mana.cxx:543
char input_file_name[10][256]
Definition mana.cxx:244
static struct @0 clp
BOOL pvm_master
Definition mana.cxx:186
INT bor(INT run_number, char *error)
Definition mana.cxx:1675
ANALYZE_REQUEST analyze_request[]
Definition analyzer.c:37
FILE * out_file
Definition mana.cxx:333
BOOL out_append
Definition mana.cxx:336
ANA_OUTPUT_INFO out_info
Definition mana.cxx:49
INT eor(INT run_number, char *error)
Definition mana.cxx:1914
INT process_event(ANALYZE_REQUEST *par, EVENT_HEADER *pevent)
Definition mana.cxx:3081
MA_FILE * ma_open(char *file_name)
Definition mana.cxx:3852
BOOL out_gzip
Definition mana.cxx:334
void update_stats()
Definition mana.cxx:3403
BOOL pvm_slave
Definition mana.cxx:186
int n_test
Definition mana.cxx:544
INT i
Definition mdump.cxx:32
DWORD BOOL
Definition midas.h:105
int INT
Definition midas.h:129
#define TRUE
Definition midas.h:182
#define POINTER_T
Definition midas.h:166
#define EVENTID_BOR
Definition midas.h:900
static char * skip(char **buf, const char *delimiters)
DWORD status
Definition odbhist.cxx:39
#define PvmDataInPlace
Definition pvm3.h:68
char filename[256]
Definition midas.h:1315
short int event_id
Definition midas.h:852
DWORD data_size
Definition midas.h:856
short int trigger_mask
Definition midas.h:853
Here is the call graph for this function:
Here is the caller graph for this function:

◆ analyzer_exit()

INT analyzer_exit ( void  )
extern

Definition at line 94 of file analyzer.c.

95{
96 return CM_SUCCESS;
97}
Here is the caller graph for this function:

◆ analyzer_init()

INT analyzer_init ( void  )
extern

Definition at line 87 of file analyzer.c.

88{
89 return CM_SUCCESS;
90}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ analyzer_loop()

INT analyzer_loop ( void  )
extern

Definition at line 129 of file analyzer.c.

130{
131 return CM_SUCCESS;
132}
Here is the caller graph for this function:

◆ banks_changed()

void banks_changed ( INT  hDB,
INT  hKey,
void info 
)

Definition at line 725 of file mana.cxx.

726{
727 char str[80];
728 HNDLE hkey;
729
730 /* close previously opened hot link */
731 sprintf(str, "/%s/Bank switches", analyzer_name);
732 db_find_key(hDB, 0, str, &hkey);
734
735#ifdef HAVE_HBOOK
736 book_ntuples();
737 printf("N-tuples rebooked\n");
738#endif
739#ifdef HAVE_ROOT
740 book_ttree();
741 printf("ROOT TTree rebooked\n");
742#endif
743}
INT db_close_record(HNDLE hDB, HNDLE hKey)
Definition odb.cxx:13473
INT book_ttree(void)
INT book_ntuples(void)
Here is the call graph for this function:

◆ book_ntuples()

INT book_ntuples ( void  )
Here is the caller graph for this function:

◆ book_ttree()

INT book_ttree ( void  )
Here is the caller graph for this function:

◆ bor()

INT bor ( INT  run_number,
char error 
)

Definition at line 1675 of file mana.cxx.

1676{
1677 ANA_MODULE **module;
1678 INT i, j, size;
1679 char str[256], file_name[256], *ext_str;
1680 BANK_LIST *bank_list;
1681
1682 /* load parameters */
1684
1685 for (i = 0; analyze_request[i].event_name[0]; i++) {
1686 /* copy output flag from ODB to bank_list */
1687 bank_list = analyze_request[i].bank_list;
1688
1689 if (bank_list != NULL)
1690 for (; bank_list->name[0]; bank_list++) {
1691 sprintf(str, "/%s/Bank switches/%s", analyzer_name, bank_list->name);
1692 bank_list->output_flag = FALSE;
1693 size = sizeof(DWORD);
1694 db_get_value(hDB, 0, str, &bank_list->output_flag, &size, TID_DWORD, TRUE);
1695 }
1696
1697 /* copy module enabled flag to ana_module */
1698 module = analyze_request[i].ana_module;
1699 for (j = 0; module != NULL && module[j] != NULL; j++) {
1700 sprintf(str, "/%s/Module switches/%s", analyzer_name, module[j]->name);
1701 module[j]->enabled = TRUE;
1702 size = sizeof(BOOL);
1703 db_get_value(hDB, 0, str, &module[j]->enabled, &size, TID_BOOL, TRUE);
1704 }
1705 }
1706
1707 /* clear histos, N-tuples and tests */
1708 if (clp.online && out_info.clear_histos) {
1709#ifdef HAVE_HBOOK
1710 int hid[10000];
1711 int n;
1712
1713 for (i = 0; analyze_request[i].event_name[0]; i++)
1714 if (analyze_request[i].bank_list != NULL)
1715 if (HEXIST(analyze_request[i].ar_info.event_id))
1716 HRESET(analyze_request[i].ar_info.event_id, bstr);
1717
1718 /* get list of all histos */
1719 HIDALL(hid, n);
1720 for (i = 0; i < n; i++) {
1721 for (j = 0; j < 10000; j++)
1722 if (lock_list[j] == 0 || lock_list[j] == hid[i])
1723 break;
1724
1725 /* clear histo if not locked */
1726 if (lock_list[j] != hid[i])
1727 HRESET(hid[i], bstr);
1728 }
1729#endif /* HAVE_HBOOK */
1730
1731#ifdef HAVE_ROOT
1732 /* clear histos */
1733 if (clp.online && out_info.clear_histos)
1735#endif /* HAVE_ROOT */
1736
1737 /* clear tests */
1738 test_clear();
1739 }
1740#ifdef HAVE_ROOT
1741 if (clp.online) {
1742 /* clear all trees when online */
1743 for (i = 0; i < tree_struct.n_tree; i++)
1744 tree_struct.event_tree[i].tree->Reset();
1745 }
1746#endif
1747
1748 /* open output file if not already open (append mode) and in offline mode */
1749 if (!clp.online && out_file == NULL && !pvm_master
1750 && !equal_ustring(clp.output_file_name, "OFLN")) {
1751 if (out_info.filename[0]) {
1752 strcpy(str, out_info.filename);
1753 if (strchr(str, '%') != NULL)
1755 else
1756 strcpy(file_name, str);
1757
1758 /* check output file extension */
1759 out_gzip = FALSE;
1760 if (strchr(file_name, '.')) {
1762 while (*ext_str != '.')
1763 ext_str--;
1764
1765 if (strncmp(ext_str, ".gz", 3) == 0) {
1766 out_gzip = TRUE;
1767 ext_str--;
1768 while (*ext_str != '.' && ext_str > file_name)
1769 ext_str--;
1770 }
1771
1772 if (strncmp(ext_str, ".asc", 4) == 0)
1774 else if (strncmp(ext_str, ".mid", 4) == 0)
1776 else if (strncmp(ext_str, ".rz", 3) == 0)
1778 else if (strncmp(ext_str, ".root", 5) == 0)
1780 else {
1781 strcpy(error, "Unknown output data format. Please use file extension .asc, .mid, .rz or .root.\n");
1782 cm_msg(MERROR, "bor", "%s", error);
1783 return 0;
1784 }
1785 } else
1787
1788#ifdef HAVE_PVM
1789 /* use node name as filename if PVM slave */
1790 if (pvm_slave) {
1791 /* extract extension */
1792 if (strchr(file_name, '.')) {
1793 strcpy(str, strchr(file_name, '.') + 1);
1795 strcat(file_name, ".");
1797 } else {
1799 }
1800
1801 PVM_DEBUG("BOR: file_name = %s", file_name);
1802 }
1803#endif
1804
1805 /* open output file */
1806 if (out_format == FORMAT_HBOOK) {
1807#ifdef HAVE_HBOOK
1808 int status, lrec;
1809 char str2[80];
1810
1811 lrec = clp.lrec;
1812#ifdef extname
1813 quest_[9] = 65000;
1814#else
1815 QUEST[9] = 65000;
1816#endif
1817
1818 strcpy(str, "BSIZE");
1820 strcpy(str, "OFFLINE");
1821 strcpy(str2, "NQP");
1823 if (status != 0) {
1824 sprintf(error, "Cannot open output file %s", out_info.filename);
1825 cm_msg(MERROR, "bor", error);
1826 out_file = NULL;
1827 return 0;
1828 } else
1829 out_file = (FILE *) 1;
1830#else
1831 cm_msg(MERROR, "bor", "HBOOK support is not compiled in");
1832#endif /* HAVE_HBOOK */
1833 }
1834
1835 else if (out_format == FORMAT_ROOT) {
1836#ifdef HAVE_ROOT
1837 // ensure the output file is closed
1838 assert(gManaOutputFile == NULL);
1839
1841 new TFile(file_name, "RECREATE", "Midas Analyzer output file");
1842 if (gManaOutputFile == NULL) {
1843 sprintf(error, "Cannot open output file %s", out_info.filename);
1844 cm_msg(MERROR, "bor", "%s", error);
1845 out_file = NULL;
1846 return 0;
1847 }
1848 // make all ROOT objects created by user module bor() functions
1849 // go into the output file
1850 gManaOutputFile->cd();
1851
1852 out_file = (FILE *) 1;
1853#else
1854 cm_msg(MERROR, "bor", "ROOT support is not compiled in");
1855#endif /* HAVE_ROOT */
1856 }
1857
1858 else {
1859 if (out_gzip)
1860 out_file = (FILE *) gzopen(file_name, "wb");
1861 else
1862 if (out_format == FORMAT_ASCII)
1863 out_file = fopen(file_name, "wt");
1864 else
1865 out_file = fopen(file_name, "wb");
1866 if (out_file == NULL) {
1867 sprintf(error, "Cannot open output file %s", file_name);
1868 cm_msg(MERROR, "bor", "%s", error);
1869 return 0;
1870 }
1871 }
1872 } else
1873 out_file = NULL;
1874
1875#ifdef HAVE_HBOOK
1876 /* book N-tuples */
1877 if (out_format == FORMAT_HBOOK) {
1878 int status = book_ntuples();
1879 if (status != SUCCESS)
1880 return status;
1881 }
1882#endif /* HAVE_HBOOK */
1883
1884#ifdef HAVE_ROOT
1885 /* book ROOT TTree */
1886 if (out_format == FORMAT_ROOT) {
1887 int status = book_ttree();
1888 if (status != SUCCESS)
1889 return status;
1890 }
1891#endif /* HAVE_ROOT */
1892
1893 }
1894
1895 /* if (out_file == NULL) */
1896 /* save run number */
1898
1899 /* call bor for modules */
1900 for (i = 0; analyze_request[i].event_name[0]; i++) {
1901 module = analyze_request[i].ana_module;
1902 for (j = 0; module != NULL && module[j] != NULL; j++)
1903 if (module[j]->bor != NULL && module[j]->enabled) {
1904 module[j]->bor(run_number);
1905 }
1906 }
1907
1908 /* call main analyzer BOR routine */
1909 return ana_begin_of_run(run_number, error);
1910}
#define FORMAT_ROOT
Definition midas.h:317
#define TID_DWORD
Definition midas.h:336
BOOL equal_ustring(const char *str1, const char *str2)
Definition odb.cxx:3201
INT db_get_value(HNDLE hDB, HNDLE hKeyRoot, const char *key_name, void *data, INT *buf_size, DWORD type, BOOL create)
Definition odb.cxx:5415
#define HEXIST(A2)
Definition hbook.h:171
#define HROPEN(A1, A2, A3, A4, A5, A6)
Definition hbook.h:154
#define HIDALL(A1, A2)
Definition hbook.h:96
#define HRESET(A1, A2)
Definition hbook.h:149
#define HBSET(A1, A2, A3)
Definition hbook.h:43
INT ana_begin_of_run(INT run_number, char *error)
Definition analyzer.c:101
INT lock_list[10000]
Definition mana.cxx:219
void test_clear()
Definition mana.cxx:582
#define HBOOK_LREC
Definition mana.cxx:230
int QUEST[100]
INT lrec
Definition mana.cxx:253
const char * bstr
Definition mana.cxx:188
INT load_parameters(INT run_number)
Definition mana.cxx:633
#define DWORD
Definition mhdump.cxx:31
#define name(x)
Definition midas_macro.h:24
INT j
Definition odbhist.cxx:40
char file_name[256]
Definition odbhist.cxx:41
TFolder * gManaHistosFolder
BOOL clear_histos
Definition midas.h:1319
BANK_LIST * bank_list
Definition midas.h:1292
char event_name[NAME_LENGTH]
Definition midas.h:1288
char name[9]
Definition midas.h:1241
BOOL output_flag
Definition midas.h:1245
Here is the call graph for this function:
Here is the caller graph for this function:

◆ correct_num_events()

void correct_num_events ( INT  i)

Definition at line 3075 of file mana.cxx.

3076{
3077 if (_current_par)
3079}
ANALYZE_REQUEST * _current_par
Definition mana.cxx:3073
DWORD events_received
Definition midas.h:1307

◆ db_get_event_definition()

EVENT_DEF * db_get_event_definition ( short int  event_id)

Definition at line 454 of file mana.cxx.

455{
456 INT i, index, status, size, type;
457 char str[80];
459 WORD id;
460 static EVENT_DEF *event_def = NULL;
461 static int n_cache = 0;
462
463 /* search free cache entry */
464 for (index = 0; index < n_cache; index++)
466 return &event_def[index];
467
468 /* If we get here, we have an undefined ID;
469 allocate memory for it, zero it, then cache the ODB data */
470 n_cache = index + 1;
471
473 assert(event_def);
474
475 memset(&event_def[index], 0, sizeof(EVENT_DEF));
476
477 /* check for system events */
478 if (event_id < 0) {
479 event_def[index].event_id = event_id;
480 event_def[index].format = FORMAT_ASCII;
481 event_def[index].hDefKey = 0;
482 event_def[index].disabled = FALSE;
483 return &event_def[index];
484 }
485
486 status = db_find_key(hDB, 0, "/equipment", &hKeyRoot);
487 if (status != DB_SUCCESS) {
488 cm_msg(MERROR, "db_get_event_definition", "cannot find /equipment entry in ODB");
489 return NULL;
490 }
491
492 for (i = 0;; i++) {
493 /* search for equipment with specific name */
495 if (status == DB_NO_MORE_SUBKEYS) {
496 cm_msg(MERROR, "db_get_event_definition", "Cannot find event id %d under /equipment", event_id);
497 return NULL;
498 }
499
500 size = sizeof(id);
501 status = db_get_value(hDB, hKey, "Common/Event ID", &id, &size, TID_WORD, TRUE);
502 if (status != DB_SUCCESS)
503 continue;
504
505 size = sizeof(type);
506 status = db_get_value(hDB, hKey, "Common/Type", &type, &size, TID_INT, TRUE);
507 if (status != DB_SUCCESS)
508 continue;
509
510 if (id == event_id) {
511 /* set cache entry */
512 event_def[index].event_id = id;
513 event_def[index].type = type;
514
515 size = sizeof(str);
516 str[0] = 0;
517 db_get_value(hDB, hKey, "Common/Format", str, &size, TID_STRING, TRUE);
518
519 if (equal_ustring(str, "Fixed"))
520 event_def[index].format = FORMAT_FIXED;
521 else if (equal_ustring(str, "ASCII"))
522 event_def[index].format = FORMAT_ASCII;
523 else if (equal_ustring(str, "MIDAS"))
524 event_def[index].format = FORMAT_MIDAS;
525 else if (equal_ustring(str, "YBOS"))
526 event_def[index].format = FORMAT_YBOS;
527 else if (equal_ustring(str, "DUMP"))
528 event_def[index].format = FORMAT_DUMP;
529 else {
530 cm_msg(MERROR, "db_get_event_definition", "unknown data format");
531 event_def[index].event_id = 0;
532 return NULL;
533 }
534
535 db_find_key(hDB, hKey, "Variables", &event_def[index].hDefKey);
536 return &event_def[index];
537 }
538 }
539}
#define DB_SUCCESS
Definition midas.h:631
#define DB_NO_MORE_SUBKEYS
Definition midas.h:646
unsigned short int WORD
Definition mcstd.h:49
#define FORMAT_FIXED
Definition midas.h:314
#define TID_WORD
Definition midas.h:332
INT db_enum_key(HNDLE hDB, HNDLE hKey, INT idx, HNDLE *subkey_handle)
Definition odb.cxx:5586
HNDLE hKey
INT index
Definition mana.cxx:271
INT type
Definition mana.cxx:269
short int event_id
Definition mana.cxx:3069
Here is the call graph for this function:
Here is the caller graph for this function:

◆ eor()

INT eor ( INT  run_number,
char error 
)

Definition at line 1914 of file mana.cxx.

1915{
1916 ANA_MODULE **module;
1917 BANK_LIST *bank_list;
1918 INT i, j, status;
1919 char str[256], file_name[256];
1920
1921 /* call EOR routines modules */
1922 for (i = 0; analyze_request[i].event_name[0]; i++) {
1923 module = analyze_request[i].ana_module;
1924 for (j = 0; module != NULL && module[j] != NULL; j++)
1925 if (module[j]->eor != NULL && module[j]->enabled) {
1926 module[j]->eor(run_number);
1927 }
1928 }
1929
1930 /* call main analyzer BOR routine */
1932
1933 /* save histos if requested */
1934 if (out_info.histo_dump && clp.online) {
1936 if (strchr(str, '%') != NULL)
1938 else
1939 strcpy(file_name, str);
1940
1942#ifdef HAVE_HBOOK
1943 for (i = 0; i < (int) strlen(str); i++)
1944 if (isupper(str[i]))
1945 break;
1946
1947 if (i < (int) strlen(str)) {
1948 printf
1949 ("Error: Due to a limitation in HBOOK, directoy names may not contain uppercase\n");
1950 printf(" characters. Histogram saving to %s will not work.\n", str);
1951 } else {
1952 char str2[256];
1953 strcpy(str2, "NT");
1954 HRPUT(0, str, str2);
1955 }
1956#endif /* HAVE_HBOOK */
1957
1958#ifdef HAVE_ROOT
1960#endif /* HAVE_ROOT */
1961 }
1962
1963 /* close output file */
1964 if (out_file && !out_append) {
1965 if (out_format == FORMAT_HBOOK) {
1966#ifdef HAVE_HBOOK
1967 HROUT(0, i, bstr);
1968 strcpy(str, "OFFLINE");
1969 HREND(str);
1970#else
1971 cm_msg(MERROR, "eor", "HBOOK support is not compiled in");
1972#endif /* HAVE_HBOOK */
1973 } else if (out_format == FORMAT_ROOT) {
1974#ifdef HAVE_ROOT
1976#else
1977 cm_msg(MERROR, "eor", "ROOT support is not compiled in");
1978#endif /* HAVE_ROOT */
1979 } else {
1980 if (out_gzip)
1982 else
1984 }
1985
1986 out_file = NULL;
1987
1988 /* free CWNT buffer */
1989 for (i = 0; analyze_request[i].event_name[0]; i++) {
1990 bank_list = analyze_request[i].bank_list;
1991
1992 if (bank_list == NULL) {
1993 if (analyze_request[i].addr) {
1994 free(analyze_request[i].addr);
1996 }
1997 } else {
1998 for (; bank_list->name[0]; bank_list++)
1999 if (bank_list->addr) {
2000 free(bank_list->addr);
2001 bank_list->addr = NULL;
2002 }
2003 }
2004 }
2005 }
2006
2007 return status;
2008}
#define HROUT(A1, A2, A3)
Definition hbook.h:155
#define HREND(A1)
Definition hbook.h:148
#define HRPUT(A1, A2, A3)
Definition hbook.h:156
INT ana_end_of_run(INT run_number, char *error)
Definition analyzer.c:108
void add_data_dir(char *result, char *file)
Definition mana.cxx:424
char addr[128]
Definition mcnaf.cxx:104
BOOL histo_dump
Definition midas.h:1317
char histo_dump_filename[256]
Definition midas.h:1318
void * addr
Definition midas.h:1301
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getparam()

INT getparam ( int  argc,
char **  argv 
)

Definition at line 361 of file mana.cxx.

362{
363 INT index, i, j, size;
364
365 /* parse command line parameters */
366 for (index = 1; index < argc;) {
367 /* search flag in parameter description */
368 if (argv[index][0] == '-') {
369 for (j = 0; clp_descrip[j].flag_char; j++)
370 if (argv[index][1] == clp_descrip[j].flag_char)
371 break;
372
373 if (!clp_descrip[j].flag_char)
374 goto usage;
375
376 if (clp_descrip[j].n > 0 && index >= argc - 1)
377 goto usage;
378 index++;
379
380 if (clp_descrip[j].type == TID_BOOL) {
381 *((BOOL *) clp_descrip[j].data) = TRUE;
382 continue;
383 }
384
385 do {
387 strcpy((char *) clp_descrip[j].data + clp_descrip[j].index * 256,
388 argv[index]);
389 else
392
393 if (clp_descrip[j].n > 1)
394 clp_descrip[j].index++;
395
396 if (clp_descrip[j].index > clp_descrip[j].n) {
397 printf("Note more than %d options possible for flag -%c\n",
399 return 0;
400 }
401
402 index++;
403
404 } while (index < argc && argv[index][0] != '-');
405
406 } else
407 goto usage;
408 }
409
410 return SUCCESS;
411
412 usage:
413
414 printf("usage: analyzer [options]\n\n");
415 printf("valid options are:\n");
416 for (i = 0; clp_descrip[i].flag_char; i++)
418
419 return 0;
420}
static void usage()
INT db_sscanf(const char *data_str, void *data, INT *data_size, INT i, DWORD tid)
Definition odb.cxx:11314
char flag_char
Definition mana.cxx:266
void * data
Definition mana.cxx:268
static struct @1 clp_descrip[]
char description[1000]
Definition mana.cxx:267
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_module_parameters()

INT init_module_parameters ( BOOL  bclose)

Definition at line 3693 of file mana.cxx.

3694{
3695 INT i, j, status, size;
3696 ANA_MODULE **module;
3697 char str[80];
3698 HNDLE hkey;
3699
3700 for (i = 0; analyze_request[i].event_name[0]; i++) {
3701 module = analyze_request[i].ana_module;
3702 for (j = 0; module != NULL && module[j] != NULL; j++) {
3703 if (module[j]->parameters != NULL) {
3704 sprintf(str, "/%s/Parameters/%s", analyzer_name, module[j]->name);
3705
3706 if (bclose) {
3707 db_find_key(hDB, 0, str, &hkey);
3709 } else {
3710 status = db_find_key(hDB, 0, str, &hkey);
3711 if (status == DB_SUCCESS) {
3712 db_get_record_size(hDB, hkey, 0, &size);
3713 if (size != module[j]->param_size)
3714 status = 0;
3715 }
3716 if (status != DB_SUCCESS && module[j]->init_str) {
3717 if (db_check_record(hDB, 0, str, strcomb1((const char **)module[j]->init_str).c_str(), TRUE) !=
3718 DB_SUCCESS) {
3719 cm_msg(MERROR, "init_module_parameters",
3720 "Cannot create/check \"%s\" parameters in ODB", str);
3721 return 0;
3722 }
3723 }
3724
3725 db_find_key(hDB, 0, str, &hkey);
3726 assert(hkey);
3727
3728 if (db_open_record(hDB, hkey, module[j]->parameters, module[j]->param_size,
3729 MODE_READ, NULL, NULL) != DB_SUCCESS) {
3730 cm_msg(MERROR, "init_module_parameters",
3731 "Cannot open \"%s\" parameters in ODB", str);
3732 return 0;
3733 }
3734 }
3735 }
3736 }
3737 }
3738
3739 return SUCCESS;
3740}
#define MODE_READ
Definition midas.h:370
INT db_open_record(HNDLE hDB, HNDLE hKey, void *ptr, INT rec_size, WORD access_mode, void(*dispatcher)(INT, INT, void *), void *info)
Definition odb.cxx:13291
std::string strcomb1(const char **list)
Definition odb.cxx:598
INT db_get_record_size(HNDLE hDB, HNDLE hKey, INT align, INT *buf_size)
Definition odb.cxx:11615
INT db_check_record(HNDLE hDB, HNDLE hKey, const char *keyname, const char *rec_str, BOOL correct)
Definition odb.cxx:12972
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_last_histos()

void load_last_histos ( )

Definition at line 3547 of file mana.cxx.

3548{
3549 char str[256];
3550
3551 /* load previous online histos */
3552 if (!clp.no_load) {
3554
3555 if (strchr(str, DIR_SEPARATOR) == NULL)
3557
3558#ifdef HAVE_HBOOK
3559 {
3560 FILE *f;
3561 char str2[256];
3562 int i;
3563
3564 for (i = 0; i < (int) strlen(str); i++)
3565 if (isupper(str[i]))
3566 break;
3567
3568 if (i < (int) strlen(str)) {
3569 printf
3570 ("Error: Due to a limitation in HBOOK, directoy names may not contain uppercase\n");
3571 printf(" characters. Histogram loading from %s will not work.\n", str);
3572 } else {
3573 f = fopen(str, "r");
3574 if (f != NULL) {
3575 fclose(f);
3576 printf("Loading previous online histos from %s\n", str);
3577 strcpy(str2, "A");
3578 HRGET(0, str, str2);
3579
3580 /* fix wrongly booked N-tuples at ID 100000 */
3581 if (HEXIST(100000))
3582 HDELET(100000);
3583 }
3584 }
3585 }
3586#endif /* HAVE_HBOOK */
3587
3588#ifdef HAVE_ROOT
3589 printf("Loading previous online histos from %s\n", str);
3591#endif
3592 }
3593}
#define HRGET(A1, A2, A3)
Definition hbook.h:151
#define HDELET(A1)
Definition hbook.h:50
char last_histo_filename[256]
Definition midas.h:1320
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_parameters()

INT load_parameters ( INT  run_number)

Definition at line 633 of file mana.cxx.

634{
635 INT i, size, index, status;
636 HNDLE hkey;
637 char file_name[256];
638 char value_string[80];
639 char param_string[80];
640 char data[32];
641
642 /* loop over configutation file names */
643 for (i = 0; clp.config_file_name[i][0] && i < 10; i++) {
644 if (strchr(clp.config_file_name[i], '%') != NULL)
645 sprintf(file_name, clp.config_file_name[i], run_number);
646 else
647 strcpy(file_name, clp.config_file_name[i]);
648
649 /* load file under "/" */
650 if (db_load(hDB, 0, file_name, FALSE) == DB_SUCCESS)
651 printf("Configuration file \"%s\" loaded\n", file_name);
652 }
653
654 /* loop over parameters */
655 for (i = 0; clp.param[i][0] && i < 10; i++) {
656 if (strchr(clp.param[i], '=') == NULL) {
657 printf("Error: parameter %s contains no value\n", clp.param[i]);
658 } else {
659 strcpy(value_string, strchr(clp.param[i], '=') + 1);
660 strcpy(param_string, clp.param[i]);
661 *strchr(param_string, '=') = 0;
662
663 index = 0;
664 if (strchr(param_string, '[') != NULL) {
665 index = atoi(strchr(param_string, '[') + 1);
666 *strchr(param_string, '[') = 0;
667 }
668
669 char str[MAX_ODB_PATH];
670
671 if (param_string[0] == '/')
672 strcpy(str, param_string);
673 else
674 sprintf(str, "/%s/Parameters/%s", analyzer_name, param_string);
675 db_find_key(hDB, 0, str, &hkey);
676 if (hkey == 0) {
677 printf("Error: cannot find parameter %s in ODB\n", str);
678 } else {
679 KEY key;
681 db_sscanf(value_string, data, &size, 0, key.type);
682
684 if (status == DB_SUCCESS)
685 printf("Parameter %s changed to %s\n", str, value_string);
686 else
687 printf("Cannot change parameter %s\n", str);
688 }
689 }
690 }
691
692 /* let parameter changes propagate to modules */
693 cm_yield(0);
694
695 return SUCCESS;
696}
INT db_get_key(HNDLE hDB, HNDLE hKey, KEY *key)
Definition odb.cxx:6019
INT db_load(HNDLE hDB, HNDLE hKeyRoot, const char *filename, BOOL bRemote)
Definition odb.cxx:8126
INT db_set_data_index(HNDLE hDB, HNDLE hKey, const void *data, INT data_size, INT idx, DWORD type)
Definition odb.cxx:7648
KEY key
Definition mdump.cxx:34
#define MAX_ODB_PATH
Definition midas.h:277
Definition midas.h:1026
DWORD type
Definition midas.h:1027
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lock_histo()

void lock_histo ( INT  id)

Definition at line 3523 of file mana.cxx.

3524{
3525 INT i;
3526
3527 for (i = 0; i < 10000; i++)
3528 if (lock_list[i] == 0)
3529 break;
3530
3531 lock_list[i] = id;
3532}

◆ loop_online()

INT loop_online ( )

Definition at line 3636 of file mana.cxx.

3637{
3638 INT status = SUCCESS;
3640 int ch;
3641
3642 printf("Running analyzer online. Stop with \"!\"\n");
3643
3644 /* main loop */
3645 last_time_update = 0;
3646 last_time_loop = 0;
3647
3648 do {
3649 /* calculate events per second */
3651
3652 if (actual_time - last_time_update > 1000) {
3653 /* update statistics */
3654 update_stats();
3656
3657 /* check keyboard */
3658 ch = 0;
3659 while (ss_kbhit()) {
3660 ch = ss_getchar(0);
3661 if (ch == -1)
3662 ch = getchar();
3663
3664 if ((char) ch == '!')
3665 break;
3666 }
3667
3668 if ((char) ch == '!')
3669 break;
3670 }
3671
3672 if (analyzer_loop_period == 0)
3673 status = cm_yield(1000);
3674 else {
3677 analyzer_loop();
3678 }
3679
3681 }
3682
3683 } while (status != RPC_SHUTDOWN && status != SS_ABORT);
3684
3685 /* update statistics */
3686 update_stats();
3687
3688 return status;
3689}
#define SS_ABORT
Definition midas.h:677
BOOL ss_kbhit()
Definition system.cxx:3664
INT ss_getchar(BOOL reset)
Definition system.cxx:7503
INT analyzer_loop_period
Definition analyzer.c:28
INT analyzer_loop(void)
Definition analyzer.c:129
DWORD actual_time
Definition mfe.cxx:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loop_runs_offline()

INT loop_runs_offline ( )

Definition at line 4301 of file mana.cxx.

4302{
4304 char input_file_name[256], output_file_name[256], *prn;
4305 BANK_LIST *bank_list;
4306
4307 if (!clp.quiet)
4308 printf("Running analyzer offline. Stop with \"!\"\n");
4309
4310 run_number = 0;
4311 out_append = ((strchr(clp.input_file_name[0], '%') != NULL) &&
4312 (strchr(clp.output_file_name, '%') == NULL))
4313 || clp.input_file_name[1][0];
4314
4315 /* loop over range of files */
4316 if (clp.run_number[0] > 0) {
4317 if (strchr(clp.input_file_name[0], '%') == NULL) {
4318 printf
4319 ("Input file name must contain a wildcard like \"%%05d\" when using a range.\n");
4320 return 0;
4321 }
4322
4323 if (clp.run_number[0] == 0) {
4324 printf("End of range not specified.\n");
4325 return 0;
4326 }
4327
4328 for (run_number = clp.run_number[0]; run_number <= clp.run_number[1]; run_number++) {
4329 sprintf(input_file_name, clp.input_file_name[0], run_number);
4330 if (strchr(clp.output_file_name, '%') != NULL)
4331 sprintf(output_file_name, clp.output_file_name, run_number);
4332 else
4333 strcpy(output_file_name, clp.output_file_name);
4334
4336 if (status == RPC_SHUTDOWN)
4337 break;
4338 }
4339 } else {
4340 /* loop over input file names */
4341 for (i = 0; clp.input_file_name[i][0] && i < 10; i++) {
4342 strcpy(input_file_name, clp.input_file_name[i]);
4343
4344 /* get run number from input file */
4346 while (strchr(prn, DIR_SEPARATOR) != NULL)
4347 prn = strchr(prn, DIR_SEPARATOR) + 1;
4348
4349 if (strpbrk(prn, "0123456789"))
4350 run_number = atoi(strpbrk(prn, "0123456789"));
4351
4352 if (strchr(clp.output_file_name, '%') != NULL) {
4353 if (run_number == 0) {
4354 printf("Cannot extract run number from input file name.\n");
4355 return 0;
4356 }
4357 sprintf(output_file_name, clp.output_file_name, run_number);
4358 } else
4359 strcpy(output_file_name, clp.output_file_name);
4360
4362 if (status == RPC_SHUTDOWN)
4363 break;
4364 }
4365 }
4366
4367 /* close output file in append mode */
4368 if (out_file && out_append) {
4369 if (out_format == FORMAT_HBOOK) {
4370#ifdef HAVE_HBOOK
4371 char str[80];
4372
4373 HROUT(0, i, bstr);
4374 strcpy(str, "OFFLINE");
4375 HREND(str);
4376#else
4377 cm_msg(MERROR, "loop_runs_offline", "HBOOK support is not compiled in");
4378#endif
4379 } else if (out_format == FORMAT_ROOT) {
4380#ifdef HAVE_ROOT
4382#else
4383 cm_msg(MERROR, "loop_runs_offline", "ROOT support is not compiled in");
4384#endif /* HAVE_ROOT */
4385 } else {
4386 if (out_gzip)
4388 else
4390 }
4391
4392 /* free bank buffer */
4393 for (i = 0; analyze_request[i].event_name[0]; i++) {
4394 bank_list = analyze_request[i].bank_list;
4395
4396 if (bank_list == NULL)
4397 continue;
4398
4399 for (; bank_list->name[0]; bank_list++)
4400 if (bank_list->addr) {
4401 free(bank_list->addr);
4402 bank_list->addr = NULL;
4403 }
4404 }
4405 }
4406#ifdef HAVE_PVM
4407 /* merge slave output files */
4409 pvm_merge();
4410#endif
4411
4412 return CM_SUCCESS;
4413}
INT analyze_run(INT run_number, char *input_file_name, char *output_file_name)
Definition mana.cxx:4045
void * addr
Definition midas.h:1246
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ma_close()

int ma_close ( MA_FILE file)

Definition at line 3919 of file mana.cxx.

3920{
3921 if (file->format == MA_FORMAT_YBOS)
3922 assert(!"YBOS not supported anymore");
3923 else
3924 gzclose((gzFile)file->gzfile);
3925
3926 free(file);
3927 return SUCCESS;
3928}
#define MA_FORMAT_YBOS
Definition mana.cxx:3836
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ma_open()

MA_FILE * ma_open ( char file_name)

Definition at line 3852 of file mana.cxx.

3853{
3854 char *ext_str;
3855 MA_FILE *file;
3856
3857 /* allocate MA_FILE structure */
3858 file = (MA_FILE *) calloc(sizeof(MA_FILE), 1);
3859 if (file == NULL) {
3860 cm_msg(MERROR, "ma_open", "Cannot allocate MA file structure");
3861 return NULL;
3862 }
3863
3864 /* save file name */
3865 strcpy(file->file_name, file_name);
3866
3867 /* for now, just read from disk */
3868 file->device = MA_DEVICE_DISK;
3869
3870 /* or from PVM */
3871 if (pvm_slave) {
3872 file->device = MA_DEVICE_PVM;
3873 file->buffer = (char *) malloc(PVM_BUFFER_SIZE);
3874 file->wp = file->rp = 0;
3875 }
3876
3877 /* check input file extension */
3878 if (strchr(file_name, '.')) {
3880 while (*ext_str != '.')
3881 ext_str--;
3882 } else
3883 ext_str = (char *)"";
3884
3885 if (strncmp(ext_str, ".gz", 3) == 0) {
3886 ext_str--;
3887 while (*ext_str != '.' && ext_str > file_name)
3888 ext_str--;
3889 }
3890
3891 if (strncmp(file_name, "/dev/", 4) == 0) /* assume MIDAS tape */
3892 file->format = MA_FORMAT_MIDAS;
3893 else if (strncmp(ext_str, ".mid", 4) == 0)
3894 file->format = MA_FORMAT_MIDAS;
3895 else if (strncmp(ext_str, ".ybs", 4) == 0)
3896 assert(!"YBOS not supported anymore");
3897 else {
3898 printf
3899 ("Unknown input data format \"%s\". Please use file extension .mid or mid.gz.\n",
3900 ext_str);
3901 return NULL;
3902 }
3903
3904 if (file->device == MA_DEVICE_DISK) {
3905 if (file->format == MA_FORMAT_YBOS) {
3906 assert(!"YBOS not supported anymore");
3907 } else {
3908 file->gzfile = gzopen(file_name, "rb");
3909 if (file->gzfile == NULL)
3910 return NULL;
3911 }
3912 }
3913
3914 return file;
3915}
#define MA_FORMAT_MIDAS
Definition mana.cxx:3835
#define MA_DEVICE_DISK
Definition mana.cxx:3830
#define PVM_BUFFER_SIZE
Definition mana.cxx:151
#define MA_DEVICE_PVM
Definition mana.cxx:3833
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ma_read_event()

int ma_read_event ( MA_FILE file,
EVENT_HEADER pevent,
int  size 
)

Definition at line 3932 of file mana.cxx.

3933{
3934 int n;
3935
3936 if (file->device == MA_DEVICE_DISK) {
3937 if (file->format == MA_FORMAT_MIDAS) {
3938 if (size < (int) sizeof(EVENT_HEADER)) {
3939 cm_msg(MERROR, "ma_read_event", "Buffer size too small");
3940 return -1;
3941 }
3942
3943 /* read event header */
3944 n = gzread(file->gzfile, pevent, sizeof(EVENT_HEADER));
3945
3946 if (n < (int) sizeof(EVENT_HEADER)) {
3947 if (n > 0)
3948 printf("Unexpected end of file %s, last event skipped\n", file->file_name);
3949 return -1;
3950 }
3951
3952 /* swap event header if in wrong format */
3953#ifdef SWAP_EVENTS
3954 WORD_SWAP(&pevent->event_id);
3955 WORD_SWAP(&pevent->trigger_mask);
3956 DWORD_SWAP(&pevent->serial_number);
3957 DWORD_SWAP(&pevent->time_stamp);
3958 DWORD_SWAP(&pevent->data_size);
3959#endif
3960
3961 /* read event */
3962 n = 0;
3963 if (pevent->data_size > 0) {
3964 if (size < (int) pevent->data_size + (int) sizeof(EVENT_HEADER)) {
3965 cm_msg(MERROR, "ma_read_event", "Buffer size too small");
3966 return -1;
3967 }
3968 n = gzread(file->gzfile, pevent + 1, pevent->data_size);
3969 if (n != (INT) pevent->data_size) {
3970 printf("Unexpected end of file %s, last event skipped\n", file->file_name);
3971 return -1;
3972 }
3973 }
3974
3975 return n + sizeof(EVENT_HEADER);
3976 } else if (file->format == MA_FORMAT_YBOS) {
3977 assert(!"YBOS not supported anymore");
3978 }
3979 } else if (file->device == MA_DEVICE_PVM) {
3980#ifdef HAVE_PVM
3981 int bufid, len, tag, tid;
3983 struct timeval timeout;
3984
3985 /* check if anything in buffer */
3986 if (file->wp > file->rp) {
3987 pe = (EVENT_HEADER *) (file->buffer + file->rp);
3988 size = sizeof(EVENT_HEADER) + pe->data_size;
3989 memcpy(pevent, pe, size);
3990 file->rp += size;
3991 return size;
3992 }
3993
3994 /* send data request */
3997
3998 /* receive data */
3999 timeout.tv_sec = 60;
4000 timeout.tv_usec = 0;
4001
4002 bufid = pvm_trecv(-1, -1, &timeout);
4003 if (bufid < 0) {
4004 pvm_perror("pvm_recv");
4005 return -1;
4006 }
4007 if (bufid == 0) {
4008 PVM_DEBUG("ma_read_event: timeout receiving data, aborting analyzer.\n");
4009 return -1;
4010 }
4011
4012 status = pvm_bufinfo(bufid, &len, &tag, &tid);
4013 if (status < 0) {
4014 pvm_perror("pvm_bufinfo");
4015 return -1;
4016 }
4017
4018 PVM_DEBUG("ma_read_event: receive tag %d, buflen %d", tag, len);
4019
4020 if (tag == TAG_EOR || tag == TAG_EXIT)
4021 return -1;
4022
4023 file->wp = len;
4024 file->rp = 0;
4025 status = pvm_upkbyte((char *) file->buffer, len, 1);
4026 if (status < 0) {
4027 pvm_perror("pvm_upkbyte");
4028 return -1;
4029 }
4030
4031 /* no new data available, sleep some time to reduce network traffic */
4032 if (len == 0)
4033 ss_sleep(200);
4034
4035 /* re-call this function */
4036 return ma_read_event(file, pevent, size);
4037#endif
4038 }
4039
4040 return 0;
4041}
INT ss_sleep(INT millisec)
Definition system.cxx:3628
#define WORD_SWAP(x)
Definition msystem.h:65
#define DWORD_SWAP(x)
Definition msystem.h:74
DWORD serial_number
Definition midas.h:854
DWORD time_stamp
Definition midas.h:855
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char argv[] 
)

Definition at line 5321 of file mana.cxx.

5322{
5323 INT status, size;
5324 char str[256];
5325 HNDLE hkey;
5326
5327#ifdef HAVE_PVM
5328 int i;
5329
5330 str[0] = 0;
5331 for (i = 0; i < argc; i++) {
5332 strcat(str, argv[i]);
5333 strcat(str, " ");
5334 }
5335 PVM_DEBUG("Analyzer started: %s", str);
5336#endif
5337
5338#ifdef HAVE_ROOT
5339 int argn = 1;
5340 char *argp = (char *) argv[0];
5341
5342 manaApp = new TRint("ranalyzer", &argn, &argp, NULL, 0, true);
5343
5344 /* default server port */
5345 clp.root_port = 9090;
5346#endif
5347
5348 /* get default from environment */
5349 cm_get_environment(clp.host_name, sizeof(clp.host_name), clp.exp_name,
5350 sizeof(clp.exp_name));
5351
5352#ifdef HAVE_HBOOK
5353 /* set default lrec size */
5354 clp.lrec = HBOOK_LREC;
5355#endif /* HAVE_HBOOK */
5356
5357 /* read in command line parameters into clp structure */
5359 if (status != CM_SUCCESS)
5360 return 1;
5361
5362 /* become a daemon */
5363 if (clp.daemon) {
5364 printf("Becoming a daemon...\n");
5365 clp.quiet = TRUE;
5367 }
5368
5369 /* set default buffer size */
5370 if (clp.pvm_buf_size == 0)
5371 clp.pvm_buf_size = 512 * 1024;
5372 else
5373 clp.pvm_buf_size *= 1024;
5374 if (clp.pvm_buf_size > PVM_BUFFER_SIZE) {
5375 printf("Buffer size cannot be larger than %dkB\n", PVM_BUFFER_SIZE / 1024);
5376 return 1;
5377 }
5378
5379 /* set online mode if no input filename is given */
5380 clp.online = (clp.input_file_name[0][0] == 0);
5381
5382#ifdef HAVE_HBOOK
5383 /* set Ntuple format to RWNT if online */
5384 if (clp.online || equal_ustring(clp.output_file_name, "OFLN"))
5385 clp.rwnt = TRUE;
5386#endif /* HAVE_HBOOK */
5387
5388#ifdef HAVE_PVM
5389 status = pvm_main(argv);
5390 if (status != CM_SUCCESS)
5391 return 1;
5392#endif
5393
5394 /* now connect to server */
5395 if (clp.online) {
5396 if (clp.host_name[0])
5397 printf("Connect to experiment %s on host %s...", clp.exp_name, clp.host_name);
5398 else
5399 printf("Connect to experiment %s...", clp.exp_name);
5400 }
5401
5402 status =
5405
5406 if (status == CM_UNDEF_EXP) {
5407 printf("\nError: Experiment \"%s\" not defined.\n", clp.exp_name);
5408 if (getenv("MIDAS_DIR")) {
5409 printf
5410 ("Note that \"MIDAS_DIR\" is defined, which results in a single experiment\n");
5411 printf
5412 ("called \"Default\". If you want to use the \"exptab\" file, undefine \"MIDAS_DIR\".\n");
5413 }
5414 return 1;
5415 } else if (status != CM_SUCCESS) {
5416 std::string s = cm_get_error(status);
5417 printf("\nError: %s\n", s.c_str());
5418 return 1;
5419 }
5420
5421 if (clp.online)
5422 printf("OK\n");
5423
5424 /* set online/offline mode */
5426
5427 size = sizeof(sys_max_event_size);
5428 status = db_get_value(hDB, 0, "/Experiment/MAX_EVENT_SIZE", &sys_max_event_size, &size, TID_DWORD, TRUE);
5429
5430 db_set_value(hDB, 0, "/Runinfo/Online Mode", &clp.online, sizeof(clp.online), 1, TID_INT);
5431
5432 if (clp.online) {
5433 /* check for duplicate name */
5435 if (status == CM_SUCCESS) {
5437 printf("An analyzer named \"%s\" is already running in this experiment.\n",
5439 printf
5440 ("Please select another analyzer name in analyzer.c or stop other analyzer.\n");
5441 return 1;
5442 }
5443
5444 /* register transitions if started online */
5449 printf("Failed to start local RPC server");
5450 return 1;
5451 }
5452 } else {
5453 if (!pvm_slave) { /* slave could run on same machine... */
5455 if (status == CM_SUCCESS) {
5456 /* kill hanging previous analyzer */
5458
5460 if (status == CM_SUCCESS) {
5461 /* analyzer may only run once if offline */
5463 if (status == CM_SHUTDOWN)
5464 printf("Previous analyzer stopped\n");
5465 }
5466 }
5467 }
5468 }
5469
5470#ifdef HAVE_HBOOK
5471 /* register callback for clearing histos */
5473#endif
5474
5475 /* turn on keepalive messages */
5477
5478 /* decrease watchdog timeout in offline mode */
5479 if (!clp.online)
5481
5482 /* turn off watchdog if in debug mode */
5483 if (clp.debug)
5485
5486 /* initialize module parameters */
5489 return 1;
5490 }
5491
5492 /* create ODB structure for output */
5493 sprintf(str, "/%s/Output", analyzer_name);
5495 db_find_key(hDB, 0, str, &hkey);
5496 assert(hkey);
5497 size = sizeof(out_info);
5499
5500#ifdef HAVE_ROOT
5501 /* create the folder for analyzer histograms */
5503 gROOT->GetRootFolder()->AddFolder("histos", "MIDAS Analyzer Histograms");
5505 gROOT->GetListOfBrowsables()->Add(gManaHistosFolder, "histos");
5506
5507 /* convert .rz names to .root names */
5509 strcpy(out_info.last_histo_filename, "last.root");
5510
5512 strcpy(out_info.histo_dump_filename, "his%05d.root");
5513
5514 db_set_record(hDB, hkey, &out_info, sizeof(out_info), 0);
5515
5516 /* start socket server */
5517 if (clp.root_port)
5518 start_root_socket_server(clp.root_port);
5519
5520#endif /* HAVE_ROOT */
5521
5522#ifdef HAVE_HBOOK
5523 /* convert .root names to .rz names */
5524 if (strstr(out_info.last_histo_filename, ".root"))
5525 strcpy(out_info.last_histo_filename, "last.rz");
5526
5527 if (strstr(out_info.histo_dump_filename, ".root"))
5528 strcpy(out_info.histo_dump_filename, "his%05d.rz");
5529
5530 db_set_record(hDB, hkey, &out_info, sizeof(out_info), 0);
5531#endif
5532
5533#ifdef HAVE_HBOOK
5534 /* create global memory */
5535 if (clp.online) {
5537 printf("\nGLOBAL MEMORY NAME = %s\n", out_info.global_memory_name);
5538 } else {
5539 if (equal_ustring(clp.output_file_name, "OFLN")) {
5540 strcpy(str, "OFLN");
5541 HLIMAP(pawc_size / 4, str);
5542 printf("\nGLOBAL MEMORY NAME = %s\n", "OFLN");
5543 } else
5544 HLIMIT(pawc_size / 4);
5545 }
5546#endif /* HAVE_HBOOK */
5547
5548 /* analyzer init function */
5549 if (mana_init() != CM_SUCCESS) {
5551 return 1;
5552 }
5553
5554 /* load histos from last.xxx */
5555 if (clp.online)
5557
5558 /* reqister event requests */
5560
5561 /* initialize ss_getchar */
5562 if (!clp.quiet && !pvm_slave)
5563 ss_getchar(0);
5564
5565 /*---- start main loop ----*/
5566
5567 if (clp.online)
5568 loop_online();
5569 else
5571
5572 /* reset terminal */
5573 if (!clp.quiet && !pvm_slave)
5575
5576 /* call exit function */
5577 mana_exit();
5578
5579 /* save histos to last.xxx */
5580 if (clp.online)
5582
5583#ifdef HAVE_PVM
5584
5585 PVM_DEBUG("Analyzer stopped");
5586
5587 /* exit PVM */
5588 pvm_exit();
5589
5590 /* if PVM slave, don't write *SHM file back */
5591 if (pvm_slave)
5593
5594#endif
5595
5596 /* disconnect from experiment */
5598
5599#ifdef HAVE_ROOT
5600 if (clp.start_rint)
5601 manaApp->Run(true);
5602 printf("\r \n"); /* overwrite superflous ROOT prompt */
5603#endif
5604
5605 return 0;
5606}
INT cm_register_transition(INT transition, INT(*func)(INT, char *), INT sequence_number)
Definition midas.cxx:3593
INT cm_shutdown(const char *name, BOOL bUnique)
Definition midas.cxx:7400
INT cm_register_function(INT id, INT(*func)(INT, void **))
Definition midas.cxx:5790
INT cm_connect_experiment1(const char *host_name, const char *default_exp_name, const char *client_name, void(*func)(char *), INT odb_size, DWORD watchdog_timeout)
Definition midas.cxx:2297
INT cm_cleanup(const char *client_name, BOOL ignore_timeout)
Definition midas.cxx:7610
INT cm_disconnect_experiment(void)
Definition midas.cxx:2846
INT cm_get_environment(char *host_name, int host_name_size, char *exp_name, int exp_name_size)
Definition midas.cxx:2134
INT cm_set_watchdog_params(BOOL call_watchdog, DWORD timeout)
Definition midas.cxx:3283
INT cm_exist(const char *name, BOOL bUnique)
Definition midas.cxx:7520
#define CM_UNDEF_EXP
Definition midas.h:586
#define CM_SHUTDOWN
Definition midas.h:588
#define TR_RESUME
Definition midas.h:408
#define TR_PAUSE
Definition midas.h:407
#define TR_START
Definition midas.h:405
#define TR_STOP
Definition midas.h:406
INT ss_daemon_init(BOOL keep_stdout)
Definition system.cxx:2001
std::string cm_get_error(INT code)
Definition midas.cxx:455
INT db_get_record1(HNDLE hDB, HNDLE hKey, void *data, INT *buf_size, INT align, const char *rec_str)
Definition odb.cxx:11805
INT db_set_record(HNDLE hDB, HNDLE hKey, void *data, INT buf_size, INT align)
Definition odb.cxx:12291
#define RPC_ANA_CLEAR_HISTOS
Definition mrpc.h:118
#define HLIMIT(A1)
Definition hbook.h:108
#define HLIMAP(A1, A2)
Definition hbook.h:107
void load_last_histos()
Definition mana.cxx:3547
INT mana_exit()
Definition mana.cxx:1655
INT mana_init()
Definition mana.cxx:1516
INT pawc_size
void register_requests(void)
Definition mana.cxx:3338
INT init_module_parameters(BOOL bclose)
Definition mana.cxx:3693
INT tr_stop(INT rn, char *error)
Definition mana.cxx:2036
INT tr_start(INT rn, char *error)
Definition mana.cxx:2014
INT loop_runs_offline()
Definition mana.cxx:4301
INT odb_size
Definition analyzer.cxx:46
INT tr_pause(INT rn, char *error)
Definition mana.cxx:2065
INT tr_resume(INT rn, char *error)
Definition mana.cxx:2078
INT getparam(int argc, char **argv)
Definition mana.cxx:361
void save_last_histos()
Definition mana.cxx:3597
INT loop_online()
Definition mana.cxx:3636
#define DEFAULT_WATCHDOG_TIMEOUT
Definition midas.h:290
#define ANA_OUTPUT_INFO_STR
Definition midas.h:1325
#define DEFAULT_RPC_TIMEOUT
Definition midas.h:287
TObjArray * gHistoFolderStack
char global_memory_name[8]
Definition midas.h:1322
Here is the call graph for this function:

◆ mana_exit()

INT mana_exit ( )

Definition at line 1655 of file mana.cxx.

1656{
1657 ANA_MODULE **module;
1658 INT i, j;
1659
1660 /* call exit routines from modules */
1661 for (i = 0; analyze_request[i].event_name[0]; i++) {
1662 module = analyze_request[i].ana_module;
1663 for (j = 0; module != NULL && module[j] != NULL; j++)
1664 if (module[j]->exit != NULL && module[j]->enabled) {
1665 module[j]->exit();
1666 }
1667 }
1668
1669 /* call main analyzer exit routine */
1670 return analyzer_exit();
1671}
INT analyzer_exit(void)
Definition analyzer.c:94
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mana_init()

INT mana_init ( )

Definition at line 1516 of file mana.cxx.

1517{
1518 ANA_MODULE **module;
1519 INT i, j, status, size;
1520 HNDLE hkey;
1521 char str[256], block_name[32];
1522 BANK_LIST *bank_list;
1523 double dummy;
1524
1525 sprintf(str, "/%s/Output", analyzer_name);
1526 db_find_key(hDB, 0, str, &hkey);
1527
1528 if (clp.online) {
1529 status =
1531 if (status != DB_SUCCESS) {
1532 cm_msg(MERROR, "bor", "Cannot read output info record");
1533 return 0;
1534 }
1535 }
1536
1537 /* create ODB structures for banks */
1538 for (i = 0; analyze_request[i].event_name[0]; i++) {
1539 bank_list = analyze_request[i].bank_list;
1540
1541 if (bank_list == NULL)
1542 continue;
1543
1544 for (; bank_list->name[0]; bank_list++) {
1545 strncpy(block_name, bank_list->name, 4);
1546 block_name[4] = 0;
1547
1548 if (bank_list->type == TID_STRUCT) {
1549 sprintf(str, "/Equipment/%s/Variables/%s", analyze_request[i].event_name,
1550 block_name);
1551 db_check_record(hDB, 0, str, strcomb1((const char **)bank_list->init_str).c_str(), TRUE);
1552 db_find_key(hDB, 0, str, &hkey);
1553 bank_list->def_key = hkey;
1554 } else {
1555 sprintf(str, "/Equipment/%s/Variables/%s", analyze_request[i].event_name,
1556 block_name);
1557 status = db_find_key(hDB, 0, str, &hkey);
1558 if (status != DB_SUCCESS) {
1559 dummy = 0;
1560 db_set_value(hDB, 0, str, &dummy, rpc_tid_size(bank_list->type), 1,
1561 bank_list->type);
1562 }
1563 bank_list->def_key = hkey;
1564 }
1565 }
1566 }
1567
1568 /* create ODB structures for fixed events */
1569 for (i = 0; analyze_request[i].event_name[0]; i++) {
1570 if (analyze_request[i].init_string) {
1571 sprintf(str, "/Equipment/%s/Variables", analyze_request[i].event_name);
1572 db_check_record(hDB, 0, str, strcomb1((const char **)analyze_request[i].init_string).c_str(), TRUE);
1573 }
1574 }
1575
1576 /* delete tests in ODB */
1577 sprintf(str, "/%s/Tests", analyzer_name);
1578 db_find_key(hDB, 0, str, &hkey);
1579 if (hkey)
1581
1582#ifdef HAVE_HBOOK
1583 /* create global memory */
1584 if (clp.online) {
1585 /* book online N-tuples only once when online */
1586 status = book_ntuples();
1587 if (status != SUCCESS)
1588 return status;
1589 } else {
1590 if (equal_ustring(clp.output_file_name, "OFLN")) {
1591 /* book online N-tuples only once when online */
1592 status = book_ntuples();
1593 if (status != SUCCESS)
1594 return status;
1595 }
1596 }
1597#endif /* HAVE_HBOOK */
1598
1599#ifdef HAVE_ROOT
1600 if (clp.online) {
1601 /* book online N-tuples only once when online */
1602 status = book_ttree();
1603 if (status != SUCCESS)
1604 return status;
1605 }
1606#endif
1607
1608 /* call main analyzer init routine */
1610 if (status != SUCCESS)
1611 return status;
1612
1613 /* initialize modules */
1614 for (i = 0; analyze_request[i].event_name[0]; i++) {
1615 module = analyze_request[i].ana_module;
1616 for (j = 0; module != NULL && module[j] != NULL; j++) {
1617
1618 /* copy module enabled flag to ana_module */
1619 sprintf(str, "/%s/Module switches/%s", analyzer_name, module[j]->name);
1620 module[j]->enabled = TRUE;
1621 size = sizeof(BOOL);
1622 db_get_value(hDB, 0, str, &module[j]->enabled, &size, TID_BOOL, TRUE);
1623
1624 if (module[j]->init != NULL && module[j]->enabled) {
1625
1626#ifdef HAVE_ROOT
1627 /* create histo subfolder for module */
1628 sprintf(str, "Histos for module %s", module[j]->name);
1629 module[j]->histo_folder = (TFolder *) gROOT->FindObjectAny(module[j]->name);
1630 if (!module[j]->histo_folder)
1631 module[j]->histo_folder =
1632 gManaHistosFolder->AddFolder(module[j]->name, str);
1633 else if (strcmp(((TObject *) module[j]->histo_folder)->ClassName(), "TFolder")
1634 != 0) {
1635 cm_msg(MERROR, "mana_init",
1636 "Fatal error: ROOT Object \"%s\" of class \"%s\" exists but it is not a TFolder, exiting!",
1637 module[j]->name,
1638 ((TObject *) module[j]->histo_folder)->ClassName());
1639 exit(1);
1640 }
1641 gHistoFolderStack->Clear();
1642 gHistoFolderStack->Add((TObject *) module[j]->histo_folder);
1643#endif
1644
1645 module[j]->init();
1646 }
1647 }
1648 }
1649
1650 return SUCCESS;
1651}
#define TID_STRUCT
Definition midas.h:348
INT db_delete_key(HNDLE hDB, HNDLE hKey, BOOL follow_links)
Definition odb.cxx:3856
INT rpc_tid_size(INT id)
Definition midas.cxx:11757
INT analyzer_init(void)
Definition analyzer.c:87
HNDLE def_key
Definition midas.h:1248
char ** init_str
Definition midas.h:1244
WORD type
Definition midas.h:1242
Here is the call graph for this function:
Here is the caller graph for this function:

◆ odb_load()

void odb_load ( EVENT_HEADER pevent)

Definition at line 3743 of file mana.cxx.

3744{
3745 BOOL flag;
3746 int size, i, status;
3747 char str[256];
3749
3750 flag = TRUE;
3751 size = sizeof(flag);
3752 sprintf(str, "/%s/ODB Load", analyzer_name);
3753 db_get_value(hDB, 0, str, &flag, &size, TID_BOOL, TRUE);
3754
3755 if (flag) {
3756 for (i = 0; i < 10; i++)
3757 if (clp.protect[i][0] && !clp.quiet)
3758 printf("Protect ODB tree \"%s\"\n", clp.protect[i]);
3759
3760 if (!clp.quiet)
3761 printf("Load ODB from run %d...", (int) current_run_number);
3762
3763 if (flag == 1) {
3764 /* lock all ODB values except run parameters */
3766
3767 db_find_key(hDB, 0, "/Experiment/Run Parameters", &hKey);
3768 if (hKey)
3770
3771 /* and analyzer parameters */
3772 sprintf(str, "/%s/Parameters", analyzer_name);
3773 db_find_key(hDB, 0, str, &hKey);
3774 if (hKey)
3776
3777 /* and equipment (except /variables) */
3778 db_find_key(hDB, 0, "/Equipment", &hKeyRoot);
3779 if (hKeyRoot) {
3781
3782 for (i = 0;; i++) {
3785 break;
3786
3788
3789 db_find_key(hDB, hKeyEq, "Variables", &hKey);
3790 if (hKey)
3792 }
3793 }
3794
3795 /* lock protected trees */
3796 for (i = 0; i < 10; i++)
3797 if (clp.protect[i][0]) {
3798 db_find_key(hDB, 0, clp.protect[i], &hKey);
3799 if (hKey)
3801 }
3802 }
3803
3804 /* close open records to parameters */
3806
3807 if (strncmp((char *) (pevent + 1), "<?xml version=\"1.0\"", 19) == 0)
3808 db_paste_xml(hDB, 0, (char *) (pevent + 1));
3809 else
3810 db_paste(hDB, 0, (char *) (pevent + 1));
3811
3812 if (flag == 1)
3814
3815 /* reinit structured opened by user analyzer */
3816 analyzer_init();
3817
3818 /* reload parameter files after BOR event */
3819 if (!clp.quiet)
3820 printf("OK\n");
3822
3823 /* open module parameters again */
3825 }
3826}
#define MODE_DELETE
Definition midas.h:372
#define MODE_WRITE
Definition midas.h:371
INT db_paste_xml(HNDLE hDB, HNDLE hKeyRoot, const char *buffer)
Definition odb.cxx:8998
INT db_set_mode(HNDLE hDB, HNDLE hKey, WORD mode, BOOL recurse)
Definition odb.cxx:8027
INT db_paste(HNDLE hDB, HNDLE hKeyRoot, const char *buffer)
Definition odb.cxx:8487
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_event()

INT process_event ( ANALYZE_REQUEST par,
EVENT_HEADER pevent 
)

Definition at line 3081 of file mana.cxx.

3082{
3083 INT i, status = SUCCESS, ch;
3084 ANA_MODULE **module;
3087 static DWORD last_time_kb = 0;
3088 static char *orig_event = NULL;
3089
3090 /* verbose output */
3091 if (clp.verbose)
3092 printf("event %d, number %d, total size %d\n",
3093 (int) pevent->event_id,
3094 (int) pevent->serial_number,
3095 (int) (pevent->data_size + sizeof(EVENT_HEADER)));
3096
3097 /* save analyze_request for event number correction */
3098 _current_par = par;
3099
3100 /* check keyboard once every second */
3102 if (!clp.online && actual_time - last_time_kb > 1000 && !clp.quiet && !pvm_slave) {
3104
3105 while (ss_kbhit()) {
3106 ch = ss_getchar(0);
3107 if (ch == -1)
3108 ch = getchar();
3109
3110 if ((char) ch == '!')
3111 return RPC_SHUTDOWN;
3112 }
3113 }
3114
3115 if (par == NULL) {
3116 /* load ODB with BOR event */
3117 if (pevent->event_id == EVENTID_BOR) {
3118 /* get run number from BOR event */
3120
3121 cm_msg(MINFO, "process_event", "Set run number %d in ODB", current_run_number);
3122 assert(current_run_number > 0);
3123
3124 /* set run number in ODB */
3125 status = db_set_value(hDB, 0, "/Runinfo/Run number", &current_run_number,
3126 sizeof(current_run_number), 1, TID_INT);
3127 assert(status == SUCCESS);
3128
3129 /* load ODB from event */
3130 odb_load(pevent);
3131
3132#ifdef HAVE_PVM
3133 PVM_DEBUG("process_event: ODB load");
3134#endif
3135 }
3136 } else
3137 /* increment event counter */
3138 par->events_received++;
3139
3140#ifdef HAVE_PVM
3141
3142 /* if master, distribute events to clients */
3143 if (pvm_master) {
3144 status = pvm_distribute(par, pevent);
3145 return status;
3146 }
3147#endif
3148
3149 /* don't analyze special (BOR,MESSAGE,...) events */
3150 if (par == NULL)
3151 return SUCCESS;
3152
3153 /* swap event if necessary */
3155 if (event_def == NULL)
3156 return 0;
3157
3158 if (event_def->format == FORMAT_MIDAS)
3159 bk_swap((BANK_HEADER *) (pevent + 1), FALSE);
3160
3161 /* keep copy of original event */
3162 if (clp.filter) {
3163 if (orig_event == NULL)
3164 orig_event = (char *) malloc(sys_max_event_size + sizeof(EVENT_HEADER));
3165 memcpy(orig_event, pevent, pevent->data_size + sizeof(EVENT_HEADER));
3166 }
3167
3168 /*---- analyze event ----*/
3169
3170 /* call non-modular analyzer if defined */
3171 if (par->analyzer) {
3172 status = par->analyzer(pevent, (void *) (pevent + 1));
3173
3174 /* don't continue if event was rejected */
3175 if (status == ANA_SKIP)
3176 return 0;
3177 }
3178
3179 /* loop over analyzer modules */
3180 module = par->ana_module;
3181 for (i = 0; module != NULL && module[i] != NULL; i++) {
3182 if (module[i]->enabled) {
3183
3184 status = module[i]->analyzer(pevent, (void *) (pevent + 1));
3185
3186 /* don't continue if event was rejected */
3187 if (status == ANA_SKIP)
3188 return 0;
3189 }
3190 }
3191
3192 if (event_def->format == FORMAT_MIDAS) {
3193 /* check if event got too large */
3194 i = bk_size(pevent + 1);
3195 if (i > sys_max_event_size)
3196 cm_msg(MERROR, "process_event", "Event got too large (%d Bytes) in analyzer", i);
3197
3198 /* correct for increased event size */
3199 pevent->data_size = i;
3200 }
3201
3202 if (event_def->format == FORMAT_YBOS) {
3203 assert(!"YBOS not supported anymore");
3204 }
3205
3206 /* increment tests */
3207 if (par->use_tests)
3209
3210 /* in filter mode, use original event */
3211 if (clp.filter)
3212 pevent = (EVENT_HEADER *) orig_event;
3213
3214 /* write resulting event */
3215 if (out_file) {
3216#ifdef HAVE_HBOOK
3217 if (out_format == FORMAT_HBOOK)
3219#endif /* HAVE_HBOOK */
3220#ifdef HAVE_ROOT
3221 if (out_format == FORMAT_ROOT)
3223#endif /* HAVE_ROOT */
3224 if (out_format == FORMAT_ASCII)
3226 if (out_format == FORMAT_MIDAS)
3228
3229 if (status != SUCCESS) {
3230 cm_msg(MERROR, "process_event", "Error writing to file (Disk full?)");
3231 return -1;
3232 }
3233
3234 par->events_written++;
3235 }
3236#ifdef HAVE_HBOOK
3237 /* fill shared memory */
3238 if ((clp.online || equal_ustring(clp.output_file_name, "OFLN"))
3239 && par->rwnt_buffer_size > 0)
3240 write_event_hbook(NULL, pevent, par);
3241#endif /* HAVE_HBOOK */
3242#ifdef HAVE_ROOT
3243 /* fill tree, should later be replaced by cyclic filling once it's implemented in ROOT */
3244 if (clp.online && par->rwnt_buffer_size > 0)
3245 write_event_ttree(NULL, pevent, par);
3246#endif
3247
3248
3249 /* put event in ODB once every second */
3251 for (i = 0; i < 50; i++) {
3252 if (last_time_event[i].event_id == pevent->event_id) {
3253 if (event_def->type == EQ_PERIODIC ||
3254 event_def->type == EQ_SLOW
3255 || actual_time - last_time_event[i].last_time > 1000) {
3256 last_time_event[i].last_time = actual_time;
3257 write_event_odb(pevent);
3258 }
3259 break;
3260 }
3261 if (last_time_event[i].event_id == 0) {
3262 last_time_event[i].event_id = pevent->event_id;
3263 last_time_event[i].last_time = actual_time;
3264 write_event_odb(pevent);
3265 break;
3266 }
3267 }
3268
3269 return SUCCESS;
3270}
INT bk_swap(void *event, BOOL force)
Definition midas.cxx:17157
INT bk_size(const void *event)
Definition midas.cxx:16495
#define EQ_PERIODIC
Definition midas.h:414
#define MINFO
Definition midas.h:560
#define EQ_SLOW
Definition midas.h:418
INT write_event_odb(EVENT_HEADER *pevent)
Definition mana.cxx:2953
static struct @2 last_time_event[50]
EVENT_DEF * db_get_event_definition(short int event_id)
Definition mana.cxx:454
INT write_event_ascii(FILE *file, EVENT_HEADER *pevent, ANALYZE_REQUEST *par)
Definition mana.cxx:2096
void test_increment()
Definition mana.cxx:597
INT write_event_midas(FILE *file, EVENT_HEADER *pevent, ANALYZE_REQUEST *par)
Definition mana.cxx:2321
void odb_load(EVENT_HEADER *pevent)
Definition mana.cxx:3743
#define ANA_SKIP
Definition midas.h:840
BOOL events_to_odb
Definition midas.h:1321
Here is the call graph for this function:
Here is the caller graph for this function:

◆ receive_event()

void receive_event ( HNDLE  buffer_handle,
HNDLE  request_id,
EVENT_HEADER pheader,
void pevent 
)

Definition at line 3274 of file mana.cxx.

3277{
3279 static DWORD buffer_size = 0;
3280 static char *buffer = NULL;
3281 char *pb;
3282
3283 if (buffer == NULL) {
3284 buffer = (char *) malloc(sys_max_event_size + sizeof(EVENT_HEADER));
3285
3286 if (buffer == NULL) {
3287 cm_msg(MERROR, "receive_event", "Not enough memory to buffer event of size %d", buffer_size);
3288 return;
3289 }
3290 }
3291
3292 /* align buffer */
3293 pb = (char *) ALIGN8((POINTER_T) buffer);
3294
3295 /* copy event to local buffer */
3296 memcpy(pb, pheader, pheader->data_size + sizeof(EVENT_HEADER));
3297
3299
3300 for (; par->event_name[0]; par++)
3301 if (par->buffer_handle == buffer_handle && par->request_id == request_id) {
3303 }
3304}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_requests()

void register_requests ( void  )

Definition at line 3338 of file mana.cxx.

3339{
3340 INT index, status;
3341 char str[256];
3342 AR_INFO *ar_info;
3343 AR_STATS *ar_stats;
3344 HNDLE hKey;
3345
3346 /* scan ANALYZE_REQUEST table from ANALYZE.C */
3347 for (index = 0; analyze_request[index].event_name[0]; index++) {
3348 ar_info = &analyze_request[index].ar_info;
3349 ar_stats = &analyze_request[index].ar_stats;
3350
3351 /* create common subtree from analyze_request table in analyze.c */
3352 sprintf(str, "/%s/%s/Common", analyzer_name, analyze_request[index].event_name);
3354 db_find_key(hDB, 0, str, &hKey);
3356
3357 strcpy(ar_info->client_name, analyzer_name);
3358 auto host = ss_gethostname();
3359 strlcpy(ar_info->host, host.c_str(), sizeof(ar_info->host));
3360 db_set_record(hDB, hKey, ar_info, sizeof(AR_INFO), 0);
3361
3362 /* open hot link to analyzer request info */
3364 NULL);
3365
3366 /* create statistics tree */
3367 sprintf(str, "/%s/%s/Statistics", analyzer_name, analyze_request[index].event_name);
3369 db_find_key(hDB, 0, str, &hKey);
3370 assert(hKey);
3371
3372 ar_stats->events_received = 0;
3373 ar_stats->events_per_sec = 0;
3374 ar_stats->events_written = 0;
3375
3376 /* open hot link to statistics tree */
3377 status =
3378 db_open_record(hDB, hKey, ar_stats, sizeof(AR_STATS), MODE_WRITE, NULL, NULL);
3379 if (status != DB_SUCCESS)
3380 printf("Cannot open statistics record, probably other analyzer is using it\n");
3381
3382 if (clp.online) {
3383 /*---- open event buffer ---------------------------------------*/
3385
3386 /* set the default buffer cache size */
3387 bm_set_cache_size(analyze_request[index].buffer_handle, 100000, 0);
3388
3389 /*---- request event -------------------------------------------*/
3390 if (ar_info->enabled)
3391 bm_request_event(analyze_request[index].buffer_handle,
3392 (short) ar_info->event_id, (short) ar_info->trigger_mask,
3395 else
3397 }
3398 }
3399}
INT bm_open_buffer(const char *buffer_name, INT buffer_size, INT *buffer_handle)
Definition midas.cxx:6717
INT bm_request_event(HNDLE buffer_handle, short int event_id, short int trigger_mask, INT sampling_type, HNDLE *request_id, EVENT_HANDLER *func)
Definition midas.cxx:8465
INT bm_set_cache_size(INT buffer_handle, size_t read_size, size_t write_size)
Definition midas.cxx:8140
std::string ss_gethostname()
Definition system.cxx:5706
#define ANALYZER_STATS_STR
Definition mana.cxx:353
void update_request(HNDLE hDB, HNDLE hKey, void *info)
Definition mana.cxx:3308
#define ANALYZER_REQUEST_STR
Definition mana.cxx:343
void receive_event(HNDLE buffer_handle, HNDLE request_id, EVENT_HEADER *pheader, void *pevent)
Definition mana.cxx:3274
#define DEFAULT_BUFFER_SIZE
Definition midas.h:255
AR_STATS ar_stats
Definition midas.h:1309
HNDLE request_id
Definition midas.h:1298
HNDLE hkey_common
Definition midas.h:1300
AR_INFO ar_info
Definition midas.h:1289
HNDLE buffer_handle
Definition midas.h:1297
BOOL enabled
Definition midas.h:1276
INT sampling_type
Definition midas.h:1274
char client_name[NAME_LENGTH]
Definition midas.h:1277
char buffer[NAME_LENGTH]
Definition midas.h:1275
INT trigger_mask
Definition midas.h:1273
INT event_id
Definition midas.h:1272
char host[NAME_LENGTH]
Definition midas.h:1278
double events_written
Definition midas.h:1284
double events_per_sec
Definition midas.h:1283
double events_received
Definition midas.h:1282
Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_last_histos()

void save_last_histos ( )

Definition at line 3597 of file mana.cxx.

3598{
3599 char str[256];
3600
3601 /* save online histos */
3603 if (strchr(str, DIR_SEPARATOR) == NULL)
3605
3606 printf("Saving current online histos to %s\n", str);
3607
3608#ifdef HAVE_HBOOK
3609 {
3610 int i;
3611 char str2[256];
3612
3613 for (i = 0; i < (int) strlen(str); i++)
3614 if (isupper(str[i]))
3615 break;
3616
3617 if (i < (int) strlen(str)) {
3618 printf
3619 ("Error: Due to a limitation in HBOOK, directoy names may not contain uppercase\n");
3620 printf(" characters. Histogram saving to %s will not work.\n", str);
3621 } else {
3622 strcpy(str2, "NT");
3623 HRPUT(0, str, str2);
3624 }
3625 }
3626#endif
3627
3628#ifdef HAVE_ROOT
3630#endif
3631
3632}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_clear()

void test_clear ( )

Definition at line 582 of file mana.cxx.

583{
584 int i;
585
586 /* clear all tests in interal list */
587 for (i = 0; i < n_test; i++) {
588 tl[i]->count = 0;
589 tl[i]->value = FALSE;
590 }
591
592 /* set "always true" test */
593 if (n_test > 0)
594 tl[0]->value = TRUE;
595}
DWORD count
Definition midas.h:1341
BOOL value
Definition midas.h:1343
Here is the caller graph for this function:

◆ test_increment()

void test_increment ( )

Definition at line 597 of file mana.cxx.

598{
599 int i;
600
601 /* increment test counters based on their value and reset them */
602 for (i = 0; i < n_test; i++) {
603 if (tl[i]->value)
604 tl[i]->count++;
605 if (i > 0)
606 tl[i]->value = FALSE;
607 }
608}
double value[100]
Definition odbhist.cxx:42
Here is the caller graph for this function:

◆ test_register()

void test_register ( ANA_TEST t)

Definition at line 546 of file mana.cxx.

547{
548 int i;
549
550 /* check if test already registered */
551 for (i = 0; i < n_test; i++)
552 if (tl[i] == t)
553 break;
554 if (i < n_test) {
555 t->registered = TRUE;
556 return;
557 }
558
559 /* allocate space for pointer to test */
560 if (n_test == 0) {
561 tl = (ANA_TEST **) malloc(2 * sizeof(void *));
562
563 /* define "always true" test */
564 tl[0] = (ANA_TEST *) malloc(sizeof(ANA_TEST));
565 strcpy(tl[0]->name, "Always true");
566 tl[0]->count = 0;
567 tl[0]->previous_count = 0;
568 tl[0]->value = TRUE;
569 tl[0]->registered = TRUE;
570 n_test++;
571 } else
572 tl = (ANA_TEST **) realloc(tl, (n_test + 1) * sizeof(void *));
573
574 tl[n_test] = t;
575 t->count = 0;
576 t->value = FALSE;
577 t->registered = TRUE;
578
579 n_test++;
580}
DWORD previous_count
Definition midas.h:1342
BOOL registered
Definition midas.h:1340
Here is the call graph for this function:

◆ test_write()

void test_write ( int  delta_time)

Definition at line 610 of file mana.cxx.

611{
612 int i;
613 char str[256];
614 float rate;
615
616 /* write all test counts to /analyzer/tests/<name> */
617 for (i = 0; i < n_test; i++) {
618 sprintf(str, "/%s/Tests/%s/Count", analyzer_name, tl[i]->name);
619 db_set_value(hDB, 0, str, &tl[i]->count, sizeof(DWORD), 1, TID_DWORD);
620
621 /* calcluate rate */
622 if (delta_time > 0) {
623 rate = (float) ((tl[i]->count - tl[i]->previous_count) / (delta_time / 1000.0));
624 tl[i]->previous_count = tl[i]->count;
625 sprintf(str, "/%s/Tests/%s/Rate [Hz]", analyzer_name, tl[i]->name);
626 db_set_value(hDB, 0, str, &rate, sizeof(float), 1, TID_FLOAT);
627 }
628 }
629}
#define TID_FLOAT
Definition midas.h:341
DWORD delta_time
Definition mchart.cxx:37
double count
Definition mdump.cxx:33
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tr_pause()

INT tr_pause ( INT  rn,
char error 
)

Definition at line 2065 of file mana.cxx.

2066{
2067 INT status;
2068
2069 status = ana_pause_run(rn, error);
2070 if (status != CM_SUCCESS)
2071 return status;
2072
2073 return CM_SUCCESS;
2074}
INT ana_pause_run(INT run_number, char *error)
Definition analyzer.c:115
INT rn
Definition mstat.cxx:30
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tr_resume()

INT tr_resume ( INT  rn,
char error 
)

Definition at line 2078 of file mana.cxx.

2079{
2080 INT status;
2081
2082 status = ana_resume_run(rn, error);
2083 if (status != CM_SUCCESS)
2084 return status;
2085
2086 return CM_SUCCESS;
2087}
INT ana_resume_run(INT run_number, char *error)
Definition analyzer.c:122
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tr_start()

INT tr_start ( INT  rn,
char error 
)

Definition at line 2014 of file mana.cxx.

2015{
2016 INT status, i;
2017
2018 /* reset counters */
2019 for (i = 0; analyze_request[i].event_name[0]; i++) {
2025 }
2026
2027 status = bor(rn, error);
2028 if (status != SUCCESS)
2029 return status;
2030
2031 return SUCCESS;
2032}
DWORD events_written
Definition midas.h:1308
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tr_stop()

INT tr_stop ( INT  rn,
char error 
)

Definition at line 2036 of file mana.cxx.

2037{
2038 INT i, status, n_bytes;
2039
2040 /* wait until all events in buffers are analyzed */
2041
2042 if (rpc_is_remote())
2043 while (bm_poll_event());
2044 else
2045 for (i = 0; analyze_request[i].event_name[0]; i++) {
2046 do {
2047 bm_get_buffer_level(analyze_request[i].buffer_handle, &n_bytes);
2048 if (n_bytes > 0)
2049 cm_yield(100);
2050 } while (n_bytes > 0);
2051 }
2052
2053 /* update statistics */
2054 update_stats();
2055
2056 status = eor(rn, error);
2057 if (status != SUCCESS)
2058 return status;
2059
2060 return CM_SUCCESS;
2061}
INT bm_poll_event()
Definition midas.cxx:11126
bool rpc_is_remote(void)
Definition midas.cxx:12761
INT bm_get_buffer_level(INT buffer_handle, INT *n_bytes)
Definition midas.cxx:7838
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_request()

void update_request ( HNDLE  hDB,
HNDLE  hKey,
void info 
)

Definition at line 3308 of file mana.cxx.

3309{
3310 AR_INFO *ar_info;
3311 INT i;
3312
3313 if (!clp.online)
3314 return;
3315
3316 /* check which request's key has changed */
3317 for (i = 0; analyze_request[i].event_name[0]; i++)
3318 if (analyze_request[i].hkey_common == hKey) {
3319 ar_info = &analyze_request[i].ar_info;
3320
3321 /* remove previous request */
3322 if (analyze_request[i].request_id != -1)
3323 bm_delete_request(analyze_request[i].request_id);
3324
3325 /* if enabled, add new request */
3326 if (ar_info->enabled)
3327 bm_request_event(analyze_request[i].buffer_handle, (short) ar_info->event_id,
3328 (short) ar_info->trigger_mask, ar_info->sampling_type,
3330 else
3332 }
3333
3334}
INT bm_delete_request(INT request_id)
Definition midas.cxx:8584
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_stats()

void update_stats ( )

Definition at line 3403 of file mana.cxx.

3404{
3405 int i;
3406 AR_STATS *ar_stats;
3407 static DWORD last_time = 0;
3409
3411
3412 if (last_time == 0)
3414
3415 if (actual_time - last_time == 0)
3416 return;
3417
3418 for (i = 0; analyze_request[i].event_name[0]; i++) {
3419 ar_stats = &analyze_request[i].ar_stats;
3422 ar_stats->events_per_sec =
3426 }
3427
3428 /* propagate new statistics to ODB */
3430
3431 /* save tests in ODB */
3433
3435}
INT db_send_changed_records()
Definition odb.cxx:13777
DWORD last_time
Definition mana.cxx:3070
void test_write(int delta_time)
Definition mana.cxx:610
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_event_ascii()

INT write_event_ascii ( FILE file,
EVENT_HEADER pevent,
ANALYZE_REQUEST par 
)

Definition at line 2096 of file mana.cxx.

2097{
2098 INT status, size, i, j, count;
2099 BOOL exclude;
2101 BANK_LIST *pbl;
2103 BANK *pbk;
2104 BANK32 *pbk32;
2105 BANK32A *pbk32a;
2106 void *pdata;
2107 char *pbuf, name[5], type_name[10];
2111 HNDLE hKey;
2112 KEY key;
2113 char buffer[100000];
2114 DWORD bkname;
2115 WORD bktype;
2116
2118 if (event_def == NULL)
2119 return SS_SUCCESS;
2120
2121 /* write event header */
2122 pbuf = buffer;
2123 name[4] = 0;
2124
2125 if (pevent->event_id == EVENTID_BOR)
2126 sprintf(pbuf, "%%ID BOR NR %d\n", (int) pevent->serial_number);
2127 else if (pevent->event_id == EVENTID_EOR)
2128 sprintf(pbuf, "%%ID EOR NR %d\n", (int) pevent->serial_number);
2129 else
2130 sprintf(pbuf, "%%ID %d TR %d NR %d\n", pevent->event_id, pevent->trigger_mask,
2131 (int) pevent->serial_number);
2132 STR_INC(pbuf, buffer);
2133
2134 /*---- MIDAS format ----------------------------------------------*/
2135 if (event_def->format == FORMAT_MIDAS) {
2136 pbh = (BANK_HEADER *) (pevent + 1);
2137 pbk = NULL;
2138 pbk32 = NULL;
2139 pbk32a = NULL;
2140 do {
2141 /* scan all banks */
2142 if (bk_is32a(pbh)) {
2143 size = bk_iterate32a(pbh, &pbk32a, &pdata);
2144 if (pbk32a == NULL)
2145 break;
2146 bkname = *((DWORD *) pbk32a->name);
2147 bktype = (WORD) pbk32a->type;
2148 } else if (bk_is32(pbh)) {
2149 size = bk_iterate32(pbh, &pbk32, &pdata);
2150 if (pbk32 == NULL)
2151 break;
2152 bkname = *((DWORD *) pbk32->name);
2153 bktype = (WORD) pbk32->type;
2154 } else {
2155 size = bk_iterate(pbh, &pbk, &pdata);
2156 if (pbk == NULL)
2157 break;
2158 bkname = *((DWORD *) pbk->name);
2159 bktype = (WORD) pbk->type;
2160 }
2161
2162 /* look if bank is in exclude list */
2163 exclude = FALSE;
2164 pbl = NULL;
2165 if (par->bank_list != NULL)
2166 for (i = 0; par->bank_list[i].name[0]; i++)
2167 if (*((DWORD *) par->bank_list[i].name) == bkname) {
2168 pbl = &par->bank_list[i];
2169 exclude = (pbl->output_flag == 0);
2170 break;
2171 }
2172
2173 if (!exclude) {
2174 if (rpc_tid_size(bktype & 0xFF))
2175 size /= rpc_tid_size(bktype & 0xFF);
2176
2179
2180 /* write bank header */
2181 *((DWORD *) name) = bkname;
2182
2183 if ((bktype & 0xFF00) == 0)
2184 strcpy(type_name, rpc_tid_name(bktype & 0xFF));
2185 else if ((bktype & 0xFF00) == TID_LRS1882)
2186 strcpy(type_name, "LRS1882");
2187 else if ((bktype & 0xFF00) == TID_LRS1877)
2188 strcpy(type_name, "LRS1877");
2189 else if ((bktype & 0xFF00) == TID_PCOS3)
2190 strcpy(type_name, "PCOS3");
2191 else
2192 strcpy(type_name, "unknown");
2193
2194 sprintf(pbuf, "BK %s TP %s SZ %d\n", name, type_name, size);
2195 STR_INC(pbuf, buffer);
2196
2197 if (bktype == TID_STRUCT) {
2198 if (pbl == NULL)
2199 cm_msg(MERROR, "write_event_ascii", "received unknown bank %s", name);
2200 else
2201 /* write structured bank */
2202 for (i = 0;; i++) {
2203 status = db_enum_key(hDB, pbl->def_key, i, &hKey);
2205 break;
2206
2207 db_get_key(hDB, hKey, &key);
2208 sprintf(pbuf, "%s:\n", key.name);
2209 STR_INC(pbuf, buffer);
2210
2211 /* adjust for alignment */
2212 pdata =
2213 (void *) VALIGN(pdata,
2215
2216 for (j = 0; j < key.num_values; j++) {
2218 strcat(pbuf, "\n");
2219 STR_INC(pbuf, buffer);
2220 }
2221
2222 /* shift data pointer to next item */
2223 pdata = (char *) pdata + key.item_size * key.num_values;
2224 }
2225 } else {
2226 /* write variable length bank */
2227 if ((bktype & 0xFF00) == TID_LRS1877) {
2228 for (i = 0; i < size;) {
2230
2231 /* print header */
2232 sprintf(pbuf, "GA %d BF %d CN %d",
2233 lrs1877_header->geo_addr, lrs1877_header->buffer,
2234 lrs1877_header->count);
2235 strcat(pbuf, "\n");
2236 STR_INC(pbuf, buffer);
2237
2238 count = lrs1877_header->count;
2239 if (count == 0)
2240 break;
2241 for (j = 1; j < count; j++) {
2242 /* print data */
2243 sprintf(pbuf, "GA %d CH %02d ED %d DA %1.1lf",
2244 lrs1877[i].geo_addr, lrs1877[i + j].channel,
2245 lrs1877[i + j].edge, lrs1877[i + j].data * 0.5);
2246 strcat(pbuf, "\n");
2247 STR_INC(pbuf, buffer);
2248 }
2249
2250 i += count;
2251 }
2252 } else
2253 for (i = 0; i < size; i++) {
2254 if ((bktype & 0xFF00) == 0)
2255 db_sprintf(pbuf, pdata, size, i, bktype & 0xFF);
2256
2257 else if ((bktype & 0xFF00) == TID_LRS1882)
2258 sprintf(pbuf, "GA %d CH %02d DA %d",
2259 lrs1882[i].geo_addr, lrs1882[i].channel, lrs1882[i].data);
2260
2261 else if ((bktype & 0xFF00) == TID_PCOS3)
2262 sprintf(pbuf, "TBD");
2263 else
2264 db_sprintf(pbuf, pdata, size, i, bktype & 0xFF);
2265
2266 strcat(pbuf, "\n");
2267 STR_INC(pbuf, buffer);
2268 }
2269 }
2270 }
2271
2272 } while (1);
2273 }
2274
2275 /*---- FIXED format ----------------------------------------------*/
2276 if (event_def->format == FORMAT_FIXED) {
2277 if (event_def->hDefKey == 0)
2278 cm_msg(MERROR, "write_event_ascii", "cannot find event definition");
2279 else {
2280 pdata = (char *) (pevent + 1);
2281 for (i = 0;; i++) {
2282 status = db_enum_key(hDB, event_def->hDefKey, i, &hKey);
2284 break;
2285
2286 db_get_key(hDB, hKey, &key);
2287 sprintf(pbuf, "%s\n", key.name);
2288 STR_INC(pbuf, buffer);
2289
2290 /* adjust for alignment */
2292
2293 for (j = 0; j < key.num_values; j++) {
2295 strcat(pbuf, "\n");
2296 STR_INC(pbuf, buffer);
2297 }
2298
2299 /* shift data pointer to next item */
2300 pdata = (char *) pdata + key.item_size * key.num_values;
2301 }
2302 }
2303 }
2304
2305 /* insert empty line after each event */
2306 strcat(pbuf, "\n");
2307 size = strlen(buffer);
2308
2309 /* write record to device */
2310 if (out_gzip)
2311 status = gzwrite((gzFile)file, buffer, size) == size ? SS_SUCCESS : SS_FILE_ERROR;
2312 else
2313 status =
2314 fwrite(buffer, 1, size, file) == (size_t) size ? SS_SUCCESS : SS_FILE_ERROR;
2315
2316 return status;
2317}
INT bk_iterate32a(const void *event, BANK32A **pbk32a, void *pdata)
Definition midas.cxx:17103
BOOL bk_is32a(const void *event)
Definition midas.cxx:16437
BOOL bk_is32(const void *event)
Definition midas.cxx:16415
INT bk_iterate32(const void *event, BANK32 **pbk, void *pdata)
Definition midas.cxx:17067
INT bk_iterate(const void *event, BANK **pbk, void *pdata)
Definition midas.cxx:17046
#define SS_SUCCESS
Definition midas.h:663
#define VALIGN(adr, align)
Definition midas.h:526
#define MIN(a, b)
Definition midas.h:515
INT ss_get_struct_align()
Definition system.cxx:1319
INT db_sprintf(char *string, const void *data, INT data_size, INT idx, DWORD type)
Definition odb.cxx:10843
const char * rpc_tid_name(INT id)
Definition midas.cxx:11764
#define TID_PCOS3
Definition hardware.h:18
#define TID_LRS1877
Definition hardware.h:17
#define TID_LRS1882
Definition hardware.h:16
INT channel
#define STR_INC(p, base)
Definition mana.cxx:2091
#define EVENTID_EOR
Definition midas.h:901
char * type_name[]
Definition mspeaker.cpp:26
Definition midas.h:1215
INT num_values
Definition midas.h:1028
char name[NAME_LENGTH]
Definition midas.h:1029
INT item_size
Definition midas.h:1032
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_event_midas()

INT write_event_midas ( FILE file,
EVENT_HEADER pevent,
ANALYZE_REQUEST par 
)

Definition at line 2321 of file mana.cxx.

2322{
2323 INT status, size = 0, i;
2324 BOOL exclude;
2326 BANK_LIST *pbl;
2328 BANK *pbk;
2329 BANK32 *pbk32;
2330 BANK32A *pbk32a;
2331 char *pdata, *pdata_copy;
2332 char *pbuf;
2335 WORD bktype;
2336 static char *buffer = NULL;
2337
2338 if (buffer == NULL)
2339 buffer = (char *) malloc(sys_max_event_size);
2340
2341 pevent_copy = (EVENT_HEADER *) ALIGN8((POINTER_T) buffer);
2342
2343 if (clp.filter) {
2344 /* use original event */
2345 size = pevent->data_size + sizeof(EVENT_HEADER);
2346 memcpy(pevent_copy, pevent, size);
2347 } else {
2348 /* copy only banks which are turned on via /analyzer/bank switches */
2349
2350 /*---- MIDAS format ----------------------------------------------*/
2351
2353 if (event_def == NULL)
2354 return SUCCESS;
2355
2356 if (event_def->format == FORMAT_MIDAS) {
2357 /* copy event header */
2358 pbuf = (char *) pevent_copy;
2359 memcpy(pbuf, pevent, sizeof(EVENT_HEADER));
2360 pbuf += sizeof(EVENT_HEADER);
2361
2362 pbh = (BANK_HEADER *) (pevent + 1);
2363
2364 if (bk_is32(pbh))
2365 bk_init32(pbuf);
2366 else
2367 bk_init(pbuf);
2368
2369 pbk = NULL;
2370 pbk32 = NULL;
2371 pbk32a = NULL;
2372 pdata_copy = pbuf;
2373 do {
2374 /* scan all banks */
2375 if (bk_is32a(pbh)) {
2376 size = bk_iterate32a(pbh, &pbk32a, &pdata);
2377 if (pbk32a == NULL)
2378 break;
2379 bkname = *((DWORD *) pbk32a->name);
2380 bktype = (WORD) pbk32a->type;
2381 bksize = pbk32a->data_size;
2382 } else if (bk_is32(pbh)) {
2383 size = bk_iterate32(pbh, &pbk32, &pdata);
2384 if (pbk32 == NULL)
2385 break;
2386 bkname = *((DWORD *) pbk32->name);
2387 bktype = (WORD) pbk32->type;
2388 bksize = pbk32->data_size;
2389 } else {
2390 size = bk_iterate(pbh, &pbk, &pdata);
2391 if (pbk == NULL)
2392 break;
2393 bkname = *((DWORD *) pbk->name);
2394 bktype = (WORD) pbk->type;
2395 bksize = pbk->data_size;
2396 }
2397
2398 /* look if bank is in exclude list */
2399 exclude = FALSE;
2400 pbl = NULL;
2401 if (par->bank_list != NULL)
2402 for (i = 0; par->bank_list[i].name[0]; i++)
2403 if (*((DWORD *) par->bank_list[i].name) == bkname) {
2404 pbl = &par->bank_list[i];
2405 exclude = (pbl->output_flag == 0);
2406 break;
2407 }
2408
2409 if (!exclude) {
2410 /* copy bank */
2411 bk_create(pbuf, (char *) (&bkname), bktype, (void **)&pdata_copy);
2413 pdata_copy += bksize;
2415 }
2416
2417 } while (1);
2418
2419 /* set event size in header */
2421 pevent_copy->data_size = size;
2422 size += sizeof(EVENT_HEADER);
2423 }
2424
2425 /*---- FIXED format ----------------------------------------------*/
2426 if (event_def->format == FORMAT_FIXED) {
2427 size = pevent->data_size + sizeof(EVENT_HEADER);
2428 memcpy(pevent_copy, pevent, size);
2429 }
2430
2431 if (pevent_copy->data_size == 0)
2432 return SUCCESS;
2433 }
2434
2435 /* write record to device */
2436 if (out_gzip)
2437 status = gzwrite((gzFile)file, pevent_copy, size) == size ? SUCCESS : SS_FILE_ERROR;
2438 else
2439 status =
2440 fwrite(pevent_copy, 1, size, file) == (size_t) size ? SUCCESS : SS_FILE_ERROR;
2441
2442 return status;
2443}
INT bk_close(void *event, void *pdata)
Definition midas.cxx:16780
void bk_init(void *event)
Definition midas.cxx:16406
void bk_init32(void *event)
Definition midas.cxx:16469
void bk_create(void *event, const char *name, WORD type, void **pdata)
Definition midas.cxx:16561
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_event_odb()

INT write_event_odb ( EVENT_HEADER pevent)

Definition at line 2953 of file mana.cxx.

2954{
2955 INT status, size, n_data, i;
2958 BANK *pbk;
2959 BANK32 *pbk32;
2960 BANK32A *pbk32a;
2961 void *pdata;
2962 char name[5];
2964 KEY key;
2965 DWORD bkname;
2966 WORD bktype;
2967
2969 if (event_def == NULL)
2970 return SS_SUCCESS;
2971
2972 /*---- MIDAS format ----------------------------------------------*/
2973
2974 if (event_def->format == FORMAT_MIDAS) {
2975 pbh = (BANK_HEADER *) (pevent + 1);
2976 pbk = NULL;
2977 pbk32 = NULL;
2978 pbk32a = NULL;
2979 do {
2980 /* scan all banks */
2981 if (bk_is32a(pbh)) {
2982 size = bk_iterate32a(pbh, &pbk32a, &pdata);
2983 if (pbk32a == NULL)
2984 break;
2985 bkname = *((DWORD *) pbk32a->name);
2986 bktype = (WORD) pbk32a->type;
2987 } else if (bk_is32(pbh)) {
2988 size = bk_iterate32(pbh, &pbk32, &pdata);
2989 if (pbk32 == NULL)
2990 break;
2991 bkname = *((DWORD *) pbk32->name);
2992 bktype = (WORD) pbk32->type;
2993 } else {
2994 size = bk_iterate(pbh, &pbk, &pdata);
2995 if (pbk == NULL)
2996 break;
2997 bkname = *((DWORD *) pbk->name);
2998 bktype = (WORD) pbk->type;
2999 }
3000
3001 n_data = size;
3002 if (rpc_tid_size(bktype & 0xFF))
3003 n_data /= rpc_tid_size(bktype & 0xFF);
3004
3005 /* get bank key */
3006 *((DWORD *) name) = bkname;
3007 name[4] = 0;
3008
3009 status = db_find_key(hDB, event_def->hDefKey, name, &hKeyRoot);
3010 if (status != DB_SUCCESS) {
3011 cm_msg(MERROR, "write_event_odb", "received unknown bank %s", name);
3012 continue;
3013 }
3014
3015 if (bktype == TID_STRUCT) {
3016 /* write structured bank */
3017 for (i = 0;; i++) {
3020 break;
3021
3022 db_get_key(hDB, hKey, &key);
3023
3024 /* adjust for alignment */
3025 if (key.type != TID_STRING && key.type != TID_LINK)
3026 pdata =
3028
3031 if (status != DB_SUCCESS) {
3032 cm_msg(MERROR, "write_event_odb", "cannot write %s to ODB", name);
3033 continue;
3034 }
3035
3036 /* shift data pointer to next item */
3037 pdata = (char *) pdata + key.item_size * key.num_values;
3038 }
3039 } else {
3041
3042 /* write variable length bank */
3043 if (n_data > 0) {
3044 status = db_set_data(hDB, hKeyRoot, pdata, size, n_data, key.type);
3045 if (status != DB_SUCCESS) {
3046 cm_msg(MERROR, "write_event_odb", "cannot write %s to ODB", name);
3047 continue;
3048 }
3049 }
3050 }
3051 } while (1);
3052 }
3053
3054 /*---- FIXED format ----------------------------------------------*/
3055
3056 if (event_def->format == FORMAT_FIXED && !clp.online) {
3057 if (db_set_record
3058 (hDB, event_def->hDefKey, (char *) (pevent + 1), pevent->data_size,
3059 0) != DB_SUCCESS)
3060 cm_msg(MERROR, "write_event_odb", "event #%d size mismatch", pevent->event_id);
3061 }
3062
3063 return SUCCESS;
3064}
#define TID_LINK
Definition midas.h:350
INT db_set_data(HNDLE hDB, HNDLE hKey, const void *data, INT buf_size, INT num_values, DWORD type)
Definition odb.cxx:7215
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ _current_par

ANALYZE_REQUEST* _current_par

Definition at line 3073 of file mana.cxx.

◆ analyze_request

ANALYZE_REQUEST analyze_request[]
extern

Definition at line 37 of file analyzer.c.

37 {
38
39 {"Trigger", /* event name */
40 1, /* event ID */
41 TRIGGER_ALL, /* trigger mask */
42 GET_SOME, /* get some events */
43 "SYSTEM", /* event buffer */
44 TRUE, /* enabled */
45 "", "",
46 analyze_trigger_event, /* analyzer routine */
47 },
48
49 {"Scaler", /* equipment name */
50 2, /* event ID */
51 TRIGGER_ALL, /* trigger mask */
52 GET_ALL, /* get all events */
53 "SYSTEM", /* event buffer */
54 TRUE, /* enabled */
55 "", "",
56 analyze_scaler_event /* analyzer routine */
57 },
58
59 {""}
60};
INT analyze_scaler_event(char *)
Definition analyzer.c:154
INT analyze_trigger_event(char *)
Definition analyzer.c:144
#define GET_ALL
Definition midas.h:321

◆ analyzer_loop_period

INT analyzer_loop_period
extern

Definition at line 28 of file analyzer.c.

◆ analyzer_name

const char* analyzer_name
extern

Definition at line 25 of file analyzer.c.

◆ bstr

const char* bstr = " "

Definition at line 188 of file mana.cxx.

◆ [struct]

struct { ... } clp

◆ [struct]

struct { ... } clp_descrip[]

◆ config_file_name

char config_file_name[10][256]

Definition at line 249 of file mana.cxx.

◆ current_run_number

DWORD current_run_number

Definition at line 210 of file mana.cxx.

◆ daemon

BOOL daemon

Definition at line 258 of file mana.cxx.

◆ data

void* data

Definition at line 268 of file mana.cxx.

◆ debug

BOOL debug

debug printouts

Definition at line 254 of file mana.cxx.

◆ description

char description[1000]

Definition at line 267 of file mana.cxx.

◆ event_id

short int event_id

Definition at line 3069 of file mana.cxx.

◆ exp_name

char exp_name[NAME_LENGTH]

Definition at line 243 of file mana.cxx.

◆ filter

BOOL filter

Definition at line 248 of file mana.cxx.

◆ flag_char

char flag_char

Definition at line 266 of file mana.cxx.

◆ hbook_types

char hbook_types[][8]
Initial value:
= {
"",
":U:8",
":I:8",
":I:8",
":U:16",
":I:16",
":U*4",
":I*4",
":I*4",
":R*4",
":R*8",
":U*4",
":C:32",
"",
"",
"",
"",
"",
}

Definition at line 700 of file mana.cxx.

700 {
701 "",
702 ":U:8", /* TID_BYTE */
703 ":I:8", /* TID_SBYTE */
704 ":I:8", /* TID_CHAR */
705 ":U:16", /* TID_WORD */
706 ":I:16", /* TID_SHORT */
707 ":U*4", /* TID_DWORD */
708 ":I*4", /* TID_INT */
709 ":I*4", /* TID_BOOL */
710 ":R*4", /* TID_FLOAT */
711 ":R*8", /* TID_DOUBLE */
712 ":U*4", /* TID_BITFIELD */
713 ":C:32", /* TID_STRING */
714 "", /* TID_ARRAY */
715 "", /* TID_STRUCT */
716 "", /* TID_KEY */
717 "", /* TID_LINK */
718 "", /* TID_LAST */
719
720};

◆ hDB

HNDLE hDB

main ODB handle

Definition at line 207 of file mana.cxx.

◆ host_name

char host_name[HOST_NAME_LENGTH]

Definition at line 242 of file mana.cxx.

◆ index

INT index

Definition at line 271 of file mana.cxx.

◆ input_file_name

char input_file_name[10][256]

Definition at line 244 of file mana.cxx.

◆ last_time

DWORD last_time

Definition at line 3070 of file mana.cxx.

◆ [struct]

struct { ... } last_time_event[50]

◆ lock_list

INT lock_list[10000]

Definition at line 219 of file mana.cxx.

◆ lrec

INT lrec

Definition at line 253 of file mana.cxx.

◆ n

INT n

Definition at line 247 of file mana.cxx.

◆ n_task

INT n_task

Definition at line 259 of file mana.cxx.

◆ n_test

int n_test = 0

Definition at line 544 of file mana.cxx.

◆ no_load

BOOL no_load

Definition at line 257 of file mana.cxx.

◆ ntuple_flag

BOOL ntuple_flag

Definition at line 216 of file mana.cxx.

◆ odb_size

INT odb_size
extern

Definition at line 46 of file analyzer.cxx.

◆ online

INT online

Definition at line 241 of file mana.cxx.

◆ out_append

BOOL out_append

Definition at line 336 of file mana.cxx.

◆ out_file

FILE* out_file

Definition at line 333 of file mana.cxx.

◆ out_format

INT out_format

Definition at line 335 of file mana.cxx.

◆ out_gzip

BOOL out_gzip

Definition at line 334 of file mana.cxx.

◆ out_info

ANA_OUTPUT_INFO out_info

Definition at line 49 of file mana.cxx.

◆ output_file_name

char output_file_name[256]

Definition at line 245 of file mana.cxx.

◆ param

char param[10][256]

Definition at line 250 of file mana.cxx.

◆ pawc_size

INT pawc_size
extern

◆ protect

char protect[10][256]

Definition at line 251 of file mana.cxx.

◆ pvm_buf_size

INT pvm_buf_size

Definition at line 260 of file mana.cxx.

◆ pvm_master

BOOL pvm_master = FALSE

Definition at line 186 of file mana.cxx.

◆ pvm_slave

BOOL pvm_slave = FALSE

Definition at line 186 of file mana.cxx.

◆ QUEST

int QUEST[100]
extern

◆ quiet

BOOL quiet

Definition at line 256 of file mana.cxx.

◆ root_port

INT root_port

Definition at line 261 of file mana.cxx.

◆ run_number

INT run_number[2]

Definition at line 246 of file mana.cxx.

◆ rwnt

BOOL rwnt

Definition at line 252 of file mana.cxx.

◆ start_rint

BOOL start_rint

Definition at line 262 of file mana.cxx.

◆ sys_max_event_size

int sys_max_event_size = DEFAULT_MAX_EVENT_SIZE
static

Definition at line 237 of file mana.cxx.

◆ tl

ANA_TEST** tl

Definition at line 543 of file mana.cxx.

◆ type

INT type

Definition at line 269 of file mana.cxx.

◆ verbose

BOOL verbose

Definition at line 255 of file mana.cxx.