Ejemplo n.º 1
0
INT analyzer_init()
{

   HNDLE hDB, hKey;
   char str[80];

   RUNINFO_STR(runinfo_str);
   EXP_PARAM_STR(exp_param_str);
   GLOBAL_PARAM_STR(global_param_str);
   TRIGGER_SETTINGS_STR(trigger_settings_str);

   /* open ODB structures */
   cm_get_experiment_database(&hDB, NULL);
   db_create_record(hDB, 0, "/Runinfo", strcomb((const char **)runinfo_str));
   db_find_key(hDB, 0, "/Runinfo", &hKey);
   if (db_open_record(hDB, hKey, &runinfo, sizeof(runinfo), MODE_READ, NULL, NULL) !=
       DB_SUCCESS) {
      cm_msg(MERROR, "analyzer_init", "Cannot open \"/Runinfo\" tree in ODB");
      return 0;
   }

   db_create_record(hDB, 0, "/Experiment/Run Parameters", strcomb((const char **)exp_param_str));
   db_find_key(hDB, 0, "/Experiment/Run Parameters", &hKey);
   if (db_open_record(hDB, hKey, &exp_param, sizeof(exp_param), MODE_READ, NULL, NULL) !=
       DB_SUCCESS) {
      cm_msg(MERROR, "analyzer_init",
             "Cannot open \"/Experiment/Run Parameters\" tree in ODB");
      return 0;
   }

   sprintf(str, "/%s/Parameters/Global", analyzer_name);
   db_create_record(hDB, 0, str, strcomb((const char **)global_param_str));
   db_find_key(hDB, 0, str, &hKey);
   if (db_open_record
       (hDB, hKey, &global_param, sizeof(global_param), MODE_READ, NULL,
        NULL) != DB_SUCCESS) {
      cm_msg(MERROR, "analyzer_init", "Cannot open \"%s\" tree in ODB", str);
      return 0;
   }

   db_create_record(hDB, 0, "/Equipment/Trigger/Settings", strcomb((const char **)trigger_settings_str));
   db_find_key(hDB, 0, "/Equipment/Trigger/Settings", &hKey);

   if (db_open_record
       (hDB, hKey, &trigger_settings, sizeof(trigger_settings), MODE_READ, NULL,
        NULL) != DB_SUCCESS) {
      cm_msg(MERROR, "analyzer_init",
             "Cannot open \"/Equipment/Trigger/Settings\" tree in ODB");
      return 0;
   }

   //Initialize gData
   gData = new TEnvi();

   return SUCCESS;
}
Ejemplo n.º 2
0
/*-- Analyzer Init -------------------------------------------------*/
INT analyzer_init()
{
    HNDLE hDB, hKey;
    char str[80];

    RUNINFO_STR(runinfo_str);            // RUNINFO_STR in experim.h      rn:  not true !?!?!
    EXP_PARAM_STR(exp_param_str);        // EXP_PARAM_STR in experim.h    rn:  not true !!?!?!
    //GLOBAL_PARAM_STR(global_param_str);  // GLOBAL_PARAM_STR in experim.h

    /* open ODB structures */
    cm_get_experiment_database(&hDB, NULL);
    db_create_record(hDB, 0, "/Runinfo", strcomb(runinfo_str));
    db_find_key(hDB, 0, "/Runinfo", &hKey);
    if (db_open_record(hDB, hKey, &runinfo, sizeof(runinfo), MODE_READ, NULL, NULL) !=
            DB_SUCCESS) {
        cm_msg(MERROR, "analyzer_init", "Cannot open \"/Runinfo\" tree in ODB");
        return 0;
    }


    db_create_record(hDB, 0, "/Experiment/Run Parameters", strcomb(exp_param_str));
    db_find_key(hDB, 0, "/Experiment/Run Parameters", &hKey);
    if (db_open_record(hDB, hKey, &exp_param, sizeof(exp_param), MODE_READ, NULL, NULL) !=
            DB_SUCCESS) {
        cm_msg(MERROR, "analyzer_init",
               "Cannot open \"/Experiment/Run Parameters\" tree in ODB");
        return 0;
    }

    //printf("\n---testing testing 123----------------------------------------------- %i  \n\n\n\n ",runinfo.run_number);
    //runnr=runinfo.run_number;


    ParameterInit();


    return SUCCESS;
}