mana.c File Reference

Go to the source code of this file.

Data Structures

struct  EVENT_DEF
struct  MA_FILE

Defines

#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
char * bstr = " "
char * analyzer_name
INT analyzer_loop_period
INT odb_size
HNDLE hDB
DWORD current_run_number
ANALYZE_REQUEST analyze_request []
BOOL ntuple_flag
INT lock_list [10000]
int QUEST [100]
INT pawc_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 []
FILE * out_file
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


Define Documentation

#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 342 of file mana.c.

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

Definition at line 352 of file mana.c.

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

Definition at line 233 of file mana.c.

Referenced by analyze_run().

#define HBOOK_LREC   8190

Definition at line 229 of file mana.c.

Referenced by bor(), and main().

#define MA_DEVICE_DISK   1

Definition at line 3805 of file mana.c.

Referenced by ma_open(), and ma_read_event().

#define MA_DEVICE_FTP   3

Definition at line 3807 of file mana.c.

#define MA_DEVICE_PVM   4

Definition at line 3808 of file mana.c.

Referenced by ma_open(), and ma_read_event().

#define MA_DEVICE_TAPE   2

Definition at line 3806 of file mana.c.

#define MA_FORMAT_GZIP   (1<<3)

Definition at line 3812 of file mana.c.

#define MA_FORMAT_MIDAS   (1<<0)

Definition at line 3810 of file mana.c.

Referenced by ma_open(), and ma_read_event().

#define MA_FORMAT_YBOS   (1<<2)

Definition at line 3811 of file mana.c.

Referenced by ma_close(), ma_open(), and ma_read_event().

#define PVM_BUFFER_SIZE   (1024*1024)

Definition at line 150 of file mana.c.

Referenced by ma_open(), and main().

#define STR_INC ( p,
base   ) 

Value:

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

Definition at line 2101 of file mana.c.


Function Documentation

void add_data_dir ( char *  result,
char *  file 
)

Definition at line 423 of file mana.c.

00424 {
00425    HNDLE hDB, hkey;
00426    char str[256];
00427    int size;
00428 
00429    cm_get_experiment_database(&hDB, NULL);
00430    db_find_key(hDB, 0, "/Logger/Data dir", &hkey);
00431 
00432    if (hkey) {
00433       size = sizeof(str);
00434       db_get_data(hDB, hkey, str, &size, TID_STRING);
00435       if (str[strlen(str) - 1] != DIR_SEPARATOR)
00436          strcat(str, DIR_SEPARATOR_STR);
00437       strcat(str, file);
00438       strcpy(result, str);
00439    } else
00440       strcpy(result, file);
00441 }

INT ana_begin_of_run ( INT  run_number,
char *  error 
)

Definition at line 199 of file analyzer.c.

00200 {
00201    return CM_SUCCESS;
00202 }

INT ana_end_of_run ( INT  run_number,
char *  error 
)

Definition at line 206 of file analyzer.c.

00207 {
00208    FILE *f;
00209    time_t now;
00210    char str[256];
00211    int size;
00212    double n;
00213    HNDLE hDB;
00214    BOOL flag;
00215 
00216    cm_get_experiment_database(&hDB, NULL);
00217 
00218    /* update run log if run was written and running online */
00219 
00220    size = sizeof(flag);
00221    db_get_value(hDB, 0, "/Logger/Write data", &flag, &size, TID_BOOL, TRUE);
00222    if (flag && runinfo.online_mode == 1) {
00223       /* update run log */
00224       size = sizeof(str);
00225       str[0] = 0;
00226       db_get_value(hDB, 0, "/Logger/Data Dir", str, &size, TID_STRING, TRUE);
00227       if (str[0] != 0)
00228          if (str[strlen(str) - 1] != DIR_SEPARATOR)
00229             strcat(str, DIR_SEPARATOR_STR);
00230       strcat(str, "runlog.txt");
00231 
00232       f = fopen(str, "a");
00233 
00234       time(&now);
00235       strcpy(str, ctime(&now));
00236       str[10] = 0;
00237 
00238       fprintf(f, "%s\t%3d\t", str, runinfo.run_number);
00239 
00240       strcpy(str, runinfo.start_time);
00241       str[19] = 0;
00242       fprintf(f, "%s\t", str + 11);
00243 
00244       strcpy(str, ctime(&now));
00245       str[19] = 0;
00246       fprintf(f, "%s\t", str + 11);
00247 
00248       size = sizeof(n);
00249       db_get_value(hDB, 0, "/Equipment/Trigger/Statistics/Events sent", &n, &size,
00250                    TID_DOUBLE, TRUE);
00251 
00252       fprintf(f, "%5.1lfk\t", n / 1000);
00253       fprintf(f, "%s\n", exp_param.comment);
00254 
00255       fclose(f);
00256    }
00257 
00258    return CM_SUCCESS;
00259 }

INT ana_pause_run ( INT  run_number,
char *  error 
)

Definition at line 263 of file analyzer.c.

00264 {
00265    return CM_SUCCESS;
00266 }

INT ana_resume_run ( INT  run_number,
char *  error 
)

Definition at line 270 of file analyzer.c.

00271 {
00272    return CM_SUCCESS;
00273 }

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

Definition at line 4049 of file mana.c.

Referenced by loop_runs_offline().

04050 {
04051    EVENT_HEADER *pevent, *pevent_unaligned;
04052    ANALYZE_REQUEST *par;
04053    INT i, n, size;
04054    DWORD num_events_in, num_events_out;
04055    char error[256], str[256];
04056    INT status = SUCCESS;
04057    MA_FILE *file;
04058    BOOL skip;
04059    DWORD start_time;
04060 
04061    /* set output file name and flags in ODB */
04062    sprintf(str, "/%s/Output/Filename", analyzer_name);
04063    db_set_value(hDB, 0, str, output_file_name, 256, 1, TID_STRING);
04064 #ifdef HAVE_HBOOK
04065    sprintf(str, "/%s/Output/RWNT", analyzer_name);
04066    db_set_value(hDB, 0, str, &clp.rwnt, sizeof(BOOL), 1, TID_BOOL);
04067 #endif
04068 
04069    assert(run_number > 0);
04070 
04071    /* set run number in ODB */
04072    status =
04073        db_set_value(hDB, 0, "/Runinfo/Run number", &run_number, sizeof(run_number), 1,
04074                     TID_INT);
04075    assert(status == SUCCESS);
04076 
04077    /* set file name in out_info */
04078    strcpy(out_info.filename, output_file_name);
04079 
04080    /* let changes propagate to modules */
04081    cm_yield(0);
04082 
04083    /* open input file, will be changed to ma_open_file later... */
04084    file = ma_open(input_file_name);
04085    if (file == NULL) {
04086       printf("Cannot open input file \"%s\"\n", input_file_name);
04087       return -1;
04088    }
04089 
04090    pevent_unaligned = (EVENT_HEADER *) malloc(EXT_EVENT_SIZE);
04091    if (pevent_unaligned == NULL) {
04092       printf("Not enough memeory\n");
04093       return -1;
04094    }
04095    pevent = (EVENT_HEADER *) ALIGN8((POINTER_T) pevent_unaligned);
04096 
04097    /* call analyzer bor routines */
04098    bor(run_number, error);
04099 
04100    num_events_in = num_events_out = 0;
04101 
04102    start_time = ss_millitime();
04103 
04104    /* event loop */
04105    do {
04106       /* read next event */
04107       n = ma_read_event(file, pevent, EXT_EVENT_SIZE);
04108       if (n <= 0)
04109          break;
04110 
04111       num_events_in++;
04112 
04113       /* copy system events (BOR, EOR, MESSAGE) to output file */
04114       if (pevent->event_id < 0) {
04115          status = process_event(NULL, pevent);
04116          if (status < 0 || status == RPC_SHUTDOWN)      /* disk full/stop analyzer */
04117             break;
04118 
04119          if (out_file && out_format == FORMAT_MIDAS) {
04120             size = pevent->data_size + sizeof(EVENT_HEADER);
04121 #ifdef HAVE_ZLIB
04122             if (out_gzip)
04123                status = gzwrite(out_file, pevent, size) == size ? SUCCESS : SS_FILE_ERROR;
04124             else
04125 #endif
04126                status =
04127                    fwrite(pevent, 1, size,
04128                           out_file) == (size_t) size ? SUCCESS : SS_FILE_ERROR;
04129 
04130             if (status != SUCCESS) {
04131                cm_msg(MERROR, "analyze_run", "Error writing to file (Disk full?)");
04132                return -1;
04133             }
04134 
04135             num_events_out++;
04136          }
04137 
04138          /* reinit start time after BOR event */
04139          if (pevent->event_id == EVENTID_BOR)
04140             start_time = ss_millitime();
04141       }
04142 
04143       /* check if event is in event limit */
04144       skip = FALSE;
04145 
04146       if (!pvm_slave) {
04147          if (clp.n[0] > 0 || clp.n[1] > 0) {
04148             if (clp.n[1] == 0) {
04149                /* treat n[0] as upper limit */
04150                if (num_events_in > clp.n[0]) {
04151                   num_events_in--;
04152                   status = SUCCESS;
04153                   break;
04154                }
04155             } else {
04156                if (num_events_in > clp.n[1]) {
04157                   status = SUCCESS;
04158                   break;
04159                }
04160                if (num_events_in < clp.n[0])
04161                   skip = TRUE;
04162                else if (clp.n[2] > 0 && num_events_in % clp.n[2] != 0)
04163                   skip = TRUE;
04164             }
04165          }
04166       }
04167 
04168       if (!skip) {
04169          /* find request belonging to this event */
04170          par = analyze_request;
04171          status = SUCCESS;
04172          for (i = 0; par->event_name[0]; par++)
04173             if ((par->ar_info.event_id == EVENTID_ALL ||
04174                  par->ar_info.event_id == pevent->event_id) &&
04175                 (par->ar_info.trigger_mask == TRIGGER_ALL ||
04176                  (par->ar_info.trigger_mask & pevent->trigger_mask))
04177                 && par->ar_info.enabled) {
04178                /* analyze this event */
04179                status = process_event(par, pevent);
04180                if (status == SUCCESS)
04181                   num_events_out++;
04182                if (status < 0 || status == RPC_SHUTDOWN)        /* disk full/stop analyzer */
04183                   break;
04184 
04185                /* check for Ctrl-C */
04186                status = cm_yield(0);
04187             }
04188          if (status < 0 || status == RPC_SHUTDOWN)
04189             break;
04190       }
04191 
04192       /* update ODB statistics once every 100 events */
04193       if (num_events_in % 100 == 0) {
04194          update_stats();
04195          if (!clp.quiet) {
04196             if (out_file)
04197                printf("%s:%d  %s:%d  events\r", input_file_name, (int) num_events_in,
04198                       out_info.filename, (int) num_events_out);
04199             else
04200                printf("%s:%d  events\r", input_file_name, (int) num_events_in);
04201 
04202 #ifndef OS_WINNT
04203             fflush(stdout);
04204 #endif
04205          }
04206       }
04207    } while (1);
04208 
04209 #ifdef HAVE_PVM
04210    PVM_DEBUG("analyze_run: event loop finished, status = %d", status);
04211 #endif
04212 
04213    /* signal EOR to slaves */
04214 #ifdef HAVE_PVM
04215    if (pvm_master) {
04216       if (status == RPC_SHUTDOWN)
04217          printf("\nShutting down distributed analyzers, please wait...\n");
04218       pvm_eor(status == RPC_SHUTDOWN ? TAG_EXIT : TAG_EOR);
04219 
04220       /* merge slave output files */
04221       if (out_info.filename[0] && !out_append)
04222          status = pvm_merge();
04223 
04224       start_time = ss_millitime() - start_time;
04225 
04226       update_stats();
04227       if (!clp.quiet) {
04228          if (out_file)
04229             printf("%s:%d  %s:%d  events, %1.2lfs\n", input_file_name, num_events_in,
04230                    out_info.filename, num_events_out, start_time / 1000.0);
04231          else
04232             printf("%s:%d  events, %1.2lfs\n", input_file_name, num_events_in,
04233                    start_time / 1000.0);
04234       }
04235    } else if (pvm_slave) {
04236       start_time = ss_millitime() - start_time;
04237 
04238       update_stats();
04239       if (!clp.quiet) {
04240          if (out_file)
04241             printf("%s:%d  %s:%d  events, %1.2lfs\n", input_file_name, num_events_in,
04242                    out_info.filename, num_events_out, start_time / 1000.0);
04243          else
04244             printf("%s:%d  events, %1.2lfs\n", input_file_name, num_events_in,
04245                    start_time / 1000.0);
04246       }
04247 
04248       eor(current_run_number, error);
04249 
04250       /* send back tests */
04251       pvm_initsend(PvmDataInPlace);
04252 
04253       for (i = 0; i < n_test; i++)
04254          pvm_pkbyte((char *) tl[i], sizeof(ANA_TEST), 1);
04255 
04256       PVM_DEBUG("analyze_run: send %d tests back to master", n_test);
04257 
04258       status = pvm_send(pvm_myparent, TAG_EOR);
04259       if (status < 0) {
04260          pvm_perror("pvm_send");
04261          return RPC_SHUTDOWN;
04262       }
04263    } else {
04264       start_time = ss_millitime() - start_time;
04265 
04266       update_stats();
04267       if (!clp.quiet) {
04268          if (out_file)
04269             printf("%s:%d  %s:%d  events, %1.2lfs\n", input_file_name, num_events_in,
04270                    out_info.filename, num_events_out, start_time / 1000.0);
04271          else
04272             printf("%s:%d  events, %1.2lfs\n", input_file_name, num_events_in,
04273                    start_time / 1000.0);
04274       }
04275 
04276       /* call analyzer eor routines */
04277       eor(current_run_number, error);
04278    }
04279 #else
04280 
04281    start_time = ss_millitime() - start_time;
04282 
04283    update_stats();
04284    if (!clp.quiet) {
04285       if (out_file)
04286          printf("%s:%d  %s:%d  events, %1.2lfs\n", input_file_name, (int) num_events_in,
04287                 out_info.filename, (int) num_events_out, start_time / 1000.0);
04288       else
04289          printf("%s:%d  events, %1.2lfs\n", input_file_name, (int) num_events_in,
04290                 start_time / 1000.0);
04291    }
04292 
04293    /* call analyzer eor routines */
04294    eor(current_run_number, error);
04295 
04296 #endif
04297 
04298    ma_close(file);
04299 
04300    free(pevent_unaligned);
04301 
04302    return status;
04303 }

INT analyzer_exit ( void   ) 

Definition at line 192 of file analyzer.c.

00193 {
00194    return CM_SUCCESS;
00195 }

INT analyzer_init ( void   ) 

Definition at line 137 of file analyzer.c.

