Persistency Author: Youhei Morita.

Slides:



Advertisements
Similar presentations
Object Persistency & Data Handling Session C - Summary Object Persistency & Data Handling Session C - Summary Dirk Duellmann.
Advertisements

Chapter 10: Designing Databases
March 24-28, 2003Computing for High-Energy Physics Configuration Database for BaBar On-line Rainer Bartoldus, Gregory Dubois-Felsmann, Yury Kolomensky,
M. D'Amato, M. Mennea, L.Silvestris INFN-Bari CMS Data Model 9-11 Aprile 2001, Catania I Workshop INFN Grid CMS DATA MODEL M. D’Amato, M. Mennea, L. Silvestris.
Object Databases Baochuan Lu. outline Concepts for Object Databases Object Database Standards, Languages, and Design Object-Relational and Extended-Relational.
Other GEANT4 capabilities Event biasing Parameterisation (fast simulation) Persistency Parallelisation and integration in a distributed computing environment.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Fundamentals, Design, and Implementation, 9/e Chapter 16 Object-Oriented Database Processing.
Lecture 9 Concepts of Programming Languages
1 A Student Guide to Object- Orientated Development Chapter 9 Design.
Object-Oriented Methods: Database Technology An introduction.
RIZWAN REHMAN, CCS, DU. Advantages of ORDBMSs  The main advantages of extending the relational data model come from reuse and sharing.  Reuse comes.
CIT241 Prerequisite Knowledge ◦ Variables ◦ Operators ◦ C++ Syntax ◦ Program Structure ◦ Classes  Basic Structure of a class  Concept of Data Hiding.
EER vs. UML Terminology EER Diagram Entity Type Entity Attribute
From C++ to C#. Web programming The course is on web programming using ASP.Net and C# The course is on web programming using ASP.Net and C# ASP.Net is.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
LCIO A persistency framework for LC detector simulation studies Frank Gaede, DESY, IT 4 th ECFA/DESY LC Workshop Amsterdam April 1 st -4 th 2003.
DBMS Lecture 9  Object Database Management Group –12 Rules for an OODBMS –Components of the ODMG standard  OODBMS Object Model Schema  OO Data Model.
Mokka and integration of the geometry AIDA kick-off meeting WP2 session: Common software tools 17 February 2011 – CERN Paulo Mora de Freitas and Gabriel.
CSE 425: Object-Oriented Programming I Object-Oriented Programming A design method as well as a programming paradigm –For example, CRC cards, noun-verb.
Object oriented databases
ObjectStore Database System By C. Lamb, G Landis, J.Orenstein, L. Weinreb Presentation by Meghana Chemburkar December 4, 2002 Instructor: Dr.Vasilis Megalooikonomou.
2nd LHC Computing Workshop, Barcelona IT/ASD CERN LHCC Computing Board An Introduction Jamie Shiers, IT/ASD, CERN Reviewer Member,
CHEP 2003 March 22-28, 2003 POOL Data Storage, Cache and Conversion Mechanism Motivation Data access Generic model Experience & Conclusions D.Düllmann,
Gaudi Framework Tutorial, April Algorithm Tools: what they are, how to write them, how to use them.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Apr. 8, 2002Calibration Database Browser Workshop1 Database Access Using D0OM H. Greenlee Calibration Database Browser Workshop Apr. 8, 2002.
Geant4 Collaboration 1 Persistency M7 Unit 3. Geant4 Collaboration 2 Category Requirements oGeant4 Persistency makes run, event, hits, digits and geometry.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Run and Event G4Run and G4RunManager In Geant4, the Run is the largest unit of simulation and it consist of a series of events Within a Run, the detector.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
© D. Wong Security and User Authorization in SQL 8.7 pp. 410  Authorization ID = user name  Special authorization ID: PUBLIC  Privileges for:
LCIO A persistency framework and data model for the linear collider CHEP 04, Interlaken Core Software, Wednesday Frank Gaede, DESY -IT-
STAR C OMPUTING Plans for Production Use of Grand Challenge Software in STAR Torre Wenaus BNL Grand Challenge Meeting LBNL 10/23/98.
The ODMG Standard for Object Databases
Some Ideas for a Revised Requirement List Dirk Duellmann.
Object storage and object interoperability
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Andrea Valassi (CERN IT-DB)CHEP 2004 Poster Session (Thursday, 30 September 2004) 1 HARP DATA AND SOFTWARE MIGRATION FROM TO ORACLE Authors: A.Valassi,
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database.
1 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 10 Designing Databases.
AliRoot Classes for access to Calibration and Alignment objects Magali Gruwé CERN PH/AIP ALICE Offline Meeting February 17 th 2005 To be presented to detector.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Evaluation of the C++ binding to the Oracle Database System Dirk Geppert and Krzysztof Nienartowicz, IT/DB CERN IT Fellow Seminar November 20, 2002.
HYDRA Framework. Setup of software environment Setup of software environment Using the documentation Using the documentation How to compile a program.
Pointer to an Object Can define a pointer to an object:
Copyright © Jim Fawcett Spring 2017
Common Object Request Broker Architecture (CORBA)
CSE687 – Object Oriented Design
Abstract Data Types and Encapsulation Concepts
C++ Templates.
OBJECTS & DATABASES Arnaud Sahuguet – CIS-550.
Open Source distributed document DB for an enterprise
Object-Oriented Databases
C++ Standard Library.
Geant4 Geometry Objects Persistency using ROOT
Appendix D: Network Model
Object-Orientated Programming
Chapter 12 Outline Overview of Object Database Concepts
Lecture 9 Concepts of Programming Languages
Abstract Data Types and Encapsulation Concepts
Chapter 2 Database Environment.
Basic C++ What’s a declaration? What’s a definition?
Abstract Data Types and Encapsulation Concepts
Other GEANT4 capabilities
From C++ to Java Java history: Oak, toaster-ovens, internet language, panacea What it is O-O language, not a hybrid (cf. C++) compiled to byte-code, executed.
HepODBMS A higher level interface to ODBMS
Overview of C++ Polymorphism
Event Storage GAUDI - Data access/storage Framework related issues
Lecture 9 Concepts of Programming Languages
Presentation transcript:

Persistency Author: Youhei Morita

Note by MGP As a novice user developing small/medium scale simulation applications, you are probably not interested in the details of persistency as described in the following Most probably, simple analysis objects (like tuple) would be sufficient to store the output of your simulation for further analysis

Category Requirements Geant4 Persistency makes run, event, hits, digits and geometry information be persistent, to be read back later by user programs Geant4 shall make use of industrial standard ODMG C++ binding and HepODBMS as persistency interface Kernel part of Geant4 should not be affected by the choice of persistency mechanism (Geant4 should be able to run with or without persistency mechanism)

What is “object persistency” ? Persistent object lives beyond an application process, may be accessed by other processes. When an object is “deactivated”, state of the object are stored into the database system. Once “activated”, the state information of the object is read back from the database.

What is ODMG ? Object Database Management Group a non-profit consortium of vendors and interested parties who collaborate to develop and promote standards for object database management systems (ODBMS). http://www.odmg.org/ ODBMS Standard Documents ODMG 2.0 released in 1997 Object Model Object Definition Language Object Query Language Language Bindings to C++, SmallTalk, Java

C++ Binding of ODMG Design persistent class using ODL (Object Definition Language) class G4PEvent : public HepPersObj {  public: persistent-capable base class G4PEvent(); : private: G4Pint eventID;  persistent-capable type } Compile ODL files (schema) to schema metadata, C++ header files, wrapper C++ source code. ex. Objectivity/DB: ooddlx preprocessor processes *.ddl files into *.hh, *_ref.hh, *_ddl.cc files, and stores schema metadata into a federated database file.

What is HepODBMS ? C++ class library that provides a simplified and consistent interface to underlying ODMG-compliant Object Database Management System Current implementation is based on Objectivity/DB Goals: an insulation layer to minimize dependencies on a given database vendor or release. high level base classes that encapsulate features such as clustering and locking strategies, database session transaction control, event collections, selection predicates, tagDB access and calibration whilst not introducing any significant performance or storage overhead. See Also: http://wwwinfo.cern.ch/asd/lhc++/HepODBMS/user-guide/H1Introduction.html

Persistency in Geant4 “Parallel World” approach Data members of transient and persistent objects are copied by Store( ) and Retrieve( ) G4 kernel objects have corresponding “P” objects in G4Persistency G4Run  G4PRun G4Event  G4PEvent G4Hit  G4PHit : : Store( ) Retrieve( ) Inherits from HepPersObj in HepODBMS

Persistency in Geant4 (2) Top Level Class Diagram Transient G4 objects are “stored” by G4RunManager through abstract interface of G4VPersistencyManager. Database file names are given via G4PerrsistencyMessenger. Interface to HepODBMS transactions are “wrapped” at G4TransactionManager. Data member copy of transient and persistent objects are handled by G4PersistentEventMan, G4PersistentHitMan, etc. G4RunManager G4UImessenger G4VPersistencyManager G4PersistencyMessenger G4PersistencyManager G4TransactionManager G4PersistentSubMan G4PersistentSubDbMan HepDbApplication G4PersistentEventMan

How to design your own persistent objects in ODBMS Design persistent-capable classes Design the object clustering Design the access patterns Design the transaction scenario

How to design your own persistent objects in ODBMS: Design persistent-capable classes Create ODL (DDL) files (similar to C++ header files) Inherit “persistency” from HepPersObj Use ODMG persistent basic types such as d_Double, d_Float In Geant4, basic types are cast into G4Pint, G4Pdoulbe etc in G4PersistentTypes.hh Use HepRef() macro as smart pointers of persistent objects in run time HepRef(G4PEvent) anEvt; anEvt = new G4PEvent(….); Use d_Ref<> template for embedded persistent association in ODL class G4PEvent : public HepPersObj { … d_Ref<G4PPrimaryVertex> thePrimaryVertex; … } Use d_Varray<> template for variable length array

