Learning to Use Root for STAR Gene Van Buren (UCLA) for the STAR Collaboration Accessing STAR Data Programming for STAR (Makers) Star => Computing => Tutorials.

Slides:



Advertisements
Similar presentations
Introduction to MATLAB The language of Technical Computing.
Advertisements

1 Starting a Program The 4 stages that take a C++ program (or any high-level programming language) and execute it in internal memory are: Compiler - C++
Chapter 10 Introduction to Arrays
1 ADVANCED MICROSOFT POWERPOINT Lesson 5 – Using Advanced Text Features Microsoft Office 2003: Advanced.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
COMP171 Data Structure & Algorithm Tutorial 1 TA: M.Y.Chan.
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
1 Java intro Part 3. 2 Arrays in Java Store fixed number of values of a given type Arrays are objects –have attributes –must be constructed Array declaration:
Chapter 6: User-Defined Functions I
C++ Programming: From Problem Analysis to Program Design, Second Edition Chapter 6: User-Defined Functions I.
Extra Notes for Assignment 1 – Salary Tax Run the sample program –The program executable can only be executed on CSLINUX machines (linux platform only)
Chapter 6: User-Defined Functions I
C++ Programming: Program Design Including Data Structures, Fifth Edition Chapter 17: Linked Lists.
Midterm Thursday Topics: First Midterm Instructions Set Architecture Machine Language Programming Assembly Language Programming Traps, Subroutines, & Interrupts.
1 of 5 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2006 Microsoft Corporation.
Review of C++ Programming Part II Sheng-Fang Huang.
® IBM Software Group © 2006 IBM Corporation JSF Tab Controls This Learning Module shows how to develop server-side EGL applications with dynamic content.
STAR Software Basics Introduction to the working environment Lee Barnby - Kent State University.
Chapter 12: Adding Functionality to Your Classes.
C++ C++ Overview (I) What is Object Orientated Programming? Approach: Break problem into subgroups of related parts that take into account code and data;
Click to edit Master title style 21 st Nov, 2003 Valeri Fine (BNL) ROOT and ROOT4STAR framework V. Fine or Software for “C++ speaking” people.
Chapter 6: User-Defined Functions I Instructor: Mohammad Mojaddam
STAR C OMPUTING Maker and I/O Model in STAR Victor Perevoztchikov.
Creating a Project with C++ Builder
Chapter 6: User-Defined Functions
Introduction to Programming Using C Modularity. 2 Contents Modularity Functions Preprocessor Comments Global variables.
Chapter 17 Creating a Database.
DATA STRUCTURES LAB 1 TA: Nouf Al-harbi
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 6: User-Defined Functions I.
Chapter 4 Grouping Objects. Flexible Sized Collections  When writing a program, we often need to be able to group objects into collections  It is typical.
Data Structures Using C++1 Chapter 4 Standard Template Library (STL)
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.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Makefiles. Multiple Source Files (1) u Obviously, large programs are not going to be contained within single files. u C provides several techniques to.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
Argonne Jamboree January 2010 Esteban Fullana AOD example analysis.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 6: User-Defined Functions I.
WHAT IS THE VALUE OF X? x = 0 for value in [3, 41, 12, 9, 74, 15] : if value < 10 : x = x + value print x.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 25 I’m Suffering from Information Overload.
Chapter 24 I’m Suffering from Information Overload (Access Databases) Clearly Visual Basic: Programming with Visual Basic nd Edition.
V.Fine ALICE-STAR Joint meeting April, 9, 2000 The STAR offline framework* V. Fine *) See also:
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 6: User-Defined Functions I.
V.Fine for STAR collaboration The STAR offline framework and 3D visualization V. Fine, Y. Fisyak, V. Perevoztchikov, T.Wenaus.
Chapter 3: User-Defined Functions I
STL CSSE 250 Susan Reeder. What is the STL? Standard Template Library Standard C++ Library is an extensible framework which contains components for Language.
SSE693 C# and.NET Dr. MacNeil Summer 2005 Jay Clary / Lance Hilliard Team Project 3.
IS2802 Introduction to Multimedia Applications for Business Lecture 4: JavaScript, Loops, and Conditional Statements Rob Gleasure
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 6: User-Defined Functions I.
CINT & Reflex – The Future CINT’s Future Layout Reflex API Work In Progress: Use Reflex to store dictionary data Smaller memory footprint First step to.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 9 Structures and Sequential Access Files.
Star Database Tutorial Package Design & Objectivity Discussion Interface Questions – What do you want? -> making requests – What do you get? -> data container.
V.Fine for STAR collaboration The STAR offline framework V. Fine, Y. Fisyak, V. Perevoztchikov, T.Wenaus.
StEvent I/O Model And Writing a Maker Or How to Add a New Detector Akio Ogawa BNL 2003 Nov Dubna.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 17: Linked Lists.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 18: Linked Lists.
Python: File Directories What is a directory? A hierarchical file system that contains folders and files. Directory (root folder) Sub-directory (folder.
HYDRA Framework. Setup of software environment Setup of software environment Using the documentation Using the documentation How to compile a program.
Microsoft Visual Basic 2005: Reloaded Second Edition
Chapter 6: User-Defined Functions I
Practical Office 2007 Chapter 10
Array Lists Chapter 6 Section 6.1 to 6.3
Tonga Institute of Higher Education
Chapter 6: User-Defined Functions I
Using Templates and Library Items
Functions continued.
 A function is a named sequence of statement(s) that performs a computation. It contains  line of code(s) that are executed sequentially from top.
SPL – PS1 Introduction to C++.
Presentation transcript:

Learning to Use Root for STAR Gene Van Buren (UCLA) for the STAR Collaboration Accessing STAR Data Programming for STAR (Makers) Star => Computing => Tutorials => Learning to Use Root for STAR

Root for STAR Accessing STAR Data All data is stored in tables Tables associated with a particular subsystem or physics topic are grouped into datasets Datasets are placed in a hierarchy of topics inside an event Events are navigated with dataset iterators to find tables of interest Need STAR base and table libraries: –gSystem->Load("St_base"); –gSystem->Load("St_Tables");

Root for STAR Using Datasets The Dataset Hierarchy Each dataset is an instance of the St_DataSet class St_DataSet In the dataset hierarchy, a dataset can be a subset of another data set An event is a dataset dataset table dataset table dataset

Root for STAR Using Datasets Dataset Iterators Navigation of a dataset hierarchy is performed with the St_DataSetIter class. St_DataSetIter To find a particular child dataset of a parent dataset –Instantiate a new iterator for the parent dataset –Supply the iterator with the name of the child dataset –A pointer to the child dataset is returned St_DataSetIter myIter("parent_set_name"); or St_DataSetIter myIter(parent_set_pointer); St_DataSet *mySet = myIter("child_set_name");

Root for STAR Using Datasets Getting an Event XDF file: St_XDFFile::NextEventGet() St_XDFFile::NextEventGet() –Sequential file access only Root file: keys –Random access (using TKey ) TKey St_XDFFileSt_XDFFile file("file_name","r"); // "r" means "read only" St_DataSet *event; while (event = file.NextEventGet()) {... } TFile file("file_name"); for (Int_t i=0; i<file.GetNKeys(); ++i) { St_DataSet *event = file.GetKey("event_name",i)->ReadObj();... }

Root for STAR Using Datasets Creating and Adding a Dataset Instantiating (creating) a dataset: St_DataSet *myNewSet = new St_DataSet("set_name"); Adding a dataset to another: –Upon instantiation: St_DataSet *myNewSet = new St_Dataset("new_set_name",parent_set_pointer); –Any other time: parent_set_pointer->Add(child_set_pointer); Removing a dataset from another: –parent_set_pointer->Remove(child_set_pointer); dataset No parent

Root for STAR Using Tables Understanding St_Table Base class for all table classes Derived classes are “wrappers” for StAF tables Nomenclature: (for tables of type table_type_name) Root class name: St_table_type_name StAF struct name: table_type_name_st Provides some basic table functions: –GetNRows() –Print() –AddAt()

Root for STAR Using Tables Understanding St_Table Derived from St_DataSet –Can be placed in the data hierarchy just as a dataset would be. –Can be found the same way a dataset is (with an St_DataSetIter) St_tpt_track *table = new St_tpt_track("tpc_tracks",3000);... myDataSet->Add(table);... table = (St_tpt_track *) myIter["tpc_tracks"]; (Note: Square brackets make dataset iterators find only tables, not sub-datasets).

Root for STAR Using Tables Understanding St_Table Derived from TArray –Each row is an array element –Each row is an instance of StAF table struct –GetTable() returns pointer to first row St_tpt_track *table = (St_tpt_track *) myIter["tpc_tracks"]; tpt_track_st *rowTable = table->GetTable(); for (Int_t i=0; i GetNRows(); i++) { hist->Fill(rowTable[i].value1); or hist->Fill(rowTable->value1); rowTable++; }

Root for STAR Using Tables Creating and Filling a Table Create new table, specifying name and max # of rows Create an instance of associated StAF table struct Fill values of row Insert row into table (row table is copied) St_tpt_track *table = new St_tpt_track("tpc_tracks",3000); tpt_track_st rowTable; rowTable.value1 = 100; rowTable.value2 = ; table->AddAt(&rowTable,0); rowTable.value1 = 200; table->AddAt(&rowTable,23);

Root for STAR Programming for STAR Makers A standardized way of doing analysis (base class: StMaker ) StMaker Each Maker is associated with (and responsible for) a dataset Makers are run as links of a processing chain ( StChain ) StChain dataset Maker2 dataset Maker3 dataset MakerN dataset Maker1 event

Root for STAR Making Makers Using the Maker template Make a root working directory for yourself Get a copy of the templates: (USE STARPRO!) cvs co StRoot/St_TLA_Maker Files are in $STAR/StRoot/St_TLA_Maker/ St_TLA_Maker.h St_TLA_Maker.cxxSt_TLA_Maker.hSt_TLA_Maker.cxx –Constructor : Name the associated dataset –Init() : Initialize any variables or tables to be used for all events –Make() : Process each event –Finish() : Post-event-loop processing –Can add additional member functions

Root for STAR Making Makers Constructor and header file (.h) First, edit St_TLA_Maker.h and St_TLA_Maker.cxx files, and perform a global replace on " TLA " with the name you wish to give your Maker. Change the constructor prototype (in the.h file) to specify the name and title you wish to give the dataset to be associated with this Maker. Probably don't need to do anything for constructor in.cxx file Add data members and new methods in.h file as necessary for the.cxx file. Use " //! " after data members which are pointers (prevents them from being saved when writing objects to file)

Root for STAR Making Makers Init() Initalize any variables which you will be using for all events. Create any tables you will be using in all events Be sure you have made variables (and table pointers) available to the whole Maker by defining them in the.h file (remember scope) Tables should be made with the " new " command, and a pointer kept. Otherwise they will be lost when the scope of Init() ends. Insert #include "class.h" at the top of the.cxx file for any classes which you are using

Root for STAR Making Makers Make() This is where the event processing takes place Create your output tables Add your output tables to the Maker's dataset: ( m_DataSet is inherited from StMaker) m_DataSet->Add(table_pointer); Get pointers to your input tables If you're wrapping a PAM, place a call to that PAM If you're writing a new analysis module, just place your code at the end of Make()

Root for STAR Making Makers Finish() Not necessary (if you don't have any post-event-loop processing) Perform calculations on histograms you've made Create run summary information

Root for STAR Making Makers Other member functions Don't be afraid of adding your own member functions Ideas: place histogramming calls in a separate MakeHist() member function which is called from the Make() member function Remember to place prototype in.h file Keep these member functions out of public: if you are going to place your Maker where others can use it (good programming practice)

Root for STAR Making Makers Compiling Set directory to root working directory (your StRoot should be a subdirectory of this directory) Use starpro Type: makel St_abc_Maker Run root4star Type: gSystem->Load("St_abc_Maker"); Debug ( dbx `which root4star` )

Root for STAR Chain Macros Macro Outline 1. Load software libraries 2. Define input file(s), and any output file(s) 3. Construct a chain which controls the flow of the analysis 4. Construct the Makers which contain the analysis modules 5. Initialize the chain (which in turn intializes all the Makers) 6. Loop over events to process from the input. For each event: a. Call the Make() member function of the chain - this calls each Maker to perform its analysis b. Output each event as desired c. Clear the chain 7. Call the Finish() member function of the chain to perform any post-run processing

Root for STAR Chain Macros Examples strange.C bfc.C Sample MDC1 Data: (on the BNL unix machines) /disk00000/star/test_data/ –year1 and year2 data –raw data (*.fza files and *.xdf files) –dst data ( *_dst.xdf )