StEvent I/O Model And Writing a Maker Or How to Add a New Detector Akio Ogawa BNL 2003 Nov Dubna.

Slides:



Advertisements
Similar presentations
1 Classes Object-oriented programming: Model the problem as a collection of objects that have certain attributes and interact with one another and/or the.
Advertisements

Overview creating your own functions calling your own functions.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
Chapter 6. 2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single Value Pass by Reference Variable Scope.
CS 240: Data Structures Tuesday, June 19 th ADT Requirements (Card), I/O.
C++ Functions. 2 Agenda What is a function? What is a function? Types of C++ functions: Types of C++ functions: Standard functions Standard functions.
Offline Trigger Software Update Akio Ogawa STAR Collaboration Meeting 2003 Feb 28 BNL.
Call-by-Value vs. Call-by-Reference Call-by-value parameters are used for passing information from the calling function to the called function (input parameters).
Learners Support Publications Pointers, Virtual Functions and Polymorphism.
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.
Modular Programming Chapter Value and Reference Parameters t Function declaration: void computesumave(float num1, float num2, float& sum, float&
STAR C OMPUTING Maker and I/O Model in STAR Victor Perevoztchikov.
A First Book of C++: From Here To There, Third Edition2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single.
Modular Programming Chapter Value and Reference Parameters computeSumAve (x, y, sum, mean) ACTUALFORMAL xnum1(input) ynum2(input) sumsum(output)
Olga Barannikova STAR Dubna Meeting STAR Software Basics Compiling using 'cons' STAR_LEVELS, starver and changing environment Coding Standards for.
The Structure of a C++ Program. Outline 1. Separate Compilation 2. The # Preprocessor 3. Declarations and Definitions 4. Organizing Decls & Defs into.
Chapter 13 Recursion. Learning Objectives Recursive void Functions – Tracing recursive calls – Infinite recursion, overflows Recursive Functions that.
Lists. Container Classes Many applications in Computer Science require the storage of information for collections of entities e.g. a student registration.
Learning to Use Root for STAR Gene Van Buren (UCLA) for the STAR Collaboration Accessing STAR Data Programming for STAR (Makers) Star => Computing => Tutorials.
Framework for Raw Data Thomas Kuhr Offline Week 29/06/2004.
STAR Analysis Meeting, BNL, Dec 2004 Alexandre A. P. Suaide University of Sao Paulo Slide 1 BEMC software and calibration L3 display 200 GeV February.
Lecture 21 Multiple Inheritance. What is Multiple Inheritance? We defined inheritance earlier in the semester as a relationship between classes. If class.
1 Overloading Overloading allows a function or operator to have a different meaning depending on the type of objects it is used on. Examples: operator+
C++ Functions. Objectives 1. Be able to implement C++ functions 2. Be able to share data among functions 2.
A Technical Validation Module for the offline Auger-Lecce, 17 September 2009  Design  The SValidStore Module  Example  Scripting  Status.
File I/O 1 ifstreams and ofstreams Sections 11.1 & 11.2.
Chapter 10 Inheritance and Polymorphism
11 Introduction to Object Oriented Programming (Continued) Cats.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Stacks.
CPSC 252 The Big Three Page 1 The “Big Three” Every class that has data members pointing to dynamically allocated memory must implement these three methods:
Variables and Data Types.  Variable: Portion of memory for storing a determined value.  Could be numerical, could be character or sequence of characters.
1 ENGI 2420 Structured Programming (Lab Tutorial 7) Memorial University of Newfoundland.
An Introduction to C++ A First Look. void Functions #include #include void main( ) { cout
#include guards Practical session #2 Software Engineering
Debugging of # P. Hristov 04/03/2013. Introduction Difficult problem – The behavior is “random” and depends on the “history” – The debugger doesn’t.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 16: Introduction to C++
POINTERS.
More C++ Bryce Boe 2013/10/23 CS24, Fall Outline Project 1 Review Alignment and Padding Finish C++ Introduction.
STAR Schema Evolution Implementation in ROOT I/O V. Perevoztchikov Brookhaven National Laboratory,USA.
CS415 C++ Programming Takamitsu Kawai x4212 G11 CERC building WV Virtual Environments Lab West Virginia University.
1 More Operator Overloading Chapter Objectives You will be able to: Define and use an overloaded operator to output objects of your own classes.
General Purpose ROOT Utilities Victor Perevoztchikov, BNL.
V.Fine ALICE-STAR Joint meeting April, 9, 2000 The STAR offline framework* V. Fine *) See also:
CSC 143A 1 CSC 143 Introduction to C++ [Appendix A]
CSE 1341 Honors Note Set 2 1. Overview  Java vs. C++  Functions in C++  First Programming Packet  Development Environment 2.
Pointers It provides a way of accessing a variable without referring to its name. The mechanism used for this is the address of the variable.
February 28, 2005 Introduction to Classes. Object Oriented Programming An object is a software bundle of related variables and methods. Software objects.
1 ENGI 2420 Structured Programming (Lab Tutorial 7) Memorial University of Newfoundland.
Prof. amr Goneid, AUC1 CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 15. Dictionaries (1): A Key Table Class.
October Test Beam DAQ. Framework sketch Only DAQs subprograms works during spills Each subprogram produces an output each spill Each dependant subprogram.
V.Fine for STAR collaboration The STAR offline framework V. Fine, Y. Fisyak, V. Perevoztchikov, T.Wenaus.
I. BelikovALICE Offline Week, CERN, 12 June ESD Classes and the Combined Reconstruction What is the ESD ? Two new classes AliESD and AliESDtrack.
Programming Fundamentals Enumerations and Functions.
STAR Collaboration DubnaSergey Panitkin 1 What do you need to write a PRL STAR Data (exists) Good Physics Idea (hopefully exists) Analysis Maker.
Lecture 01d: C++ review Topics: functions scope / lifetime preprocessor directives header files C structures ("simple classes")
AliRoot Classes for access to Calibration and Alignment objects Magali Gruwé CERN PH/AIP ALICE Offline Meeting February 17 th 2005 To be presented to detector.
FUNCTIONS (C) KHAERONI, M.SI. OBJECTIVE After this topic, students will be able to understand basic concept of user defined function in C++ to declare.
C++ Functions A bit of review (things we’ve covered so far)
Joe Foster 1 This talk extends the one I gave in 2006 called Visualizing Data with ROOT. –
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Binding & Dynamic Linking Presented by: Raunak Sulekh(1013) Pooja Kapoor(1008)
Object Access m1.write(44); m2.write(m2.read() +1); std::cout
HYDRA Framework. Setup of software environment Setup of software environment Using the documentation Using the documentation How to compile a program.
Review 1.
Bill Tucker Austin Community College COSC 1315
News on the CDB Framework
foo.h #ifndef _FOO #define _FOO template <class T> class foo{
Templates CMSC 202, Version 4/02.
Lecture 3 More on Flow Control, More on Functions,
Presentation transcript:

StEvent I/O Model And Writing a Maker Or How to Add a New Detector Akio Ogawa BNL 2003 Nov Dubna

What is StEvent? StEvent is our DST –It has all reconstructed (and some raw) data Run#, beam conditions, trigger information, etc Hits/Tracks from TPC and other tracking detectors ADC/Enegry/Cluster/”Points” from EMC All other detector information –StEvent can be saved to a file, using root I/O (StTreeMaker) –StEvent need to be always backward compatible - requires good design from the beginning StEvent is our “common block” + subroutines -Created or read back from files on memory -Contains quite some useful functions associated with data StEvent is collection of C++ classes

What is Maker (and chain)? Maker is our reconstruction / analysis model –Standard functions: Init() once at beginning Make() every event Finish() at the end InitRun() every time new run number is found Clear() at the end of every event Chain is our analysis framework –Chain automatically collects all makers initiated –Chain runs all makers in sequence –Allow makers to access object/data in other maker BFC (Big Full Chain = Bolshaya Polnaya Tsepochka) is our production chain

Big Picture

Writing your first StEvent class & a Maker Example: You got a new detector called Xxx Adding a class in StEvent for the detector Write a maker to put data in This should be useful for other kind of Makers Not covered by this talk: StDaqMaker, StDaqLib need update (contact experts) Documentation (See Petr’s tutorial) Modifying BFChain (you need to contact Jerome) Usage of containers in StEvent Coding standards