00138 {
00139    HNDLE hDB, hKey;
00140    char str[80];
00141 
00142    RUNINFO_STR(runinfo_str);
00143    EXP_PARAM_STR(exp_param_str);
00144    GLOBAL_PARAM_STR(global_param_str);
00145    TRIGGER_SETTINGS_STR(trigger_settings_str);
00146 
00147    /* open ODB structures */
00148    cm_get_experiment_database(&hDB, NULL);
00149    db_create_record(hDB, 0, "/Runinfo", strcomb((const char **)runinfo_str));
00150    db_find_key(hDB, 0, "/Runinfo", &hKey);
00151    if (db_open_record(hDB, hKey, &runinfo, sizeof(runinfo), MODE_READ, NULL, NULL) !=
00152        DB_SUCCESS) {
00153       cm_msg(MERROR, "analyzer_init", "Cannot open \"/Runinfo\" tree in ODB");
00154       return 0;
00155    }
00156 
00157    db_create_record(hDB, 0, "/Experiment/Run Parameters", strcomb((const char **)exp_param_str));
00158    db_find_key(hDB, 0, "/Experiment/Run Parameters", &hKey);
00159    if (db_open_record(hDB, hKey, &exp_param, sizeof(exp_param), MODE_READ, NULL, NULL) !=
00160        DB_SUCCESS) {
00161       cm_msg(MERROR, "analyzer_init",
00162              "Cannot open \"/Experiment/Run Parameters\" tree in ODB");
00163       return 0;
00164    }
00165 
00166    sprintf(str, "/%s/Parameters/Global", analyzer_name);
00167    db_create_record(hDB, 0, str, strcomb((const char **)global_param_str));
00168    db_find_key(hDB, 0, str, &hKey);
00169    if (db_open_record
00170        (hDB, hKey, &global_param, sizeof(global_param), MODE_READ, NULL,
00171         NULL) != DB_SUCCESS) {
00172       cm_msg(MERROR, "analyzer_init", "Cannot open \"%s\" tree in ODB", str);
00173       return 0;
00174    }
00175 
00176    db_create_record(hDB, 0, "/Equipment/Trigger/Settings", strcomb((const char **)trigger_settings_str));
00177    db_find_key(hDB, 0, "/Equipment/Trigger/Settings", &hKey);
00178 
00179    if (db_open_record
00180        (hDB, hKey, &trigger_settings, sizeof(trigger_settings), MODE_READ, NULL,
00181         NULL) != DB_SUCCESS) {
00182       cm_msg(MERROR, "analyzer_init",
00183              "Cannot open \"/Equipment/Trigger/Settings\" tree in ODB");
00184       return 0;
00185    }
00186 
00187    return SUCCESS;
00188 }

INT analyzer_loop ( void   ) 

Definition at line 277 of file analyzer.c.

00278 {
00279    return CM_SUCCESS;
00280 }

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

Definition at line 721 of file mana.c.

00722 {
00723    char str[80];
00724    HNDLE hkey;
00725 
00726    /* close previously opened hot link */
00727    sprintf(str, "/%s/Bank switches", analyzer_name);
00728    db_find_key(hDB, 0, str, &hkey);
00729    db_close_record(hDB, hkey);
00730 
00731 #ifdef HAVE_HBOOK
00732    book_ntuples();
00733    printf("N-tuples rebooked\n");
00734 #endif
00735 #ifdef USE_ROOT
00736    book_ttree();
00737    printf("ROOT TTree rebooked\n");
00738 #endif
00739 }

INT book_ntuples ( void   ) 

INT book_ttree ( void   ) 

Referenced by banks_changed(), and bor().

INT bor ( INT  run_number,
char *  error 
)

Definition at line 1671 of file mana.c.

Referenced by analyze_run(), tr_start(), and tr_start_fal().

01672 {
01673    ANA_MODULE **module;
01674    INT i, j, size;
01675    char str[256], file_name[256], *ext_str;
01676    BANK_LIST *bank_list;
01677 
01678    /* load parameters */
01679    load_parameters(run_number);
01680 
01681    for (i = 0; analyze_request[i].event_name[0]; i++) {
01682       /* copy output flag from ODB to bank_list */
01683       bank_list = analyze_request[i].bank_list;
01684 
01685       if (bank_list != NULL)
01686          for (; bank_list->name[0]; bank_list++) {
01687             sprintf(str, "/%s/Bank switches/%s", analyzer_name, bank_list->name);
01688             bank_list->output_flag = FALSE;
01689             size = sizeof(DWORD);
01690             db_get_value(hDB, 0, str, &bank_list->output_flag, &size, TID_DWORD, TRUE);
01691          }
01692 
01693       /* copy module enabled flag to ana_module */
01694       module = analyze_request[i].ana_module;
01695       for (j = 0; module != NULL && module[j] != NULL; j++) {
01696          sprintf(str, "/%s/Module switches/%s", analyzer_name, module[j]->name);
01697          module[j]->enabled = TRUE;
01698          size = sizeof(BOOL);
01699          db_get_value(hDB, 0, str, &module[j]->enabled, &size, TID_BOOL, TRUE);
01700       }
01701    }
01702 
01703    /* clear histos, N-tuples and tests */
01704    if (clp.online && out_info.clear_histos) {
01705 #ifdef HAVE_HBOOK
01706       int hid[10000];
01707       int n;
01708 
01709       for (i = 0; analyze_request[i].event_name[0]; i++)
01710          if (analyze_request[i].bank_list != NULL)
01711             if (HEXIST(analyze_request[i].ar_info.event_id))
01712                HRESET(analyze_request[i].ar_info.event_id, bstr);
01713 
01714       /* get list of all histos */
01715       HIDALL(hid, n);
01716       for (i = 0; i < n; i++) {
01717          for (j = 0; j < 10000; j++)
01718             if (lock_list[j] == 0 || lock_list[j] == hid[i])
01719                break;
01720 
01721          /* clear histo if not locked */
01722          if (lock_list[j] != hid[i])
01723             HRESET(hid[i], bstr);
01724       }
01725 #endif                          /* HAVE_HBOOK */
01726 
01727 #ifdef USE_ROOT
01728       /* clear histos */
01729       if (clp.online && out_info.clear_histos)
01730          ClearRootHistograms(gManaHistosFolder);
01731 #endif                          /* USE_ROOT */
01732 
01733       /* clear tests */
01734       test_clear();
01735    }
01736 #ifdef USE_ROOT
01737    if (clp.online) {
01738       /* clear all trees when online */
01739       for (i = 0; i < tree_struct.n_tree; i++)
01740          tree_struct.event_tree[i].tree->Reset();
01741    }
01742 #endif
01743 
01744    /* open output file if not already open (append mode) and in offline mode */
01745    if (!clp.online && out_file == NULL && !pvm_master
01746        && !equal_ustring(clp.output_file_name, "OFLN")) {
01747       if (out_info.filename[0]) {
01748          strcpy(str, out_info.filename);
01749          if (strchr(str, '%') != NULL)
01750             sprintf(file_name, str, run_number);
01751          else
01752             strcpy(file_name, str);
01753 
01754          /* check output file extension */
01755 #ifdef HAVE_ZLIB
01756          out_gzip = FALSE;
01757 #endif
01758          if (strchr(file_name, '.')) {
01759             ext_str = file_name + strlen(file_name) - 1;
01760             while (*ext_str != '.')
01761                ext_str--;
01762 
01763             if (strncmp(ext_str, ".gz", 3) == 0) {
01764 #ifdef HAVE_ZLIB
01765                out_gzip = TRUE;
01766                ext_str--;
01767                while (*ext_str != '.' && ext_str > file_name)
01768                   ext_str--;
01769 #else
01770                strcpy(error,
01771                       ".gz extension not possible because zlib support is not compiled in.\n");
01772                cm_msg(MERROR, "bor", error);
01773                return 0;
01774 #endif
01775             }
01776 
01777             if (strncmp(ext_str, ".asc", 4) == 0)
01778                out_format = FORMAT_ASCII;
01779             else if (strncmp(ext_str, ".mid", 4) == 0)
01780                out_format = FORMAT_MIDAS;
01781             else if (strncmp(ext_str, ".rz", 3) == 0)
01782                out_format = FORMAT_HBOOK;
01783             else if (strncmp(ext_str, ".root", 5) == 0)
01784                out_format = FORMAT_ROOT;
01785             else {
01786                strcpy(error,
01787                       "Unknown output data format. Please use file extension .asc, .mid, .rz or .root.\n");
01788                cm_msg(MERROR, "bor", error);
01789                return 0;
01790             }
01791          } else
01792             out_format = FORMAT_ASCII;
01793 
01794 #ifdef HAVE_PVM
01795          /* use node name as filename if PVM slave */
01796          if (pvm_slave) {
01797             /* extract extension */
01798             if (strchr(file_name, '.')) {
01799                strcpy(str, strchr(file_name, '.') + 1);
01800                sprintf(file_name, "n%d", pvm_client_index);
01801                strcat(file_name, ".");
01802                strcat(file_name, str);
01803             } else {
01804                sprintf(file_name, "n%d", pvm_client_index);
01805             }
01806 
01807             PVM_DEBUG("BOR: file_name = %s", file_name);
01808          }
01809 #endif
01810 
01811          /* open output file */
01812          if (out_format == FORMAT_HBOOK) {
01813 #ifdef HAVE_HBOOK
01814             int status, lrec;
01815             char str2[80];
01816 
01817             lrec = clp.lrec;
01818 #ifdef extname
01819             quest_[9] = 65000;
01820 #else
01821             QUEST[9] = 65000;
01822 #endif
01823 
01824             strcpy(str, "BSIZE");
01825             HBSET(str, HBOOK_LREC, status);
01826             strcpy(str, "OFFLINE");
01827             strcpy(str2, "NQP");
01828             HROPEN(1, str, file_name, str2, lrec, status);
01829             if (status != 0) {
01830                sprintf(error, "Cannot open output file %s", out_info.filename);
01831                cm_msg(MERROR, "bor", error);
01832                out_file = NULL;
01833                return 0;
01834             } else
01835                out_file = (FILE *) 1;
01836 #else
01837             cm_msg(MERROR, "bor", "HBOOK support is not compiled in");
01838 #endif                          /* HAVE_HBOOK */
01839          }
01840 
01841          else if (out_format == FORMAT_ROOT) {
01842 #ifdef USE_ROOT
01843             // ensure the output file is closed
01844             assert(gManaOutputFile == NULL);
01845 
01846             gManaOutputFile =
01847                 new TFile(file_name, "RECREATE", "Midas Analyzer output file");
01848             if (gManaOutputFile == NULL) {
01849                sprintf(error, "Cannot open output file %s", out_info.filename);
01850                cm_msg(MERROR, "bor", error);
01851                out_file = NULL;
01852                return 0;
01853             }
01854             // make all ROOT objects created by user module bor() functions
01855             // go into the output file
01856             gManaOutputFile->cd();
01857 
01858             out_file = (FILE *) 1;
01859 #else
01860             cm_msg(MERROR, "bor", "ROOT support is not compiled in");
01861 #endif                          /* USE_ROOT */
01862          }
01863 
01864          else {
01865 #ifdef HAVE_ZLIB
01866             if (out_gzip)
01867                out_file = (FILE *) gzopen(file_name, "wb");
01868             else
01869 #endif
01870             if (out_format == FORMAT_ASCII)
01871                out_file = fopen(file_name, "wt");
01872             else
01873                out_file = fopen(file_name, "wb");
01874             if (out_file == NULL) {
01875                sprintf(error, "Cannot open output file %s", file_name);
01876                cm_msg(MERROR, "bor", error);
01877                return 0;
01878             }
01879          }
01880       } else
01881          out_file = NULL;
01882 
01883 #ifdef HAVE_HBOOK
01884       /* book N-tuples */
01885       if (out_format == FORMAT_HBOOK) {
01886          int status = book_ntuples();
01887          if (status != SUCCESS)
01888             return status;
01889       }
01890 #endif                          /* HAVE_HBOOK */
01891 
01892 #ifdef USE_ROOT
01893       /* book ROOT TTree */
01894       if (out_format == FORMAT_ROOT) {
01895          int status = book_ttree();
01896          if (status != SUCCESS)
01897             return status;
01898       }
01899 #endif                          /* USE_ROOT */
01900 
01901    }
01902 
01903    /* if (out_file == NULL) */
01904    /* save run number */
01905    current_run_number = run_number;
01906 
01907    /* call bor for modules */
01908    for (i = 0; analyze_request[i].event_name[0]; i++) {
01909       module = analyze_request[i].ana_module;
01910       for (j = 0; module != NULL && module[j] != NULL; j++)
01911          if (module[j]->bor != NULL && module[j]->enabled) {
01912             module[j]->bor(run_number);
01913          }
01914    }
01915 
01916    /* call main analyzer BOR routine */
01917    return ana_begin_of_run(run_number, error);
01918 }

void correct_num_events ( INT  i  ) 

Definition at line 3048 of file mana.c.

03049 {
03050    if (_current_par)
03051       _current_par->events_received += i - 1;
03052 }

EVENT_DEF* db_get_event_definition ( short int  event_id  ) 

Definition at line 453 of file mana.c.

00454 {
00455    INT i, index, status, size, type;
00456    char str[80];
00457    HNDLE hKey, hKeyRoot;
00458    WORD id;
00459    static EVENT_DEF *event_def = NULL;
00460    static int n_cache = 0;
00461 
00462    /* search free cache entry */
00463    for (index = 0; index < n_cache; index++)
00464       if (event_def[index].event_id == event_id)
00465          return &event_def[index];
00466 
00467    /* If we get here, we have an undefined ID;
00468       allocate memory for it, zero it, then cache the ODB data */
00469    n_cache = index + 1;
00470 
00471    event_def = (EVENT_DEF *) realloc(event_def, (n_cache) * sizeof(EVENT_DEF));
00472    assert(event_def);
00473 
00474    memset(&event_def[index], 0, sizeof(EVENT_DEF));
00475 
00476    /* check for system events */
00477    if (event_id < 0) {
00478       event_def[index].event_id = event_id;
00479       event_def[index].format = FORMAT_ASCII;
00480       event_def[index].hDefKey = 0;
00481       event_def[index].disabled = FALSE;
00482       return &event_def[index];
00483    }
00484 
00485    status = db_find_key(hDB, 0, "/equipment", &hKeyRoot);
00486    if (status != DB_SUCCESS) {
00487       cm_msg(MERROR, "db_get_event_definition", "cannot find /equipment entry in ODB");
00488       return NULL;
00489    }
00490 
00491    for (i = 0;; i++) {
00492       /* search for equipment with specific name */
00493       status = db_enum_key(hDB, hKeyRoot, i, &hKey);
00494       if (status == DB_NO_MORE_SUBKEYS) {
00495          sprintf(str, "Cannot find event id %d under /equipment", event_id);
00496          cm_msg(MERROR, "db_get_event_definition", str);
00497          return NULL;
00498       }
00499 
00500       size = sizeof(id);
00501       status = db_get_value(hDB, hKey, "Common/Event ID", &id, &size, TID_WORD, TRUE);
00502       if (status != DB_SUCCESS)
00503          continue;
00504 
00505       size = sizeof(type);
00506       status = db_get_value(hDB, hKey, "Common/Type", &type, &size, TID_INT, TRUE);
00507       if (status != DB_SUCCESS)
00508          continue;
00509 
00510       if (id == event_id) {
00511          /* set cache entry */
00512          event_def[index].event_id = id;
00513          event_def[index].type = type;
00514 
00515          size = sizeof(str);
00516          str[0] = 0;
00517          db_get_value(hDB, hKey, "Common/Format", str, &size, TID_STRING, TRUE);
00518 
00519          if (equal_ustring(str, "Fixed"))
00520             event_def[index].format = FORMAT_FIXED;
00521          else if (equal_ustring(str, "ASCII"))
00522             event_def[index].format = FORMAT_ASCII;
00523          else if (equal_ustring(str, "MIDAS"))
00524             event_def[index].format = FORMAT_MIDAS;
00525          else if (equal_ustring(str, "YBOS"))
00526             event_def[index].format = FORMAT_YBOS;
00527          else if (equal_ustring(str, "DUMP"))
00528             event_def[index].format = FORMAT_DUMP;
00529          else {
00530             cm_msg(MERROR, "db_get_event_definition", "unknown data format");
00531             event_def[index].event_id = 0;
00532             return NULL;
00533          }
00534 
00535          db_find_key(hDB, hKey, "Variables", &event_def[index].hDefKey);
00536          return &event_def[index];
00537       }
00538    }
00539 }

