14 - 10 - Utilizzo del codice GEANT4 in campo medico LNS (Mon 12-Oct-2009 ---- Wed 14-Oct-2009) Gestione ed analisi dei dati prodotti.

Slides:



Advertisements
Similar presentations
Interaction Design: Visio
Advertisements

Intro to Access 2007 Lindsey Brewer CSSCR September 18, 2009.
Office Links - Sharing Data in Microsoft Office A Mixed Bag of Treasures Chester N. Barkan Registrar Long Island University, C.W.Post Campus.
MS® PowerPoint.
An Introduction to Using
Tutorial 8 Sharing, Integrating, and Analyzing Data
McGraw-Hill/Irwin ©2008 The McGraw-Hill Companies, All Rights Reserved TECHNOLOGY PLUG-IN T4 PROBLEM SOLVING USING EXCEL Goal Seek, Solver & Pivot Tables.
June 4-8, 2007 G4ParisAnalysis 2 P. Gueye1 Analysis 2 Histograms and ntuples Paul Guèye Hampton University Hampton VA
Victor Serbo, SLACACAT’2002, Moscow, June 24-28, Status of AIDA and JAS 3 by Victor Serbo What is AIDA History/Collaboration/Documentation Some Details.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
Managing Grades with Excel Viewing Help To view Help 1.Open Excel on your computer. 2.In the top right hand corner of the Excel Screen type in the.
Microsoft Excel 2010 Chapter 7
4 November 2009 Geant4 Data Analysis J. Perl 1 Trivial Data Analysis for Geant4 Joseph Perl, SLAC Geant4 v9.2p02.
Integrating Access with the Web and with Other Programs.
13 January 2011 Geant4 Data Analysis J. Perl 1 Trivial Data Analysis for Geant4 Joseph Perl, SLAC Geant4 v9.4.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
1 Introduction to OBIEE: Learning to Access, Navigate, and Find Data in the SWIFT Data Warehouse Lesson 8: Printing and Exporting an OBIEE Analysis This.
XP New Perspectives on Microsoft Access 2002 Tutorial 71 Microsoft Access 2002 Tutorial 7 – Integrating Access With the Web and With Other Programs.
Access Tutorial 8 Sharing, Integrating, and Analyzing Data
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
ROOT An object oriented HEP analysis framework.. Computing in Physics Physics = experimental science =>Experiments (e.g. at CERN) Planning phase Physics.
Classroom User Training June 29, 2005 Presented by:
XP New Perspectives on Introducing Microsoft Office XP Tutorial 1 1 Introducing Microsoft Office XP Tutorial 1.
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
Analysing Data with Excel Importing Data from a Text File To import data from a text file: 1.Start Excel. 2.Click File, click New, click Workbook,
JAS3 + AIDA LC Simulations Workshop SLAC 19 th May 2003.
CHAPTER 9 Introducing Microsoft Office Learning Objectives Start Office programs and explore common elements Use the Ribbon Work with files Use.
Creating a Web Site to Gather Data and Conduct Research.
Microsoft Access Lesson 1 Lexington Technology Center February 11, 2003 Bob Herring On the Web at
XP New Perspectives on Integrating Microsoft Office XP Tutorial 2 1 Integrating Microsoft Office XP Tutorial 2 – Integrating Word, Excel, and Access.
Excel Connector for JIRA Installation and functional presentation.
Interaction Design Interaction Design - Joan Cahill - Visio Interaction Design: Visio.
Teacher’s Assessment Assistant Worksheet Builder Starting the Program
University of Sunderland CDM105 Session 6 Dreamweaver and Multimedia Fireworks MX 2004 Creating Menus and Button images.
Key Applications Module Lesson 21 — Access Essentials
Writing Extension Modules (Plugins) for JAS 3 Mark Donszelmann Tony Johnson Victor Serbo Max Turri CHEP2004, 27 september-1 october 2004, Interlaken, Switzerland.
Chapter 1 Creating a Dreamweaver Web Page and Local Site
Prachi Chitnis.  The CSS feel  SDS – Synoptic Display Studio  ADL Converter  PV table, Probe…
Office Management Tools II Ms Saima Gul. Office Management Tools II Ms Saima Gul.
Analysing Data with Excel Viewing Help To view Help 1.On the Start menu, point to Programs, and then click Microsoft Excel. 2.On the Help menu,
07 Apr, 2000 GAUDI Histograms Pavel Binko, LHCb / CERN 1 LHCb Software Week GAUDI Histograms Pavel Binko LHCb / CERN.
Pasewark & Pasewark 1 PowerPoint Lesson 4 Expanding on PowerPoint Basics Microsoft Office 2007: Introductory.
CLAS12 software paradigm My two cents… Vardan Gyurjyan Friday, August 26, 2005.
GranSasso, Jul-2002 Andreas Pfeiffer, CERN/IT-API, AIDA Abstract Interfaces for Data Analysis Andreas Pfeiffer CERN IT/API
Using This PowerPoint This PowerPoint presentation assumes your Computer Science teacher has provided you with the InstallingJava folder, which contains.
Quick Test Professional 9.2. Testing Process Preparing to Record Recording Enhancing a Test Debugging Running the Test and Analyzing the Results Reporting.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 8 1 Microsoft Office Access 2003 Tutorial 8 – Integrating Access with the.
Features of JAS Plots Plots update in real time. Data for plots can be local or remote (use Java RMI to connect to JAS Data Server). Rich variety of styles.
WS1-1 ADM730, Workshop 1, September 2005 Copyright  2005 MSC.Software Corporation WORKSHOP 1 INTRODUCTION Open Retracted - Bad Retracted - Good.
AIDA Abstract Interfaces for Data Analysis Massimiliano Turri, SLACCHEP, La Jolla, March “The goal of the AIDA project is to define abstract.
File and File Systems Compiled by IITG Team Need to be reorganized and reworded.
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
Microsoft Excel 2007 Noris Bt. Ismail Faculty of Information and Communication Technology Tel : (Ext 8408) BCOMP0101.
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 8-1 LINKS TO OBJECTIVES Import data from another Access table Import data from another Access table.
XP Creating Web Pages with Microsoft Office
Introduction to OBIEE:
Analysis 2 Histograms and ntuples
Computer Fundamentals
WORKSHOP 3 GSE IMPORT.
Multi-host Internet Access Portal (MIAP) Enhancement Guide
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
Welcome to E-Prime E-Prime refers to the Experimenter’s Prime (best) development studio for the creation of computerized behavioral research. E-Prime is.
Using JDeveloper.
Access Tutorial 8 Sharing, Integrating, and Analyzing Data
Microsoft Office Access 2003
Microsoft Office Access 2003
From Excel to Outlook: creating a distribution list via Blackboard.
Tutorial 7 – Integrating Access With the Web and With Other Programs
Tutorial 8 Sharing, Integrating, and Analyzing Data
Lab 08 Introduction to Spreadsheets MS Excel
Presentation transcript:

Utilizzo del codice GEANT4 in campo medico LNS (Mon 12-Oct Wed 14-Oct-2009) Gestione ed analisi dei dati prodotti Francesco Di Rosa

I.Overview of basic Analysis a)Generic and simple Output in Geant4 b)Analysis of ASCII files II.Overview of advanced Analysis a)Downloading the AIDA utility package b)Turning on the analysis package c)Loading the package d)Producing/Analyzing first histograms e)The packages: JAS, ROOT, PAW, OpenScientist III.Few examples of Analysis a)JAS b)ROOT c)PAW IV.Conclusion Outline

Geant4 does not attempt to provide its own data analysis tools, focusing instead on its central mission as a simulation toolkit The Geant4 user is expected to provide his own code to output results to an appropriate analysis format The Geant4 simple output: the simplest possible output format here G4Cout ASCII *. TXT (Row, Matrices, Line) *. CSV (Comma-Separated Values), *. PIPPO (What you want!!!!!!!!! Exe: mixed formats) The resulting files can be analyzed by tools such as: Excel, OpenOffice, Gnuplot, Matlab, OriginLab I. a) Generic and simple Output in Geant4

An Example of G4COUT (good for test and verify) I. a) Generic and simple Output in Geant4 Lung Interface!! G4cout " << " " << std::setw( 6) << edep << " " " << " " << std::setw( 2) << particleCharge << " " " << " " << std::setw( 2) << kineticEnergy << " " << G4endl;

