GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected] AIDA Abstract...

30
GranSasso, Jul-2 002 Andreas Pfeiffer, CERN/I T-API, andreas.pfeiffer@ cern.ch 1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API [email protected]

Transcript of GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected] AIDA Abstract...

Page 1: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

1

AIDAAbstract Interfaces

for Data Analysis

Andreas PfeifferCERN IT/[email protected]

Page 2: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

2

Outline

What is AIDAHistory/Collaboration/DocumentationSome DetailsExamplesOngoing workSummary

Page 3: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

3

What is AIDA

Abstract Interfaces for Data Analysis (AIDA)

“The goals of the AIDA project are to define abstract interfaces for common physics analysis objects, such as histograms, ntuples, fitters, IO etc.The adoption of these interfaces should make it easier for developers and users to select to use different tools without having to learn new interfaces or change their code. In addition it should be possible to exchange data (objects) between AIDA compliant applications.”

Page 4: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

4

Motivation

AdvantagesThe user needs to learn only one set of interfacesSame user code can be used with different AIDA-compliant analysis applicationsPool experience of different developer teams

LHC++, OpenScientist, JASDifferent analysis tools can exchange analysis objects

same storage format, use functionality from other tools

Two versions of AIDA interfacesOne for C++One for JavaAs identical as possible

Page 5: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

5

Abstract Interfaces

Abstract Interfaces only pure virtual methods, inheritance only from other A.I.components use other components only through their A.I.defines a kind of a “protocol” for a component Maximize flexibility and re-use of packagesallow each component to develop independentlyre-use of existing packages to implement components reduces start-up time significantly

De-couple implementation of a package from its use

Page 6: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

6

AIDA ExampleUse same code with any AIDA-compliant analysis tool.

A

I

D

A

User code (e.g. GEANT4)

Analysis tool 1

Analysis tool 2

Page 7: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

7

Architectural issue: Components (I)

Identify components by functionalityDefine “protocol” using Abstract InterfacesEmphasize separation of different aspects for each component

Example: Histogram statistical entity (density distribution of a physics quantity) view of a “collection of data points” (which can be a density distribution but also a detector efficiency curve)command to manipulate/store/plot/fit/...

“User’s view” is different from “implementor’s (developer’s) view”

separate Abstract Interfaces for both aspects

Page 8: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

8

Use of Components withAbstract Interfaces

User Code uses only Interface classesIHistogram1D * hist = histoFactory-> create1D(‘track quality’, 100, 0., 10.)

Actual implementations are selected at run-time

loading of shared libraries

No change at all to user code but keep freedom to choose implementation

Histo-Impl. 2

Histo-IF Fitter-IF

User Code

Fitter-Impl. Y

Histo-Impl. 1

Fitter-Impl. X

Page 9: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

9

Across the languages

JAida : C++ access to Java libsusing C++ proxies implementing the C++ Abstract Interfaces to the Java interfaces

C++UserCode

AIDA-IF C++ AIDA-IF Java

Java Lib

JAida

Page 10: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

10

XML standards

Started with 1D and 2D Histogramsaim: easy transfer between applications

Will extend to other data typesother histos, fits, ntuples, …

Comments/contributions welcome !

Page 11: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

11

History

Initial idea formed during discussion at HepVis-99 workshop at Orsay

Informal AIDA discussions at CERN in 2000AIDA workshops:

January 2001 - Paris/Orsay April 2001 - Boston (preceding HepVis 2001)Informal meetings (e.g during Geant4 meetings and video conferences)June 2002 – CERN

Interfaces have been designed by discussion and (eventual) consensus

Takes some time, but result is well though out and robust

Page 12: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

12

Organization - Developers

No formal collaboration/author list.Some people who have contributed (ideas, code, etc).

Guy Barrand, Pavel Binko, Mark Donszelmann, Wolfgang Hoschek, Tony Johnson, Emmanuel Medernach, Dino Ferrero Merlino, Lorenzo Moneta, Jakub Moscicki, Ioannis Papadopoulos, Andreas Pfeiffer, Max Sang, Victor Serbo, Max Turri

Apologies to people accidentally missed

Page 13: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

13

Organization – Code, Documentation

AIDA – open source projectCVS repository: cvs.freehep.org

“anonymous” download available

Web page: http://aida.freehep.orgGeneral information, relevant linksTutorial, users’ guide, examplesDownloads and web-browsable source codeTest cases (coming soon)

Page 14: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

14

Current Status

AIDA Version 2.2 released (December 2001)First “End User” releaseThree implementations of AIDA exist

Anaphe/Lizard (C++)http://anaphe.web.cern.ch/anaphe

Open Scientist (C++)http://www.lal.in2p3.fr/OpenScientist

JAIDA/JAS (Java) + AIDA-JNI 1.0 (C++)http://java.freehep.org/lib/freehep/doc/aida

GEANT4 adopted AIDA for analysis

AIDA 3 Currently under discussionRelease foreseen for Sep 2002

Page 15: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

15

AIDA Interfaces Summary

AIDA FactoriesITupleIHistogramICloudITree

Page 16: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

16

AIDA Design

Page 17: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

17

Aida design (details)IAnalysisFactory(from AIDA-2.2)

IAnnotation(from AIDA-2.2)