INT eor ( INT  run_number,
char *  error 
)

Definition at line 1922 of file mana.c.

Referenced by tr_stop(), and tr_stop_fal().

01923 {
01924    ANA_MODULE **module;
01925    BANK_LIST *bank_list;
01926    INT i, j, status;
01927    char str[256], file_name[256];
01928 
01929    /* call EOR routines modules */
01930    for (i = 0; analyze_request[i].event_name[0]; i++) {
01931       module = analyze_request[i].ana_module;
01932       for (j = 0; module != NULL && module[j] != NULL; j++)
01933          if (module[j]->eor != NULL && module[j]->enabled) {
01934             module[j]->eor(run_number);
01935          }
01936    }
01937 
01938    /* call main analyzer BOR routine */
01939    status = ana_end_of_run(run_number, error);
01940 
01941    /* save histos if requested */
01942    if (out_info.histo_dump && clp.online) {
01943       strcpy(str, out_info.histo_dump_filename);
01944       if (strchr(str, '%') != NULL)
01945          sprintf(file_name, str, run_number);
01946       else
01947          strcpy(file_name, str);
01948 
01949       add_data_dir(str, file_name);
01950 #ifdef HAVE_HBOOK
01951       for (i = 0; i < (int) strlen(str); i++)
01952          if (isupper(str[i]))
01953             break;
01954 
01955       if (i < (int) strlen(str)) {
01956          printf
01957              ("Error: Due to a limitation in HBOOK, directoy names may not contain uppercase\n");
01958          printf("       characters. Histogram saving to %s will not work.\n", str);
01959       } else {
01960          char str2[256];
01961          strcpy(str2, "NT");
01962          HRPUT(0, str, str2);
01963       }
01964 #endif                          /* HAVE_HBOOK */
01965 
01966 #ifdef USE_ROOT
01967       SaveRootHistograms(gManaHistosFolder, str);
01968 #endif                          /* USE_ROOT */
01969    }
01970 
01971    /* close output file */
01972    if (out_file && !out_append) {
01973       if (out_format == FORMAT_HBOOK) {
01974 #ifdef HAVE_HBOOK
01975          HROUT(0, i, bstr);
01976          strcpy(str, "OFFLINE");
01977          HREND(str);
01978 #else
01979          cm_msg(MERROR, "eor", "HBOOK support is not compiled in");
01980 #endif                          /* HAVE_HBOOK */
01981       } else if (out_format == FORMAT_ROOT) {
01982 #ifdef USE_ROOT
01983          CloseRootOutputFile();
01984 #else
01985          cm_msg(MERROR, "eor", "ROOT support is not compiled in");
01986 #endif                          /* USE_ROOT */
01987       } else {
01988 #ifdef HAVE_ZLIB
01989          if (out_gzip)
01990             gzclose(out_file);
01991          else
01992 #endif
01993             fclose(out_file);
01994       }
01995 
01996       out_file = NULL;
01997 
01998       /* free CWNT buffer */
01999       for (i = 0; analyze_request[i].event_name[0]; i++) {
02000          bank_list = analyze_request[i].bank_list;
02001 
02002          if (bank_list == NULL) {
02003             if (analyze_request[i].addr) {
02004                free(analyze_request[i].addr);
02005                analyze_request[i].addr = NULL;
02006             }
02007          } else {
02008             for (; bank_list->name[0]; bank_list++)
02009                if (bank_list->addr) {
02010                   free(bank_list->addr);
02011                   bank_list->addr = NULL;
02012                }
02013          }
02014       }
02015    }
02016 
02017    return status;
02018 }

INT getparam ( int  argc,
char **  argv 
)

Definition at line 360 of file mana.c.

Referenced by do_jrpc_rev0(), interprete(), load_vars_param(), main(), show_cnaf_page(), show_custom_page(), show_elog_delete(), show_elog_page(), show_elog_submit_query(), show_form_query(), show_hist_config_page(), show_hist_page(), show_odb_tag(), show_programs_page(), show_query_page(), show_rawfile(), show_sc_page(), show_set_page(), show_start_page(), submit_elog(), and submit_form().

00361 {
00362    INT index, i, j, size;
00363 
00364    /* parse command line parameters */
00365    for (index = 1; index < argc;) {
00366       /* search flag in parameter description */
00367       if (argv[index][0] == '-') {
00368          for (j = 0; clp_descrip[j].flag_char; j++)
00369             if (argv[index][1] == clp_descrip[j].flag_char)
00370                break;
00371 
00372          if (!clp_descrip[j].flag_char)
00373             goto usage;
00374 
00375          if (clp_descrip[j].n > 0 && index >= argc - 1)
00376             goto usage;
00377          index++;
00378 
00379          if (clp_descrip[j].type == TID_BOOL) {
00380             *((BOOL *) clp_descrip[j].data) = TRUE;
00381             continue;
00382          }
00383 
00384          do {
00385             if (clp_descrip[j].type == TID_STRING)
00386                strcpy((char *) clp_descrip[j].data + clp_descrip[j].index * 256,
00387                       argv[index]);
00388             else
00389                db_sscanf(argv[index], clp_descrip[j].data, &size, clp_descrip[j].index,
00390                          clp_descrip[j].type);
00391 
00392             if (clp_descrip[j].n > 1)
00393                clp_descrip[j].index++;
00394 
00395             if (clp_descrip[j].index > clp_descrip[j].n) {
00396                printf("Note more than %d options possible for flag -%c\n",
00397                       clp_descrip[j].n, clp_descrip[j].flag_char);
00398                return 0;
00399             }
00400 
00401             index++;
00402 
00403          } while (index < argc && argv[index][0] != '-');
00404 
00405       } else
00406          goto usage;
00407    }
00408 
00409    return SUCCESS;
00410 
00411  usage:
00412 
00413    printf("usage: analyzer [options]\n\n");
00414    printf("valid options are:\n");
00415    for (i = 0; clp_descrip[i].flag_char; i++)
00416       printf("  -%c %s\n", clp_descrip[i].flag_char, clp_descrip[i].description);
00417 
00418    return 0;
00419 }

INT init_module_parameters ( BOOL  bclose  ) 

Definition at line 3668 of file mana.c.

03669 {
03670    INT i, j, status, size;
03671    ANA_MODULE **module;
03672    char str[80];
03673    HNDLE hkey;
03674 
03675    for (i = 0; analyze_request[i].event_name[0]; i++) {
03676       module = analyze_request[i].ana_module;
03677       for (j = 0; module != NULL && module[j] != NULL; j++) {
03678          if (module[j]->parameters != NULL) {
03679             sprintf(str, "/%s/Parameters/%s", analyzer_name, module[j]->name);
03680 
03681             if (bclose) {
03682                db_find_key(hDB, 0, str, &hkey);
03683                db_close_record(hDB, hkey);
03684             } else {
03685                status = db_find_key(hDB, 0, str, &hkey);
03686                if (status == DB_SUCCESS) {
03687                   db_get_record_size(hDB, hkey, 0, &size);
03688                   if (size != module[j]->param_size)
03689                      status = 0;
03690                }
03691                if (status != DB_SUCCESS && module[j]->init_str) {
03692                   if (db_check_record(hDB, 0, str, strcomb((const char **)module[j]->init_str), TRUE) !=
03693                       DB_SUCCESS) {
03694                      cm_msg(MERROR, "init_module_parameters",
03695                             "Cannot create/check \"%s\" parameters in ODB", str);
03696                      return 0;
03697                   }
03698                }
03699 
03700                db_find_key(hDB, 0, str, &hkey);
03701                assert(hkey);
03702 
03703                if (db_open_record(hDB, hkey, module[j]->parameters, module[j]->param_size,
03704                                   MODE_READ, NULL, NULL) != DB_SUCCESS) {
03705                   cm_msg(MERROR, "init_module_parameters",
03706                          "Cannot open \"%s\" parameters in ODB", str);
03707                   return 0;
03708                }
03709             }
03710          }
03711       }
03712    }
03713 
03714    return SUCCESS;
03715 }

void load_last_histos (  ) 

Definition at line 3522 of file mana.c.

Referenced by main().

03523 {
03524    char str[256];
03525 
03526    /* load previous online histos */
03527    if (!clp.no_load) {
03528       strcpy(str, out_info.last_histo_filename);
03529 
03530       if (strchr(str, DIR_SEPARATOR) == NULL)
03531          add_data_dir(str, out_info.last_histo_filename);
03532 
03533 #ifdef HAVE_HBOOK
03534       {
03535          FILE *f;
03536          char str2[256];
03537          int i;
03538 
03539          for (i = 0; i < (int) strlen(str); i++)
03540             if (isupper(str[i]))
03541                break;
03542 
03543          if (i < (int) strlen(str)) {
03544             printf
03545                 ("Error: Due to a limitation in HBOOK, directoy names may not contain uppercase\n");
03546             printf("       characters. Histogram loading from %s will not work.\n", str);
03547          } else {
03548             f = fopen(str, "r");
03549             if (f != NULL) {
03550                fclose(f);
03551                printf("Loading previous online histos from %s\n", str);
03552                strcpy(str2, "A");
03553                HRGET(0, str, str2);
03554 
03555                /* fix wrongly booked N-tuples at ID 100000 */
03556                if (HEXIST(100000))
03557                   HDELET(100000);
03558             }
03559          }
03560       }
03561 #endif                          /* HAVE_HBOOK */
03562 
03563 #ifdef USE_ROOT
03564       printf("Loading previous online histos from %s\n", str);
03565       LoadRootHistograms(gManaHistosFolder, str);
03566 #endif
03567    }
03568 }

INT load_parameters ( INT  run_number  ) 

Definition at line 633 of file mana.c.

Referenced by bor(), and odb_load().

00634 {
00635    INT i, size, index, status;
00636    HNDLE hkey;
00637    char file_name[256], str[80], value_string[80], param_string[80];
00638    char data[32];
00639    KEY key;
00640 
00641    /* loop over configutation file names */
00642    for (i = 0; clp.config_file_name[i][0] && i < 10; i++) {
00643       if (strchr(clp.config_file_name[i], '%') != NULL)
00644          sprintf(file_name, clp.config_file_name[i], run_number);
00645       else
00646          strcpy(file_name, clp.config_file_name[i]);
00647 
00648       /* load file under "/" */
00649       if (db_load(hDB, 0, file_name, FALSE) == DB_SUCCESS)
00650          printf("Configuration file \"%s\" loaded\n", file_name);
00651    }
00652 
00653    /* loop over parameters */
00654    for (i = 0; clp.param[i][0] && i < 10; i++) {
00655       if (strchr(clp.param[i], '=') == NULL) {
00656          printf("Error: parameter %s contains no value\n", clp.param[i]);
00657       } else {
00658          strcpy(value_string, strchr(clp.param[i], '=') + 1);
00659          strcpy(param_string, clp.param[i]);
00660          *strchr(param_string, '=') = 0;
00661 
00662          index = 0;
00663          if (strchr(param_string, '[') != NULL) {
00664             index = atoi(strchr(param_string, '[') + 1);
00665             *strchr(param_string, '[') = 0;
00666          }
00667 
00668          if (param_string[0] == '/')
00669             strcpy(str, param_string);
00670          else
00671             sprintf(str, "/%s/Parameters/%s", analyzer_name, param_string);
00672          db_find_key(hDB, 0, str, &hkey);
00673          if (hkey == 0) {
00674             printf("Error: cannot find parameter %s in ODB\n", str);
00675          } else {
00676             db_get_key(hDB, hkey, &key);
00677             db_sscanf(value_string, data, &size, 0, key.type);
00678 
00679             status = db_set_data_index(hDB, hkey, data, size, index, key.type);
00680             if (status == DB_SUCCESS)
00681                printf("Parameter %s changed to %s\n", str, value_string);
00682             else
00683                printf("Cannot change parameter %s\n", str);
00684          }
00685       }
00686    }
00687 
00688    /* let parameter changes propagate to modules */
00689    cm_yield(0);
00690 
00691    return SUCCESS;
00692 }

void lock_histo ( INT  id  ) 

Definition at line 3498 of file mana.c.

03499 {
03500    INT i;
03501 
03502    for (i = 0; i < 10000; i++)
03503       if (lock_list[i] == 0)
03504          break;
03505 
03506    lock_list[i] = id;
03507 }

INT loop_online (  ) 

Definition at line 3611 of file mana.c.

Referenced by main().

03612 {
03613    INT status = SUCCESS;
03614    DWORD last_time_loop, last_time_update, actual_time;
03615    int ch;
03616 
03617    printf("Running analyzer online. Stop with \"!\"\n");
03618 
03619    /* main loop */
03620    last_time_update = 0;
03621    last_time_loop = 0;
03622 
03623    do {
03624       /* calculate events per second */
03625       actual_time = ss_millitime();
03626 
03627       if (actual_time - last_time_update > 1000) {
03628          /* update statistics */
03629          update_stats();
03630          last_time_update = actual_time;
03631 
03632          /* check keyboard */
03633          ch = 0;
03634          while (ss_kbhit()) {
03635             ch = ss_getchar(0);
03636             if (ch == -1)
03637                ch = getchar();
03638 
03639             if ((char) ch == '!')
03640                break;
03641          }
03642 
03643          if ((char) ch == '!')
03644             break;
03645       }
03646 
03647       if (analyzer_loop_period == 0)
03648          status = cm_yield(1000);
03649       else {
03650          if (actual_time - last_time_loop > (DWORD) analyzer_loop_period) {
03651             last_time_loop = actual_time;
03652             analyzer_loop();
03653          }
03654 
03655          status = cm_yield(analyzer_loop_period);
03656       }
03657 
03658    } while (status != RPC_SHUTDOWN && status != SS_ABORT);
03659 
03660    /* update statistics */
03661    update_stats();
03662 
03663    return status;
03664 }