std::ofstream myfile(“File_di_OUTPUT”, std::ios::app); myfile << edep << '\t' <<particleCharge<<'\t' << kineticEnergy << '\n' << G4endl; controlloTally=evtNb; An Example of ASCII File (Save As……) I. a) Generic and simple Output in Geant4

I. a) Generic and simple Output in Geant4 PDD

Excel Comes from a small company called MicroSoft Part of Microsoft Office (very common software) From the “Data” menu, select “Get External Data”…“Import Data…” Select the file using the extension (*.*) The Text Import Wizard will come up Check the “Delimited” box Hit “Next” Check the “Comma” box The bottom part of the Wizard should now show your data nicely separated into appropriate columns. Hit “Finish” You will see a dialog titled “Import Data” which will ask where to put the data. Accept the defaults: Existing worksheet: =$A$1 Hit “OK” The data should now show up in the spreadsheet (see the next slide) I. b) Analysis of ASCII files

I. b) Analysis of ASCII files Importing data in Excel

Plotting with Excel Select at least one item in the filled data area. From the “Insert” menu, select “Chart…” Select Chart type: “Histogram” Hit “Finish” You’re done I. b) Analysis of ASCII files Now that the data is in the spreadsheet, you can plot it as follows:

OpenOffice OpenOffice.org is a multiplatform and multilingual office suite and an open-source projectmultiplatformmultilingualoffice suiteopen-source Compatible with all other major office suites, the product is free to download, use, and distribute From the “File” menu, Select “Open…” In the “File type” box, select “Text CSV” Then select your file Typology ………………………………………. I. b) Analysis of ASCII files

Importing Data from a.csv File Into OpenOffice Once you select your file: The Text Import dialog will come up Check the “Comma” box The bottom part of the dialog should now show your data nicely separated into appropriate columns, then Hit “OK” I. b) Analysis of ASCII files The data should now show up in the spreadsheet (maybe)

Plotting with OpenOffice Now that the data is in the spreadsheet, you can plot it as follows: Select at least one item in the filled data area. From the “Insert” menu, select “Chart…” The defaults should be fine Hit “Next” I. b) Analysis of ASCII files Select the Icon for “Line” chart Hit “Create” You’re done!

“Gnuplot is a portable command-line driven interactive data and function plotting utility for UNIX, IBM OS/2, MS Windows, DOS, Macintosh, VMS, Atari and many other platforms.” “The software is copyrighted but freely distributed (i.e., you don't have to pay for it)” See the demo page ( I. b) Analysis of ASCII files Gnuplot

) Choose the data Folder 2) LOAD the output file 3) In the workspace appear your data I. b) Analysis of ASCII files 4. One-click with right mouse bottom on Workspace 5. Select Plot Catalog and prefer the Chart type 6. You’re done… :-/ Plotting with MatLab

I.Overview of basic Analysis a)Generic and simple Output in Geant4 b)Analysis of ASCII files II.Overview of advanced Analysis a)Downloading the AIDA utility package b)Turning on the analysis package c)Loading the package d)Producing/Analyzing first histograms e)The packages: JAS, ROOT, PAW, OpenScientist III.Few examples of Analysis a)JAS b)ROOT c)PAW IV.Conclusion Outline