Files and directory structure and how to compile At your working directory: –“cvs checkout StRoot/StEvent” –“mkdir StRoot/StXxxMaker” Your will be creating 4 new files –StRoot/StEvent/StXxxCollection.h –StRoot/StEvent/StXxxCollection.cxx –StRoot/StXxxMaker/StXxxMaker.h –StRoot/StXxxMaker/StXxxMaker.cxx To compile –“cons” –And have a coffee break

1) Name, and what it is StXxxCollection.h #ifndef StXxxCollection_hh #define StXxxCollection_hh #include "StObject.h" class StXxxCollection : public StObject { public: StXxxCollection(); virtual ~StXxxCollection(); int getADC(int ch); void setADC(int ch, int val); int getADCSum(); protected: enum {mNchannel=10;};//! int mADC[mNchannel]; int mTDC[mNchannel]; ClassDef(StXxxCollection, 1) } #endif StXxxCollection.cxx #include "StXxxCollection.h" ClassImp(StXxxCollection) StXxxCollection: StXxxCollection() {} StXxxCollection: ~StXxxCollection() {} int StXxxCollection:getADC(int ch){ return mADC[ch]; } void StXxxCollection:setADC(int ch, int val){ mADC[ch]=val; } int StXxxCollection:getADCSum(){ int sum=0; for(int i=0; i<mNchannel; i++){ sum+=mADC[i]; } return sum; } Do not use “#define Nch 10” For class name: First letter is capital “X” Later are all non-capital “x” Data members start with “m”

2) Define as a delivered class from StObject StXxxCollection.h #ifndef StXxxCollection_hh #define StXxxCollection_hh #include "StObject.h" class StXxxCollection : public StObject { public: StXxxCollection(); virtual ~StXxxCollection(); int getADC(int ch); void setADC(int ch, int val); int getADCSum(); protected: enum {mNchannel=10;};//! int mADC[mNchannel]; int mTDC[mNchannel]; ClassDef(StXxxCollection, 1) } #endif StXxxCollection.cxx #include "StXxxCollection.h" ClassImp(StXxxCollection) StXxxCollection: StXxxCollection() {} StXxxCollection: ~StXxxCollection() {} int StXxxCollection:getADC(int ch){ return mADC[ch]; } void StXxxCollection:setADC(int ch, int val){ mADC[ch]=val; } int StXxxCollection:getADCSum(){ int sum=0; for(int i=0; i<mNchannel; i++){ sum+=mADC[i]; } return sum; } Always have a default constructer with no arguments.

3) Put access functions StXxxCollection.h #ifndef StXxxCollection_hh #define StXxxCollection_hh #include "StObject.h" class StXxxCollection : public StObject { public: StXxxCollection(); virtual ~StXxxCollection(); int getADC(int ch); void setADC(int ch, int val); int getADCSum(); void setDebug(bool b) {mDebug=b;} protected: enum {mNchannel=10;}; int mADC[mNchannel]; int mTDC[mNchannel]; bool mDebug; ClassDef(StXxxCollection, 1) } #endif StXxxCollection.cxx #include "StXxxCollection.h" ClassImp(StXxxCollection) StXxxCollection: StXxxCollection() {} StXxxCollection: ~StXxxCollection() {} int StXxxCollection:getADC(int ch){ return mADC[ch]; } void StXxxCollection:setADC(int ch, int val){ if(ch =mNchannel){ if(mDebug) { cout << “error!” << endl;} }else{ mADC[ch]=val; } int StXxxCollection:getADCSum(){ int sum=0; for(int i=0; i<mNchannel; i++){ sum+=mADC[i]; } return sum; } For function name: First word start with non-capital Later words are all start with capital