INT loop_runs_offline (  ) 

Definition at line 4307 of file mana.c.

Referenced by main().

04308 {
04309    INT i, status, run_number;
04310    char input_file_name[256], output_file_name[256], *prn;
04311    BANK_LIST *bank_list;
04312 
04313    if (!clp.quiet)
04314       printf("Running analyzer offline. Stop with \"!\"\n");
04315 
04316    run_number = 0;
04317    out_append = ((strchr(clp.input_file_name[0], '%') != NULL) &&
04318                  (strchr(clp.output_file_name, '%') == NULL))
04319        || clp.input_file_name[1][0];
04320 
04321    /* loop over range of files */
04322    if (clp.run_number[0] > 0) {
04323       if (strchr(clp.input_file_name[0], '%') == NULL) {
04324          printf
04325              ("Input file name must contain a wildcard like \"%%05d\" when using a range.\n");
04326          return 0;
04327       }
04328 
04329       if (clp.run_number[0] == 0) {
04330          printf("End of range not specified.\n");
04331          return 0;
04332       }
04333 
04334       for (run_number = clp.run_number[0]; run_number <= clp.run_number[1]; run_number++) {
04335          sprintf(input_file_name, clp.input_file_name[0], run_number);
04336          if (strchr(clp.output_file_name, '%') != NULL)
04337             sprintf(output_file_name, clp.output_file_name, run_number);
04338          else
04339             strcpy(output_file_name, clp.output_file_name);
04340 
04341          status = analyze_run(run_number, input_file_name, output_file_name);
04342          if (status == RPC_SHUTDOWN)
04343             break;
04344       }
04345    } else {
04346       /* loop over input file names */
04347       for (i = 0; clp.input_file_name[i][0] && i < 10; i++) {
04348          strcpy(input_file_name, clp.input_file_name[i]);
04349 
04350          /* get run number from input file */
04351          prn = input_file_name;
04352          while (strchr(prn, DIR_SEPARATOR) != NULL)
04353             prn = strchr(prn, DIR_SEPARATOR) + 1;
04354 
04355          if (strpbrk(prn, "0123456789"))
04356             run_number = atoi(strpbrk(prn, "0123456789"));
04357 
04358          if (strchr(clp.output_file_name, '%') != NULL) {
04359             if (run_number == 0) {
04360                printf("Cannot extract run number from input file name.\n");
04361                return 0;
04362             }
04363             sprintf(output_file_name, clp.output_file_name, run_number);
04364          } else
04365             strcpy(output_file_name, clp.output_file_name);
04366 
04367          status = analyze_run(run_number, input_file_name, output_file_name);
04368          if (status == RPC_SHUTDOWN)
04369             break;
04370       }
04371    }
04372 
04373    /* close output file in append mode */
04374    if (out_file && out_append) {
04375       if (out_format == FORMAT_HBOOK) {
04376 #ifdef HAVE_HBOOK
04377          char str[80];
04378 
04379          HROUT(0, i, bstr);
04380          strcpy(str, "OFFLINE");
04381          HREND(str);
04382 #else
04383          cm_msg(MERROR, "loop_runs_offline", "HBOOK support is not compiled in");
04384 #endif
04385       } else if (out_format == FORMAT_ROOT) {
04386 #ifdef USE_ROOT
04387          CloseRootOutputFile();
04388 #else
04389          cm_msg(MERROR, "loop_runs_offline", "ROOT support is not compiled in");
04390 #endif                          /* USE_ROOT */
04391       } else {
04392 #ifdef HAVE_ZLIB
04393          if (out_gzip)
04394             gzclose(out_file);
04395          else
04396 #endif
04397             fclose(out_file);
04398       }
04399 
04400       /* free bank buffer */
04401       for (i = 0; analyze_request[i].event_name[0]; i++) {
04402          bank_list = analyze_request[i].bank_list;
04403 
04404          if (bank_list == NULL)
04405             continue;
04406 
04407          for (; bank_list->name[0]; bank_list++)
04408             if (bank_list->addr) {
04409                free(bank_list->addr);
04410                bank_list->addr = NULL;
04411             }
04412       }
04413    }
04414 #ifdef HAVE_PVM
04415    /* merge slave output files */
04416    if (pvm_master && out_info.filename[0] && out_append)
04417       pvm_merge();
04418 #endif
04419 
04420    return CM_SUCCESS;
04421 }

int ma_close ( MA_FILE file  ) 

Definition at line 3911 of file mana.c.

03912 {
03913    if (file->format == MA_FORMAT_YBOS)
03914      assert(!"YBOS not supported anymore");
03915    else
03916 #ifdef HAVE_ZLIB
03917       gzclose(file->gzfile);
03918 #else
03919       fclose(file->file);
03920 #endif
03921 
03922    free(file);
03923    return SUCCESS;
03924 }

MA_FILE* ma_open ( char *  file_name  ) 

Definition at line 3831 of file mana.c.

Referenced by analyze_run().

03832 {
03833    char *ext_str;
03834    int status;
03835    MA_FILE *file;
03836 
03837    /* allocate MA_FILE structure */
03838    file = (MA_FILE *) calloc(sizeof(MA_FILE), 1);
03839    if (file == NULL) {
03840       cm_msg(MERROR, "ma_open", "Cannot allocate MA file structure");
03841       return NULL;
03842    }
03843 
03844    /* save file name */
03845    strcpy(file->file_name, file_name);
03846 
03847    /* for now, just read from disk */
03848    file->device = MA_DEVICE_DISK;
03849 
03850    /* or from PVM */
03851    if (pvm_slave) {
03852       file->device = MA_DEVICE_PVM;
03853       file->buffer = (char *) malloc(PVM_BUFFER_SIZE);
03854       file->wp = file->rp = 0;
03855    }
03856 
03857    /* check input file extension */
03858    if (strchr(file_name, '.')) {
03859       ext_str = file_name + strlen(file_name) - 1;
03860       while (*ext_str != '.')
03861          ext_str--;
03862    } else
03863       ext_str = "";
03864 
03865    if (strncmp(ext_str, ".gz", 3) == 0) {
03866 #ifdef HAVE_ZLIB
03867       ext_str--;
03868       while (*ext_str != '.' && ext_str > file_name)
03869          ext_str--;
03870 #else
03871       cm_msg(MERROR, "ma_open",
03872              ".gz extension not possible because zlib support is not compiled in.\n");
03873       return NULL;
03874 #endif
03875    }
03876 
03877    if (strncmp(file_name, "/dev/", 4) == 0)     /* assume MIDAS tape */
03878       file->format = MA_FORMAT_MIDAS;
03879    else if (strncmp(ext_str, ".mid", 4) == 0)
03880       file->format = MA_FORMAT_MIDAS;
03881    else if (strncmp(ext_str, ".ybs", 4) == 0)
03882      assert(!"YBOS not supported anymore");
03883    else {
03884       printf
03885           ("Unknown input data format \"%s\". Please use file extension .mid or mid.gz.\n",
03886            ext_str);
03887       return NULL;
03888    }
03889 
03890    if (file->device == MA_DEVICE_DISK) {
03891       if (file->format == MA_FORMAT_YBOS) {
03892         assert(!"YBOS not supported anymore");
03893       } else {
03894 #ifdef HAVE_ZLIB
03895          file->gzfile = gzopen(file_name, "rb");
03896          if (file->gzfile == NULL)
03897             return NULL;
03898 #else
03899          file->file = fopen(file_name, "rb");
03900          if (file->file == NULL)
03901             return NULL;
03902 #endif
03903       }
03904    }
03905 
03906    return file;
03907 }

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

Definition at line 3928 of file mana.c.

Referenced by analyze_run().

03929 {
03930    int status, n;
03931 
03932    if (file->device == MA_DEVICE_DISK) {
03933       if (file->format == MA_FORMAT_MIDAS) {
03934          if (size < (int) sizeof(EVENT_HEADER)) {
03935             cm_msg(MERROR, "ma_read_event", "Buffer size too small");
03936             return -1;
03937          }
03938 
03939          /* read event header */
03940 #ifdef HAVE_ZLIB
03941          n = gzread(file->gzfile, pevent, sizeof(EVENT_HEADER));
03942 #else
03943          n = sizeof(EVENT_HEADER)*fread(pevent, sizeof(EVENT_HEADER), 1, file->file);
03944 #endif
03945 
03946          if (n < (int) sizeof(EVENT_HEADER)) {
03947             if (n > 0)
03948                printf("Unexpected end of file %s, last event skipped\n", file->file_name);
03949             return -1;
03950          }
03951 
03952          /* swap event header if in wrong format */
03953 #ifdef SWAP_EVENTS
03954          WORD_SWAP(&pevent->event_id);
03955          WORD_SWAP(&pevent->trigger_mask);
03956          DWORD_SWAP(&pevent->serial_number);
03957          DWORD_SWAP(&pevent->time_stamp);
03958          DWORD_SWAP(&pevent->data_size);
03959 #endif
03960 
03961          /* read event */
03962          n = 0;
03963          if (pevent->data_size > 0) {
03964             if (size < (int) pevent->data_size + (int) sizeof(EVENT_HEADER)) {
03965                cm_msg(MERROR, "ma_read_event", "Buffer size too small");
03966                return -1;
03967             }
03968 #ifdef HAVE_ZLIB
03969             n = gzread(file->gzfile, pevent + 1, pevent->data_size);
03970 #else
03971             n = pevent->data_size*fread(pevent + 1, pevent->data_size, 1, file->file);
03972 #endif
03973             if (n != (INT) pevent->data_size) {
03974                printf("Unexpected end of file %s, last event skipped\n", file->file_name);
03975                return -1;
03976             }
03977          }
03978 
03979          return n + sizeof(EVENT_HEADER);
03980       } else if (file->format == MA_FORMAT_YBOS) {
03981         assert(!"YBOS not supported anymore");
03982       }
03983    } else if (file->device == MA_DEVICE_PVM) {
03984 #ifdef HAVE_PVM
03985       int bufid, len, tag, tid;
03986       EVENT_HEADER *pe;
03987       struct timeval timeout;
03988 
03989       /* check if anything in buffer */
03990       if (file->wp > file->rp) {
03991          pe = (EVENT_HEADER *) (file->buffer + file->rp);
03992          size = sizeof(EVENT_HEADER) + pe->data_size;
03993          memcpy(pevent, pe, size);
03994          file->rp += size;
03995          return size;
03996       }
03997 
03998       /* send data request */
03999       pvm_initsend(PvmDataInPlace);
04000       pvm_send(pvm_myparent, TAG_DATA);
04001 
04002       /* receive data */
04003       timeout.tv_sec = 60;
04004       timeout.tv_usec = 0;
04005 
04006       bufid = pvm_trecv(-1, -1, &timeout);
04007       if (bufid < 0) {
04008          pvm_perror("pvm_recv");
04009          return -1;
04010       }
04011       if (bufid == 0) {
04012          PVM_DEBUG("ma_read_event: timeout receiving data, aborting analyzer.\n");
04013          return -1;
04014       }
04015 
04016       status = pvm_bufinfo(bufid, &len, &tag, &tid);
04017       if (status < 0) {
04018          pvm_perror("pvm_bufinfo");
04019          return -1;
04020       }
04021 
04022       PVM_DEBUG("ma_read_event: receive tag %d, buflen %d", tag, len);
04023 
04024       if (tag == TAG_EOR || tag == TAG_EXIT)
04025          return -1;
04026 
04027       file->wp = len;
04028       file->rp = 0;
04029       status = pvm_upkbyte((char *) file->buffer, len, 1);
04030       if (status < 0) {
04031          pvm_perror("pvm_upkbyte");
04032          return -1;
04033       }
04034 
04035       /* no new data available, sleep some time to reduce network traffic */
04036       if (len == 0)
04037          ss_sleep(200);
04038 
04039       /* re-call this function */
04040       return ma_read_event(file, pevent, size);
04041 #endif
04042    }
04043 
04044    return 0;
04045 }

int main ( int  argc,
char *  argv[] 
)

Definition at line 5329 of file mana.c.