While the Geant4 collaboration does not maintain any data analysis system, many data analysis tool developers have interfaced their systems to Geant4 and each of the following has an active Geant4 user community II. Overview of advanced Analysis (AIDA) ROOT is an Object Oriented Data Analysis Framework. It is heavily used in High Energy Physics. Freely available at AIDA (Analysis Interface for Data Analysis) is an interface standard used by several advanced data analysis tools. It provides a single standard way to create your data Commands to:instantiate/fill an nTuple instantiate/fill a Histogram You can switch from one AIDA-compliant tool to another without having to change how you book and fill your histograms (

AIDA Example AIDAAIDA User code (e.g. GEANT4) Analysis tool 1 Analysis tool 2 Analysis tool 3 Use same code with any AIDA-compliant analysis tool II. Overview of advanced Analysis (AIDA)

Now, you have just AIDA installed…… But….. If you DO NOT have AIDA installed, then (will take ~5-10 min): 1.Create AIDA directory under "geant4/work" directory mkdir geant4/work/AIDA 2.Download "osc_batch-v16r0-XX-i386-gcc_401.zip" into "AIDA" folder from –WindowsXX = CYGWIN –LinuxXX = Linux –MACOSXX = Darwin 3.Decompress the file 4.Go into “osc_batch/v16r2” directory cd osc_batch/v16r0 5.Setup the AIDA environment source aida-setup.csh or source aida-setup.sh 6.Done! II. a) Downloading & Setting the AIDA utility package

G4ANALYSIS_USE Set variable –setenv G4ANALYSIS_USE 1 (csh) –export G4ANALYSIS_USE=1 (bash o setup) Is it on? (linux commands) –1 (on) or 0 (off) –“echo”echo $G4ANALYSIS_USE –“env” env then look for G4ANALYSIS_USE II. b) Turning on the Analysis Package

Required files #include  Define AnalysisManager.cc  Create & Fill AnalysisManager.hh II. b) Loading the analysis package I

II. b) Loading the analysis package II: AnalysisManager.cc (create) From Hadrontherapy Example

…………. A01AnalysisManager::A01AnalysisManager() :analysisFactory(0), hFactory(0), tFactory(0) { // Hooking an AIDA compliant analysis system. analysisFactory = AIDA_createAnalysisFactory(); if(analysisFactory) { ITreeFactory* treeFactory = analysisFactory->createTreeFactory(); tree = treeFactory->create("A01.aida","xml",false,true,"compress=yes"); hFactory = analysisFactory->createHistogramFactory(*tree); tFactory = analysisFactory->createTupleFactory(*tree); delete treeFactory; // Will not delete the ITree. } …….. II. b) Loading the analysis package II: AnalysisManager.cc (create) From Extended Example A01

… std::string opts = "compress=no"; fTree = treeFactory->create("AnaEx01.aida","xml",false,true,opts); ….. // Create an histo factory that will create histo in the tree : AIDA::IHistogramFactory* histoFactory = fAIDA- >createHistogramFactory(*fTree); if (histoFactory) { fEAbs = histoFactory->createHistogram1D("EAbs",100,0,100); fLAbs = histoFactory->createHistogram1D("LAbs",100,0,100); … delete histoFactory; } … II. b) Loading the analysis package II: AnalysisManager.cc (create) From Extended Example AnaEx01: create histograms

… // Get a tuple factory : AIDA::ITupleFactory* tupleFactory = fAIDA->createTupleFactory(*fTree); if (tupleFactory) { // Create a tuple : fTuple = tupleFactory->create("AnaEx01","AnaEx01", "double EAbs,double LAbs,double EGap,double LGap"); delete tupleFactory; } … II. b) Loading the analysis package III: AnalysisManager.cc (create) From Extended Example AnaEx01: create ntuples

II. b) Loading the analysis package IV: AnalysisManager.cc (fill) From Hadrontherapy Example

… if (CHC) { G4int n_hit = CHC->entries(); for (G4int i=0;i<n_hit;i++) { G4double EAbs = (*CHC)[i]->GetEdepAbs(); G4double LAbs = (*CHC)[i]->GetTrakAbs(); … fEAbs->fill(EAbs); fLAbs->fill(LAbs); … fTuple->fill(0,EAbs); fTuple->fill(1,LAbs); … fTuple->addRow(); } }… II. b) Loading the analysis package IV: AnalysisManager.cc (fill) From Extened Example AnaEx01: fill histograms and ntuples