4) Adding root specific stuff StXxxCollection.h #ifndef StXxxCollection_hh #define StXxxCollection_hh #include "StObject.h" class StXxxCollection : public StObject { public: StXxxCollection(); virtual ~StXxxCollection(); int getADC(int ch); void setADC(int ch, int val); int getADCSum(); void setDebug(bool b) {mDebug=b;} protected: enum {mNchannel=10;}; int mADC[mNchannel]; int mTDC[mNchannel]; bool mDebug; //! ClassDef(StXxxCollection, 1) } #endif StXxxCollection.cxx #include "StXxxCollection.h" ClassImp(StXxxCollection) StXxxCollection: StXxxCollection() {} StXxxCollection: ~StXxxCollection() {} int StXxxCollection:getADC(int ch){ return mADC[ch]; } void StXxxCollection:setADC(int ch, int val){ if(ch =mNchannel){ if(mDebug) { cout << “error!” << endl;} }else{ mADC[ch]=val; } int StXxxCollection:getADCSum(){ int sum=0; for(int i=0; i<mNchannel; i++){ sum+=mADC[i]; } return sum; } “//!” means “do not save to file” 2 macros for root CINT ClassDef(name,version#) ClassImp(name)

5) Adding more advanced access functions StXxxCollection.h #ifndef StXxxCollection_hh #define StXxxCollection_hh #include "StObject.h" class StXxxCollection : public StObject { public: StXxxCollection(); virtual ~StXxxCollection(); int getADC(int ch); void setADC(int ch, int val); int getNChannel() {return mNchannel;} int getADCSum(); void setDebug(bool b) {mDebug=b;} protected: enum {mNchannel=10;}; int mADC[mNchannel]; int mTDC[mNchannel]; bool mDebug; //! ClassDef(StXxxCollection, 1) } #endif StXxxCollection.cxx #include "StXxxCollection.h" ClassImp(StXxxCollection) StXxxCollection: StXxxCollection() {} StXxxCollection: ~StXxxCollection() {} int StXxxCollection:getADC(int ch){ return mADC[ch]; } void StXxxCollection:setADC(int ch, int val){ if(ch =mNchannel){ if(mDebug) { cout << “error!” << endl;} }else{ mADC[ch]=val; } int StXxxCollection:getADCSum(){ int sum=0; for(int i=0; i<mNchannel; i++){ sum+=mADC[i]; } return sum; }

5) Adding data member : schema evolution should take care it StXxxCollection.h #ifndef StXxxCollection_hh #define StXxxCollection_hh #include "StObject.h" class StXxxCollection : public StObject { public: StXxxCollection(); virtual ~StXxxCollection(); int getADC(int ch); void setADC(int ch, int val); int getNChannel() {return mNchannel;} int getADCSum(); void setDebug(bool b) {mDebug=b;} protected: enum {mNchannel=10;}; int mADC[mNchannel]; int mTDC[mNchannel]; bool mDebug; //! ClassDef(StXxxCollection, 2) } #endif StXxxCollection.cxx #include "StXxxCollection.h" ClassImp(StXxxCollection) StXxxCollection: StXxxCollection() {} StXxxCollection: ~StXxxCollection() {} int StXxxCollection:getADC(int ch){ return mADC[ch]; } void StXxxCollection:setADC(int ch, int val){ if(ch =mNchannel){ if(mDebug) { cout << “error!” << endl;} }else{ mADC[ch]=val; } int StXxxCollection:getADCSum(){ int sum=0; for(int i=0; i<mNchannel; i++){ sum+=mADC[i]; } return sum; } New version # Adding new valuables -OK Adding new functions - always OK Do NOT change order of valuables Do NOT change the name of valuables