05330 {
05331    INT status, size;
05332    char str[256];
05333    HNDLE hkey;
05334 
05335 #ifdef HAVE_PVM
05336    int i;
05337 
05338    str[0] = 0;
05339    for (i = 0; i < argc; i++) {
05340       strcat(str, argv[i]);
05341       strcat(str, " ");
05342    }
05343    PVM_DEBUG("Analyzer started: %s", str);
05344 #endif
05345 
05346 #ifdef USE_ROOT
05347    int argn = 1;
05348    char *argp = (char *) argv[0];
05349 
05350    manaApp = new TRint("ranalyzer", &argn, &argp, NULL, 0, true);
05351 
05352    /* default server port */
05353    clp.root_port = 9090;
05354 #endif
05355 
05356    /* get default from environment */
05357    cm_get_environment(clp.host_name, sizeof(clp.host_name), clp.exp_name,
05358                       sizeof(clp.exp_name));
05359 
05360 #ifdef HAVE_HBOOK
05361    /* set default lrec size */
05362    clp.lrec = HBOOK_LREC;
05363 #endif                          /* HAVE_HBOOK */
05364 
05365    /* read in command line parameters into clp structure */
05366    status = getparam(argc, argv);
05367    if (status != CM_SUCCESS)
05368       return 1;
05369 
05370    /* become a daemon */
05371    if (clp.daemon) {
05372       printf("Becoming a daemon...\n");
05373       clp.quiet = TRUE;
05374       ss_daemon_init(FALSE);
05375    }
05376 
05377    /* set default buffer size */
05378    if (clp.pvm_buf_size == 0)
05379       clp.pvm_buf_size = 512 * 1024;
05380    else
05381       clp.pvm_buf_size *= 1024;
05382    if (clp.pvm_buf_size > PVM_BUFFER_SIZE) {
05383       printf("Buffer size cannot be larger than %dkB\n", PVM_BUFFER_SIZE / 1024);
05384       return 1;
05385    }
05386 
05387    /* set online mode if no input filename is given */
05388    clp.online = (clp.input_file_name[0][0] == 0);
05389 
05390 #ifdef HAVE_HBOOK
05391    /* set Ntuple format to RWNT if online */
05392    if (clp.online || equal_ustring(clp.output_file_name, "OFLN"))
05393       clp.rwnt = TRUE;
05394 #endif                          /* HAVE_HBOOK */
05395 
05396 #ifdef HAVE_PVM
05397    status = pvm_main(argv);
05398    if (status != CM_SUCCESS)
05399       return 1;
05400 #endif
05401 
05402 #ifdef USE_ROOT
05403    /* workaround for multi-threading with midas system calls */
05404    ss_force_single_thread();
05405 #endif
05406 
05407    /* now connect to server */
05408    if (clp.online) {
05409       if (clp.host_name[0])
05410          printf("Connect to experiment %s on host %s...", clp.exp_name, clp.host_name);
05411       else
05412          printf("Connect to experiment %s...", clp.exp_name);
05413    }
05414 
05415    status =
05416        cm_connect_experiment1(clp.host_name, clp.exp_name, analyzer_name, NULL, odb_size,
05417                               DEFAULT_WATCHDOG_TIMEOUT);
05418 
05419    if (status == CM_UNDEF_EXP) {
05420       printf("\nError: Experiment \"%s\" not defined.\n", clp.exp_name);
05421       if (getenv("MIDAS_DIR")) {
05422          printf
05423              ("Note that \"MIDAS_DIR\" is defined, which results in a single experiment\n");
05424          printf
05425              ("called \"Default\". If you want to use the \"exptab\" file, undefine \"MIDAS_DIR\".\n");
05426       }
05427       return 1;
05428    } else if (status != CM_SUCCESS) {
05429       cm_get_error(status, str);
05430       printf("\nError: %s\n", str);
05431       return 1;
05432    }
05433 
05434    if (clp.online)
05435       printf("OK\n");
05436 
05437    /* set online/offline mode */
05438    cm_get_experiment_database(&hDB, NULL);
05439    db_set_value(hDB, 0, "/Runinfo/Online Mode", &clp.online, sizeof(clp.online), 1,
05440                 TID_INT);
05441 
05442    if (clp.online) {
05443       /* check for duplicate name */
05444       status = cm_exist(analyzer_name, FALSE);
05445       if (status == CM_SUCCESS) {
05446          cm_disconnect_experiment();
05447          printf("An analyzer named \"%s\" is already running in this experiment.\n",
05448                 analyzer_name);
05449          printf
05450              ("Please select another analyzer name in analyzer.c or stop other analyzer.\n");
05451          return 1;
05452       }
05453 
05454       /* register transitions if started online */
05455       if (cm_register_transition(TR_START, tr_start, 300) != CM_SUCCESS ||
05456           cm_register_transition(TR_STOP, tr_stop, 700) != CM_SUCCESS ||
05457           cm_register_transition(TR_PAUSE, tr_pause, 700) != CM_SUCCESS ||
05458           cm_register_transition(TR_RESUME, tr_resume, 300) != CM_SUCCESS) {
05459          printf("Failed to start local RPC server");
05460          return 1;
05461       }
05462    } else {
05463       if (!pvm_slave) {         /* slave could run on same machine... */
05464          status = cm_exist(analyzer_name, FALSE);
05465          if (status == CM_SUCCESS) {
05466             /* kill hanging previous analyzer */
05467             cm_cleanup(analyzer_name, FALSE);
05468 
05469             status = cm_exist(analyzer_name, FALSE);
05470             if (status == CM_SUCCESS) {
05471                /* analyzer may only run once if offline */
05472                status = cm_shutdown(analyzer_name, FALSE);
05473                if (status == CM_SHUTDOWN)
05474                   printf("Previous analyzer stopped\n");
05475             }
05476          }
05477       }
05478    }
05479 
05480 #ifdef HAVE_HBOOK
05481    /* register callback for clearing histos */
05482    cm_register_function(RPC_ANA_CLEAR_HISTOS, ana_callback);
05483 #endif
05484 
05485    /* turn on keepalive messages */
05486    cm_set_watchdog_params(TRUE, DEFAULT_RPC_TIMEOUT);
05487 
05488    /* decrease watchdog timeout in offline mode */
05489    if (!clp.online)
05490       cm_set_watchdog_params(TRUE, 2000);
05491 
05492    /* turn off watchdog if in debug mode */
05493    if (clp.debug)
05494       cm_set_watchdog_params(0, 0);
05495 
05496    /* initialize module parameters */
05497    if (init_module_parameters(FALSE) != CM_SUCCESS) {
05498       cm_disconnect_experiment();
05499       return 1;
05500    }
05501 
05502    /* create ODB structure for output */
05503    sprintf(str, "/%s/Output", analyzer_name);
05504    db_check_record(hDB, 0, str, ANA_OUTPUT_INFO_STR, TRUE);
05505    db_find_key(hDB, 0, str, &hkey);
05506    assert(hkey);
05507    size = sizeof(out_info);
05508    db_get_record(hDB, hkey, &out_info, &size, 0);
05509 
05510 #ifdef USE_ROOT
05511    /* create the folder for analyzer histograms */
05512    gManaHistosFolder =
05513        gROOT->GetRootFolder()->AddFolder("histos", "MIDAS Analyzer Histograms");
05514    gHistoFolderStack = new TObjArray();
05515    gROOT->GetListOfBrowsables()->Add(gManaHistosFolder, "histos");
05516 
05517    /* convert .rz names to .root names */
05518    if (strstr(out_info.last_histo_filename, ".rz"))
05519       strcpy(out_info.last_histo_filename, "last.root");
05520 
05521    if (strstr(out_info.histo_dump_filename, ".rz"))
05522       strcpy(out_info.histo_dump_filename, "his%05d.root");
05523 
05524    db_set_record(hDB, hkey, &out_info, sizeof(out_info), 0);
05525 
05526    /* start socket server */
05527    if (clp.root_port)
05528       start_root_socket_server(clp.root_port);
05529 
05530 #endif                          /* USE_ROOT */
05531 
05532 #ifdef HAVE_HBOOK
05533    /* convert .root names to .rz names */
05534    if (strstr(out_info.last_histo_filename, ".root"))
05535       strcpy(out_info.last_histo_filename, "last.rz");
05536 
05537    if (strstr(out_info.histo_dump_filename, ".root"))
05538       strcpy(out_info.histo_dump_filename, "his%05d.rz");
05539 
05540    db_set_record(hDB, hkey, &out_info, sizeof(out_info), 0);
05541 #endif
05542 
05543 #ifdef HAVE_HBOOK
05544    /* create global memory */
05545    if (clp.online) {
05546       HLIMAP(pawc_size / 4, out_info.global_memory_name);
05547       printf("\nGLOBAL MEMORY NAME = %s\n", out_info.global_memory_name);
05548    } else {
05549       if (equal_ustring(clp.output_file_name, "OFLN")) {
05550          strcpy(str, "OFLN");
05551          HLIMAP(pawc_size / 4, str);
05552          printf("\nGLOBAL MEMORY NAME = %s\n", "OFLN");
05553       } else
05554          HLIMIT(pawc_size / 4);
05555    }
05556 #endif                          /* HAVE_HBOOK */
05557 
05558    /* analyzer init function */
05559    if (mana_init() != CM_SUCCESS) {
05560       cm_disconnect_experiment();
05561       return 1;
05562    }
05563 
05564    /* load histos from last.xxx */
05565    if (clp.online)
05566       load_last_histos();
05567 
05568    /* reqister event requests */
05569    register_requests();
05570 
05571    /* initialize ss_getchar */
05572    if (!clp.quiet && !pvm_slave)
05573       ss_getchar(0);
05574 
05575    /*---- start main loop ----*/
05576 
05577    if (clp.online)
05578       loop_online();
05579    else
05580       loop_runs_offline();
05581 
05582    /* reset terminal */
05583    if (!clp.quiet && !pvm_slave)
05584       ss_getchar(TRUE);
05585 
05586    /* call exit function */
05587    mana_exit();
05588 
05589    /* save histos to last.xxx */
05590    if (clp.online)
05591       save_last_histos();
05592 
05593 #ifdef HAVE_PVM
05594 
05595    PVM_DEBUG("Analyzer stopped");
05596 
05597    /* exit PVM */
05598    pvm_exit();
05599 
05600    /* if PVM slave, don't write *SHM file back */
05601    if (pvm_slave)
05602       disable_shm_write = TRUE;
05603 
05604 #endif
05605 
05606    /* disconnect from experiment */
05607    cm_disconnect_experiment();
05608 
05609 #ifdef USE_ROOT
05610    if (clp.start_rint)
05611       manaApp->Run(true);
05612    printf("\r               \n");       /* overwrite superflous ROOT prompt */
05613 #endif
05614 
05615    return 0;
05616 }

INT mana_exit (  ) 

Definition at line 1651 of file mana.c.

01652 {
01653    ANA_MODULE **module;
01654    INT i, j;
01655 
01656    /* call exit routines from modules */
01657    for (i = 0; analyze_request[i].event_name[0]; i++) {
01658       module = analyze_request[i].ana_module;
01659       for (j = 0; module != NULL && module[j] != NULL; j++)
01660          if (module[j]->exit != NULL && module[j]->enabled) {
01661             module[j]->exit();
01662          }
01663    }
01664 
01665    /* call main analyzer exit routine */
01666    return analyzer_exit();
01667 }

INT mana_init (  ) 

Definition at line 1512 of file mana.c.

01513 {
01514    ANA_MODULE **module;
01515    INT i, j, status, size;
01516    HNDLE hkey;
01517    char str[256], block_name[32];
01518    BANK_LIST *bank_list;
01519    double dummy;
01520 
01521    sprintf(str, "/%s/Output", analyzer_name);
01522    db_find_key(hDB, 0, str, &hkey);
01523 
01524    if (clp.online) {
01525       status =
01526           db_open_record(hDB, hkey, &out_info, sizeof(out_info), MODE_READ, NULL, NULL);
01527       if (status != DB_SUCCESS) {
01528          cm_msg(MERROR, "bor", "Cannot read output info record");
01529          return 0;
01530       }
01531    }
01532 
01533    /* create ODB structures for banks */
01534    for (i = 0; analyze_request[i].event_name[0]; i++) {
01535       bank_list = analyze_request[i].bank_list;
01536 
01537       if (bank_list == NULL)
01538          continue;
01539 
01540       for (; bank_list->name[0]; bank_list++) {
01541          strncpy(block_name, bank_list->name, 4);
01542          block_name[4] = 0;
01543 
01544          if (bank_list->type == TID_STRUCT) {
01545             sprintf(str, "/Equipment/%s/Variables/%s", analyze_request[i].event_name,
01546                     block_name);
01547             db_check_record(hDB, 0, str, strcomb((const char **)bank_list->init_str), TRUE);
01548             db_find_key(hDB, 0, str, &hkey);
01549             bank_list->def_key = hkey;
01550          } else {
01551             sprintf(str, "/Equipment/%s/Variables/%s", analyze_request[i].event_name,
01552                     block_name);
01553             status = db_find_key(hDB, 0, str, &hkey);
01554             if (status != DB_SUCCESS) {
01555                dummy = 0;
01556                db_set_value(hDB, 0, str, &dummy, rpc_tid_size(bank_list->type), 1,
01557                             bank_list->type);
01558             }
01559             bank_list->def_key = hkey;
01560          }
01561       }
01562    }
01563 
01564    /* create ODB structures for fixed events */
01565    for (i = 0; analyze_request[i].event_name[0]; i++) {
01566       if (analyze_request[i].init_string) {
01567          sprintf(str, "/Equipment/%s/Variables", analyze_request[i].event_name);
01568          db_check_record(hDB, 0, str, strcomb((const char **)analyze_request[i].init_string), TRUE);
01569       }
01570    }
01571 
01572    /* delete tests in ODB */
01573    sprintf(str, "/%s/Tests", analyzer_name);
01574    db_find_key(hDB, 0, str, &hkey);
01575    if (hkey)
01576       db_delete_key(hDB, hkey, FALSE);
01577 
01578 #ifdef HAVE_HBOOK
01579    /* create global memory */
01580    if (clp.online) {
01581       /* book online N-tuples only once when online */
01582       status = book_ntuples();
01583       if (status != SUCCESS)
01584          return status;
01585    } else {
01586       if (equal_ustring(clp.output_file_name, "OFLN")) {
01587          /* book online N-tuples only once when online */
01588          status = book_ntuples();
01589          if (status != SUCCESS)
01590             return status;
01591       }
01592    }
01593 #endif                          /* HAVE_HBOOK */
01594 
01595 #ifdef USE_ROOT
01596    if (clp.online) {
01597       /* book online N-tuples only once when online */
01598       status = book_ttree();
01599       if (status != SUCCESS)
01600          return status;
01601    }
01602 #endif
01603 
01604    /* call main analyzer init routine */
01605    status = analyzer_init();
01606    if (status != SUCCESS)
01607       return status;
01608 
01609    /* initialize modules */
01610    for (i = 0; analyze_request[i].event_name[0]; i++) {
01611       module = analyze_request[i].ana_module;
01612       for (j = 0; module != NULL && module[j] != NULL; j++) {
01613 
01614          /* copy module enabled flag to ana_module */
01615          sprintf(str, "/%s/Module switches/%s", analyzer_name, module[j]->name);
01616          module[j]->enabled = TRUE;
01617          size = sizeof(BOOL);
01618          db_get_value(hDB, 0, str, &module[j]->enabled, &size, TID_BOOL, TRUE);
01619 
01620          if (module[j]->init != NULL && module[j]->enabled) {
01621 
01622 #ifdef USE_ROOT
01623             /* create histo subfolder for module */
01624             sprintf(str, "Histos for module %s", module[j]->name);
01625             module[j]->histo_folder = (TFolder *) gROOT->FindObjectAny(module[j]->name);
01626             if (!module[j]->histo_folder)
01627                module[j]->histo_folder =
01628                    gManaHistosFolder->AddFolder(module[j]->name, str);
01629             else if (strcmp(((TObject *) module[j]->histo_folder)->ClassName(), "TFolder")
01630                      != 0) {
01631                cm_msg(MERROR, "mana_init",
01632                       "Fatal error: ROOT Object \"%s\" of class \"%s\" exists but it is not a TFolder, exiting!",
01633                       module[j]->name,
01634                       ((TObject *) module[j]->histo_folder)->ClassName());
01635                exit(1);
01636             }
01637             gHistoFolderStack->Clear();
01638             gHistoFolderStack->Add((TObject *) module[j]->histo_folder);
01639 #endif
01640 
01641             module[j]->init();
01642          }
01643       }
01644    }
01645 
01646    return SUCCESS;
01647 }

void odb_load ( EVENT_HEADER pevent  ) 

Definition at line 3718 of file mana.c.

Referenced by process_event().

