How to make a "condition-style" parameter container

1. Step
Write the class, derive it from HParCond and implement the virtual functions:
   // Fills all persistent data members into the list for write.
   void putParams(HParamList*)

   // Fills all persistent data members from the list after reading.
   // The function returns false, when a data member is not in the list.
   Bool_t getParams(HParamList*)

Use the the "detector" I/O HCondParIO in the init and write function
   // Reads the data from an input
   Bool_t init(HParIo*, Int_t* set = 0)

   // Writes the data to an output
   Int_t write(HParIo*)

Design considerations:
  • Split the parameters
    If parameters are split, they can be retrieved from the parameter list with old and new code. The actual code simply takes from the list only the parameters it needs.
    (The Oracle interface fills all valid parameter into the list. Old parameters not present anymore in the new class version, are not invalidated, at least not automatically, and therefore still present in the list).

  • Use ROOT arrays TArrayI, TArrayF, TArrayD for small arrays and if the full precision of a float or double variable is not needed.
    The user can see the data in WebDB and the data can be written to an ASCII file, while this is not possible for binary arrays.
    The size is not fixed. People using old code can still read and use the data, if additional data members are added at the end in a new class version.

  • Use Histograms or classes only, if it is really necessary.
    Classes are streamed to a binary object using the class streamer. But the streamer is only backward compatible, never forward compatible.
    If the class changes and the data are stored in Oracle, people cannot initialize the parameter container any longer with old code without setting a history date (date before the new data were validated). The history data on the other side is global for all parameter containers, which implies that also all other parameter containers will be initialized with the versions valid at this history date. The people must create therefor a ROOT file for all other parameter containers for which they want to use more recent data.

Add the parameter container and its contexts in the container factory of the library, which contains the class.

3. Step
Make sure, that the code is accepted by the HADES Software Board and will be committed to CVS /SVN.
ALERT! Do not continue with step 4 and 5, as long it is not accepted!

4. Step
Add the class and its contexts in Oracle via the WebDB application
          -> Params & Conds
                         -> Show, add and change parameter classes and its contexts
Click on the question mark in the header line for instructions.

5. Step
Write the parameters to Oracle and validate them.

-- IlseKoenig - 16 Jul 2007
Topic revision: r1 - 16 Jul 2007, IlseKoenig
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Hades Wiki? Send feedback
Imprint (in German)
Privacy Policy (in German)