Gaudi Framework Tutorial, April 2006 5 Histograms And N-tuples.

Slides:



Advertisements
Similar presentations
Must-Know ROOT Class I/O/TGraph/Tntuple/Ttree/…. 1.
Advertisements

Why ROOT?. ROOT ROOT: is an object_oriented frame work aimed at solving the data analysis challenges of high energy physics Object _oriented: by encapsulation,
Mantid Architecture Straw man proposal Nick Draper 24 th August 2007.
Object Oriented Programming COP3330 / CGS5409.  C++ Automatics ◦ Copy constructor () ◦ Assignment operator =  Shallow copy vs. Deep copy  DMA Review.
Persistent State of Package Variables. 2 home back first prev next last What Will I Learn? Identify persistent states of package variables Control the.
Gaudi Framework Tutorial, April Accessing Event Data.
XP 1 Using Common Features of Microsoft Office 2003 Rod Rodrigues.
Pythia 8 Event Production Electron positron distribution A basic analysis.
More Classes in C++ Bryce Boe 2012/08/20 CS32, Summer 2012 B.
ADVANCED MICROSOFT POWERPOINT Lesson 6 – Creating Tables and Charts
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
1 ATPESC 2014 Vijay Mahadevan Tutorial Session for Scalable Interfaces for Geometry and Mesh based Applications (SIGMA) FASTMath SciDAC Institute.
ROOT An object oriented HEP analysis framework.. Computing in Physics Physics = experimental science =>Experiments (e.g. at CERN) Planning phase Physics.
Introduction to Hall-D Software February 27, 2009 David Lawrence - JLab.
LHCb Software week November, 1999 M.Frank LHCb/CERN N-Tuples within Gaudi ã Definition ã Usage ä Run through simplified example ã The persistent.
M.Frank LHCb/CERN - In behalf of the LHCb GAUDI team Data Persistency Solution for LHCb ã Motivation ã Data access ã Generic model ã Experience & Conclusions.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
Frank Welcome to D2L Training Module 4: Login: Questions: Adding Content Evaluating Students: Dropbox Quizzes.
Browsing Data with GaudiPython Disclaimers: 1.I am an apprentice! 2.The porpoise: we think GaudiPython could be quite useful for a LHCb physicist… Browsing.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Geant4 Acceptance Suite for Key Observables CHEP06, T.I.F.R. Mumbai, February 2006 J. Apostolakis, I. MacLaren, J. Apostolakis, I. MacLaren, P. Mendez.
N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett A Lightweight Histogram Interface Layer CHEP 2000 Session F (F320) Thursday.
Moodle (Course Management Systems). Managing Your class In this Lecture, we’ll cover course management, including understanding and using roles, arranging.
Athena and HEC Test Beam Reconstruction Tutorial October 12, 2001 CERN N. Kanaya, M. Marino, S. Rajagopalan, M. Wielers.
Event View G. Watts (UW) O. Harris (UW). Philosophy EventView Goals Object Identification & Interpretation Is that a jet or an electron? Is that jet a.
CERN Tutorial, September Job Options and Printing.
Job Options and Printing 1 LHCb software tutorial - September 2011.
AIDA Tuple Service Manuel Domenech Wednesday
Database Applications – Microsoft Access Lesson 1 Introduction 26 Slides in Presentation Updated 8/12.
9 Associators How to relate objects to each other Create relations Save relations Use relations: Associators.
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
Gaudi Framework Tutorial, April Algorithm Tools: what they are, how to write them, how to use them.
Gaudi Framework Tutorial, April Job Options and Printing.
Jose A. Hernando Trigger Gaudies Reconstruction Tools & Algorithms Inspectors MC & Data Algorithms Template preserved container Jose A. Hernando.
Argonne Jamboree January 2010 Esteban Fullana AOD example analysis.
A proposal for a Proposal for a Simulation Framework in BTeV G. Cerati, E. Di Maio, S. Magni, D. Menasce.
1. FINISHING FUNCTIONS 2. INTRODUCING PLOTTING 1.
25th May, 1999 HTL - Histogram Template Library Pavel Binko, LHCb / CERN 1 LHCb Computing Meeting HTL - Histogram Template Library Pavel Binko LHCb / CERN.
Bologna Tutorial, April Job Options and Printing.
Postgraduate Computing Lectures PAW 1 PAW: Physicist Analysis Workstation What is PAW? –A tool to display and manipulate data. Learning PAW –See ref. in.
Tutorial: Examples (09may00 - ATLAS Software LBNL) May 2000 Prototype Framework Tutorial: Examples Paolo Calafiura, Charles Leggett HCG/NERSC/LBNL.
ITM © Port,Kazman 1 ITM 352 Cookies. ITM © Port,Kazman 2 Problem… r How do you identify a particular user when they visit your site (or any.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Gaudi Framework Tutorial, April Creating Objects and Writing Data.
DaVinciAssociators How to relate physics objects to MC truth.
Muon Persistency Persistent Analysis Objects Muon Persistency Norbert Neumeister µ-PRS meeting February 10, 2004.
Athena Tutorial: Liquid Argon Example ATHENA The ATLAS Control Framework Tutorial: Liquid Argon Example Based on original by S. Rajagopalan BNL.
27/02/04 ATLAS weekTileCal Athena tutorial, part 21 TileCal Athena tutorial Part 2: Reading GEANT hits from ZEBRA and POOL Reading HLT and testbeam ByteStream.
Proposal for extension of GaudiAlgorithm and GaudiTool classes Vanya Belyaev CERN & ITEP/Moscow.
Gaudi Framework Tutorial, Algorithm Tools: what they are and how to use them.
June 2004 ATLAS WeekAlexander Solodkov1 testbeam 2004 offline reconstruction.
Gaudi Framework Tutorial, April Histograms And N-tuples.
9 Associators How to relate objects to each other Create relations Save relations Use relations: Associators.
Athena StoreGate Tutorial: May 30, Objectives Learn how to access data objects using StoreGate How to record/retrieve by TYPE Optionally using keys.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Starting Analysis with Athena (Esteban Fullana Torregrosa) Rik Yoshida High Energy Physics Division Argonne National Laboratory.
An AOD analysis example Esteban Fullana Torregrosa High Energy Physics Division Argonne National Laboratory.
HYDRA Framework. Setup of software environment Setup of software environment Using the documentation Using the documentation How to compile a program.
ROOT1 Hands-on Sami Kama. S.Kama ROOT1 Hands-On ISTAPP2011 Dogus Univ.07/02/ Download root file from indico.
AOD example analysis Argonne Jamboree January 2010
Root I/O and the Gaudi Framework
DecayTreeTuple – an update (v2r3p1)
Writing Physics Tools Schedule: Timing Topic 20 minutes Lecture
LHCb Software Tutorial
Introduction to Athena
2 Getting Started.
2 Getting Started.
2 Getting Started.
Use Of GAUDI framework in Online Environment
Presentation transcript:

Gaudi Framework Tutorial, April Histograms And N-tuples

5-2 Gaudi Framework Tutorial, April 2006 Objectives After completing this lesson, you should be able to: Book and fill histograms. Book and fill N-tuples. After completing this lesson, you should be able to: Book and fill histograms. Book and fill N-tuples.

5-3 Gaudi Framework Tutorial, April 2006 Histograms & N-tuples One of the key tools in HEP HBOOK was one of the best packages in CERNLIB Usage and function is obvious –We did not reinvent the wheel In Gaudi it’s the same concept –First book then fill, requires explicit use of histogram pointer (c.f. HFF1) –Simplification in GaudiHistoAlg, combine in a single call, and hide pointer handling in base class One of the key tools in HEP HBOOK was one of the best packages in CERNLIB Usage and function is obvious –We did not reinvent the wheel In Gaudi it’s the same concept –First book then fill, requires explicit use of histogram pointer (c.f. HFF1) –Simplification in GaudiHistoAlg, combine in a single call, and hide pointer handling in base class

5-4 Gaudi Framework Tutorial, April 2006 Histograms - Good To Know... Histograms are kept in memory If not saved - they are lost Like all other data - they reside in a Data Store – Same access mechanism Persistency is configuarable – HBOOK, ROOT Histograms are kept in memory If not saved - they are lost Like all other data - they reside in a Data Store – Same access mechanism Persistency is configuarable – HBOOK, ROOT

5-5 Gaudi Framework Tutorial, April 2006 GaudiHistoAlg and GaudiTupleAlg Specialisations of GaudiAlgorithmSpecialisations of GaudiAlgorithm Algorithm GaudiAlgorithm GaudiHistoAlg GaudiTupleAlg Simplify handling of histograms and N-tuplesSimplify handling of histograms and N-tuples

5-6 Gaudi Framework Tutorial, April 2006 Booking and filling 1D histograms Booking done automatically on first filling call plot( energy, 12, "Primary particle energy (GeV)", 0., 100., 100 ); Location is set by job options –HistoTopDir (default is “”, recommend using “sub-detector name” + “/” ) –HistoDir (default is algorithm name) Booking done automatically on first filling call plot( energy, 12, "Primary particle energy (GeV)", 0., 100., 100 ); Location is set by job options –HistoTopDir (default is “”, recommend using “sub-detector name” + “/” ) –HistoDir (default is algorithm name) Number of bins High edge Low edge Title Integer ID Variable to plot

5-7 Gaudi Framework Tutorial, April 2006 Booking and filling 2D histograms similar to 1D plot2D( xVtx, yVtx 1001, "Primary vertex position", -1., 1., -1., 1. ); In this example, number of bins and weight are taken from defaults – see doxygen – 3D histograms, 1D profiles and 2D profiles are also available similar to 1D plot2D( xVtx, yVtx 1001, "Primary vertex position", -1., 1., -1., 1. ); In this example, number of bins and weight are taken from defaults – see doxygen – 3D histograms, 1D profiles and 2D profiles are also available y Low/High edge x Low/High edge Title Integer ID Variables to plot

5-8 Gaudi Framework Tutorial, April 2006 Histogram Persistency Job options // Set up the service using standard options // Choose Hbook or Root #include "$STDOPTS/RootHist.opts" //#include “$STDOPTS/Hbook.opts”; // Output filename (use.hbook extension for HBOOK) HistogramPersistencySvc.OutputFile = "histo.root"; Job options // Set up the service using standard options // Choose Hbook or Root #include "$STDOPTS/RootHist.opts" //#include “$STDOPTS/Hbook.opts”; // Output filename (use.hbook extension for HBOOK) HistogramPersistencySvc.OutputFile = "histo.root";

5-9 Gaudi Framework Tutorial, April 2006 N-tuples - Good To Know... Cannot be kept in memory – Grow and grow and grow... Like all other data - reside in a Data Store – Same access mechanism – Usage simplified by GaudiTupleAlg Cannot be kept in memory – Grow and grow and grow... Like all other data - reside in a Data Store – Same access mechanism – Usage simplified by GaudiTupleAlg

5-10 Gaudi Framework Tutorial, April 2006 Book and fill an N-tuple Book, declare items and fill all in one go: // Book the N-tuple. If already booked, retrieve its pointer Tuple myTuple = nTuple( 100, "An example nTuple“ ); // Declare the columns and fill myTuple->column( “Ntrack", numTracks ); myTuple->column( "NeutralE", neutralEnergy/TeV ); // Commit the entry myTuple->write(); Book, declare items and fill all in one go: // Book the N-tuple. If already booked, retrieve its pointer Tuple myTuple = nTuple( 100, "An example nTuple“ ); // Declare the columns and fill myTuple->column( “Ntrack", numTracks ); myTuple->column( "NeutralE", neutralEnergy/TeV ); // Commit the entry myTuple->write();

5-11 Gaudi Framework Tutorial, April 2006 N-tuple Persistency Job options NTupleSvc.Output = { ”FILE1 DATAFILE=’../job/tuples.root' OPT='NEW‘”}; // Convention for file extension is.root or.hbook Default persistency is Root. For Hbook: ApplicationMgr.HistogramPersistency = "HBOOK"; ApplicationMgr.DLLs += { "HbookCnv" }; Job options NTupleSvc.Output = { ”FILE1 DATAFILE=’../job/tuples.root' OPT='NEW‘”}; // Convention for file extension is.root or.hbook Default persistency is Root. For Hbook: ApplicationMgr.HistogramPersistency = "HBOOK"; ApplicationMgr.DLLs += { "HbookCnv" };

5-12 Gaudi Framework Tutorial, April 2006 Histogram and Ntuple IDs Numerical and Alpha Numerical IDs possible E.g. plot1D( energy, 12, "Particle Energy", 0,100,100 ); plot1D( energy, "en1", "Particle Energy", 0,100,100 ); plot1D( energy, “subdir/12", "Particle Energy", 0, 100, 100 ); plot1D( energy, “subdir/en1", "Particle Energy", 0, 100, 100 ); Numerical and Alpha Numerical IDs possible E.g. plot1D( energy, 12, "Particle Energy", 0,100,100 ); plot1D( energy, "en1", "Particle Energy", 0,100,100 ); plot1D( energy, “subdir/12", "Particle Energy", 0, 100, 100 ); plot1D( energy, “subdir/en1", "Particle Energy", 0, 100, 100 ); “HistoTopDir/HistoDir/12” “HistoTopDir/HistoDir/en1” “HistoTopDir/HistoDir/subdir/12” “HistoTopDir/HistoDir/subdir/en1”

5-13 Gaudi Framework Tutorial, April 2006 Hands On Create a new algorithm VisibleEnergyAlgorithm.h/cpp – Inheriting from GaudiTupleAlg Don’t forget to add it to Components_load.cpp Include additional header files in.cpp // Event model #include "Event/MCVertex.h" #include "Event/MCParticle.h" #include “Kernel/PhysicalConstants.h“ Copy loop over MCParticles from previous example… Create a new algorithm VisibleEnergyAlgorithm.h/cpp – Inheriting from GaudiTupleAlg Don’t forget to add it to Components_load.cpp Include additional header files in.cpp // Event model #include "Event/MCVertex.h" #include "Event/MCParticle.h" #include “Kernel/PhysicalConstants.h“ Copy loop over MCParticles from previous example…

5-14 Gaudi Framework Tutorial, April 2006 Hands On: Book and fill Histogram Whatever you want to histogram Whatever you want to histogram …or: // Plot size of MCParticles container attached to // primary vertex plot( daughters.size(), 1, "Primary vertex multiplicity", 0., 500., 100 ); …or: // Plot size of MCParticles container attached to // primary vertex plot( daughters.size(), 1, "Primary vertex multiplicity", 0., 500., 100 ); // Loop over the primary particles and plot their energy … double energy = (*itP)->momentum().e()/GeV; plot( energy, 12, "Primary particle energy (GeV)", 0., 100., 100 ); Whatever you want to histogram Whatever you want to histogram …or: // Plot size of MCParticles container attached to // primary vertex plot( daughters.size(), 1, "Primary vertex multiplicity", 0., 500., 100 ); …or: // Plot size of MCParticles container attached to // primary vertex plot( daughters.size(), 1, "Primary vertex multiplicity", 0., 500., 100 ); // Loop over the primary particles and plot their energy … double energy = (*itP)->momentum().e()/GeV; plot( energy, 12, "Primary particle energy (GeV)", 0., 100., 100 ); Geant 4 units are MeV, mm, nanosec. Need to convert to something reasonable Geant 4 units are MeV, mm, nanosec. Need to convert to something reasonable

5-15 Gaudi Framework Tutorial, April 2006 Hands On: Book and fill N-tuple Tuple myTuple = nTuple( 100, "An example nTuple", CLID_ColumnWiseTuple ); myTuple->column( "numNeutr", daughters.size()-numCharged ); myTuple->column( "NeutralE", neutralEnergy/TeV ); myTuple->write(); Tuple myTuple = nTuple( 100, "An example nTuple", CLID_ColumnWiseTuple ); myTuple->column( "numNeutr", daughters.size()-numCharged ); myTuple->column( "NeutralE", neutralEnergy/TeV ); myTuple->write();

5-16 Gaudi Framework Tutorial, April 2006 Visualize Histograms & N-tuple …e.g. using ROOT  root  root [0] TBrowser B .. and use menus to open and browse the histogram and Ntuple files …e.g. using ROOT  root  root [0] TBrowser B .. and use menus to open and browse the histogram and Ntuple files

5-17 Gaudi Framework Tutorial, April 2006 Solution In src.histo_ntuple directory of Tutorial/Components package To try this solution and start next exercise from it: In src.histo_ntuple directory of Tutorial/Components package To try this solution and start next exercise from it: Uncomment Tutorial 2 options in $MAINROOT/options/jobOptions.opts cd ~/cmtuser/Tutorial/Component/v7r0/src Move your modified files if you want to keep them cp../src.histo_ntuple/*.*. cd../cmt gmake $MAINROOT/$CMTCONFIG/Main.exe $MAINROOT/options/jobOptions.opts