03719 {
03720    BOOL flag;
03721    int size, i, status;
03722    char str[256];
03723    HNDLE hKey, hKeyRoot, hKeyEq;
03724 
03725    flag = TRUE;
03726    size = sizeof(flag);
03727    sprintf(str, "/%s/ODB Load", analyzer_name);
03728    db_get_value(hDB, 0, str, &flag, &size, TID_BOOL, TRUE);
03729 
03730    if (flag) {
03731       for (i = 0; i < 10; i++)
03732          if (clp.protect[i][0] && !clp.quiet)
03733             printf("Protect ODB tree \"%s\"\n", clp.protect[i]);
03734 
03735       if (!clp.quiet)
03736          printf("Load ODB from run %d...", (int) current_run_number);
03737 
03738       if (flag == 1) {
03739          /* lock all ODB values except run parameters */
03740          db_set_mode(hDB, 0, MODE_READ, TRUE);
03741 
03742          db_find_key(hDB, 0, "/Experiment/Run Parameters", &hKey);
03743          if (hKey)
03744             db_set_mode(hDB, hKey, MODE_READ | MODE_WRITE | MODE_DELETE, TRUE);
03745 
03746          /* and analyzer parameters */
03747          sprintf(str, "/%s/Parameters", analyzer_name);
03748          db_find_key(hDB, 0, str, &hKey);
03749          if (hKey)
03750             db_set_mode(hDB, hKey, MODE_READ | MODE_WRITE | MODE_DELETE, TRUE);
03751 
03752          /* and equipment (except /variables) */
03753          db_find_key(hDB, 0, "/Equipment", &hKeyRoot);
03754          if (hKeyRoot) {
03755             db_set_mode(hDB, hKeyRoot, MODE_READ | MODE_WRITE | MODE_DELETE, FALSE);
03756 
03757             for (i = 0;; i++) {
03758                status = db_enum_key(hDB, hKeyRoot, i, &hKeyEq);
03759                if (status == DB_NO_MORE_SUBKEYS)
03760                   break;
03761 
03762                db_set_mode(hDB, hKeyEq, MODE_READ | MODE_WRITE | MODE_DELETE, TRUE);
03763 
03764                db_find_key(hDB, hKeyEq, "Variables", &hKey);
03765                if (hKey)
03766                   db_set_mode(hDB, hKey, MODE_READ, TRUE);
03767             }
03768          }
03769 
03770          /* lock protected trees */
03771          for (i = 0; i < 10; i++)
03772             if (clp.protect[i][0]) {
03773                db_find_key(hDB, 0, clp.protect[i], &hKey);
03774                if (hKey)
03775                   db_set_mode(hDB, hKey, MODE_READ, TRUE);
03776             }
03777       }
03778 
03779       /* close open records to parameters */
03780       init_module_parameters(TRUE);
03781 
03782       if (strncmp((char *) (pevent + 1), "<?xml version=\"1.0\"", 19) == 0)
03783          db_paste_xml(hDB, 0, (char *) (pevent + 1));
03784       else
03785          db_paste(hDB, 0, (char *) (pevent + 1));
03786 
03787       if (flag == 1)
03788          db_set_mode(hDB, 0, MODE_READ | MODE_WRITE | MODE_DELETE, TRUE);
03789 
03790       /* reinit structured opened by user analyzer */
03791       analyzer_init();
03792 
03793       /* reload parameter files after BOR event */
03794       if (!clp.quiet)
03795          printf("OK\n");
03796       load_parameters(current_run_number);
03797 
03798       /* open module parameters again */
03799       init_module_parameters(FALSE);
03800    }
03801 }

INT process_event ( ANALYZE_REQUEST par,
EVENT_HEADER pevent 
)

Definition at line 3054 of file mana.c.

03055 {
03056    INT i, status = SUCCESS, ch;
03057    ANA_MODULE **module;
03058    DWORD actual_time;
03059    EVENT_DEF *event_def;
03060    static DWORD last_time_kb = 0;
03061    static char *orig_event = NULL;
03062 
03063    /* verbose output */
03064    if (clp.verbose)
03065       printf("event %d, number %d, total size %d\n",
03066              (int) pevent->event_id,
03067              (int) pevent->serial_number,
03068              (int) (pevent->data_size + sizeof(EVENT_HEADER)));
03069 
03070    /* save analyze_request for event number correction */
03071    _current_par = par;
03072 
03073    /* check keyboard once every second */
03074    actual_time = ss_millitime();
03075    if (!clp.online && actual_time - last_time_kb > 1000 && !clp.quiet && !pvm_slave) {
03076       last_time_kb = actual_time;
03077 
03078       while (ss_kbhit()) {
03079          ch = ss_getchar(0);
03080          if (ch == -1)
03081             ch = getchar();
03082 
03083          if ((char) ch == '!')
03084             return RPC_SHUTDOWN;
03085       }
03086    }
03087 
03088    if (par == NULL) {
03089       /* load ODB with BOR event */
03090       if (pevent->event_id == EVENTID_BOR) {
03091          /* get run number from BOR event */
03092          current_run_number = pevent->serial_number;
03093 
03094          cm_msg(MINFO, "process_event", "Set run number %d in ODB", current_run_number);
03095          assert(current_run_number > 0);
03096 
03097          /* set run number in ODB */
03098          status = db_set_value(hDB, 0, "/Runinfo/Run number", &current_run_number,
03099                                sizeof(current_run_number), 1, TID_INT);
03100          assert(status == SUCCESS);
03101 
03102          /* load ODB from event */
03103          odb_load(pevent);
03104 
03105 #ifdef HAVE_PVM
03106          PVM_DEBUG("process_event: ODB load");
03107 #endif
03108       }
03109    } else
03110       /* increment event counter */
03111       par->events_received++;
03112 
03113 #ifdef HAVE_PVM
03114 
03115    /* if master, distribute events to clients */
03116    if (pvm_master) {
03117       status = pvm_distribute(par, pevent);
03118       return status;
03119    }
03120 #endif
03121 
03122    /* don't analyze special (BOR,MESSAGE,...) events */
03123    if (par == NULL)
03124       return SUCCESS;
03125 
03126    /* swap event if necessary */
03127    event_def = db_get_event_definition(pevent->event_id);
03128    if (event_def == NULL)
03129       return 0;
03130 
03131    if (event_def->format == FORMAT_MIDAS)
03132       bk_swap((BANK_HEADER *) (pevent + 1), FALSE);
03133 
03134    /* keep copy of original event */
03135    if (clp.filter) {
03136       if (orig_event == NULL)
03137          orig_event = (char *) malloc(MAX_EVENT_SIZE + sizeof(EVENT_HEADER));
03138       memcpy(orig_event, pevent, pevent->data_size + sizeof(EVENT_HEADER));
03139    }
03140 
03141   /*---- analyze event ----*/
03142 
03143    /* call non-modular analyzer if defined */
03144    if (par->analyzer) {
03145       status = par->analyzer(pevent, (void *) (pevent + 1));
03146 
03147       /* don't continue if event was rejected */
03148       if (status == ANA_SKIP)
03149          return 0;
03150    }
03151 
03152    /* loop over analyzer modules */
03153    module = par->ana_module;
03154    for (i = 0; module != NULL && module[i] != NULL; i++) {
03155       if (module[i]->enabled) {
03156 
03157          status = module[i]->analyzer(pevent, (void *) (pevent + 1));
03158 
03159          /* don't continue if event was rejected */
03160          if (status == ANA_SKIP)
03161             return 0;
03162       }
03163    }
03164 
03165    if (event_def->format == FORMAT_MIDAS) {
03166       /* check if event got too large */
03167       i = bk_size(pevent + 1);
03168       if (i > MAX_EVENT_SIZE)
03169          cm_msg(MERROR, "process_event", "Event got too large (%d Bytes) in analyzer", i);
03170 
03171       /* correct for increased event size */
03172       pevent->data_size = i;
03173    }
03174 
03175    if (event_def->format == FORMAT_YBOS) {
03176      assert(!"YBOS not supported anymore");
03177    }
03178 
03179    /* increment tests */
03180    if (par->use_tests)
03181       test_increment();
03182 
03183    /* in filter mode, use original event */
03184    if (clp.filter)
03185       pevent = (EVENT_HEADER *) orig_event;
03186 
03187    /* write resulting event */
03188    if (out_file) {
03189 #ifdef HAVE_HBOOK
03190       if (out_format == FORMAT_HBOOK)
03191          status = write_event_hbook(out_file, pevent, par);
03192 #endif                          /* HAVE_HBOOK */
03193 #ifdef USE_ROOT
03194       if (out_format == FORMAT_ROOT)
03195          status = write_event_ttree(out_file, pevent, par);
03196 #endif                          /* USE_ROOT */
03197       if (out_format == FORMAT_ASCII)
03198          status = write_event_ascii(out_file, pevent, par);
03199       if (out_format == FORMAT_MIDAS)
03200          status = write_event_midas(out_file, pevent, par);
03201 
03202       if (status != SUCCESS) {
03203          cm_msg(MERROR, "process_event", "Error writing to file (Disk full?)");
03204          return -1;
03205       }
03206 
03207       par->events_written++;
03208    }
03209 #ifdef HAVE_HBOOK
03210    /* fill shared memory */
03211    if ((clp.online || equal_ustring(clp.output_file_name, "OFLN"))
03212        && par->rwnt_buffer_size > 0)
03213       write_event_hbook(NULL, pevent, par);
03214 #endif                          /* HAVE_HBOOK */
03215 #ifdef USE_ROOT
03216    /* fill tree, should later be replaced by cyclic filling once it's implemented in ROOT */
03217    if (clp.online && par->rwnt_buffer_size > 0)
03218       write_event_ttree(NULL, pevent, par);
03219 #endif
03220 
03221 
03222    /* put event in ODB once every second */
03223    if (out_info.events_to_odb)
03224       for (i = 0; i < 50; i++) {
03225          if (last_time_event[i].event_id == pevent->event_id) {
03226             if (event_def->type == EQ_PERIODIC ||
03227                 event_def->type == EQ_SLOW
03228                 || actual_time - last_time_event[i].last_time > 1000) {
03229                last_time_event[i].last_time = actual_time;
03230                write_event_odb(pevent);
03231             }
03232             break;
03233          }
03234          if (last_time_event[i].event_id == 0) {
03235             last_time_event[i].event_id = pevent->event_id;
03236             last_time_event[i].last_time = actual_time;
03237             write_event_odb(pevent);
03238             break;
03239          }
03240       }
03241 
03242    return SUCCESS;
03243 }

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

Definition at line 3247 of file mana.c.

03250 {
03251    INT i;
03252    ANALYZE_REQUEST *par;
03253    static DWORD buffer_size = 0;
03254    static char *buffer = NULL;
03255    char *pb;
03256 
03257    if (buffer == NULL) {
03258       buffer = (char *) malloc(MAX_EVENT_SIZE + sizeof(EVENT_HEADER));
03259 
03260       if (buffer == NULL) {
03261          cm_msg(MERROR, "receive_event", "Not enough memory to buffer event of size %d",
03262                 buffer_size);
03263          return;
03264       }
03265    }
03266 
03267    /* align buffer */
03268    pb = (char *) ALIGN8((POINTER_T) buffer);
03269 
03270    /* copy event to local buffer */
03271    memcpy(pb, pheader, pheader->data_size + sizeof(EVENT_HEADER));
03272 
03273    par = analyze_request;
03274 
03275    for (i = 0; par->event_name[0]; par++)
03276       if (par->buffer_handle == buffer_handle && par->request_id == request_id) {
03277          process_event(par, (EVENT_HEADER *) pb);
03278       }
03279 }

void register_requests ( void   ) 

Definition at line 3313 of file mana.c.

03314 {
03315    INT index, status;
03316    char str[256];
03317    AR_INFO *ar_info;
03318    AR_STATS *ar_stats;
03319    HNDLE hKey;
03320 
03321    /* scan ANALYZE_REQUEST table from ANALYZE.C */
03322    for (index = 0; analyze_request[index].event_name[0]; index++) {
03323       ar_info = &analyze_request[index].ar_info;
03324       ar_stats = &analyze_request[index].ar_stats;
03325 
03326       /* create common subtree from analyze_request table in analyze.c */
03327       sprintf(str, "/%s/%s/Common", analyzer_name, analyze_request[index].event_name);
03328       db_check_record(hDB, 0, str, ANALYZER_REQUEST_STR, TRUE);
03329       db_find_key(hDB, 0, str, &hKey);
03330       analyze_request[index].hkey_common = hKey;
03331 
03332       strcpy(ar_info->client_name, analyzer_name);
03333       gethostname(ar_info->host, sizeof(ar_info->host));
03334       db_set_record(hDB, hKey, ar_info, sizeof(AR_INFO), 0);
03335 
03336       /* open hot link to analyzer request info */
03337       db_open_record(hDB, hKey, ar_info, sizeof(AR_INFO), MODE_READ, update_request,
03338                      NULL);
03339 
03340       /* create statistics tree */
03341       sprintf(str, "/%s/%s/Statistics", analyzer_name, analyze_request[index].event_name);
03342       db_check_record(hDB, 0, str, ANALYZER_STATS_STR, TRUE);
03343       db_find_key(hDB, 0, str, &hKey);
03344       assert(hKey);
03345 
03346       ar_stats->events_received = 0;
03347       ar_stats->events_per_sec = 0;
03348       ar_stats->events_written = 0;
03349 
03350       /* open hot link to statistics tree */
03351       status =
03352           db_open_record(hDB, hKey, ar_stats, sizeof(AR_STATS), MODE_WRITE, NULL, NULL);
03353       if (status != DB_SUCCESS)
03354          printf("Cannot open statistics record, probably other analyzer is using it\n");
03355 
03356       if (clp.online) {
03357          /*---- open event buffer ---------------------------------------*/
03358          bm_open_buffer(ar_info->buffer, 2*MAX_EVENT_SIZE,
03359                         &analyze_request[index].buffer_handle);
03360 
03361          /* set the default buffer cache size */
03362          bm_set_cache_size(analyze_request[index].buffer_handle, 100000, 0);
03363 
03364          /*---- request event -------------------------------------------*/
03365          if (ar_info->enabled)
03366             bm_request_event(analyze_request[index].buffer_handle,
03367                              (short) ar_info->event_id, (short) ar_info->trigger_mask,
03368                              ar_info->sampling_type, &analyze_request[index].request_id,
03369                              receive_event);
03370          else
03371             analyze_request[index].request_id = -1;
03372       }
03373    }
03374 }

void save_last_histos (  ) 

Definition at line 3572 of file mana.c.

Referenced by main().

03573 {
03574    char str[256];
03575 
03576    /* save online histos */
03577    strcpy(str, out_info.last_histo_filename);
03578    if (strchr(str, DIR_SEPARATOR) == NULL)
03579       add_data_dir(str, out_info.last_histo_filename);
03580 
03581    printf("Saving current online histos to %s\n", str);
03582 
03583 #ifdef HAVE_HBOOK
03584    {
03585       int i;
03586       char str2[256];
03587 
03588       for (i = 0; i < (int) strlen(str); i++)
03589          if (isupper(str[i]))
03590             break;
03591 
03592       if (i < (int) strlen(str)) {
03593          printf
03594              ("Error: Due to a limitation in HBOOK, directoy names may not contain uppercase\n");
03595          printf("       characters. Histogram saving to %s will not work.\n", str);
03596       } else {
03597          strcpy(str2, "NT");
03598          HRPUT(0, str, str2);
03599       }
03600    }
03601 #endif
03602 
03603 #ifdef USE_ROOT
03604    SaveRootHistograms(gManaHistosFolder, str);
03605 #endif
03606 
03607 }

void test_clear (  ) 

Definition at line 582 of file mana.c.

00583 {
00584    int i;
00585 
00586    /* clear all tests in interal list */
00587    for (i = 0; i < n_test; i++) {
00588       tl[i]->count = 0;
00589       tl[i]->value = FALSE;
00590    }
00591 
00592    /* set "always true" test */
00593    if (n_test > 0)
00594       tl[0]->value = TRUE;
00595 }

