Parameter handling Parameter handling and the HADES Oracle database and the HADES Oracle database Ilse Koenig, GSI HADES Analysis workshop, May 2017 Outline: Initialization concept Runtime database Parameter containers Example macros Version management Parameter file generator Documentation on HADES computing page: HYDRA MANUALS: Parameter Initialization, Geometry
The HADES Oracle database The HADES Oracle database users DAQ EPICS web interface ROOT macros file catalog slow control data beam time logbook Oracle setup of electronics geometry parameters Run: related to runs by time stamps smallest data set individually treated several files, one per event builder online simulation analysis offline analysis Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 2
Examples for parameters needed for a DST production Examples for parameters needed for a DST production Experiment Simulation thresholds GEANT geometry channel masks Unpacking lookup tables digitization Digitization parameters Calibration calibration parameters Hit parameters for hit finding reconstruction geometry alignment Correlation, field map momentum reconstruction, spline parameters ... matching windows ... Track candidates In total more than 100 parameter containers, about 70 needed for a DST production Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 3
Analysis initialization concept Analysis initialization concept Web GUI separate shared libraries Oracle Precompiler Oracle ASCII Files ASCII, ROOT Files HYDRA HYDRA Geometry Interface Runtime Database HGEANT ROOT TGeoManager Designed for automatic initialization Parameters (numbers, arrays, user defined or ROOT classes,…) are stored in parameter containers , automatically in the init-functions of the unpackers and analysis tasks and managed by the runtime database classes. User chooses one or two parameter sources in the analysis macro. The analyzed files define the parameter versions . Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 4
Runtime Database Runtime Database Parameter containers: Container factories: derived from base class HParSet defines virtual functions init, write, clear, … loaded when Hydra2 is loaded data members: parameter context, IO versions, ... one for each shared library with parameters flags: static, changed containers functions to create the parameter containers created via container factories in a macro or the init function of a task (calls constructor if not existing) List of runs: rtdb->getContainer(“ContainerName”); added during initialization to search for a parameter container use rtdb->initContainers(runId); rtdb->findContainer(“...”) Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 5
Parameter IO Parameter IO Oracle HParOra2Io* ora = new HParOra2Io; ora->open(); // input (default user HADES_ANA) ora->open(“rich_oper”); // input/output (user with write access) Root file HParRootFileIo* file = new HParRootFileIo; file->open(“xxx.root”); // input (default “READ”) → file open(“xxx.root”,”RECREATE”); // output ASCII file HParAsciiFileIo* file = new HParAsciiFileIo; file->open(“xxx.txt”); // input (default “in”) file->open(“xxx.txt”,”out”); // output rtdb->setFirstInput(io); rtdb->setSecondInput(io); rtdb->setOutput(io); Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 6
Flow of initialization Flow of initialization calls rtdb->initContainers(runId) loops over all parameter containers tries to initialize a container from 1st input, if it fails from 2nd input Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 7
Example initialization macro init_params.C Example initialization macro init_params.C // create the parameter containers { rtdb->getContainer("WallCalPar"); // create a Hades object and get the rtdb->getContainer("WallRefWinPar"); // pointers to the runtime database and // the spectrometer // initialize the parameter containers Hades* myHades = new Hades; rtdb->initContainers(1620123104); HSpectrometer* spec = gHades->getSetup(); HRuntimeDb* rtdb = gHades->getRuntimeDb(); // save the output // (writes the data to the file) rtdb->saveOutput(); // create the detector and its setup // and add it in the spectrometer // print content of the runtime HWallDetector* wall = new HWallDetector; // database on the screen Int_t mods[] = {1}; rtdb->print(); wall->setModules(-1,mods); // delete the Hades object spec->addDetector(wall); delete myHades; } // define the input HParOra2Io* ora = new HParOra2Io; ora->open(); ora->setHistoryDate("now"); rtdb->setFirstInput(ora); // define the output HParRootFileIo* output = new HParRootFileIo; output->open("wallParams.root","RECREATE"); rtdb->setOutput(output); Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 8
Layout of parameter containers Layout of parameter containers Basically two groups of parameter containers : 1. “Tree-style”: array of objects each containing the same list of parameters Data are stored in one or more individual tables in Oracle. Each parameter corresponds to a table column. Many records together form a version set of the parameter container . Advantage: enforcement of data consistency via constraints and triggers Disadvantage: more dedicated C++ code needed, lack of flexibility Adding or discarding parameters needs changes in the tables and interfaces have to be done by an expert Suitable only for stable code Used for low-level analysis parameters Example: Lookup table for an unpacker (maps readout channels to detector cells) Constraints guarantee for each parameter container version that one readout channel maps to only one detector cell and both are unique. Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 9
Generic parameter container HParCond Generic parameter container HParCond All parameters are stored as name – object pairs in the same set of tables different versions parameter container parameter object name data stored as byte array (RAW or BLOB) type: Int_t, Float_t, Double_t, Char_t, number of values (single value or array) Text_t, UChar_t, class type class version streamer info, root version for ROOT classes own version management any class derived from TObject decoded in the analysis interface allows to add or discard (invalidate) a parameter by ROOT streamer makes it (almost) code independent Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 10
Implementation and interfaces Implementation and interfaces for generic parameter containers for generic parameter containers Generic read and write interfaces for Oracle, ROOT and ASCII files implemented in base classes The Oracle interface stores a snapshot of parameters in a ROOT TList. The parameter container copies only parameters defined in the actual code version. The user stores the parameter in Oracle by a ROOT macro. At validation, new parameters are added automatically. Old parameters no longer needed stay valid until explicitly set invalid. Requires only a few lines of dedicated C++ code in the container class implementation of virtual void putParams(HParamList*)=0; virtual Bool_t getParams(HParamList*)=0; virtual void printParams(); (only needed for special layout) No database expert needed! Data consistency must be checked by the user. Web-based graphical interface to Oracle for validation, searches and comparisons Suitable also for non-stable code Used for conditions and high-level analysis parameters Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 11
Example: HRpcHitFPar (hrpchitfpar.h) Example: HRpcHitFPar (hrpchitfpar.h) Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 12
hrpchitfpar.cc (format changed slightly, comments added) hrpchitfpar.cc (format changed slightly, comments added) Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 13
Write to Oracle (demo macro writeParToOra.C) Write to Oracle (demo macro writeParToOra.C) Stored in intermediate „LOAD“ table WebDB GUI for validation Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 14
Version management Version management ASCII file: no version management ROOT file: local version management may store different versions of the same parameter container (the variable fCycle in TKey ) version table stores the version number for each run and each parameter container stores the detector setup parameter file for local access snapshots of versions in Oracle If the run id is not found in the ROOT file, the parameter containers cannot be initialized for ! this run. But you may use an other run in the file as a reference run. Oracle: complete history of all parameters since 2002 Storage of parameters: 1. Insert of parameters with a ROOT macro 2. Validation with web GUI Parameter handling - HADES Analysis Workshop at GSI, May 10-11 2017 15
Recommend
More recommend