Geant4 Collaboration 1 Persistency M7 Unit 3. Geant4 Collaboration 2 Category Requirements oGeant4 Persistency makes run, event, hits, digits and geometry.

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,
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.
ODMG Standard: Object Model1 OBJECT-ORIENTED DATABASE SYSTEMS ODMG Standard: Object Model Susan D. Urban and Suzanne W. Dietrich Department of Computer.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Principles of Object-Oriented Software Development The language Java.
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases.
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.
Data Persistence and Object-Relational Mapping Slides by James Brucker, used with his permission 1.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
DBMS Lecture 9  Object Database Management Group –12 Rules for an OODBMS –Components of the ODMG standard  OODBMS Object Model Schema  OO Data Model.
CSS/417 Introduction to Database Management Systems Workshop 5.
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.
Intro-Part 1 Introduction to Database Management: Ch 1 & 2.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 4th Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
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,
Object-Oriented Database Processing
Hibernate Persistence. What is Persistence Persist data to database or other storage.  In OO world, persistence means persist object to external storage.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 18 Object- Oriented Database Processing.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
A Histogramming Package in Java CHEP 2000 February 10, 2000 Teatro Antonianum, Padova Naomi Takashimizu/Shimane University Takashi Sasaki/KEK.
Gaudi Framework Tutorial, April Algorithm Tools: what they are, how to write them, how to use them.
Copyright © 2004 Pearson Education, Inc.. Chapter 21 Object Database Standards, Languages, and Design.
CS 376b Introduction to Computer Vision 01 / 23 / 2008 Instructor: Michael Eckmann.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Netprog: Corba Object Services1 CORBA 2.0 Object Services Ref: The Essential Distributed Objects Survival Guide: Orfali, Harky & Edwards.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Apr. 8, 2002Calibration Database Browser Workshop1 Database Access Using D0OM H. Greenlee Calibration Database Browser Workshop Apr. 8, 2002.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Ch- 8. Class Diagrams Class diagrams are the most common diagram found in modeling object- oriented systems. Class diagrams are important not only for.
© D. Wong Security and User Authorization in SQL 8.7 pp. 410  Authorization ID = user name  Special authorization ID: PUBLIC  Privileges for:
CSE323 การวิเคราะห์และออกแบบระบบ (Systems Analysis and Design) Lecture 12: Data Management Design.
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.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
Overview of C/C++ DB APIs Dirk Düllmann, IT-ADC Database Workshop for LHC developers 27 January, 2005.
Singleton Academy, Pune. Course syllabus Singleton Academy Pune – Course Syllabus1.
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.
CPSC 252 ADTs and C++ Classes Page 1 Abstract data types (ADTs) An abstract data type is a user-defined data type that has: private data hidden inside.
OOPSLA Lab1 Chapter 7 Java Binding Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National University.
Evaluation of the C++ binding to the Oracle Database System Dirk Geppert and Krzysztof Nienartowicz, IT/DB CERN IT Fellow Seminar November 20, 2002.
OBJECTS & DATABASES Arnaud Sahuguet – CIS-550.
Open Source distributed document DB for an enterprise
Persistency Author: Youhei Morita.
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
Other GEANT4 capabilities
HepODBMS A higher level interface to ODBMS
Lecture 9 Concepts of Programming Languages
Presentation transcript:

Geant4 Collaboration 1 Persistency M7 Unit 3

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

Geant4 Collaboration 3 What is “object persistency” ? oPersistent object lives beyond an application process, may be accessed by other processes. oWhen 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.

Geant4 Collaboration 4 What is ODMG ? oObject 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). oODBMS Standard Documents ODMG 2.0 released in 1997 F Object Model F Object Definition Language F Object Query Language F Language Bindings to C++, SmallTalk, Java

Geant4 Collaboration 5 C++ Binding of ODMG oDesign persistent class using ODL (Object Definition Language) class G4PEvent : public HepPersObj {  public: persistent-capable base class G4PEvent(); : private: G4Pint eventID;  persistent-capable type : } oCompile 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.

Geant4 Collaboration 6 What is HepODBMS ? oC++ class library that provides a simplified and consistent interface to underlying ODMG-compliant Object Database Management System oCurrent implementation is based on Objectivity/DB oGoals: l an insulation layer to minimize dependencies on a given database vendor or release. l high level base classes that encapsulate features such as clustering and locking strategies, database session l transaction control, event collections, selection predicates, tagDB access and calibration l whilst not introducing any significant performance or storage overhead. oSee Also:

Geant4 Collaboration 7 Persistency in Geant4 o“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 : G4 kernel objects have corresponding “P” objects in G4Persistency G4Run  G4PRun G4Event  G4PEvent G4Hit  G4PHit : Store( ) Retrieve( ) Inherits from HepPersObj in HepODBMS

Geant4 Collaboration 8 Persistency in Geant4 (2) oTop Level Class Diagram G4RunManager G4PersistencyMessengerG4UImessengerG4PersistencyManagerG4VPersistencyManagerG4TransactionManagerHepDbApplicationG4PersistentSubDbManG4PersistentSubManG4PersistentEventMan oTransient G4 objects are “stored” by G4RunManager thru abstract interface of G4VPersistencyManager. oDatabase file names are given via G4PerrsistencyMessenger. oInterface to HepODBMS transactions are “wrapped” at G4TransactionManager. oData member copy of transient and persistent objects are handled by G4PersistentEventMan, G4PersistentHitMan, etc. oTransient G4 objects are “stored” by G4RunManager thru abstract interface of G4VPersistencyManager. oDatabase file names are given via G4PerrsistencyMessenger. oInterface to HepODBMS transactions are “wrapped” at G4TransactionManager. oData member copy of transient and persistent objects are handled by G4PersistentEventMan, G4PersistentHitMan, etc.

Geant4 Collaboration 9 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

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

Geant4 Collaboration 11 How to design your own persistent objects in ODBMS: Design persistent-capable classes - G4PEvent.ddl 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 thePrimaryVertex; G4Pint numberOfPrimaryVertex; d_Ref HC; d_Ref DC; public: void SetEventID(const G4Event *evt); inline G4int GetEventID() const { return eventID; } inline void AddPrimaryVertex(HepRef(G4PPrimaryVertex) aPrimaryVertex) {…} inline G4int GetNumberOfPrimaryVertex() const { return numberOfPrimaryVertex; } …... }; Inherit persistency from persistent base class Inherit persistency from persistent base class Smart pointers to other persistent objects in run time Smart pointers to other persistent objects in run time Persistent base types Persistent base types Embedded association to other persistent objects Embedded association to other persistent objects

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

Geant4 Collaboration 13 How to design your own persistent objects in ODBMS: Design the access patterns oDecide the primary object(s) to be picked up from the database oMake 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: " GetNumberOfParticle() << G4endl; } Iterator for G4PEvent Iterator for G4PEvent Using the Iterator Using the (1st) G4PEvent Returns a smart pointer of the G4PPrimaryVertex Returns a smart pointer of the G4PPrimaryVertex

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

Geant4 Collaboration 15 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

Geant4 Collaboration 16 Persistent Objects in “Events” Database

Geant4 Collaboration 17 Example Database Configuration Runs FDDBSystem Events Geometry Boot file exampleFD Persistent Ex01/02 readDBhits2digits Lock Server FDDBSystem Boot file exampleSchema “gmake newfd” oocheckls oolockserver ookillls oodump $OO_FD_BOOT

Geant4 Collaboration 18 How to build G4 Persistent Libraries oDefine variables l $G4USE_HEPODBMS = 1 l $G4EXAMPLE_FDID oDefine HepODBMS variables l $HEP_ODBMS_DIR l $HEP_ODBMS_INCLUDES oInclude HepODBMS and Objectivity library path into $LD_LIBRARY_PATH oSetup Objectivity variables (eg. on CERN AFS) l source /afs/cern.ch/rd45/objectivity/objyenv.csh(csh) l. /afs/cern.ch/rd45/objectivity/objyenv.sh(bsh) oCheck and start “Lock Server” oType “gmake” in $G4INSTALL/source oSee $G4INSTALL/examples/extended/persistency/PersistentEx01/README for more detail (see also the release note for version information)

Geant4 Collaboration 19 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 readDB: standalone HepODBMS example to read objects createTag: standalone example to create HepODBMS tag readTag: standalone example to read HepODBMS tag

Geant4 Collaboration 20 If you want to learn more... oUser's Guide: For Application Developers orApplicationDeveloper/html/index.html oHepODBMS User Guide oObjectivity/DB Support at CERN oCERN/IT DataBase Group oThe Object Database Standard: ODMG 2.0 Edited by R.G.G. Cattell, D.K. Barry, Morgan Kaufmann Publishers, Inc. ISBN

Geant4 Collaboration 21 Whom to contact about Geant4 Persistency Geant4 Persistency Category Coordinator Youhei Morita (KEK) - HepODBMS and Objectivity/DB issues CERN/IT DataBase Group -