A) Now, write a Maker to fill it StXxxMaker.h #ifndef STAR_StXxxMaker #define STAR_StXxxMaker #include "StMaker.h" class StXxxMaker : public StMaker { public: StXxxMaker(const char *name=”Xxx"); virtual ~StXxxMaker() {}; virtual Int_t Init() {return StMaker::Init();}; virtual Int_t Make(); virtual Int_t Finish() {return StMaker::Finish();}; ClassDef(StXxxMaker,0) } #endif StXxxMaker.cxx Classimp(StXXXMaker) StXxxMaker::StXxxMaker(const char *name):StMaker(name) {} Int_t StXxxMaker::Make(){ StXxxCollection* xxxCollection; StEvent *mEvent = (StEvent *) GetInputDS("StEvent"); if(mEvent == 0) return kStWarn; xxxCollection = mEvent->XxxCollection(); if(XxxCollection == 0) { xxxCollection = new StXxxCollection(); mEvent->setXxxCollection(xxxCollection); } St_DataSet* daqReaderDS = GetDataSet("StDAQReader"); if (daqReaderDS==0) return kStWarn; StDAQReader* daqReader = (StDAQReader*)(daqReaderDS->GetObject()); if (daqReader==0) return kStWarn; if (!(daqReader->XxxPresent())) return kStOK; StXxxReaderInterface* xxxReader = xxxReader->getXxxReader(); if (xxxReader==0) return kStWarn; for (int i=0; i getNChannel(); i++){ XxxCollection->setAdc(i,XxxReader->GetAdc(i)); } Derived from StMaker Name will be used to access to this Maker from other Makers

B) Init, Make and Finish StXxxMaker.h #ifndef STAR_StXxxMaker #define STAR_StXxxMaker #include "StMaker.h" class StXxxMaker : public StMaker { public: StXxxMaker(const char *name=”Xxx"); virtual ~StXxxMaker() {}; virtual Int_t Init() {return StMaker::Init();}; virtual Int_t Make(); virtual Int_t Finish() {return StMaker::Finish();}; ClassDef(StXxxMaker,0) } #endif StXxxMaker.cxx Classimp(StXXXMaker) StXxxMaker::StXxxMaker(const char *name):StMaker(name) {} Int_t StXxxMaker::Make(){ StXxxCollection* xxxCollection; StEvent *mEvent = (StEvent *) GetInputDS("StEvent"); if(mEvent == 0) return kStWarn; xxxCollection = mEvent->XxxCollection(); if(XxxCollection == 0) { xxxCollection = new StXxxCollection(); mEvent->setXxxCollection(xxxCollection); } St_DataSet* daqReaderDS = GetDataSet("StDAQReader"); if (daqReaderDS==0) return kStWarn; StDAQReader* daqReader = (StDAQReader*)(daqReaderDS->GetObject()); if (daqReader==0) return kStWarn; if (!(daqReader->XxxPresent())) return kStOK; StXxxReaderInterface* xxxReader = xxxReader->getXxxReader(); if (xxxReader==0) return kStWarn; for (int i=0; i getNChannel(); i++){ XxxCollection->setAdc(i,XxxReader->GetAdc(i)); } Init (once at beginning) Make (every event) Finish (once at the end)

C) How to access to StEvent? StXxxMaker.h #ifndef STAR_StXxxMaker #define STAR_StXxxMaker #include "StMaker.h" class StXxxMaker : public StMaker { public: StXxxMaker(const char *name=”Xxx"); virtual ~StXxxMaker() {}; virtual Int_t Init() {return StMaker::Init();}; virtual Int_t Make(); virtual Int_t Finish() {return StMaker::Finish();}; ClassDef(StXxxMaker,0) } #endif StXxxMaker.cxx Classimp(StXXXMaker) StXxxMaker::StXxxMaker(const char *name):StMaker(name) {} Int_t StXxxMaker::Make(){ StXxxCollection* xxxCollection; StEvent *mEvent = (StEvent *) GetInputDS("StEvent"); if(mEvent == 0) return kStWarn; xxxCollection = mEvent->XxxCollection(); if(XxxCollection == 0) { xxxCollection = new StXxxCollection(); mEvent->setXxxCollection(xxxCollection); } St_DataSet* daqReaderDS = GetDataSet("StDAQReader"); if (daqReaderDS==0) return kStWarn; StDAQReader* daqReader = (StDAQReader*)(daqReaderDS->GetObject()); if (daqReader==0) return kStWarn; if (!(daqReader->XxxPresent())) return kStOK; StXxxReaderInterface* xxxReader = xxxReader->getXxxReader(); if (xxxReader==0) return kStWarn; for (int i=0; i getNChannel(); i++){ XxxCollection->setAdc(i,XxxReader->GetAdc(i)); } This is how you can obtain StEvent