How to design your own persistent objects in ODBMS: Design persistent-capable classes - G4PEvent.ddl Inherit persistency from persistent base class class G4PEvent : public HepPersObj { public: G4PEvent(); G4PEvent(const G4Event *evt); G4PEvent(const G4Event *evt, HepRef(G4PHCofThisEvent) pHC, HepRef(G4PDCofThisEvent) pDC); ~G4PEvent(); private: G4Pint eventID; d_Ref<G4PPrimaryVertex> thePrimaryVertex; G4Pint numberOfPrimaryVertex; d_Ref<G4PHCofThisEvent> HC; d_Ref<G4PDCofThisEvent> DC; void SetEventID(const G4Event *evt); inline G4int GetEventID() const { return eventID; } inline void AddPrimaryVertex(HepRef(G4PPrimaryVertex) aPrimaryVertex) {…} inline G4int GetNumberOfPrimaryVertex() const { return numberOfPrimaryVertex; } …<skipped>... }; Smart pointers to other persistent objects in run time Persistent base types Embedded association to other persistent objects

aVertex will be stored near How to design your own persistent objects in ODBMS: Design the object clustering Organize a group of classes which will be accessed simultaneously Use “new” operator with clustering directive: e.g.. HepClusteringHint Use “new” operator with neighboring object e.g.. In the constructor of G4PEvent::G4PEvent(...) …. aVertex = new (ooThis()) G4PPrimaryVertex(…); …. aVertex will be stored near this G4PEvent object Runs FDDB System Events Geometry Boot file exampleFD G4PEvent G4PPrimaryVertex G4PPrimaryParticle

Returns a smart pointer of How to design your own persistent objects in ODBMS: Design the access patterns Decide the primary object(s) to be picked up from the database Make a loop of iteration for the primary object ooItr(G4PEvent) pevent_iterator; pevent_iterator.scan(container); while (pevent_iterator.next()) { // loop for all G4PEvent’s in this container… int evt_id = pevent_iterator->GetEventID(); ... } Follow the association for the related objects for ( int i = 0; i < n_pvertex; i++ ) // Loop for all primary vertex in this event HepRef(G4PPrimaryVertex) pvertex = pevent_iterator->GetPrimaryVertex(i); cout << " No. of particle in the primary vertex: " << pvertex->GetNumberOfParticle() << G4endl; Iterator for G4PEvent Using the Iterator Using the (1st) G4PEvent Returns a smart pointer of the G4PPrimaryVertex

How to design your own persistent objects in ODBMS: Design the transaction scenario Access to any persistent objects should be a part of “transaction” HepDbApplication::Init() HepDbApplication::startRead() HepDbApplication::startUpdate() HepDbApplication::commit() HepDbApplication::abort() HepODBMS with Objectivity/DB has a choice of selecting “database” and “container” HepDbApplication::db(dbName) HepDbApplication::container(containerName)

How to design your own persistent objects in ODBMS: Design the transaction scenario - readDB.cpp HepDbApplication* dbApp = new HepDbApplication(name); …... dbApp->Init(); // initialise the db session dbApp->startRead(); // start a read transaction HepDatabaseRef myDb = dbApp->db("Events"); // select “Events” database HepContainerRef cont = dbApp->container("EventContainer"); // select “EventContainer” container ooItr(G4PEvent) pevent_iterator; // initialize iterator for G4PEvent pevent_iterator.scan(cont); while (pevent_iterator.next()) // Loop for all G4PEvent { int evt_id = pevent_iterator->GetEventID(); // access this G4PEvent int n_pvertex = pevent_iterator->GetNumberOfPrimaryVertex(); } // End of loop over events dbApp->commit(); // finish this read transaction

Persistent Objects in “Events” Database

Example Database Configuration $OO_FD_BOOT FDDB System Boot file exampleSchema Runs FDDB System Events Geometry Boot file exampleFD “gmake newfd” Lock Server oocheckls oolockserver ookillls oodump Persistent Ex01/02 readDB hits2digits

How to build G4 Persistent Libraries Define variables $G4USE_HEPODBMS = 1 $G4EXAMPLE_FDID Define HepODBMS variables $HEP_ODBMS_DIR $HEP_ODBMS_INCLUDES Include HepODBMS and Objectivity library path into $LD_LIBRARY_PATH Setup Objectivity variables (e.g.. on CERN AFS) source /afs/cern.ch/rd45/objectivity/objyenv.csh (csh) . /afs/cern.ch/rd45/objectivity/objyenv.sh (bsh) Check and start “Lock Server” Type “gmake” in $G4INSTALL/source See $G4INSTALL/examples/extended/persistency/PersistentEx01/README for more detail (see also the release note for version information)

Geant4 examples illustrating persistency features Extended examples PersistentEx01: Make persistent Run/Event/Geometry objects readDB: standalone HepODBMS example to read objects createTag: standalone example to create HepODBMS tag readTag: standalone example to read HepODBMS tag PersistentEx02: Make user defined persistent Hits objects