Presentation is loading. Please wait.

Presentation is loading. Please wait.

AliRoot I/O and Folder Alice Offline-Week 10-15 V 2002 Piotr Krzysztof Skowroński June 11, 2002.

Similar presentations


Presentation on theme: "AliRoot I/O and Folder Alice Offline-Week 10-15 V 2002 Piotr Krzysztof Skowroński June 11, 2002."— Presentation transcript:

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

2 2P. K. Skowroński Alice Offline Week11 May 2002 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 3P. K. Skowroński Alice Offline Week11 May 2002 TPC.RecPoints.root Object Tree TPC.Hits.root Root dir Folder Kine.root Event #2 TreeH Event #2 TreeK Event #1 TreeH Event #1 TreeK TPC.Digits.root Event #1Event #2 File ITS.Tracks.rootITS.Digits.rootTPC.Tracks.rootITS.Hits.rootTPC.RecPoints.root Object g a lice.root RunLoader gAlice TreeE TreeD

4 4P. K. Skowroński Alice Offline Week11 May 2002 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_cast (fEventFolder->FindObject(fgkHeaderContainerName)); each time, one can use loader->TreeH();

5 5P. K. Skowroński Alice Offline Week11 May 2002 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 6P. K. Skowroński Alice Offline Week11 May 2002 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 7P. K. Skowroński Alice Offline Week11 May 2002 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 8P. K. Skowroński Alice Offline Week11 May 2002 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 9P. K. Skowroński Alice Offline Week11 May 2002 Usage Each session should be started from loading RunLoader itself static AliRunLoader* AliRunLoader::Open(const char* filename = "galice.root", const char* eventfoldername= AliConfig::fgkDefaultEventFolderName, Option_t* option = "READ"); For example AliRunLoader *rl = AliRunLoader::Open("galice.root","MyFolder","READ"); if (rl == 0x0) { cerr<<"Can not open session for file galice.root"; return; }

10 10P. K. Skowroński Alice Offline Week11 May 2002 AliRunLoader::Open This method tries 1.to open file in mode specified by option 2.Find the run loader object in file If file option is „new”, „create” or „recreate” it creates new AliRunObject instead 3.Calls AliConfig::BuildEventFolder to create folder structure for event 4.Puts AliRunLoader in folder and returns pointer to it 5.In case of error returns NULL

11 11P. K. Skowroński Alice Offline Week11 May 2002 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 AliStack::GetEvent which connects Tree. LoadTrackRefs – Opens file with track references and puts them in folder

12 12P. K. Skowroński Alice Offline Week11 May 2002 Usage cont. (AliRunLoader) To write data, call WriteKinematics WriteHeader WriteTrackRefs Tu unload data UnloadKinematics UnloadHeader UnloadTrackRefs UnloadgAlice

13 13P. K. Skowroński Alice Offline Week11 May 2002 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 TFile::Open

14 14P. K. Skowroński Alice Offline Week11 May 2002 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 15P. K. Skowroński Alice Offline Week11 May 2002 Usage cont. To unload call UnloadDataType e.g.  UnloadHits To make new container (tree) call MakeDataTypeContainer e.g.  AliLoader::MakeHitsContainer  AliRunLoader::MakeKineContainer Old style MakeTree(Option_t*) is supported as well  AliRunLoader::MakeTree(”K”) – makes TreeK  AliRunLoader::MakeTree(”H”) – makes TreeH for all loaders in the list  AliLoader::MakeTree(”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 16P. K. Skowroński Alice Offline Week11 May 2002 Usage cont. To get access to data (trees) one can use shortcut methods like AliLoader::TreeH() AliLoader::TreeS() AliRunLoader::TreeK() AliRunLoader::TreeE()

17 17P. K. Skowroński Alice Offline Week11 May 2002 Usage cont. (AliRunLoader) To get loader for specific detector use AliLoader* GetLoader(const char* name) AliLoader* GetLoader(AliDetector* name) Getting event: AliRunLoader::GetEvent(Int_t) Reloads all loaded data, for example AliRunLoader *rl = AliRunLoader::Open("galice.root","MyFolder","READ"); rl->GetEvent(0);//(1) – redundant: default is event 0 rl->LoadKinematics("READ");//(2)-loads kinematics AliLoader* tpcloader = rl->GetLoader("TPCLoader");//(3) tpcloader->LoadDigits("RECREATE");//(4)-loads Digits for TPC rl->GetEvent(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 18P. K. Skowroński Alice Offline Week11 May 2002 Usage cont. (AliRunLoader) To load detector data you can use method AliRunLoader::LoadDataType (Option_t* detectors="all", Option_t* opt="READ") eg: AliRunLoader::LoadHits() – calls LoadHits("READ") for all loaders AliRunLoader::LoadHits("TPC ITS PHOS") calls LoadHits("READ") for TPC, ITS and PHOS laoders AliRunLoader::LoadHits("all","update") calls LoadHits("update") for all loaders

19 19P. K. Skowroński Alice Offline Week11 May 2002 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/people/skowron/codedoc/split http://alisoft.cern.ch/people/skowron/codedoc/split

20 20P. K. Skowroński Alice Offline Week11 May 2002 Substitutions AliRun::GetEvent(Int_t) AliRun::Stack() AliRun::GetHeader() AliRun::TreeK() AliRun::TreeE() AliRun::TreeH() AliRun::TreeS() AliRun::TreeD() AliRun::TreeR() AliRunLoader::GetEvent(Int_t) AliRunLoader::Stack() AliRunLoader::GetHeader() AliRunLoader::TreeK() AliRunLoader::TreeE() AliLoader::TreeH() AliLoader::TreeS() AliLoader::TreeD() AliLoader::TreeR()

21 21P. K. Skowroński Alice Offline Week11 May 2002 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 22P. K. Skowroński Alice Offline Week11 May 2002 Example AliRunLoader *rl = AliRunLoader::Open("galice.root","Event",“read"); rl->LoadgAlice(); gAlice = rl->GetAliRun();//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC"); AliLoader * tpcl = rl->GetLoader("TPCLoader"); tpcl->LoadHits("READ"); tpcl->LoadSDigits("RECREATE"); Int_t nevent = rl->GetNumberOfEvents(); for for(Int_t eventn =0;eventn<nevent;eventn++) { rl->GetEvent(eventn); TPC->Hits2SDigits2(eventn); tpcl->WriteSDigits(“OVERWRITE”); } delete delete rl;


Download ppt "AliRoot I/O and Folder Alice Offline-Week 10-15 V 2002 Piotr Krzysztof Skowroński June 11, 2002."

Similar presentations


Ads by Google