Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
OO-Design in PHENIX • • • • • • • CHEP-2000 PHENIX, a BIG Collaboration A Liberal Data Model Simple (and fast) DST I/O Design Patterns OO-Database, an example for the abstract extreme Does it really work? Ergo. . . Matthias Messer, BNL 1 Under Construction . . . Software infrastructure CHEP-2000 Matthias Messer, BNL 2 From RAW to DST • • • • Official Language is C++ FORTRAN legacy now only in simulation (GEANT 3) 200,000 lines of code and still growing fast Limited manpower and financial resources – How unusual, what? – Usage of many free open-source packages • Linux, automake, Root, Bonsai, CVS, CLHEP (well, sort of) • many more – Good experience as compared to commercial software • Maintenance(!), upgrades, necessary modifications CHEP-2000 Matthias Messer, BNL 3 PHENIXians • Picture shows only a third of the collaboration • Many developers – Ideas – Strong opinions about programming • Software infrastructure has to integrate them all CHEP-2000 Matthias Messer, BNL 4 A Liberal OO Model • Old OO: Everything is one grand song – Have a (preferably) complete design before you start coding – Work done by experienced OO-programmers – Well . . . • Liberal OO: Have it your way – – – – Data-objects with some methods method-collections (functors) with some data-members shallow inheritance structures for modularity Independently designed packages work on one data-structure • Composite Objects: A node-tree to hold (and share) data CHEP-2000 Matthias Messer, BNL 5 PHOOL, The PHENIX OO Library • Composite Objects: A node-tree to hold (and share) data Composite Nodes Data Node CHEP-2000 Matthias Messer, BNL 6 PHNode the Data-Classes • • Data node is template – type-safe But all inherit from PHNode – Navigation class PHNodeIterator uses Polymorphism • PHNodeIterator – Unix-like navigation • cd(“ . . .”) • find(“ . . .”) – Can use abstract strategies • for_each(PHStrategy) CHEP-2000 Matthias Messer, BNL 7 PHModule the Functor Classes • Method-container class – common interface or entry-point, the event() function – Can be used with a PHModuleManager – PHDataNode<PHModule> for implementation of strategies CHEP-2000 Matthias Messer, BNL 8 Abstract Strategies • Used in Node tree – apply a method to all nodes of a branch • Used in Module Manager – call event() function of all Modules in the collection: the event-loop CHEP-2000 Matthias Messer, BNL 9 OODBs in PHENIX • Two autonomous partitions – Counting House – RCF (RHIC Computing – – • Facility) Robust against the ‘bulldozer incident’ The picture shows a subset Pdbcal is only one of many DB applications, but – – The one most of all used in reconstruction code The biggest data volume • CHEP-2000 Matthias Messer, BNL order of Tbyte/Year 10 Pdbcal • a user-friendly database-application – small set of wrapped control-classes • start, end transactions – easily expandable by the user himself • provide a storage class (e.g. a hardware-channel) • gets picked up by code-generators for integration into the DB-package – you handle only a very abstract (2.5 layers) bank-class • applications do not depend on later generated code – transparent low-level activity • Open a new DB-file when 2 Gbyte limit is reached • traverse from Tag-DB to calibration-DB CHEP-2000 Matthias Messer, BNL 11 Data-Storage in Objy/Root • • • • No need for elaborate design of the base classes concentrate on functionality and on ONE application (objy) for now add Root I/O later by way of inheritance transparent for the user interface CHEP-2000 Matthias Messer, BNL 12 Useful (and used) Design-Patterns • singletons – database application manager – a classmap hash-table (STL-map) • abstract base-classes and factories – change low-level applications without changing interfaces • Objectivity Root – protect the user from implementation details (and vice versa) • composite objects – flexible, yet type-safe node-tree • abstract strategies – standardized operations on no-tree-data – great flexibility in choosing analysis methods CHEP-2000 Matthias Messer, BNL 13 The Very Real Life . . . • . . . of simulated data processing – MDC: Mock Data Challenge – two weeks of simultaneous • data sinking into HPSS • data mining from HPSS • parallel data processing using the PHOOL environment – the new reconstruction software • is fast: – 30s / event is factor two faster than with old data-model (STAF) • is reliable: – few crashes, none related to memory-management in the reconstruction code – no memory leaks (non trivial in such a liberal data-model) CHEP-2000 Matthias Messer, BNL 14 In Somma . . . • The relaxed OO-philosophy (PHOOL) – has: • slightly more separation between data and methods • shallow inheritance trees – – you buy what you want, or “I don’t want a three-vector that can send me email” – can: • integrate many peoples software efforts • allow flexible usage of outside-packages • The approach of the abstract extreme (Pdbcal) – shields user, prevents fear of first contact – maintains flexibility in usage of low-level software • Contact – email: [email protected] – more info: www.phenix.bnl.gov/~messer CHEP-2000 Matthias Messer, BNL 15