void test_increment (  ) 

Definition at line 597 of file mana.c.

00598 {
00599    int i;
00600 
00601    /* increment test counters based on their value and reset them */
00602    for (i = 0; i < n_test; i++) {
00603       if (tl[i]->value)
00604          tl[i]->count++;
00605       if (i > 0)
00606          tl[i]->value = FALSE;
00607    }
00608 }

void test_register ( ANA_TEST t  ) 

Definition at line 546 of file mana.c.

00547 {
00548    int i;
00549 
00550    /* check if test already registered */
00551    for (i = 0; i < n_test; i++)
00552       if (tl[i] == t)
00553          break;
00554    if (i < n_test) {
00555       t->registered = TRUE;
00556       return;
00557    }
00558 
00559    /* allocate space for pointer to test */
00560    if (n_test == 0) {
00561       tl = (ANA_TEST **) malloc(2 * sizeof(void *));
00562 
00563       /* define "always true" test */
00564       tl[0] = (ANA_TEST *) malloc(sizeof(ANA_TEST));
00565       strcpy(tl[0]->name, "Always true");
00566       tl[0]->count = 0;
00567       tl[0]->previous_count = 0;
00568       tl[0]->value = TRUE;
00569       tl[0]->registered = TRUE;
00570       n_test++;
00571    } else
00572       tl = (ANA_TEST **) realloc(tl, (n_test + 1) * sizeof(void *));
00573 
00574    tl[n_test] = t;
00575    t->count = 0;
00576    t->value = FALSE;
00577    t->registered = TRUE;
00578 
00579    n_test++;
00580 }

void test_write ( int  delta_time  ) 

Definition at line 610 of file mana.c.

00611 {
00612    int i;
00613    char str[256];
00614    float rate;
00615 
00616    /* write all test counts to /analyzer/tests/<name> */
00617    for (i = 0; i < n_test; i++) {
00618       sprintf(str, "/%s/Tests/%s/Count", analyzer_name, tl[i]->name);
00619       db_set_value(hDB, 0, str, &tl[i]->count, sizeof(DWORD), 1, TID_DWORD);
00620 
00621       /* calcluate rate */
00622       if (delta_time > 0) {
00623          rate = (float) ((tl[i]->count - tl[i]->previous_count) / (delta_time / 1000.0));
00624          tl[i]->previous_count = tl[i]->count;
00625          sprintf(str, "/%s/Tests/%s/Rate [Hz]", analyzer_name, tl[i]->name);
00626          db_set_value(hDB, 0, str, &rate, sizeof(float), 1, TID_FLOAT);
00627       }
00628    }
00629 }

INT tr_pause ( INT  rn,
char *  error 
)

Definition at line 2075 of file mana.c.

02076 {
02077    INT status;
02078 
02079    status = ana_pause_run(rn, error);
02080    if (status != CM_SUCCESS)
02081       return status;
02082 
02083    return CM_SUCCESS;
02084 }

INT tr_resume ( INT  rn,
char *  error 
)

Definition at line 2088 of file mana.c.

02089 {
02090    INT status;
02091 
02092    status = ana_resume_run(rn, error);
02093    if (status != CM_SUCCESS)
02094       return status;
02095 
02096    return CM_SUCCESS;
02097 }

INT tr_start ( INT  rn,
char *  error 
)

Definition at line 2024 of file mana.c.

02025 {
02026    INT status, i;
02027 
02028    /* reset counters */
02029    for (i = 0; analyze_request[i].event_name[0]; i++) {
02030       analyze_request[i].ar_stats.events_received = 0;
02031       analyze_request[i].ar_stats.events_per_sec = 0;
02032       analyze_request[i].ar_stats.events_written = 0;
02033       analyze_request[i].events_received = 0;
02034       analyze_request[i].events_written = 0;
02035    }
02036 
02037    status = bor(rn, error);
02038    if (status != SUCCESS)
02039       return status;
02040 
02041    return SUCCESS;
02042 }

INT tr_stop ( INT  rn,
char *  error 
)

Definition at line 2046 of file mana.c.

02047 {
02048    INT i, status, n_bytes;
02049 
02050    /* wait until all events in buffers are analyzed */
02051 
02052    if (rpc_is_remote())
02053       while (bm_poll_event(TRUE));
02054    else
02055       for (i = 0; analyze_request[i].event_name[0]; i++) {
02056          do {
02057             bm_get_buffer_level(analyze_request[i].buffer_handle, &n_bytes);
02058             if (n_bytes > 0)
02059                cm_yield(100);
02060          } while (n_bytes > 0);
02061       }
02062 
02063    /* update statistics */
02064    update_stats();
02065 
02066    status = eor(rn, error);
02067    if (status != SUCCESS)
02068       return status;
02069 
02070    return CM_SUCCESS;
02071 }

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

Definition at line 3283 of file mana.c.

Referenced by register_requests().

03284 {
03285    AR_INFO *ar_info;
03286    INT i;
03287 
03288    if (!clp.online)
03289       return;
03290 
03291    /* check which request's key has changed */
03292    for (i = 0; analyze_request[i].event_name[0]; i++)
03293       if (analyze_request[i].hkey_common == hKey) {
03294          ar_info = &analyze_request[i].ar_info;
03295 
03296          /* remove previous request */
03297          if (analyze_request[i].request_id != -1)
03298             bm_delete_request(analyze_request[i].request_id);
03299 
03300          /* if enabled, add new request */
03301          if (ar_info->enabled)
03302             bm_request_event(analyze_request[i].buffer_handle, (short) ar_info->event_id,
03303                              (short) ar_info->trigger_mask, ar_info->sampling_type,
03304                              &analyze_request[i].request_id, receive_event);
03305          else
03306             analyze_request[i].request_id = -1;
03307       }
03308 
03309 }

void update_stats (  ) 

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

Definition at line 2106 of file mana.c.

02107 {
02108    INT status, size, i, j, count;
02109    BOOL exclude;
02110    BANK_HEADER *pbh;
02111    BANK_LIST *pbl;
02112    EVENT_DEF *event_def;
02113    BANK *pbk;
02114    BANK32 *pbk32;
02115    void *pdata;
02116    char *pbuf, name[5], type_name[10];
02117    LRS1882_DATA *lrs1882;
02118    LRS1877_DATA *lrs1877;
02119    LRS1877_HEADER *lrs1877_header;
02120    HNDLE hKey;
02121    KEY key;
02122    char buffer[100000];
02123    DWORD bkname;
02124    WORD bktype;
02125 
02126    event_def = db_get_event_definition(pevent->event_id);
02127    if (event_def == NULL)
02128       return SS_SUCCESS;
02129 
02130    /* write event header */
02131    pbuf = buffer;
02132    name[4] = 0;
02133 
02134    if (pevent->event_id == EVENTID_BOR)
02135       sprintf(pbuf, "%%ID BOR NR %d\n", (int) pevent->serial_number);
02136    else if (pevent->event_id == EVENTID_EOR)
02137       sprintf(pbuf, "%%ID EOR NR %d\n", (int) pevent->serial_number);
02138    else
02139       sprintf(pbuf, "%%ID %d TR %d NR %d\n", pevent->event_id, pevent->trigger_mask,
02140               (int) pevent->serial_number);
02141    STR_INC(pbuf, buffer);
02142 
02143   /*---- MIDAS format ----------------------------------------------*/
02144    if (event_def->format == FORMAT_MIDAS) {
02145       pbh = (BANK_HEADER *) (pevent + 1);
02146       pbk = NULL;
02147       pbk32 = NULL;
02148       do {
02149          /* scan all banks */
02150          if (bk_is32(pbh)) {
02151             size = bk_iterate32(pbh, &pbk32, &pdata);
02152             if (pbk32 == NULL)
02153                break;
02154             bkname = *((DWORD *) pbk32->name);
02155             bktype = (WORD) pbk32->type;
02156          } else {
02157             size = bk_iterate(pbh, &pbk, &pdata);
02158             if (pbk == NULL)
02159                break;
02160             bkname = *((DWORD *) pbk->name);
02161             bktype = (WORD) pbk->type;
02162          }
02163 
02164          /* look if bank is in exclude list */
02165          exclude = FALSE;
02166          pbl = NULL;
02167          if (par->bank_list != NULL)
02168             for (i = 0; par->bank_list[i].name[0]; i++)
02169                if (*((DWORD *) par->bank_list[i].name) == bkname) {
02170                   pbl = &par->bank_list[i];
02171                   exclude = (pbl->output_flag == 0);
02172                   break;
02173                }
02174 
02175          if (!exclude) {
02176             if (rpc_tid_size(bktype & 0xFF))
02177                size /= rpc_tid_size(bktype & 0xFF);
02178 
02179             lrs1882 = (LRS1882_DATA *) pdata;
02180             lrs1877 = (LRS1877_DATA *) pdata;
02181 
02182             /* write bank header */
02183             *((DWORD *) name) = bkname;
02184 
02185             if ((bktype & 0xFF00) == 0)
02186                strcpy(type_name, rpc_tid_name(bktype & 0xFF));
02187             else if ((bktype & 0xFF00) == TID_LRS1882)
02188                strcpy(type_name, "LRS1882");
02189             else if ((bktype & 0xFF00) == TID_LRS1877)
02190                strcpy(type_name, "LRS1877");
02191             else if ((bktype & 0xFF00) == TID_PCOS3)
02192                strcpy(type_name, "PCOS3");
02193             else
02194                strcpy(type_name, "unknown");
02195 
02196             sprintf(pbuf, "BK %s TP %s SZ %d\n", name, type_name, size);
02197             STR_INC(pbuf, buffer);
02198 
02199             if (bktype == TID_STRUCT) {
02200                if (pbl == NULL)
02201                   cm_msg(MERROR, "write_event_ascii", "received unknown bank %s", name);
02202                else
02203                   /* write structured bank */
02204                   for (i = 0;; i++) {
02205                      status = db_enum_key(hDB, pbl->def_key, i, &hKey);
02206                      if (status == DB_NO_MORE_SUBKEYS)
02207                         break;
02208 
02209                      db_get_key(hDB, hKey, &key);
02210                      sprintf(pbuf, "%s:\n", key.name);
02211                      STR_INC(pbuf, buffer);
02212 
02213                      /* adjust for alignment */
02214                      pdata =
02215                          (void *) VALIGN(pdata,
02216                                          MIN(ss_get_struct_align(), key.item_size));
02217 
02218                      for (j = 0; j < key.num_values; j++) {
02219                         db_sprintf(pbuf, pdata, key.item_size, j, key.type);
02220                         strcat(pbuf, "\n");
02221                         STR_INC(pbuf, buffer);
02222                      }
02223 
02224                      /* shift data pointer to next item */
02225                      pdata = (char *) pdata + key.item_size * key.num_values;
02226                   }
02227             } else {
02228                /* write variable length bank  */
02229                if ((bktype & 0xFF00) == TID_LRS1877) {
02230                   for (i = 0; i < size;) {
02231                      lrs1877_header = (LRS1877_HEADER *) & lrs1877[i];
02232 
02233                      /* print header */
02234                      sprintf(pbuf, "GA %d BF %d CN %d",
02235                              lrs1877_header->geo_addr, lrs1877_header->buffer,
02236                              lrs1877_header->count);
02237                      strcat(pbuf, "\n");
02238                      STR_INC(pbuf, buffer);
02239 
02240                      count = lrs1877_header->count;
02241                      if (count == 0)
02242                         break;
02243                      for (j = 1; j < count; j++) {
02244                         /* print data */
02245                         sprintf(pbuf, "GA %d CH %02d ED %d DA %1.1lf",
02246                                 lrs1877[i].geo_addr, lrs1877[i + j].channel,
02247                                 lrs1877[i + j].edge, lrs1877[i + j].data * 0.5);
02248                         strcat(pbuf, "\n");
02249                         STR_INC(pbuf, buffer);
02250                      }
02251 
02252                      i += count;
02253                   }
02254                } else
02255                   for (i = 0; i < size; i++) {
02256                      if ((bktype & 0xFF00) == 0)
02257                         db_sprintf(pbuf, pdata, size, i, bktype & 0xFF);
02258 
02259                      else if ((bktype & 0xFF00) == TID_LRS1882)
02260                         sprintf(pbuf, "GA %d CH %02d DA %d",
02261                                 lrs1882[i].geo_addr, lrs1882[i].channel, lrs1882[i].data);
02262 
02263                      else if ((bktype & 0xFF00) == TID_PCOS3)
02264                         sprintf(pbuf, "TBD");
02265                      else
02266                         db_sprintf(pbuf, pdata, size, i, bktype & 0xFF);
02267 
02268                      strcat(pbuf, "\n");
02269                      STR_INC(pbuf, buffer);
02270                   }
02271             }
02272          }
02273 
02274       } while (1);
02275    }
02276 
02277   /*---- FIXED format ----------------------------------------------*/
02278    if (event_def->format == FORMAT_FIXED) {
02279       if (event_def->hDefKey == 0)
02280          cm_msg(MERROR, "write_event_ascii", "cannot find event definition");
02281       else {
02282          pdata = (char *) (pevent + 1);
02283          for (i = 0;; i++) {
02284             status = db_enum_key(hDB, event_def->hDefKey, i, &hKey);
02285             if (status == DB_NO_MORE_SUBKEYS)
02286                break;
02287 
02288             db_get_key(hDB, hKey, &key);
02289             sprintf(pbuf, "%s\n", key.name);
02290             STR_INC(pbuf, buffer);
02291 
02292             /* adjust for alignment */
02293             pdata = (void *) VALIGN(pdata, MIN(ss_get_struct_align(), key.item_size));
02294 
02295             for (j = 0; j < key.num_values; j++) {
02296                db_sprintf(pbuf, pdata, key.item_size, j, key.type);
02297                strcat(pbuf, "\n");
02298                STR_INC(pbuf, buffer);
02299             }
02300 
02301             /* shift data pointer to next item */
02302             pdata = (char *) pdata + key.item_size * key.num_values;
02303          }
02304       }
02305    }
02306 
02307    /* insert empty line after each event */
02308    strcat(pbuf, "\n");
02309    size = strlen(buffer);
02310 
02311    /* write record to device */
02312 #ifdef HAVE_ZLIB
02313    if (out_gzip)
02314       status = gzwrite(file, buffer, size) == size ? SS_SUCCESS : SS_FILE_ERROR;
02315    else
02316 #endif
02317       status =
02318           fwrite(buffer, 1, size, file) == (size_t) size ? SS_SUCCESS : SS_FILE_ERROR;
02319 
02320    return status;
02321 }

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

Definition at line 2325 of file mana.c.