D) Get, or create your class StXxxMaker.h #ifndef STAR_StXxxMaker #define STAR_StXxxMaker #include "StMaker.h" class StXxxMaker : public StMaker { public: StXxxMaker(const char *name=”Xxx"); virtual ~StXxxMaker() {}; virtual Int_t Init() {return StMaker::Init();}; virtual Int_t Make(); virtual Int_t Finish() {return StMaker::Finish();}; ClassDef(StXxxMaker,0) } #endif StXxxMaker.cxx Classimp(StXXXMaker) StXxxMaker::StXxxMaker(const char *name):StMaker(name) {} Int_t StXxxMaker::Make(){ StXxxCollection* xxxCollection; StEvent *mEvent = (StEvent *) GetInputDS("StEvent"); if(mEvent == 0) return kStWarn; xxxCollection = mEvent->xxxCollection(); if(xxxCollection == 0) { xxxCollection = new StXxxCollection(); mEvent->setXxxCollection(xxxCollection); } St_DataSet* daqReaderDS = GetDataSet("StDAQReader"); if (daqReaderDS==0) return kStWarn; StDAQReader* daqReader = (StDAQReader*)(daqReaderDS->GetObject()); if (daqReader==0) return kStWarn; if (!(daqReader->XxxPresent())) return kStOK; StXxxReaderInterface* xxxReader = xxxReader->getXxxReader(); if (xxxReader==0) return kStWarn; for (int i=0; i getNChannel(); i++){ xxxCollection->setAdc(i,xxxReader->GetAdc(i)); } Try to get StXxxCollection from StEvent If it’s empty, create one and add to StEvent

E) How to obtain raw data? StXxxMaker.h #ifndef STAR_StXxxMaker #define STAR_StXxxMaker #include "StMaker.h" class StXxxMaker : public StMaker { public: StXxxMaker(const char *name=”Xxx"); virtual ~StXxxMaker() {}; virtual Int_t Init() {return StMaker::Init();}; virtual Int_t Make(); virtual Int_t Finish() {return StMaker::Finish();}; ClassDef(StXxxMaker,0) } #endif StXxxMaker.cxx Classimp(StXXXMaker) StXxxMaker::StXxxMaker(const char *name):StMaker(name) {} Int_t StXxxMaker::Make(){ StXxxCollection* xxxCollection; StEvent *mEvent = (StEvent *) GetInputDS("StEvent"); if(mEvent == 0) return kStWarn; xxxCollection = mEvent->xxxCollection(); if(xxxCollection == 0) { xxxCollection = new StXxxCollection(); mEvent->setXxxCollection(xxxCollection); } St_DataSet* daqReaderDS = GetDataSet("StDAQReader"); if (daqReaderDS==0) return kStWarn; StDAQReader* daqReader = (StDAQReader*)(daqReaderDS->GetObject()); if (daqReader==0) return kStWarn; if (!(daqReader->XxxPresent())) return kStOK; StXxxReaderInterface* xxxReader = xxxReader->getXxxReader(); if (xxxReader==0) return kStWarn; for (int i=0; i getNChannel(); i++){ xxxCollection->setAdc(i,xxxReader->GetAdc(i)); } Get Raw Data reader from “StDAQReader”

