Storing parameters in Oracle

All tree-style and condition-style parameter containers can be stored in Oracle in the following way:
  1. The parameter container is written to Oracle with a ROOT macro.
  2. The parameters are then validated for a certain time range with a WebDB GUI.
ALERT! Without the second step the data cannot be used for (an automatic) initialization.

While the macro looks the same for both types of parameter containers, the WebDb GUIs are different.

The macro

To write the data to Oracle is almost the same as writing to an ASCII or ROOT file, besides three exceptions:
  • You must open the Oracle connection as a user with write privilege and it prompts you for the password
  • You must set the author and a comment for the parameters in the parameter container
  • You must explicitly call the write function of each parameter container to be stored using the pointer to the Oracle output as argument.

Example macro

The following macro writes the (condition-style) parameter container HWallRefWinPar initialized from an ASCII file to Oracle. %begin c++% { // create a Hades object and get the pointer to the runtime database Hades* myHades=new Hades; HRuntimeDb* rtdb=gHades->getRuntimeDb();

// create the input HParAsciiFileIo* input=new HParAsciiFileIo; input->open("wallParams.txt"); rtdb->setFirstInput(input);

// define Oracle as Output // connect as user with write privilege HParOraIo* ora=new HParOraIo; ora->open("wall_oper"); rtdb->setOutput(ora);

// create the parameter container HWallRefWinPar* pPar=(HWallRefWinPar*)(rtdb->getContainer("WallRefWinPar"));

// initialize the parameter container Bool_t rc=rtdb->initContainers(1347612441);

// set the author and the comment in the parameter container (mandatory!) pPar->setAuthor("Ilse Koenig"); pPar->setDescription("Test of Oracle interface");

// write the parameters to Oracle if (rc) { pPar->write(ora); }

// delete the Hades object delete myHades; } %end% The interface creates a new version for the parameters and then writes the data for this new version. As output on the screen you see the new version number and typically the number of parameters written to Oracle.

Testing condition-style parameters written to Oracle before validation

Condition-style parameter containers are not written directly to the final tables but to an intermedied LOAD table. For testing purposes you may read the data of certain version from this LOAD table with the function
  // Arguments: pPar    = the pointer to the parameter container
  //            version = parameter version in the LOAD table
  Bool_t HCondParOraIo::readFromLoadingTable(HParCond* pPar,Int_t version)

Example: %begin c++% // get a pointer to the interface for condition-style parameter containers // where ora is the pointer to the Oracle input or output HCondParOraIo* condParIo=(HCondParOraIo*)(ora->getDetParIo("HCondParIo")); condParIo->readFromLoadingTable(pPar,490) %end% TIP This is especially usefull for parameters stored in binary format in Oracle, which cannot be decoded with the WebDB GUI.

Parameter validation for condition-style parameter containers

See here

Parameter validation for tree-style parameter containers

See here

-- IlseKoenig - 27 Jun 2007
Topic revision: r1 - 2007-06-27, IlseKoenig
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki Send feedback | Imprint | Privacy Policy (in German)