02326 {
02327    INT status, size = 0, i;
02328    BOOL exclude;
02329    BANK_HEADER *pbh;
02330    BANK_LIST *pbl;
02331    EVENT_DEF *event_def;
02332    BANK *pbk;
02333    BANK32 *pbk32;
02334    char *pdata, *pdata_copy;
02335    char *pbuf;
02336    EVENT_HEADER *pevent_copy;
02337    DWORD bkname, bksize;
02338    WORD bktype;
02339    static char *buffer = NULL;
02340 
02341    if (buffer == NULL)
02342       buffer = (char *) malloc(MAX_EVENT_SIZE);
02343 
02344    pevent_copy = (EVENT_HEADER *) ALIGN8((POINTER_T) buffer);
02345 
02346    if (clp.filter) {
02347       /* use original event */
02348       size = pevent->data_size + sizeof(EVENT_HEADER);
02349       memcpy(pevent_copy, pevent, size);
02350    } else {
02351       /* copy only banks which are turned on via /analyzer/bank switches */
02352 
02353     /*---- MIDAS format ----------------------------------------------*/
02354 
02355       event_def = db_get_event_definition(pevent->event_id);
02356       if (event_def == NULL)
02357          return SUCCESS;
02358 
02359       if (event_def->format == FORMAT_MIDAS) {
02360          /* copy event header */
02361          pbuf = (char *) pevent_copy;
02362          memcpy(pbuf, pevent, sizeof(EVENT_HEADER));
02363          pbuf += sizeof(EVENT_HEADER);
02364 
02365          pbh = (BANK_HEADER *) (pevent + 1);
02366 
02367          if (bk_is32(pbh))
02368             bk_init32(pbuf);
02369          else
02370             bk_init(pbuf);
02371 
02372          pbk = NULL;
02373          pbk32 = NULL;
02374          pdata_copy = pbuf;
02375          do {
02376             /* scan all banks */
02377             if (bk_is32(pbh)) {
02378                size = bk_iterate32(pbh, &pbk32, &pdata);
02379                if (pbk32 == NULL)
02380                   break;
02381                bkname = *((DWORD *) pbk32->name);
02382                bktype = (WORD) pbk32->type;
02383                bksize = pbk32->data_size;
02384             } else {
02385                size = bk_iterate(pbh, &pbk, &pdata);
02386                if (pbk == NULL)
02387                   break;
02388                bkname = *((DWORD *) pbk->name);
02389                bktype = (WORD) pbk->type;
02390                bksize = pbk->data_size;
02391             }
02392 
02393             /* look if bank is in exclude list */
02394             exclude = FALSE;
02395             pbl = NULL;
02396             if (par->bank_list != NULL)
02397                for (i = 0; par->bank_list[i].name[0]; i++)
02398                   if (*((DWORD *) par->bank_list[i].name) == bkname) {
02399                      pbl = &par->bank_list[i];
02400                      exclude = (pbl->output_flag == 0);
02401                      break;
02402                   }
02403 
02404             if (!exclude) {
02405                /* copy bank */
02406                bk_create(pbuf, (char *) (&bkname), bktype, &pdata_copy);
02407                memcpy(pdata_copy, pdata, bksize);
02408                pdata_copy += bksize;
02409                bk_close(pbuf, pdata_copy);
02410             }
02411 
02412          } while (1);
02413 
02414          /* set event size in header */
02415          size = ALIGN8((POINTER_T) pdata_copy - (POINTER_T) pbuf);
02416          pevent_copy->data_size = size;
02417          size += sizeof(EVENT_HEADER);
02418       }
02419 
02420     /*---- FIXED format ----------------------------------------------*/
02421       if (event_def->format == FORMAT_FIXED) {
02422          size = pevent->data_size + sizeof(EVENT_HEADER);
02423          memcpy(pevent_copy, pevent, size);
02424       }
02425 
02426       if (pevent_copy->data_size == 0)
02427          return SUCCESS;
02428    }
02429 
02430    /* write record to device */
02431 #ifdef HAVE_ZLIB
02432    if (out_gzip)
02433       status = gzwrite(file, pevent_copy, size) == size ? SUCCESS : SS_FILE_ERROR;
02434    else
02435 #endif
02436       status =
02437           fwrite(pevent_copy, 1, size, file) == (size_t) size ? SUCCESS : SS_FILE_ERROR;
02438 
02439    return status;
02440 }

INT write_event_odb ( EVENT_HEADER pevent  ) 

Definition at line 2934 of file mana.c.

02935 {
02936    INT status, size, n_data, i;
02937    BANK_HEADER *pbh;
02938    EVENT_DEF *event_def;
02939    BANK *pbk;
02940    BANK32 *pbk32;
02941    void *pdata;
02942    char name[5];
02943    HNDLE hKeyRoot, hKey;
02944    KEY key;
02945    DWORD bkname;
02946    WORD bktype;
02947 
02948    event_def = db_get_event_definition(pevent->event_id);
02949    if (event_def == NULL)
02950       return SS_SUCCESS;
02951 
02952    /*---- MIDAS format ----------------------------------------------*/
02953 
02954    if (event_def->format == FORMAT_MIDAS) {
02955       pbh = (BANK_HEADER *) (pevent + 1);
02956       pbk = NULL;
02957       pbk32 = NULL;
02958       do {
02959          /* scan all banks */
02960          if (bk_is32(pbh)) {
02961             size = bk_iterate32(pbh, &pbk32, &pdata);
02962             if (pbk32 == NULL)
02963                break;
02964             bkname = *((DWORD *) pbk32->name);
02965             bktype = (WORD) pbk32->type;
02966          } else {
02967             size = bk_iterate(pbh, &pbk, &pdata);
02968             if (pbk == NULL)
02969                break;
02970             bkname = *((DWORD *) pbk->name);
02971             bktype = (WORD) pbk->type;
02972          }
02973 
02974          n_data = size;
02975          if (rpc_tid_size(bktype & 0xFF))
02976             n_data /= rpc_tid_size(bktype & 0xFF);
02977 
02978          /* get bank key */
02979          *((DWORD *) name) = bkname;
02980          name[4] = 0;
02981 
02982          status = db_find_key(hDB, event_def->hDefKey, name, &hKeyRoot);
02983          if (status != DB_SUCCESS) {
02984             cm_msg(MERROR, "write_event_odb", "received unknown bank %s", name);
02985             continue;
02986          }
02987 
02988          if (bktype == TID_STRUCT) {
02989             /* write structured bank */
02990             for (i = 0;; i++) {
02991                status = db_enum_key(hDB, hKeyRoot, i, &hKey);
02992                if (status == DB_NO_MORE_SUBKEYS)
02993                   break;
02994 
02995                db_get_key(hDB, hKey, &key);
02996 
02997                /* adjust for alignment */
02998                if (key.type != TID_STRING && key.type != TID_LINK)
02999                   pdata =
03000                       (void *) VALIGN(pdata, MIN(ss_get_struct_align(), key.item_size));
03001 
03002                status = db_set_data(hDB, hKey, pdata, key.item_size * key.num_values,
03003                                     key.num_values, key.type);
03004                if (status != DB_SUCCESS) {
03005                   cm_msg(MERROR, "write_event_odb", "cannot write %s to ODB", name);
03006                   continue;
03007                }
03008 
03009                /* shift data pointer to next item */
03010                pdata = (char *) pdata + key.item_size * key.num_values;
03011             }
03012          } else {
03013             db_get_key(hDB, hKeyRoot, &key);
03014 
03015             /* write variable length bank  */
03016             if (n_data > 0) {
03017                status = db_set_data(hDB, hKeyRoot, pdata, size, n_data, key.type);
03018                if (status != DB_SUCCESS) {
03019                   cm_msg(MERROR, "write_event_odb", "cannot write %s to ODB", name);
03020                   continue;
03021                }
03022             }
03023          }
03024       } while (1);
03025    }
03026 
03027    /*---- FIXED format ----------------------------------------------*/
03028 
03029    if (event_def->format == FORMAT_FIXED && !clp.online) {
03030       if (db_set_record
03031           (hDB, event_def->hDefKey, (char *) (pevent + 1), pevent->data_size,
03032            0) != DB_SUCCESS)
03033          cm_msg(MERROR, "write_event_odb", "event #%d size mismatch", pevent->event_id);
03034    }
03035 
03036    return SUCCESS;
03037 }


Variable Documentation

ANALYZE_REQUEST* _current_par

Definition at line 3046 of file mana.c.

Referenced by correct_num_events(), and process_event().

ANALYZE_REQUEST analyze_request[]

Definition at line 99 of file analyzer.c.

INT analyzer_loop_period

Definition at line 43 of file analyzer.c.

char* analyzer_name

Definition at line 40 of file analyzer.c.

char* bstr = " "

Definition at line 187 of file mana.c.

struct { ... } clp [static]

Referenced by analyze_run(), bor(), eor(), load_last_histos(), load_parameters(), loop_runs_offline(), main(), mana_init(), odb_load(), process_event(), register_requests(), update_request(), write_event_midas(), and write_event_odb().

struct { ... } clp_descrip[] [static]

Referenced by getparam().

char config_file_name[10][256]

Definition at line 246 of file mana.c.

DWORD current_run_number

Definition at line 209 of file mana.c.

Referenced by bor(), odb_load(), and process_event().

BOOL daemon

Definition at line 255 of file mana.c.

Referenced by main().

void* data

Definition at line 265 of file mana.c.

Referenced by byteOutputOrder(), caenv488_MIW(), caenv488_outb_read(), caenv488_status(), cm_set_client_info(), cmd_dir(), command_loop(), evaluate_src(), exec_script(), gen_odb_attachment(), getparam(), interprete(), load_parameters(), lrs2365_set(), lrs2373_set(), ps7106_set(), scan_tree(), search_callback(), search_key(), set_key(), show_create_page(), show_custom_gif(), show_custom_page(), show_odb_page(), show_odb_tag(), show_sc_page(), show_set_page(), show_start_page(), v1190_DataReady(), v1190_EvtCounter(), v1190_EvtStored(), v1190_GeoWrite(), v1190_MicroFlush(), v1729_PedestalRun(), vf48_ParameterRead(), VPPGBeamCtlRegRead(), VPPGEnableExtTrig(), VPPGExtTrigRegRead(), and write_event_ascii().

BOOL debug

Definition at line 251 of file mana.c.

char description[1000]

Definition at line 264 of file mana.c.

Referenced by getparam().

short int event_id

Definition at line 3042 of file mana.c.

char exp_name[NAME_LENGTH]

Definition at line 240 of file mana.c.

BOOL filter

Definition at line 245 of file mana.c.

char flag_char

Definition at line 263 of file mana.c.

Referenced by getparam().

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:8",                      
   ":C:32",                     
   "",                          
   "",                          
   "",                          
   "",                          
   "",                          

}

Definition at line 696 of file mana.c.

HNDLE hDB

Definition at line 206 of file mana.c.

char host_name[HOST_NAME_LENGTH]

Definition at line 239 of file mana.c.

INT index

Definition at line 268 of file mana.c.

Referenced by bm_check_buffers(), bm_close_buffer(), bm_empty_buffers(), bm_open_buffer(), cm_set_watchdog_params(), condition_test(), create_experim_h(), db_close_database(), db_get_event_definition(), db_open_database(), gdImageSetBrush(), getparam(), interprete(), load_parameters(), load_vars_odb(), load_vars_param(), logger_init(), main(), readHstFile(), register_equipment(), save_vars_odb(), show_alarm_page(), show_custom_gif(), show_custom_page(), show_elog_page(), show_elog_submit_query(), show_hist_config_page(), show_hist_page(), show_odb_tag(), submit_elog(), and VPPGLoad().

char input_file_name[10][256]

Definition at line 241 of file mana.c.

Referenced by loop_runs_offline().

DWORD last_time

Definition at line 3043 of file mana.c.

Referenced by cmd_edit(), lazy_copy(), process_event(), sc_thread(), scan_fragment(), server_loop(), and update_stats().

struct { ... } last_time_event[50] [static]

INT lock_list[10000]

Definition at line 218 of file mana.c.

Referenced by bor(), and lock_histo().

INT lrec

Definition at line 250 of file mana.c.

Referenced by bor().

INT n

Definition at line 267 of file mana.c.

DWORD n[4]

Definition at line 244 of file mana.c.

Referenced by ana_end_of_run(), bor(), cm_execute(), cm_msg_retrieve(), cnaf_callback(), convert_done_list(), db_load(), db_save(), decode_post(), el_submit(), evaluate_src(), getparam(), hs_get_tags_odbc(), initialize_equipment(), interprete(), readHstFile(), scaler_accum(), show_cnaf_page(), show_start_page(), and WriteEvent().

INT n_task

Definition at line 256 of file mana.c.

int n_test = 0

Definition at line 544 of file mana.c.

BOOL no_load

Definition at line 254 of file mana.c.

BOOL ntuple_flag

Definition at line 215 of file mana.c.

INT odb_size

Definition at line 46 of file analyzer.c.

INT online

Definition at line 238 of file mana.c.

BOOL out_append

Definition at line 335 of file mana.c.

Referenced by eor(), and loop_runs_offline().

FILE* out_file

Definition at line 330 of file mana.c.

Referenced by bor(), and eor().

INT out_format

Definition at line 334 of file mana.c.

Referenced by analyze_run(), bor(), and eor().

ANA_OUTPUT_INFO out_info

Definition at line 51 of file mana.c.

char output_file_name[256]

Definition at line 242 of file mana.c.

Referenced by loop_runs_offline().

char param[10][256]

Definition at line 247 of file mana.c.

Referenced by command_loop().

INT pawc_size

char protect[10][256]

Definition at line 248 of file mana.c.

Referenced by db_lock_database(), and db_unlock_database().

INT pvm_buf_size

Definition at line 257 of file mana.c.

BOOL pvm_master = FALSE

Definition at line 185 of file mana.c.

Referenced by bor(), and process_event().

BOOL pvm_slave = FALSE

Definition at line 185 of file mana.c.

Referenced by analyze_run(), bor(), ma_open(), main(), and process_event().

int QUEST[100]

BOOL quiet

Definition at line 253 of file mana.c.

INT root_port

Definition at line 258 of file mana.c.

INT run_number[2]

Definition at line 243 of file mana.c.

BOOL rwnt

Definition at line 249 of file mana.c.

Referenced by write_event_hbook().

BOOL start_rint

Definition at line 259 of file mana.c.

ANA_TEST** tl

Definition at line 543 of file mana.c.

INT type

Definition at line 266 of file mana.c.

Referenced by add_event(), bk_swap(), close_channels(), db_get_event_definition(), export_hist(), getparam(), load_fragment(), midas_bank_display(), midas_bank_display32(), open_history(), PrintTags(), readHstFile(), rpc_server_dispatch(), show_alarm_page(), show_custom_page(), show_elog_new(), show_elog_page(), show_elog_submit_query(), show_status_page(), tr_start(), tr_start_abort(), tr_stop(), vpc6_PATypeRead(), vpc6_PortRegRBRead(), vpc6_PortRegRead(), and vpc6_PortTypeRead().

BOOL verbose

Definition at line 252 of file mana.c.


Midas DOC Version 3.0.0 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Exaos Lee - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk