The JANA Calibrations and Conditions Database API March 23, 2009 David Lawrence JLab 3/23/091JANA Calibration API David Lawrence -- JLab.

Slides:



Advertisements
Similar presentations
Introduction to C++ Templates Speaker: Bill Chapman, C++ developer, financial company in Mid-Manhattan. Can be reached via: ' This.
Advertisements

Review What is a virtual function? What can be achieved with virtual functions? How to define a pure virtual function? What is an abstract class? Can a.
Hall-D Software Status May 12, 2009 David Lawrence 5/12/091.
Reconstruction and Analysis on Demand: A Success Story Christopher D. Jones Cornell University, USA.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Server Architecture Models Operating Systems Hebrew University Spring 2004.
II. Middleware for Distributed Systems
File System. NET+OS 6 File System Architecture Design Goals File System Layer Design Storage Services Layer Design RAM Services Layer Design Flash Services.
CLEO’s User Centric Data Access System Christopher D. Jones Cornell University.
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
Offline Software Status Jan. 30, 2009 David Lawrence JLab 1.
Multi-threaded Event Processing with JANA David Lawrence – Jefferson Lab Nov. 3, /3/08 Multi-threaded Event Processing with JANA - D. Lawrence JLab.
Thomas Jefferson National Accelerator Facility (JLab) 6/16/09Multi-threaded event processing with JANA -- David Lawrence 1 6 GeV electron accelerator user.
May. 11, 2015 David Lawrence JLab Counting House Operations.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
Introduction to Hall-D Software February 27, 2009 David Lawrence - JLab.
Data Structures Using C++ 2E
Chapter 2 Database System Architecture. An “architecture” for a database system. A specification of how it will work, what it will “look like.” The “ANSI/SPARC”
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
The GlueX Detector 5/29/091CIPANP The GlueX Detector -- David Lawrence (JLab) David Lawrence (JLab) Electron beam accelerator continuous-wave (1497MHz,
In the name of Allah The Proxy Pattern Elham moazzen.
David N. Brown Lawrence Berkeley National Lab Representing the BaBar Collaboration The BaBar Mini  BaBar  BaBar’s Data Formats  Design of the Mini 
Templates An introduction. Simple Template Functions template T max(T x, T y) { if (x > y) { return x; } else { return y; } } int main(void) { int x =
Event Data History David Adams BNL Atlas Software Week December 2001.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
NOVA Networked Object-based EnVironment for Analysis P. Nevski, A. Vaniachine, T. Wenaus NOVA is a project to develop distributed object oriented physics.
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
4/5/2007Data handling and transfer in the LHCb experiment1 Data handling and transfer in the LHCb experiment RT NPSS Real Time 2007 FNAL - 4 th May 2007.
UNIX Files File organization and a few primitives.
JANA and Raw Data David Lawrence, JLab Oct. 5, 2012.
Calibration API in JANA David Lawrence, Jlab July 17, 2007.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
DANA uses a factory model to deliver data “just in time”
1 5. Abstract Data Structures & Algorithms 5.2 Static Data Structures.
Calibration and alignment database development Dmitry Romanov December 15, 2010.
Introduction to C#. Why C#? Develop on the Following Platforms ASP.NET Native Windows Windows 8 / 8.1 Windows Phone WPF Android (Xamarin) iOS (Xamarin)
N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Interval of Validity Service IOVSvc ATLAS Software Week May Architecture.
CS 376b Introduction to Computer Vision 01 / 23 / 2008 Instructor: Michael Eckmann.
C Functions Three major differences between C and Java functions: –Functions are stand-alone entities, not part of objects they can be defined in a file.
Peter Chochula ALICE Offline Week, October 04,2005 External access to the ALICE DCS archives.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Concurrency, Processes, and System calls Benefits and issues of concurrency The basic concept of process System calls.
Integration of the ATLAS Tag Database with Data Management and Analysis Components Caitriana Nicholson University of Glasgow 3 rd September 2007 CHEP,
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
The JANA Reconstruction Framework David Lawrence - JLab May 25, /25/101JANA - Lawrence - CLAS12 Software Workshop.
1 Classes II Chapter 7 2 Introduction Continued study of –classes –data abstraction Prepare for operator overloading in next chapter Work with strings.
Intro to Web Services Dr. John P. Abraham UTPA. What are Web Services? Applications execute across multiple computers on a network.  The machine on which.
.NET Mobile Application Development XML Web Services.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 2.
The DCS Databases Peter Chochula. 31/05/2005Peter Chochula 2 Outline PVSS basics (boring topic but useful if one wants to understand the DCS data flow)
GlueX Software Status + Framework Development David Lawrence JLab September 19, /19/081Software Status -- David Lawrence, JLab.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
Event Management. EMU Graham Heyes April Overview Background Requirements Solution Status.
October 21, 2010 David Lawrence JLab Oct. 21, 20101RootSpy -- CHEP10, Taipei -- David Lawrence, JLab Parallel Session 53: Software Engineering, Data Stores,
ATLAS The ConditionDB is accessed by the offline reconstruction framework (ATHENA). COOLCOnditions Objects for LHC The interface is provided by COOL (COnditions.
October 19, 2010 David Lawrence JLab Oct. 19, 20101RootSpy -- CHEP10, Taipei -- David Lawrence, JLab Parallel Session 18: Software Engineering, Data Stores,
Pyragen A PYTHON WRAPPER GENERATOR TO APPLICATION CORE LIBRARIES Fernando PEREIRA, Christian THEIS - HSE/RP EDMS tech note:
David Lawrence JLab May 11, /11/101Reconstruction Framework -- GlueX Collab. meeting -- D. Lawrence.
DANA David Lawrence Oct. 21, D. Lawrence, JLab GlueX Software Workshop Oct Outline Requirements Philosophy Overview of Features Open Questions.
User-Written Functions
CMS High Level Trigger Configuration Management
Chapter 5 Remote Procedure Call
The DANA Analysis Framework David Lawrence Jlab Jan. 19,
OpenStorage API part II
Chapter 2: The Linux System Part 2
Abstraction: Generic Programming, pt. 2
Chapter 11 Managing Databases with SQL Server 2000
SPL – PS1 Introduction to C++.
Presentation transcript:

The JANA Calibrations and Conditions Database API March 23, 2009 David Lawrence JLab 3/23/091JANA Calibration API David Lawrence -- JLab

The GlueX Experiment 3/23/09JANA Calibration API David Lawrence -- JLab2 real  beam 2 Tesla solenoid magnet 30 cm LH 2 target Forward EM calorimeter and forward TOF wall downstream Cylindrical and planar drift chambers inside magnet Barrel EM calorimeter inside magnet The “continuous wave” 12GeV electron beam at JLab has a beam bunch every 2 ns Conventional meson has quantum numbers determined only by constituent quarks Hybrid meson has some quantum properties due to contributions from the “glue”

Data Rates in 12GeV era Front End DAQ Rate Event Size L1 Trigger Rate Bandwidth to mass Storage GlueX3 GB/s15 kB200 kHz300 MB/s CLAS12100 MB/s20 kB10 kHz100 MB/s ALICE500 GB/s2.5 MB200 kHz200 MB/s ATLAS113 GB/s1.5MB75 kHz300 MB/s CMS200 GB/s1 MB100kHz100 MB/s LHCb40 GB/s40 kB1 MHz100 MB/s STAR8 GB/s80 MB100 Hz30 MB/s PHENIX900 MB/s~60 kB~ 15 kHz450 MB/s 3/23/09JANA Calibration API David Lawrence -- JLab3 LHC JLab BNL * CHEP2007 talk Sylvain Chapelin private comm. * NIM A499 Mar ppg ** CHEP2006 talk MartinL. Purschke **

Targeted Customers for JCalibration “B”-coders = reconstruction code authors (“A”-coders = framework authors; “C”-coders = physics analysis) 3/23/09JANA Calibration API David Lawrence -- JLab4 JCalibration URL run_number context (string) … Reconstruction Code namepath (string) STL container ref. Database Reconstruction Program B-codersA-coders The minimal information needed from the reconstruction code is the name of the constants and a container to put them in. (The container implicitly contains a data type.)

5 API For Accessing Constants Constants can be stored in either arrays (1D) or tables (2D) and can be indexed either by name (key-value) or by position. // Get 1-D array of values indexed by name bool Get(string namepath, map &vals) // Get 1-D array of values indexed by row bool Get(string namepath, vector &vals) // Get 2-D table of values indexed by row and name bool Get(string namepath, vector > &vals) // Get 2-D table of values indexed by row and column bool Get(string namepath, vector > &vals) // Get 1-D array of values indexed by name bool Get(string namepath, map &vals) // Get 1-D array of values indexed by row bool Get(string namepath, vector &vals) // Get 2-D table of values indexed by row and name bool Get(string namepath, vector > &vals) // Get 2-D table of values indexed by row and column bool Get(string namepath, vector > &vals) arrays tables 3/23/09JANA Calibration API David Lawrence -- JLab // Get list of available namepaths from backend void GetListOfNamepaths(vector &namepaths) // Get list of available namepaths from backend void GetListOfNamepaths(vector &namepaths) discovery

map twpars; loop->Get("FDC/driftvelocity/timewalk_parameters", twpars); slope = twpars["slope"]; offset = twpars["offset"]; exponent = twpars["exponent"]; map twpars; loop->Get("FDC/driftvelocity/timewalk_parameters", twpars); slope = twpars["slope"]; offset = twpars["offset"]; exponent = twpars["exponent"]; 6 Example of Accessing Calibration Constants as key-value pairs... in factory class definition … Template method converts values to doubles using stringstream class For a few parameters like this, it makes sense to copy them into local data members of the factory class 3/23/09JANA Calibration API David Lawrence -- JLab double slope, offset, exponent; double slope, offset, exponent;... in brun() method...

Backend Requirements 3/23/09JANA Calibration API David Lawrence -- JLab7 virtual bool GetCalib(string namepath, map &svals) virtual bool GetCalib(string namepath, vector > &svals) virtual void GetListOfNamepaths(vector &namepaths) virtual bool GetCalib(string namepath, map &svals) virtual bool GetCalib(string namepath, vector > &svals) virtual void GetListOfNamepaths(vector &namepaths) To implement a JCalibration interface to a new backend, only 3 virtual methods need to be implemented! OK, actually, it’s closer to 6, but these 3 are for the generator class and are trivial. virtual const char* Description(void) virtual double CheckOpenable(string url, int run, string context) virtual JCalibration* MakeJCalibration(string url, int run, string context) virtual const char* Description(void) virtual double CheckOpenable(string url, int run, string context) virtual JCalibration* MakeJCalibration(string url, int run, string context) The generator mechanism allows access to multiple types of databases in the same executable. Access to a new type can even be brought in through a plugin.

Calibration Web Service The JCalibrationWS class provides calibration constants through a web service – Implemented as a plugin so remote access can be added to an existing executable – Allows read-only access to calibration constants from anywhere in the world over HTTP ( – Uses gSOAP, a C++ SOAP implementation – Currently works like a proxy for JCalibrationFile on server side, but could trivially be made to use another type of backend Calibration constants will need to be accessible from remote computers via the internet Direct access to a database is problematic due to cybersecurity concerns Web services work over HTTP and so are the appropriate mechanism for remote access 3/23/098JANA Calibration API David Lawrence -- JLab

Saving a (semi-)complete set of calibration constants to the local disk All JANA programs have the command line option: --dumpcalibrations Records which namepaths are requested during a job and writes the constants into ASCII files compatible with JCalibrationFile Avoids copying and running entire database or even copying a “complete” set of calibration constants (which could include obsolete ones or ones not applicable to the current run/code version) 3/23/099JANA Calibration API David Lawrence -- JLab

A simple API for accessing calibration/conditions DB exists in JANA that allows code development prior to developing the actual database – C++ templates + ANSI stringstream allows handling of all data types Web Service is a good option for allowing remote access to constants in a cyber-secure way – SOAP standard (Java, C++, …) JANA has a built-in mechanism for dumping constants to the local disk regardless of the source – Local access is (almost) always faster than network access 3/23/09JANA Calibration API David Lawrence -- JLab10

Backup Slides 3/23/09JANA Calibration API David Lawrence -- JLab11

Threads in JANA 3/23/09JANA Calibration API David Lawrence -- JLab12 Each thread in JANA is composed of its own event processing loop and a complete set of factories Reconstruction of a given event is done entirely inside of a single thread No mutex locking is required by authors of reconstruction code Threads work asynchronously to maximize rates at the expense of not maintaining the event order on output raw data read in reconstructed values written out (e.g. ROOT tree)

13 Example of Accessing Calibration Constants as an array... in factory class definition... vector tof_tdc_offsets;... in brun() method... loop->GetCalib(”TOF/tdc_offsets", tof_tdc_offsets); if(tof_tdc_offsets.size()!=Ntof) throw JException(“Bad Ntof!”);... in evnt() method... double t = tof->tdc - tof_tdc_offsets[tof->id]; 3/23/09JANA Calibration API David Lawrence -- JLab

14 Backend Database The API defines the routines B-coders will use to obtain calibration constants independent of the details of how the actual database is implemented This does impose some requirements of the database design itself: – Store both 1-D arrays and 2-D tables – Index either by name or position – Uniquely identify constants by Run number Context string (may include timestamp) URL JCalibrationFile implements a trivial calibration backend that maps directly to ASCII files on the local file system – Represents snapshot of constants and so ignores run number and context string – URL points to root directory (e.g. file:///group/halld/calib) – Constants currently kept in svn ( 3/23/09JANA Calibration API David Lawrence -- JLab

Calibration object generators and namepath Discovery o Generator mechanism for JCalibration JCalibrationGenerator class added Allows multiple types of database backends to be supported in same binary Allows new calibration database backends to be added dynamically to pre-compiled binaries Useful for private development of backend alongside trunk without disturbing standard builds o Discovery mechanism JCalibration now has a new virtual method called GetListOfNamepaths() that can be used to probe a calibration backend for the available constants This is utilized in the jcalibread utility using the “-L” switch 3/23/0915JANA Calibration API David Lawrence -- JLab

Recycled Containers... in factory class definition... const double *fcal_gains;... in brun() method... const vector *my_fcal_gains; loop->GetCalib(”FCAL/Energy/gains", my_fcal_gains); fcal_gains = &(my_fcal_gains->front());... in evnt() method... double Ecorr = fcal_hit->E * fcal_gains[fcal_hit->id]; fcal_gains[3] =1.2; // This will generate compile time error! A new templated Get() method has been added to JCalibration that instructs it to keep ownership of the constants and just return a const pointer to the container. Since STL vectors keep internal data sequential in memory, the values can be accessed via a standard array pointer while maintaining const correctness. 3/23/0916JANA Calibration API David Lawrence -- JLab