F) Now, actually fill it StXxxMaker.h #ifndef STAR_StXxxMaker #define STAR_StXxxMaker #include "StMaker.h" class StXxxMaker : public StMaker { public: StXxxMaker(const char *name=”Xxx"); virtual ~StXxxMaker() {}; virtual Int_t Init() {return StMaker::Init();}; virtual Int_t Make(); virtual Int_t Finish() {return StMaker::Finish();}; ClassDef(StXxxMaker,0) } #endif StXxxMaker.cxx Classimp(StXXXMaker) StXxxMaker::StXxxMaker(const char *name):StMaker(name) {} Int_t StXxxMaker::Make(){ StXxxCollection* xxxCollection; StEvent *mEvent = (StEvent *) GetInputDS("StEvent"); if(mEvent == 0) return kStWarn; xxxCollection = mEvent->xxxCollection(); if(xxxCollection == 0) { xxxCollection = new StXxxCollection(); mEvent->setXxxCollection(xxxCollection); } St_DataSet* daqReaderDS = GetDataSet("StDAQReader"); if (daqReaderDS==0) return kStWarn; StDAQReader* daqReader = (StDAQReader*)(daqReaderDS->GetObject()); if (daqReader==0) return kStWarn; if (!(daqReader->XxxPresent())) return kStOK; StXxxReaderInterface* xxxReader = xxxReader->getXxxReader(); if (xxxReader==0) return kStWarn; for (int i=0; i getNChannel(); i++){ xxxCollection->setAdc(i,xxxReader->GetAdc(i)); } Fill StXxxCollection from raw data

G) Return values and some protections StXxxMaker.h #ifndef STAR_StXxxMaker #define STAR_StXxxMaker #include "StMaker.h" class StXxxMaker : public StMaker { public: StXxxMaker(const char *name=”Xxx"); virtual ~StXxxMaker() {}; virtual Int_t Init() {return StMaker::Init();}; virtual Int_t Make(); virtual Int_t Finish() {return StMaker::Finish();}; ClassDef(StXxxMaker,0) } #endif StXxxMaker.cxx Classimp(StXXXMaker) StXxxMaker::StXxxMaker(const char *name):StMaker(name) {} Int_t StXxxMaker::Make(){ StXxxCollection* xxxCollection; StEvent *mEvent = (StEvent *) GetInputDS("StEvent"); if(mEvent == 0) return kStWarn; xxxCollection = mEvent->xxxCollection(); if(xxxCollection == 0) { xxxCollection = new StXxxCollection(); mEvent->setXxxCollection(xxxCollection); } St_DataSet* daqReaderDS = GetDataSet("StDAQReader"); if (daqReaderDS==0) return kStWarn; StDAQReader* daqReader = (StDAQReader*)(daqReaderDS->GetObject()); if (daqReader==0) return kStWarn; if (!(daqReader->XxxPresent())) return kStOK; StXxxReaderInterface* xxxReader = xxxReader->getXxxReader(); if (xxxReader==0) return kStWarn; for (int i=0; i getNChannel(); i++){ xxxCollection->setAdc(i,xxxReader->GetAdc(i)); } return kStOK;} Return Values: kStOk = Good kStWarn = Warning, but continue kStErr = Error, skip this event for this maker kStFatal = Fatal, skip event (do not use in BFC!) (kStEOF = End of File) Makers should NOT assume that input / other makers are there “ independence of makers”

H) Include files StXxxMaker.h #ifndef STAR_StXxxMaker #define STAR_StXxxMaker #include "StMaker.h" class StEvent; class StXxxMaker : public StMaker { public: StXxxMaker(const char *name=”Xxx"); virtual ~StXxxMaker() {}; virtual Int_t Init() {return StMaker::Init();}; virtual Int_t Make(); virtual Int_t Finish() {return StMaker::Finish();}; Int_t fillFrom(StEvent* evt); ClassDef(StXxxMaker,0) } #endif StXxxMaker.cxx #include “StXxxMaker.h” #include “StEventTypes.h” #include "StDaqLib/XXX/XXX_Reader.hh" #include "StDAQMaker/StDAQReader.h" Classimp(StXXXMaker) StXxxMaker::StXxxMaker(const char *name):StMaker(name) {} Int_t StXxxMaker::Make(){ … return kStOK; } Int_t fillFrom(StEvent *evt){ … } Single include file for ALL classes in StEvent These raw data reader need to be implemented by experts Do not include in.h file unless absolutely needed Instead, use class if this is enough

What’s Next? Contact Thomas Ullrich for modifying mother StEvent classes to add your class Contact Jerome Lauret for adding your maker to BFChain One should really read real documents for deeper understanding on StEvent and Makers: – – Once done, you should be able to run it with macro bfc.C