IAxis(from AIDA-2.2)

IHistogram3D(from AIDA-2.2)

IHistogram(from AIDA-2.2)

IHistogram2D(from AIDA-2.2)

IHistogram1D(from AIDA-2.2)

ICloud(from AIDA-2.2)

ICloud3D(from AIDA-2.2)

ICloud2D(from AIDA-2.2)

ICloud1D(from AIDA-2.2)

ICloudFactory(from AIDA-2.2)

IHistogramFactory(from AIDA-2.2)

ITree(from AIDA-2.2)

ITreeFactory

<<virtual>> ~ITreeFactory()<<abstract>> create()

(from AIDA-2.2)

IManagedObject(from AIDA-2.2)

IPlotter(from AIDA-2.2)

IPlotterFactory(from AIDA-2.2)

ITuple(from AIDA-2.2)

ITupleFactory(from AIDA-2.2)

IFilterFactory(from AIDA-2.2)

IFilter(from AIDA-2.2)

IEvaluatorFactory(from AIDA-2.2)

IEvaluator(from AIDA-2.2)

IFitFunction(from AIDA-2.2)

IFunction(from AIDA-2.2)

IFunctionFactory(from AIDA-2.2)

IDevTree

<<virtual>> ~IDevTree()<<abstract>> add()<<abstract>> store()

(from AIDA-2.2-dev)

IStore

<<virtual>> ~IStore()<<abstract>> close()

<<abstract>> commit()<<abstract>> select()<<abstract>> write()

(from AIDA-2.2-dev)

File: /data/pfeiffer/Rose/AIDA-2.2.mdl Sun Jun 30 17:18:39 2002 Class Diagram: Logical View / Main Page 1

Page 18: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

18

Example Program (Java)

Create, fill, and view 1D and 2D histograms:

Page 19: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

19

ITuple

ITuple - interface to the Data“get/set” methods for double, float, int, …Information about columns: min, max, mean, rmsNavigating: start(), next(), skip(int nRows)Project ITuple into 1D, 2D, 3D histogramNew features for AIDA 2.3:

Support for complex internal structures (subfolders)Merging and chaining of ITuples under discussion

Page 20: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

20

Details - ITuple

Interface to

the Data:

Page 21: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

21

IHistogram (1D-3D)

Binned histogram: IHistogram1D, 2D, 3D

“fill” methods (with/without weight)Histogram info: entries, mean, rms, axisBin info: centre, entries, height, errorHistogram arithmetic: add, multiply, divideConvenience methods, like coordinate-to-index conversion

Page 22: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

22

Details – IHistogram (1D-3D)

IHistogram:

Common functionality for all histograms (like entries, label, dimension,)

IHistogram1D

IHistogram2D

IHistogram3D

Page 23: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

23

ICloud

Unbinned collection of points: ICloud1D, 2D, 3D

Can represent scatter plot, dynamically rebinnable histogramCan be converted to a binned histogramStandard “get/set” methods for entriesCollection info: lower, upper, mean, rms

Page 24: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

24

Details - ICloud

ICloud:

Common functionality for all histograms (like entries, label, dimension,)

ICloud1D

ICloud2D

ICloud3D

Page 25: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

25

IFunction and Fitting

Fitting: IFunction, IFitFunctionIFunction – simple interface, allows to set parameters and get function valueIFitFunction – fit function to a histogram

Extends IFunctionVarious fit control methods: step size, bounds, etc.Allows to perform fit and get resultsAIDA 2.2 fitting functionality fairly limited

AIDA 2.3 (Under discussion) extended functionality

Page 26: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

26

ITree

ITreedirectory-like structure (Unix directory convention)

Methods like: cd, ls, mkdir, etc.

AIDA analysis objects (tuples, histograms, clouds, ets.) exist within ITree directories“save/restore” functionality, hides storage details from the user

Compatible with database or file storageCan support multiple file formatsMount/Unmount functionality (like unix) allows multiple stores to be seamlessly mergedAIDA XML format is defined for data interchange

Page 27: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

27

Details - ITree

Directory-like structures: ITree

Page 28: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

28

June 2002 Developers Workshop

2 Day “Users Workshop” 3 Day “Developer Workshop”

Items under discussionFitting (two proposals, from SLAC, CERN)

Similar but different, differences need to be resolved

Improved plotting (IPlotter)

Graph (XYData)

Tuple chaining, merging

Small updates/extensions to API

Input/Participation from people always welcome !

Page 29: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

29

Ongoing work

Refining Fitter and Plotter componentsIFitter, IOptimizer, IFitResultIplotter, I*Styles for plotting

Developer-level interfacesCode sharingMore robust operation

Put AIDA-based utilities in CVS Utility to test AIDA implementationsUser contributions

Common binary storage format

Page 30: GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, andreas.pfeiffer@cern.ch1 AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API andreas.pfeiffer@cern.ch.

GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, [email protected]

30

Summary

Abstract Interfaces de-couple components of frameworksWeakly coupled components and frameworks have large advantages

User code needs no change if changing implementationEven across “language boundaries” (JAIDA)

Ease of re-use of a componentFlexibility through independence of implementationMaintainability through independent evolution of components

Example using Geant-4 and AIDA compliant analysis tools (see tutorial)