II. c) Producing/Analyzing first histograms  Copy example into your work area (hadrontherapy)  Go into example directory: cd hadrontherapy  Compile: gmake or make  Run: ~/geant4/work/bin/Linux-g++/……  A new file should appear: hadronterapy.root (.hbk,.aida) ANALYSIS  Start JAS (…ROOT,AIDA,HBOOK)  Open the file: File  “Open File” then select XX.root  Double click on “Blue Folder”  Double click on histogram of interest Homework assignment

I.Overview of basic Analysis a)Generic and simple Output in Geant4 b)Analysis of ASCII files II.Overview of advanced Analysis a)Downloading the AIDA utility package b)Turning on the analysis package c)Loading the package d)Producing/Analyzing first histograms e)The packages: JAS, ROOT, PAW, OpenScientist III.Few examples of Analysis a)JAS b)ROOT c)PAW IV.Conclusion Outline

Java Analysis Studio: JAS (all files) The Root of Everything: ROOT (root files) Physics Analysis Workstation: PAW (hbook files) OpenScientist (all files) III. Few examples of advanced analysis

–Written entirely in Java (really portable) –Originally targeted at offline analysis (but also used extensively for online monitoring) –Rich, easy to use GUI Can view trees, plots, HTML pages with embedded active objects –Built-in editor/compiler for writing analysis code Based on open source JEdit editor (pure Java editor, syntax highlighting, auto indent, parenthesis matching, etc.) –Local and Client-Server Operation Access local or remote analysis objects Can send analysis code to the data and ship back only the results III a) Java Analysis Studio (JAS, Java Analysis Studio (JAS)

Start jas Open the file: File  “Open File” then select OUTPUT.aida Double click on “Blue Folder” (OUTPUT.aida) Double click on histogram and then the ones of interest Double click on tuples then “Yellow Folder” III a) Java Analysis Studio (Example)

Built-in HTML viewer with embeddable “objects” (plots, buttons, etc.). Pages can display histograms. User can control layout, add, remove plots. Tree area provides access to analysis objects. Each item has popup menu and double- click action. Plot Widget, shows data in real time, optimized for fast refresh performance. III a) Java Analysis Studio (GUI)

III b) ROOT ( - ) In AnaEx01AnalysisManager.cc  Verify or type the following lines std::string opts = “export=root"; fTree = treeFactory->create("AnaEx01.root",“ROOT",false,true,opts); Start root Launch browser: new TBrowser() Open the file: File  “Open” then select nameFile.root Double click on “Yellow Folder” (ROOT Files) Double click on “Yellow Folder” (file.root) Double click on “Yellow Folder” (histograms) and then the ones of interest Double click on “Yellow Folder” (tuples) then right-mouse on “nameFile” and select Start Viewer Drag variables of interest into (X,Y,Z) (Ex: X=EAbs and Y=Labs) Select Draw Icon (bottom left corner) Create a cut: double click on E() then type: EGapcut (alias) and EGap<20 (expression) Drag cut into Scissor Select Draw Icon (bottom left corner) Can enable or disable the cut by double clicking on it

III b) ROOT (Hist Browser)

III b) ROOT ( TGhtml web browser plug-in) URL You can browse a root file You can execute a script

III b) ROOT (Macro Manager/Editor plug-in) Click on button to execute script

III b) ROOT (Math libraries)

III c) Physics Analysis Workstation (PAW, cernlib) PAW is no longer supported: you are on your own!!! In AnaEx01AnalysisManager.cc  Verify or type the following lines std::string opts = “export=hbook"; fTree = treeFactory->create("AnaEx01.hbook",“HBOOK",false,true,opts); Should get: AnaEx01.hbook Start paw++ Open file: h/file 0 [filepath]/AnaEx01.hbook Double click on logical unit 1 (lun1) Double click on histograms or ntuple Select a variable and double lick in (X,Y,Z) (Ex: X=EAbs and Y=Labs) Click on Plot Click on Cut Editor … Left box = variable, middle box = expression, right box = value (Ex: EGap<20) Click on Plot

Conclusion The Geant4 user is expected to provide his own code to output results to an appropriate analysis format Geant4 does not attempt to provide its own data analysis tools, focusing instead on its central mission as a simulation toolkit Several analysis tools are available Real Conclusion Use Whatever Analysis Tool You Like Use as it suits your needs

MORE INFORMATIONS ABOUT AIDA

n -Tuple (The term originated as an abstraction of the sequence: single, double, triple, quadruple, quintuple, n-tuple) Let us consider the following example A Data Summary Tape contains events. Each event consists of many variables (200) for which we would like to make some distributions according to various selection criteria One possibility is to create and fill 200 histograms on an event-by-event basis while reading the DST An alternative solution is to create one Ntuple Instead of histograming the 200 variables directly, and therefore losing the exact values of the variables for each event and their correlations, the variables are first stored in an Ntuple. An Ntuple is like a table where the 200 variables mentioned above are the columns and each event is a row Let us use Example

Factory – “a building or set of buildings with facilities for manufacturing” (Webster Dictionary). O bjects in AIDA are created by Factories or internally by other objects. User should newer utilize “new”.  static IAnalysisFactory create ()  IHistogramFactory createHistogramFactory (ITree tree)  IFunctionFactory createFunctionFactory (ITree tree)  ITupleFactory createTupleFactory (ITree tree)  ITreeFactory createTreeFactory ()  IPlotterFactory createPlotterFactory ()  IDataPointSetFactory createDataPointSetFactory (ITree tree)  IFitFactory createFitFactory () AIDA Factories – IAnalysisFactory

Creates 1D, 2D, 3D IHistograms, IClouds, IProfiles: –IHistogram1D createHistogram1D (String name, String title, int nBins, double lowerEdge, double upperEdge, String options ) –IHistogram1D createHistogram1D (String name, String title, int nBins, double[] binEdges, String options ) –Options: “type=efficiency” – create efficiency histogram. –Options: “autoconvert=true” – to enable auto conversion for Clouds. Does operations on those objects: –Copy and Arithmetic operations add/subtract/divide/multiply IHistogram1D add (String name, IHistogram1D h1, IHistogram1D h2) –Projections and Slices of 2D and 3D Objects: 2D -> 1D, 3D -> 2D IHistogram1D projectionX (String name, IHistogram2D h2D) IHistogram1D sliceX (String name, IHistogram2D h2D, int index) AIDA Factories – IHistogramFactory

IHistogram (1D-3D) Binned histogram: IHistogram1D, 2D, 3DIHistogram1D –“fill” methods (with/without weight) –Histogram info: entries, mean, rms, axis –Bin info: centre, entries, height, error –Histogram arithmetic: add, multiply, divide –Convenience methods, like coordinate-to- index conversion

ITuple ITuple - interface to the DataITuple –“get/set” methods for double, float, int, … –Information about columns: min, max, mean, rms –Navigating: start(), next(), skip(int nRows) –Project ITuple into 1D, 2D, 3D histogram –New features for AIDA 3.0: Support for complex internal structures (subfolders) Chaining of ITuples

ICloud Unbinned collection of points: ICloud1D, 2D, 3DICloud1D –Can represent scatter plot, dynamically rebinnable histogram –Can be converted to a binned histogram –Standard “get/set” methods for entries –Collection info: lower, upper, mean, rms

IFunction and Fitting Fitting: IFunction, IFitFunction –IFunction – simple interface, allows to set parameters and get function value –IFitFunction – fit function to a histogram Extends IFunction Various fit control methods: step size, bounds, etc. Allows to perform fit and get results AIDA 2.2 fitting functionality fairly limited –AIDA 3.0 (Under discussion) extended functionality

ITree –directory-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 storage Can support multiple file formats Mount/Unmount functionality (like unix) allows multiple stores to be seamlessly merged AIDA XML format is defined for data interchange