AliRoot IO and Folder - PowerPoint PPT Presentation

About This Presentation
Title:

AliRoot IO and Folder

Description:

AliRoot IO and Folder – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 23
Provided by: piotr74
Learn more at: https://www.star.bnl.gov
Category:
Tags: aliroot | folder | kine

less

Transcript and Presenter's Notes

Title: AliRoot IO and Folder


1
AliRoot I/O and Folder
  • Alice Offline-Week 10-15 V 2002
  • Piotr Krzysztof Skowronski
  • June 11, 2002

2
Goal
  • All data types goes to the separate file.
  • Each event is stored in separate root-directory
    within root file
  • One tree per event for each data type no event
    number embedded in the tree name
  • Data exchange through folders.

3
galice.root
RunLoader
TreeE
Tree
4
Idea of Loaders
  • Loader is an object responsible for
    openning/closing files
  • Manages files and directory (OS as well as ROOT)
    names
  • Posting data
  • from file to folder reading
  • and vice versa - writing
  • Plus some shortcut methods for accessing data
    from folders
  • e.g instead of calling dynamic_castltTTreegt(fEven
    tFolder-gtFindObject(fgkHeaderContainerName))each
    time, one can useloader-gtTreeH()

5
Two types of loaders
  • Run Loader (AliRunLoader)
  • Manages all central data
  • AliRun - gAlice
  • Header TreeE
  • Kinematics - TreeK
  • Track References - TreeTR
  • Run Loader itself
  • Detector Loader (AliLoader)
  • Manages all data related to each detector
  • Hits TreeH
  • Summable Digids TreeS
  • Digits TreeD
  • Reconstructed Points TreeR
  • Tracks TreeT

6
AliLoader
  • AliLoader implements all standard functionality
    However if any detector needs other behaviour of
    loader than standard it should create detector
    specific loader and overload proper methods
  • The same applies if extensions are needed
  • See example of AliPHOSLoader

7
AliRunLoader
  • Decouples all I/O management from AliRun
  • It stays itself in folder as well
  • Is written to galice.root as an object
  • Manages event reloading (as an only one object in
    aliroot)
  • Is an owner of AliStack and AliHeader
  • Is responsible for reloading events

8
Architecture
  • AliRunLoader is a central I/O manager
  • It is created in Config.C and set to gAlice
    object
  • AliRunLoader has a list of AliLoaders
  • Each detector registers its loader during MC
    initialization
  • Detector itself stores the pointer to its loader
  • Faster data access
  • If detector is read from file, it gets pointer to
    its loader automatically
  • AliDetector is not owner of loader!

9
Usage
  • Each session should be started from loading
    RunLoader itselfstatic AliRunLoader
    AliRunLoaderOpen(const char filename
    "galice.root", const char eventfoldername
    AliConfigfgkDefaultEventFolderName,
    Option_t option "READ")For
    exampleAliRunLoader rl AliRunLoaderOpen("gal
    ice.root","MyFolder","READ")if (rl 0x0)
    cerrltlt"Can not open session for file
    galice.root" return

10
AliRunLoaderOpen
  • This method tries
  • to open file in mode specified by option
  • Find the run loader object in file
  • If file option is new, create or recreate
    it creates new AliRunObject instead
  • Calls AliConfigBuildEventFolder to create
    folder structure for event
  • Puts AliRunLoader in folder and returns pointer
    to it
  • In case of error returns NULL

11
Usage cont. (AliRunLoader)
  • In order to load data
  • LoadgAlice loads AliRun
  • LoadHeader Loads TreeE, creates AliHeader, sets
    address in tree and gets header for current event
  • LoadKinematics Opens kine file, posts TreeK for
    current event to folder. If header loaded calls
    AliStackGetEvent which connects Tree.
  • LoadTrackRefs Opens file with track references
    and puts them in folder

12
Usage cont. (AliRunLoader)
  • To write data, call
  • WriteKinematics
  • WriteHeader
  • WriteTrackRefs
  • Tu unload data
  • UnloadKinematics
  • UnloadHeader
  • UnloadTrackRefs
  • UnloadgAlice

13
Usage cont. (AliLoader)
  • To load detector specific data call following
    methods
  • LoadHits loads hits for given detector
  • LoadSDigits loads summable digits
  • LoadDigits
  • LoadRecPoints
  • LoadTracks
  • All methods above takes Option_t as a parameter,
    which is passed to TFileOpen

14
Usage cont. (AliLoader)
  • To write detector specific data call following
    methods
  • WriteHits writes hits for given detector
  • WriteSDigits writes summable digits
  • WriteDigits
  • WriteRecPoints
  • WriteTracks
  • They take option, which can be OVERWRITE to
    force overwriting

15
Usage cont.
  • To unload call UnloadDataType e.g.
  • UnloadHits
  • To make new container (tree) call
    MakeDataTypeContainer
  • e.g.
  • AliLoaderMakeHitsContainer
  • AliRunLoaderMakeKineContainer
  • Old style MakeTree(Option_t) is supported as
    well
  • AliRunLoaderMakeTree(K) makes TreeK
  • AliRunLoaderMakeTree(H) makes TreeH for all
    loaders in the list
  • AliLoaderMakeTree(D) makes TreeD for only
    one detector
  • However it does not support option TR since it
    will be recognized as Track Tree and
    Recostruction Tree

16
Usage cont.
  • To get access to data (trees) one can use
    shortcut methods like
  • AliLoaderTreeH()
  • AliLoaderTreeS()
  • AliRunLoaderTreeK()
  • AliRunLoaderTreeE()

17
Usage cont. (AliRunLoader)
  • To get loader for specific detector use
  • AliLoader GetLoader(const char name)
  • AliLoader GetLoader(AliDetector name)
  • Getting event AliRunLoaderGetEvent(Int_t)
  • Reloads all loaded data, for exampleAliRunLoader
    rl AliRunLoaderOpen("galice.root","MyFolder
    ","READ")rl-gtGetEvent(0)//(1) redundant
    default is event 0rl-gtLoadKinematics("READ")//(2
    )-loads kinematicsAliLoader tpcloader
    rl-gtGetLoader("TPCLoader")//(3)tpcloader-gtLoadDi
    gits("RECREATE")//(4)-loads Digits for
    TPCrl-gtGetEvent(1)//(5)
  • At the moment of loading data (2),(3),(4) they
    are loaded for event 0 (current event). GetEvent
    in line (5) causes that all loaded data are
    reloaded for event 1.

18
Usage cont. (AliRunLoader)
  • To load detector data you can use
    methodAliRunLoaderLoadDataType (Option_t
    detectors"all", Option_t opt"READ")eg
  • AliRunLoaderLoadHits() calls LoadHits("READ")
    for all loaders
  • AliRunLoaderLoadHits("TPC ITS PHOS") calls
    LoadHits("READ") for TPC, ITS and PHOS laoders
  • AliRunLoaderLoadHits("all","update") calls
    LoadHits("update") for all loaders

19
Status
  • New I/O version is merged with v3-08-02
  • It compiles for all detectors but EMCAL
  • TPC even works up to tracking
  • Take it as a practical example
  • display.C works as well
  • I already wrote some documentation up to now
    rather poor however...http//alisoft.cern.ch/peop
    le/skowron/codedoc/split

20
Substitutions
  • AliRunGetEvent(Int_t)
  • AliRunStack()
  • AliRunGetHeader()
  • AliRunTreeK()
  • AliRunTreeE()
  • AliRunTreeH()
  • AliRunTreeS()
  • AliRunTreeD()
  • AliRunTreeR()
  • AliRunLoaderGetEvent(Int_t)
  • AliRunLoaderStack()
  • AliRunLoaderGetHeader()
  • AliRunLoaderTreeK()
  • AliRunLoaderTreeE()
  • AliLoaderTreeH()
  • AliLoaderTreeS()
  • AliLoaderTreeD()
  • AliLoaderTreeR()

21
Clue
  • How to get access to Run Loader?
  • Add a data member with folder name
  • In AliDetector is not needed it already have
    pointer to its AliLoader.
  • AliRunLoader is easily accessible from folder
    using static method
  • AliRunLoader AliRunLoader
    GetRunLoader(const char eventfoldername)
  • Set the event folder name from the place you open
    session macro, manager or superior class

22
Example
  • AliRunLoader rl AliRunLoaderOpen("galice.root
    ","Event",read")
  • rl-gtLoadgAlice()
  • gAlice rl-gtGetAliRun()//!!!!!!!!!!!!!!!!!!!!!!!
    !!!!!!!!
  • AliTPC TPC (AliTPC)gAlice-gtGetDetector("TPC")
  • AliLoader tpcl rl-gtGetLoader("TPCLoader")
  • tpcl-gtLoadHits("READ")
  • tpcl-gtLoadSDigits("RECREATE")
  • Int_t nevent rl-gtGetNumberOfEvents()
  • for(Int_t eventn 0eventnltneventeventn)
  • rl-gtGetEvent(eventn)
  • TPC-gtHits2SDigits2(eventn)
  • tpcl-gtWriteSDigits(OVERWRITE)
  • delete rl
Write a Comment
User Comments (0)
About PowerShow.com