1 #include "AliRunLoader.h"
2 //____________________________________________________________________
3 //////////////////////////////////////////////////////////////////////
5 // class AliRunLoader //
7 // This class aims to be the unque interface for managing data I/O. //
8 // It stores Loaders for all modules which, knows names //
9 // of the files were data are to be stored. //
11 // It aims to substitud AliRun in automatic data managing //
12 // thus there is no necessity of loading gAlice from file in order //
13 // to get access to the data. //
15 // Logical place to put the specific Loader to the given //
16 // detector is detector itself (i.e ITSLoader in ITS). //
17 // But, to load detector object one need to load gAlice, and //
18 // by the way all other detectors with their geometrieces and //
19 // so on. So, if one need to open TPC clusters there is no //
20 // principal need to read everything. //
23 // When RunLoader is read from the file it does not connect to //
24 // the folder structure automatically. It must be connected //
25 // (mounted) manualy. Default event folder is defined by //
26 // AliConfig::fgkDefaultEventFolderName //
27 // but can be mounted elsewhere. Usefull specially in merging case, //
28 // when more than pone session needs to be loaded //
30 //////////////////////////////////////////////////////////////////////
36 #include <TGeometry.h>
37 #include <TObjArray.h>
44 #include "AliConfig.h"
45 #include "AliLoader.h"
46 #include "AliHeader.h"
48 #include "AliDetector.h"
49 #include "AliRunDigitizer.h"
51 ClassImp(AliRunLoader)
53 AliRunLoader* AliRunLoader::fgRunLoader = 0x0;
55 const TString AliRunLoader::fgkRunLoaderName("RunLoader");
57 const TString AliRunLoader::fgkHeaderBranchName("Header");
58 const TString AliRunLoader::fgkHeaderContainerName("TE");
59 const TString AliRunLoader::fgkKineContainerName("TreeK");
60 const TString AliRunLoader::fgkTrackRefsContainerName("TreeTR");
61 const TString AliRunLoader::fgkKineBranchName("Particles");
62 const TString AliRunLoader::fgkDefaultKineFileName("Kinematics.root");
63 const TString AliRunLoader::fgkDefaultTrackRefsFileName("TrackRefs.root");
64 const TString AliRunLoader::fgkGAliceName("gAlice");
65 /**************************************************************************/
67 AliRunLoader::AliRunLoader():
75 fTrackRefsDataLoader(0x0),
79 AliConfig::Instance();//force to build the folder structure
80 if (!fgRunLoader) fgRunLoader = this;
82 /**************************************************************************/
84 AliRunLoader::AliRunLoader(const char* eventfoldername):
85 TNamed(fgkRunLoaderName,fgkRunLoaderName),
86 fLoaders(new TObjArray()),
92 fKineDataLoader(new AliDataLoader(fgkDefaultKineFileName,fgkKineContainerName,"Kinematics")),
93 fTrackRefsDataLoader(new AliDataLoader(fgkDefaultTrackRefsFileName,fgkTrackRefsContainerName,"Track References")),
98 SetEventFolderName(eventfoldername);
99 if (!fgRunLoader) fgRunLoader = this;
101 /**************************************************************************/
103 AliRunLoader::~AliRunLoader()
106 if (fgRunLoader == this) fgRunLoader = 0x0;
112 fLoaders->SetOwner();
116 delete fKineDataLoader;
117 delete fTrackRefsDataLoader;
122 //fEventFolder is deleted by the way of removing - TopAliceFolder owns it
127 /**************************************************************************/
129 AliRunLoader::AliRunLoader(TFolder* topfolder):
130 TNamed(fgkRunLoaderName,fgkRunLoaderName),
131 fLoaders(new TObjArray()),
132 fEventFolder(topfolder),
137 fKineDataLoader(new AliDataLoader(fgkDefaultKineFileName,fgkKineContainerName,"Kinematics")),
138 fTrackRefsDataLoader(new AliDataLoader(fgkDefaultTrackRefsFileName,fgkTrackRefsContainerName,"Track References")),
143 if (!fgRunLoader) fgRunLoader = this;
146 Fatal("AliRunLoader(TFolder*)","Parameter is NULL");
150 TObject* obj = fEventFolder->FindObject(fgkRunLoaderName);
152 { //if it is, then sth. is going wrong... exits aliroot session
153 Fatal("AliRunLoader(const char*)",
154 "In Event Folder Named %s object named %s already exists. I am confused ...",
155 fEventFolder->GetName(),fgkRunLoaderName.Data());
156 return;//never reached
159 fEventFolder->Add(this);//put myself to the folder to accessible for all
162 /**************************************************************************/
164 Int_t AliRunLoader::GetEvent(Int_t evno)
166 //Gets event number evno
167 //Reloads all data properly
168 if (fCurrentEvent == evno) return 0;
172 Error("GetEvent","Can not give the event with negative number");
176 if (evno >= GetNumberOfEvents())
178 Error("GetEvent","There is no event with number %d",evno);
184 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
185 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
186 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
187 Info("GetEvent"," GETTING EVENT %d",evno);
188 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
189 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
190 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
193 fCurrentEvent = evno;
197 //Reload header (If header was loaded)
200 retval = TreeE()->GetEvent(fCurrentEvent);
203 Error("GetEvent","Cannot find event: %d\n ",fCurrentEvent);
207 //Reload stack (If header was loaded)
208 if (TreeE()) fStack = GetHeader()->Stack();
209 //Set event folder in stack (it does not mean that we read kinematics from file)
212 fStack->SetEventFolderName(fEventFolder->GetName());
216 Warning("GetEvent","Stack not found in header");
222 Error("GetEvent","Error occured while setting event %d",evno);
226 //Post Track References
227 retval = fTrackRefsDataLoader->GetEvent();
230 Error("GetEvent","Error occured while GetEvent for Track References. Event %d",evno);
234 //Read Kinematics if loaded
235 fKineDataLoader->GetEvent();
238 Error("GetEvent","Error occured while GetEvent for Kinematics. Event %d",evno);
242 if (fStack && fKineDataLoader->GetBaseLoader(0)->IsLoaded()) fStack->GetEvent();
244 //Trigger data reloading in all loaders
245 TIter next(fLoaders);
247 while((loader = (AliLoader*)next()))
249 retval = loader->GetEvent();
252 Error("GetEvent","Error occured while getting event for %s. Event %d.",
253 loader->GetDetectorName().Data(), evno);
258 SetDetectorAddresses();
262 /**************************************************************************/
263 Int_t AliRunLoader::SetEvent()
265 //if kinematics was loaded Cleans folder data
269 retval = fKineDataLoader->SetEvent();
272 Error("SetEvent","SetEvent for Kinamtics Data Loader retutned error.");
275 retval = fTrackRefsDataLoader->SetEvent();
278 Error("SetEvent","SetEvent for Track References Data Loader retutned error.");
282 TIter next(fLoaders);
284 while((loader = (AliLoader*)next()))
286 retval = loader->SetEvent();
289 Error("SetEvent","SetEvent for %s Data Loader retutned error.",loader->GetName());
296 /**************************************************************************/
298 Int_t AliRunLoader::SetEventNumber(Int_t evno)
300 //cleans folders and sets the root dirs in files
301 if (fCurrentEvent == evno) return 0;
302 fCurrentEvent = evno;
306 /**************************************************************************/
307 AliRunLoader* AliRunLoader::Open
308 (const char* filename, const char* eventfoldername, Option_t* option)
310 //Opens a desired file 'filename'
311 //gets the the run-Loader and mounts it desired folder
312 //returns the pointer to run Loader which can be further used for accessing data
313 //in case of error returns NULL
315 static const TString webaddress("http://alisoft.cern.ch/people/skowron/codedoc/split/index.html");
316 if (AliLoader::GetDebug())
317 ::Info("AliRunLoader::Open",
318 "\n\n\nNew I/O strcture: See more info:\n %s\n\n\n",webaddress.Data());
320 AliRunLoader* result = 0x0;
322 /* ************************************************ */
323 /* Chceck if folder with given name already exists */
324 /* ************************************************ */
326 TObject* obj = AliConfig::Instance()->GetTopFolder()->FindObject(eventfoldername);
329 TFolder* fold = dynamic_cast<TFolder*>(obj);
332 ::Error("AliRunLoader::Open","Such a obejct already exists in top alice folder and it is not a folder.");
336 //check if we can get RL from that folder
337 result = AliRunLoader::GetRunLoader(eventfoldername);
340 ::Error("AliRunLoader::Open",
341 "Folder %s already exists, and can not find session there. Can not mount.",eventfoldername);
345 if (result->GetFileName().CompareTo(filename) != 0)
347 ::Error("AliRunLoader::Open","Other file is mounted in demanded folder. Can not mount.");
351 //check if now is demanded (re)creation
352 if ( AliLoader::TestFileOption(option) == kFALSE)
354 ::Error("AliRunLoader::Open",
355 "Session already exists in folder %s and this session option is %s. Unable to proceed.",
356 eventfoldername,option);
360 //check if demanded option is update and existing one
361 TString tmpstr(option);
362 if ( (tmpstr.CompareTo("update",TString::kIgnoreCase) == 0) &&
363 (result->fGAFile->IsWritable() == kFALSE) )
365 ::Error("AliRunLoader::Open",
366 "Session already exists in folder %s and is not writable while this session option is %s. Unable to proceed.",
367 eventfoldername,option);
371 ::Warning("AliRunLoader::Open","Session is already opened and mounted in demanded folder");
373 } //end of checking in case of existance of object named identically that folder session is being opened
376 TFile * gAliceFile = TFile::Open(filename,option);//open a file
378 {//null pointer returned
379 ::Error("AliRunLoader::Open","Can not open file %s.",filename);
383 if (gAliceFile->IsOpen() == kFALSE)
384 {//pointer to valid object returned but file is not opened
385 ::Error("AliRunLoader::Open","Can not open file %s.",filename);
389 //if file is "read" or "update" than we try to find AliRunLoader there - if not found cry and exit
390 //else create new AliRunLoader
391 if ( AliLoader::TestFileOption(option) )
393 if (AliLoader::GetDebug())
394 ::Info("AliRunLoader::Open","Reading RL from file");
396 result = dynamic_cast<AliRunLoader*>(gAliceFile->Get(fgkRunLoaderName));//get the run Loader from the file
399 ::Error("AliRunLoader::Open","Can not find run-Loader in file %s.",filename);
400 delete gAliceFile;//close the file
403 Int_t tmp = result->SetEventFolderName(eventfoldername);//mount a event folder
404 if (tmp)//if SetEvent returned error
406 ::Error("AliRunLoader::Open","Can not mount event in folder %s.",eventfoldername);
407 delete result; //delete run-Loader
408 delete gAliceFile;//close the file
414 if (AliLoader::GetDebug())
415 ::Info("AliRunLoader::Open","Creating new AliRunLoader. Folder name is %s",eventfoldername);
416 result = new AliRunLoader(eventfoldername);
419 //procedure for extracting dir name from the file name
420 TString fname(filename);
421 Int_t nsl = fname.Last('/');//look for slash in file name
425 Int_t nsl = fname.Last(':');//look for colon e.g. rfio:galice.root
426 if (nsl < 0) dirname = ".";//not found
427 else dirname = fname.Remove(nsl);//found
429 else dirname = fname.Remove(nsl);//slash found
431 if (AliLoader::GetDebug())
432 ::Info("AliRunLoader::Open","Dir name is : %s",dirname.Data());
434 result->SetDirName(dirname);
435 result->SetGAliceFile(gAliceFile);//set the pointer to gAliceFile
436 if (!fgRunLoader) fgRunLoader = result; //PH get access from any place
439 /**************************************************************************/
440 Int_t AliRunLoader::GetNumberOfEvents()
442 //returns number of events in Run
446 retval = LoadHeader();
449 Error("GetNumberOfEvents","Error occured while loading header");
453 return (Int_t)TreeE()->GetEntries();
455 /**************************************************************************/
457 void AliRunLoader::MakeHeader()
459 //Makes header and connects it to header tree (if it exists)
460 if (GetDebug()) Info("MakeHeader","");
463 if (GetDebug()) Info("MakeHeader","Creating new Header Object");
464 fHeader= new AliHeader();
466 TTree* tree = TreeE();
469 if (GetDebug()) Info("MakeHeader","Got Tree from folder.");
470 TBranch* branch = tree->GetBranch(fgkHeaderBranchName);
473 if (GetDebug()) Info("MakeHeader","Creating new branch");
474 branch = tree->Branch(fgkHeaderBranchName, "AliHeader", &fHeader, 4000, 0);
475 branch->SetAutoDelete(kFALSE);
479 if (GetDebug()) Info("MakeHeader","Got Branch from Tree");
480 branch->SetAddress(&fHeader);
481 tree->GetEvent(fCurrentEvent);
482 fStack = fHeader->Stack(); //should be safe - if we created Stack, header returns pointer to the same object
485 fStack->SetEventFolderName(fEventFolder->GetName());
486 if (TreeK()) fStack->GetEvent();
490 if (GetDebug()) Info("MakeHeader","Haeder do not have a stack.");
494 if (GetDebug()) Info("MakeHeader","Exiting MakeHeader method");
496 /**************************************************************************/
498 void AliRunLoader::MakeStack()
500 //Creates the stack object - do not connect the tree
503 fStack = new AliStack(10000);
504 fStack->SetEventFolderName(fEventFolder->GetName());
508 /**************************************************************************/
510 void AliRunLoader::MakeTree(Option_t *option)
513 const char *oK = strstr(option,"K"); //Kine
514 const char *oE = strstr(option,"E"); //Header
518 if (fKineDataLoader->GetBaseLoader(0)->IsLoaded() == kFALSE)
520 Error("MakeTree(\"K\")","Load Kinematics first");
524 fKineDataLoader->MakeTree();
526 fStack->ConnectTree();
527 WriteKinematics("OVERWRITE");
534 TTree* tree = new TTree(fgkHeaderContainerName,"Tree with Headers");
535 GetEventFolder()->Add(tree);
537 WriteHeader("OVERWRITE");
540 TIter next(fLoaders);
542 while((loader = (AliLoader*)next()))
544 loader->MakeTree(option);
548 /**************************************************************************/
550 Int_t AliRunLoader::LoadgAlice()
552 //Loads gAlice from file
555 Warning("LoadgAlice","AliRun is already in folder. Unload first.");
558 AliRun* alirun = dynamic_cast<AliRun*>(fGAFile->Get(fgkGAliceName));
561 Error("LoadgAlice"," Can not find gAlice in file %s",fGAFile->GetName());
564 alirun->SetRunLoader(this);
567 Warning("LoadgAlice","gAlice already exists. Putting retrived object in folder named %s",
568 GetEventFolder()->GetName());
574 SetDetectorAddresses();//calls SetTreeAddress for all detectors
577 /**************************************************************************/
579 Int_t AliRunLoader::LoadHeader()
581 //loads treeE and reads header object for current event
584 Warning("LoadHeader","Header is already loaded. Use ReloadHeader to force reload. Nothing done");
588 if (GetEventFolder() == 0x0)
590 Error("LoadHeader","Event folder not specified yet");
596 Error("LoadHeader","Session not opened. Use AliRunLoader::Open");
600 if (fGAFile->IsOpen() == kFALSE)
602 Error("LoadHeader","Session not opened. Use AliRunLoader::Open");
606 TTree* tree = dynamic_cast<TTree*>(fGAFile->Get(fgkHeaderContainerName));
609 Fatal("LoadHeader","Can not find header tree named %s in file %s",
610 fgkHeaderContainerName.Data(),fGAFile->GetName());
614 if (tree == TreeE()) return 0;
617 GetEventFolder()->Add(tree);
618 MakeHeader();//creates header object and connects to tree
622 /**************************************************************************/
624 Int_t AliRunLoader::LoadKinematics(Option_t* option)
626 //Loads the kinematics
627 Int_t retval = fKineDataLoader->GetBaseLoader(0)->Load(option);
630 Error("LoadKinematics","Error occured while loading kinamatics tree.");
633 if (fStack) fStack->GetEvent();
636 /**************************************************************************/
638 Int_t AliRunLoader::OpenDataFile(const TString& filename,TFile*& file,TDirectory*& dir,Option_t* opt,Int_t cl)
640 //Opens File with kinematics
643 if (file->IsOpen() == kFALSE)
644 {//pointer is not null but file is not opened
645 Warning("OpenDataFile","Pointer to file is not null, but file is not opened");//risky any way
647 file = 0x0; //proceed with opening procedure
651 Warning("OpenDataFile","File %s already opened",filename.Data());
655 //try to find if that file is opened somewere else
656 file = (TFile *)( gROOT->GetListOfFiles()->FindObject(filename) );
659 if(file->IsOpen() == kTRUE)
661 Warning("OpenDataFile","File %s already opened by sombody else.",file->GetName());
666 file = TFile::Open(filename,opt);
669 Error("LoadKinematics","Can not open file %s",filename.Data());
672 if (file->IsOpen() == kFALSE)
673 {//file is not opened
674 Error("LoadKinematics","Can not open file %s",filename.Data());
678 file->SetCompressionLevel(cl);
680 dir = AliLoader::ChangeDir(file,fCurrentEvent);
683 Error("OpenKineFile","Can not change to root directory in file %s",filename.Data());
688 /**************************************************************************/
690 TTree* AliRunLoader::TreeE() const
692 //returns the tree from folder; shortcut method
693 TObject *obj = fEventFolder->FindObject(fgkHeaderContainerName);
694 return (obj)?dynamic_cast<TTree*>(obj):0x0;
696 /**************************************************************************/
698 AliHeader* AliRunLoader::GetHeader() const
700 //returns pointer header object
703 /**************************************************************************/
705 TTree* AliRunLoader::TreeK() const
707 //returns the tree from folder; shortcut method
708 TObject *obj = GetEventFolder()->FindObject(fgkKineContainerName);
709 return (obj)?dynamic_cast<TTree*>(obj):0x0;
711 /**************************************************************************/
713 TTree* AliRunLoader::TreeTR() const
715 //returns the tree from folder; shortcut method
716 TObject* obj = GetEventFolder()->FindObject(fgkTrackRefsContainerName);
717 return (obj)?dynamic_cast<TTree*>(obj):0x0;
719 /**************************************************************************/
721 AliRun* AliRunLoader::GetAliRun() const
723 //returns AliRun which sits in the folder
724 if (fEventFolder == 0x0) return 0x0;
725 TObject *obj = fEventFolder->FindObject(fgkGAliceName);
726 return (obj)?dynamic_cast<AliRun*>(obj):0x0;
728 /**************************************************************************/
730 Int_t AliRunLoader::WriteGeometry(Option_t* /*opt*/)
732 //writes geometry to the file
734 TGeometry* geo = GetAliRun()->GetGeometry();
737 Error("WriteGeometry","Can not get geometry from gAlice");
743 /**************************************************************************/
745 Int_t AliRunLoader::WriteHeader(Option_t* opt)
748 if (GetDebug()) Info("WriteHeader"," WRITING HEADER");
750 TTree* tree = TreeE();
753 Warning("WriteHeader","Can not find Header Tree in Folder");
756 if (fGAFile->IsWritable() == kFALSE)
758 Error("WriteHeader","File %s is not writable",fGAFile->GetName());
762 TObject* obj = fGAFile->Get(fgkHeaderContainerName);
764 { //if they exist, see if option OVERWRITE is used
766 if(tmp.Contains("OVERWRITE",TString::kIgnoreCase) == 0)
767 {//if it is not used - give an error message and return an error code
768 Error("WriteHeader","Tree already exisists. Use option \"OVERWRITE\" to overwrite previous data");
773 tree->SetDirectory(fGAFile);
774 tree->Write(0,TObject::kOverwrite);
776 if (GetDebug()) Info("WriteHeader","WRITTEN\n\n");
780 /**************************************************************************/
782 Int_t AliRunLoader::WriteAliRun(Option_t* /*opt*/)
784 //writes AliRun object to the file
786 if (GetAliRun()) GetAliRun()->Write();
789 /**************************************************************************/
791 Int_t AliRunLoader::WriteKinematics(Option_t* opt)
794 return fKineDataLoader->GetBaseLoader(0)->WriteData(opt);
796 /**************************************************************************/
797 Int_t AliRunLoader::WriteTrackRefs(Option_t* opt)
799 //writes Track References tree
800 return fTrackRefsDataLoader->GetBaseLoader(0)->WriteData(opt);
802 /**************************************************************************/
804 Int_t AliRunLoader::WriteHits(Option_t* opt)
806 //Calls WriteHits for all loaders
809 TIter next(fLoaders);
811 while((loader = (AliLoader*)next()))
813 res = loader->WriteHits(opt);
816 Error("WriteHits","Failed to write hits for %s (%d)",loader->GetDetectorName().Data(),res);
822 /**************************************************************************/
824 Int_t AliRunLoader::WriteSDigits(Option_t* opt)
826 //Calls WriteSDigits for all loaders
829 TIter next(fLoaders);
831 while((loader = (AliLoader*)next()))
833 res = loader->WriteSDigits(opt);
836 Error("WriteSDigits","Failed to write summable digits for %s.",loader->GetDetectorName().Data());
842 /**************************************************************************/
844 Int_t AliRunLoader::WriteDigits(Option_t* opt)
846 //Calls WriteDigits for all loaders
849 TIter next(fLoaders);
851 while((loader = (AliLoader*)next()))
853 res = loader->WriteDigits(opt);
856 Error("WriteDigits","Failed to write digits for %s.",loader->GetDetectorName().Data());
862 /**************************************************************************/
864 Int_t AliRunLoader::WriteRecPoints(Option_t* opt)
866 //Calls WriteRecPoints for all loaders
869 TIter next(fLoaders);
871 while((loader = (AliLoader*)next()))
873 res = loader->WriteRecPoints(opt);
876 Error("WriteRecPoints","Failed to write Reconstructed Points for %s.",
877 loader->GetDetectorName().Data());
883 /**************************************************************************/
885 Int_t AliRunLoader::WriteTracks(Option_t* opt)
887 //Calls WriteTracks for all loaders
890 TIter next(fLoaders);
892 while((loader = (AliLoader*)next()))
894 res = loader->WriteTracks(opt);
897 Error("WriteTracks","Failed to write Tracks for %s.",
898 loader->GetDetectorName().Data());
904 /**************************************************************************/
906 Int_t AliRunLoader::WriteRunLoader(Option_t* /*opt*/)
908 //Writes itself to the file
910 this->Write(0,TObject::kOverwrite);
913 /**************************************************************************/
915 Int_t AliRunLoader::SetEventFolderName(const TString& name)
917 //sets top folder name for this run; of alread
920 Error("SetTopFolderName","Name is empty");
924 //check if such a folder already exists - try to find it in alice top folder
925 TObject* obj = AliConfig::Instance()->GetTopFolder()->FindObject(name);
928 TFolder* fold = dynamic_cast<TFolder*>(obj);
931 Error("SetTopFolderName","Such a obejct already exists in top alice folder and it is not a folder.");
934 //folder which was found is our folder
935 if (fEventFolder == fold)
941 Error("SetTopFolderName","Such a folder already exists in top alice folder. Can not mount.");
946 //event is alredy connected, just change name of the folder
949 fEventFolder->SetName(name);
953 if (fKineDataLoader == 0x0)
954 fKineDataLoader = new AliDataLoader(fgkDefaultKineFileName,fgkKineContainerName,"Kinematics");
956 if ( fTrackRefsDataLoader == 0x0)
957 fTrackRefsDataLoader = new AliDataLoader(fgkDefaultTrackRefsFileName,fgkTrackRefsContainerName,"Track References");
959 //build the event folder structure
960 if (GetDebug()) Info("SetEventFolderName","Creating new event folder named %s",name.Data());
961 fEventFolder = AliConfig::Instance()->BuildEventFolder(name,"Event Folder");
962 fEventFolder->Add(this);//put myself to the folder to accessible for all
964 if (Stack()) Stack()->SetEventFolderName(fEventFolder->GetName());
965 TIter next(fLoaders);
967 while((loader = (AliLoader*)next()))
969 loader->Register(fEventFolder);//build folder structure for this detector
972 fKineDataLoader->SetEventFolder(GetEventFolder());
973 fTrackRefsDataLoader->SetEventFolder(GetEventFolder());
974 fKineDataLoader->SetFolder(GetEventFolder());
975 fTrackRefsDataLoader->SetFolder(GetEventFolder());
977 fEventFolder->SetOwner();
980 /**************************************************************************/
982 void AliRunLoader::AddLoader(AliLoader* loader)
984 //Adds the Loader for given detector
985 if (loader == 0x0) //if null shout and exit
987 Error("AddLoader","Parameter is NULL");
990 loader->SetDirName(fUnixDirName);
991 if (fEventFolder) loader->SetEventFolder(fEventFolder); //if event folder is already defined,
992 //pass information to the Loader
993 fLoaders->Add(loader);//add the Loader to the array
995 /**************************************************************************/
997 void AliRunLoader::AddLoader(AliDetector* det)
999 //Asks module (detector) ro make a Loader and stores in the array
1000 if (det == 0x0) return;
1001 AliLoader* get = det->GetLoader();//try to get loader
1002 if (get == 0x0) get = det->MakeLoader(fEventFolder->GetName());//if did not obtain, ask to make it
1006 if (GetDebug()) Info("AddLoader","Detector: %s Loader : %s",det->GetName(),get->GetName());
1011 /**************************************************************************/
1013 AliLoader* AliRunLoader::GetLoader(const char* detname) const
1015 //returns loader for given detector
1016 //note that naming convention is TPCLoader not just TPC
1017 return (AliLoader*)fLoaders->FindObject(detname);
1020 /**************************************************************************/
1022 AliLoader* AliRunLoader::GetLoader(AliDetector* det) const
1024 //get loader for detector det
1025 if(det == 0x0) return 0x0;
1026 TString getname(det->GetName());
1028 if (GetDebug()) Info("GetLoader(AliDetector* det)"," Loader name is %s",getname.Data());
1029 return GetLoader(getname);
1032 /**************************************************************************/
1034 void AliRunLoader::CleanFolders()
1036 // fEventFolder->Add(this);//put myself to the folder to accessible for all
1042 /**************************************************************************/
1044 void AliRunLoader::CleanDetectors()
1046 //Calls CleanFolders for all detectors
1047 TIter next(fLoaders);
1049 while((loader = (AliLoader*)next()))
1051 loader->CleanFolders();
1054 /**************************************************************************/
1056 void AliRunLoader::RemoveEventFolder()
1058 //remove all the tree of event
1059 //all the stuff changing EbE stays untached (PDGDB, tasks, etc.)
1061 if (fEventFolder == 0x0) return;
1062 fEventFolder->SetOwner(kFALSE);//don't we want to deleted while removing the folder that we are sitting in
1063 fEventFolder->Remove(this);//remove us drom folder
1065 AliConfig::Instance()->GetTopFolder()->SetOwner(); //brings ownership back for fEventFolder since it sits in top folder
1066 AliConfig::Instance()->GetTopFolder()->Remove(fEventFolder); //remove the event tree
1067 delete fEventFolder;
1069 /**************************************************************************/
1071 void AliRunLoader::SetGAliceFile(TFile* gafile)
1073 //sets pointer to galice.root file
1077 /**************************************************************************/
1079 Int_t AliRunLoader::LoadHits(Option_t* detectors,Option_t* opt)
1081 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1083 if (GetDebug()) Info("LoadHits","Loading Hits");
1087 const char* oAll = strstr(detectors,"all");
1090 if (GetDebug()) Info("LoadHits","Option is All");
1095 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1096 loaders = &arr;//get the pointer array
1099 if (GetDebug()) Info("LoadHits","For detectors. Number of detectors chosen for loading %d",loaders->GetEntries());
1101 TIter next(loaders);
1103 while((loader = (AliLoader*)next()))
1105 if (GetDebug()) Info("LoadHits"," Calling LoadHits(%s) for %s",opt,loader->GetName());
1106 loader->LoadHits(opt);
1108 if (GetDebug()) Info("LoadHits","Done");
1112 /**************************************************************************/
1114 Int_t AliRunLoader::LoadSDigits(Option_t* detectors,Option_t* opt)
1116 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1121 const char* oAll = strstr(detectors,"all");
1128 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1129 loaders = &arr;//get the pointer to array
1132 TIter next(loaders);
1134 while((loader = (AliLoader*)next()))
1136 loader->LoadSDigits(opt);
1141 /**************************************************************************/
1143 Int_t AliRunLoader::LoadDigits(Option_t* detectors,Option_t* opt)
1145 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1150 const char* oAll = strstr(detectors,"all");
1157 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1158 loaders = &arr;//get the pointer array
1161 TIter next(loaders);
1163 while((loader = (AliLoader*)next()))
1165 loader->LoadDigits(opt);
1169 /**************************************************************************/
1171 Int_t AliRunLoader::LoadRecPoints(Option_t* detectors,Option_t* opt)
1173 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1178 const char* oAll = strstr(detectors,"all");
1185 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1186 loaders = &arr;//get the pointer array
1189 TIter next(loaders);
1191 while((loader = (AliLoader*)next()))
1193 loader->LoadRecPoints(opt);
1197 /**************************************************************************/
1199 Int_t AliRunLoader::LoadRecParticles(Option_t* detectors,Option_t* opt)
1201 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1206 const char* oAll = strstr(detectors,"all");
1213 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1214 loaders = &arr;//get the pointer array
1217 TIter next(loaders);
1219 while((loader = (AliLoader*)next()))
1221 loader->LoadRecParticles(opt);
1225 /**************************************************************************/
1227 Int_t AliRunLoader::LoadTracks(Option_t* detectors,Option_t* opt)
1229 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1234 const char* oAll = strstr(detectors,"all");
1241 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1242 loaders = &arr;//get the pointer array
1245 TIter next(loaders);
1247 while((loader = (AliLoader*)next()))
1249 loader->LoadTracks(opt);
1253 /**************************************************************************/
1255 void AliRunLoader::UnloadHits(Option_t* detectors)
1257 //unloads hits for detectors specified in parameter
1261 const char* oAll = strstr(detectors,"all");
1268 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1269 loaders = &arr;//get the pointer to array
1272 TIter next(loaders);
1274 while((loader = (AliLoader*)next()))
1276 loader->UnloadHits();
1279 /**************************************************************************/
1281 void AliRunLoader::UnloadSDigits(Option_t* detectors)
1283 //unloads SDigits for detectors specified in parameter
1287 const char* oAll = strstr(detectors,"all");
1294 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1295 loaders = &arr;//get the pointer to array
1298 TIter next(loaders);
1300 while((loader = (AliLoader*)next()))
1302 loader->UnloadSDigits();
1305 /**************************************************************************/
1307 void AliRunLoader::UnloadDigits(Option_t* detectors)
1309 //unloads Digits for detectors specified in parameter
1313 const char* oAll = strstr(detectors,"all");
1320 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1321 loaders = &arr;//get the pointer to array
1324 TIter next(loaders);
1326 while((loader = (AliLoader*)next()))
1328 loader->UnloadDigits();
1331 /**************************************************************************/
1333 void AliRunLoader::UnloadRecPoints(Option_t* detectors)
1335 //unloads RecPoints for detectors specified in parameter
1339 const char* oAll = strstr(detectors,"all");
1346 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1347 loaders = &arr;//get the pointer to array
1350 TIter next(loaders);
1352 while((loader = (AliLoader*)next()))
1354 loader->UnloadRecPoints();
1357 /**************************************************************************/
1359 void AliRunLoader::UnloadAll(Option_t* detectors)
1361 //calls UnloadAll for detectors names specified in parameter
1362 // option "all" passed can be passed
1366 const char* oAll = strstr(detectors,"all");
1373 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1374 loaders = &arr;//get the pointer to array
1377 TIter next(loaders);
1379 while((loader = (AliLoader*)next()))
1381 loader->UnloadAll();
1384 /**************************************************************************/
1386 void AliRunLoader::UnloadTracks(Option_t* detectors)
1388 //unloads Tracks for detectors specified in parameter
1392 const char* oAll = strstr(detectors,"all");
1399 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1400 loaders = &arr;//get the pointer to array
1403 TIter next(loaders);
1405 while((loader = (AliLoader*)next()))
1407 loader->UnloadTracks();
1410 /**************************************************************************/
1412 void AliRunLoader::UnloadRecParticles(Option_t* detectors)
1414 //unloads Particles for detectors specified in parameter
1418 const char* oAll = strstr(detectors,"all");
1425 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1426 loaders = &arr;//get the pointer to array
1429 TIter next(loaders);
1431 while((loader = (AliLoader*)next()))
1433 loader->UnloadRecParticles();
1436 /**************************************************************************/
1438 AliRunLoader* AliRunLoader::GetRunLoader(const char* eventfoldername)
1440 //returns RunLoader from folder named eventfoldername
1441 TFolder* evfold= dynamic_cast<TFolder*>(AliConfig::Instance()->GetTopFolder()->FindObject(eventfoldername));
1446 AliRunLoader* runget = dynamic_cast<AliRunLoader*>(evfold->FindObject(AliRunLoader::fgkRunLoaderName));
1450 /**************************************************************************/
1452 AliLoader* AliRunLoader::GetDetectorLoader(const char* detname, const char* eventfoldername)
1454 //get the loader of the detector with the given name from the global
1456 AliRunLoader* runLoader = GetRunLoader(eventfoldername);
1458 ::Error("AliRunLoader::GetDetectorLoader","No run loader found");
1461 return runLoader->GetDetectorLoader(detname);
1463 /**************************************************************************/
1465 AliLoader* AliRunLoader::GetDetectorLoader(const char* detname)
1467 //get the loader of the detector with the given name from the global
1470 char loadername[256];
1471 sprintf(loadername, "%sLoader", detname);
1472 AliLoader* loader = GetLoader(loadername);
1474 Error("GetDetectorLoader", "No loader for %s found", detname);
1479 /**************************************************************************/
1481 TTree* AliRunLoader::GetTreeH(const char* detname, Bool_t maketree, const char* eventfoldername)
1483 //get the tree with hits of the detector with the given name
1484 //if maketree is true and the tree does not exist, the tree is created
1485 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1486 if (!loader) return NULL;
1487 if (!loader->TreeH() && maketree) loader->MakeTree("H");
1488 return loader->TreeH();
1491 /**************************************************************************/
1493 TTree* AliRunLoader::GetTreeH(const char* detname, Bool_t maketree)
1495 //get the tree with hits of the detector with the given name
1496 //if maketree is true and the tree does not exist, the tree is created
1497 AliLoader* loader = GetDetectorLoader(detname);
1498 if (!loader) return NULL;
1499 if (!loader->TreeH() && maketree) loader->MakeTree("H");
1500 return loader->TreeH();
1502 /**************************************************************************/
1504 TTree* AliRunLoader::GetTreeS(const char* detname, Bool_t maketree,const char* eventfoldername)
1506 //get the tree with summable digits of the detector with the given name
1507 //if maketree is true and the tree does not exist, the tree is created
1508 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1509 if (!loader) return NULL;
1510 if (!loader->TreeS() && maketree) loader->MakeTree("S");
1511 return loader->TreeS();
1513 /**************************************************************************/
1515 TTree* AliRunLoader::GetTreeS(const char* detname, Bool_t maketree)
1517 //get the tree with summable digits of the detector with the given name
1518 //if maketree is true and the tree does not exist, the tree is created
1519 AliLoader* loader = GetDetectorLoader(detname);
1520 if (!loader) return NULL;
1521 if (!loader->TreeS() && maketree) loader->MakeTree("S");
1522 return loader->TreeS();
1524 /**************************************************************************/
1526 TTree* AliRunLoader::GetTreeD(const char* detname, Bool_t maketree,const char* eventfoldername)
1528 //get the tree with digits of the detector with the given name
1529 //if maketree is true and the tree does not exist, the tree is created
1530 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1531 if (!loader) return NULL;
1532 if (!loader->TreeD() && maketree) loader->MakeTree("D");
1533 return loader->TreeD();
1535 /**************************************************************************/
1537 TTree* AliRunLoader::GetTreeD(const char* detname, Bool_t maketree)
1539 //get the tree with digits of the detector with the given name
1540 //if maketree is true and the tree does not exist, the tree is created
1541 AliLoader* loader = GetDetectorLoader(detname);
1542 if (!loader) return NULL;
1543 if (!loader->TreeD() && maketree) loader->MakeTree("D");
1544 return loader->TreeD();
1546 /**************************************************************************/
1547 TTree* AliRunLoader::GetTreeR(const char* detname, Bool_t maketree,const char* eventfoldername)
1549 //get the tree with clusters of the detector with the given name
1550 //if maketree is true and the tree does not exist, the tree is created
1551 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1552 if (!loader) return NULL;
1553 if (!loader->TreeR() && maketree) loader->MakeTree("R");
1554 return loader->TreeR();
1556 /**************************************************************************/
1558 TTree* AliRunLoader::GetTreeR(const char* detname, Bool_t maketree)
1560 //get the tree with clusters of the detector with the given name
1561 //if maketree is true and the tree does not exist, the tree is created
1562 AliLoader* loader = GetDetectorLoader(detname);
1563 if (!loader) return NULL;
1564 if (!loader->TreeR() && maketree) loader->MakeTree("R");
1565 return loader->TreeR();
1567 /**************************************************************************/
1569 TTree* AliRunLoader::GetTreeT(const char* detname, Bool_t maketree,const char* eventfoldername)
1571 //get the tree with tracks of the detector with the given name
1572 //if maketree is true and the tree does not exist, the tree is created
1573 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1574 if (!loader) return NULL;
1575 if (!loader->TreeT() && maketree) loader->MakeTree("T");
1576 return loader->TreeT();
1578 /**************************************************************************/
1580 TTree* AliRunLoader::GetTreeT(const char* detname, Bool_t maketree)
1582 //get the tree with tracks of the detector with the given name
1583 //if maketree is true and the tree does not exist, the tree is created
1584 AliLoader* loader = GetDetectorLoader(detname);
1585 if (!loader) return NULL;
1586 if (!loader->TreeT() && maketree) loader->MakeTree("T");
1587 return loader->TreeT();
1589 /**************************************************************************/
1591 TTree* AliRunLoader::GetTreeP(const char* detname, Bool_t maketree,const char* eventfoldername)
1593 //get the tree with particles of the detector with the given name
1594 //if maketree is true and the tree does not exist, the tree is created
1595 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1596 if (!loader) return NULL;
1597 if (!loader->TreeP() && maketree) loader->MakeTree("P");
1598 return loader->TreeP();
1600 /**************************************************************************/
1602 TTree* AliRunLoader::GetTreeP(const char* detname, Bool_t maketree)
1604 //get the tree with particles of the detector with the given name
1605 //if maketree is true and the tree does not exist, the tree is created
1606 AliLoader* loader = GetDetectorLoader(detname);
1607 if (!loader) return NULL;
1608 if (!loader->TreeP() && maketree) loader->MakeTree("P");
1609 return loader->TreeP();
1612 /**************************************************************************/
1614 void AliRunLoader::CdGAFile()
1616 //sets gDirectory to galice file
1618 if(fGAFile) fGAFile->cd();
1621 /**************************************************************************/
1623 void AliRunLoader::GetListOfDetectors(const char * namelist,TObjArray& pointerarray) const
1625 //this method looks for all Loaders corresponding
1626 //to names (many) specified in namelist i.e. namelist ("ITS TPC TRD")
1630 strcpy(dets,namelist);//compiler cries when char* = const Option_t*;
1631 dets[strlen(dets)+1] = '\n';//set endl at the end of string
1636 tmp = sscanf(pdet,"%s",buff);//read the string from the input string pdet into buff
1637 if ( (buff[0] == 0) || (tmp == 0) ) break; //if not read
1639 pdet = strstr(pdet,buff) + strlen(buff);//move the input pointer about number of bytes (letters) read
1640 //I am aware that is a little complicated. I don't know the number of spaces between detector names
1641 //so I read the string, than I find where it starts (strstr) and move the pointer about length of a string
1642 //If there is a better way, please write me (Piotr.Skowronski@cern.ch)
1643 //construct the Loader name
1644 TString getname(buff);
1646 AliLoader* loader = GetLoader(getname);//get the Loader
1649 pointerarray.Add(loader);
1653 Error("GetListOfDetectors","Can not find Loader for %s",buff);
1659 /*****************************************************************************/
1661 void AliRunLoader::Clean(const TString& name)
1663 //removes object with given name from event folder and deletes it
1664 if (GetEventFolder() == 0x0) return;
1665 TObject* obj = GetEventFolder()->FindObject(name);
1668 if (GetDebug()) Info("Clean(const TString&)","name=%s, cleaning %s.",GetName(),name.Data());
1669 GetEventFolder()->Remove(obj);
1674 /*****************************************************************************/
1676 TTask* AliRunLoader::GetRunDigitizer()
1678 //returns Run Digitizer from folder
1680 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1681 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetDigitizerTaskName());
1682 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1684 /*****************************************************************************/
1686 TTask* AliRunLoader::GetRunSDigitizer()
1688 //returns SDigitizer Task from folder
1690 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1691 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetSDigitizerTaskName());
1692 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1694 /*****************************************************************************/
1696 TTask* AliRunLoader::GetRunReconstructioner()
1698 //returns Reconstructioner Task from folder
1699 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1700 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetReconstructionerTaskName());
1701 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1703 /*****************************************************************************/
1705 TTask* AliRunLoader::GetRunTracker()
1707 //returns Tracker Task from folder
1708 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1709 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetTrackerTaskName());
1710 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1712 /*****************************************************************************/
1714 TTask* AliRunLoader::GetRunPIDTask()
1716 //returns Tracker Task from folder
1717 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1718 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetPIDTaskName());
1719 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1721 /*****************************************************************************/
1723 TTask* AliRunLoader::GetRunQATask()
1725 //returns Quality Assurance Task from folder
1726 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1729 ::Error("AliRunLoader::GetRunQATask","Can not get task folder from AliConfig");
1732 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetQATaskName());
1733 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1736 /*****************************************************************************/
1738 void AliRunLoader::SetCompressionLevel(Int_t cl)
1740 //Sets Compression Level in all files
1741 if (fGAFile) fGAFile->SetCompressionLevel(cl);
1742 SetKineComprLevel(cl);
1743 SetTrackRefsComprLevel(cl);
1744 TIter next(fLoaders);
1746 while((loader = (AliLoader*)next()))
1748 loader->SetCompressionLevel(cl);
1751 /**************************************************************************/
1753 void AliRunLoader::SetKineComprLevel(Int_t cl)
1755 //Sets comression level in Kine File
1756 fKineDataLoader->SetCompressionLevel(cl);
1758 /**************************************************************************/
1760 void AliRunLoader::SetTrackRefsComprLevel(Int_t cl)
1762 //Sets comression level in Track Refences File
1763 fTrackRefsDataLoader->SetCompressionLevel(cl);
1765 /**************************************************************************/
1767 void AliRunLoader::UnloadHeader()
1769 //removes TreeE from folder and deletes it
1770 // as well as fHeader object
1775 /**************************************************************************/
1777 void AliRunLoader::UnloadKinematics()
1779 //Unloads Kinematics
1780 fKineDataLoader->GetBaseLoader(0)->Unload();
1782 /**************************************************************************/
1784 void AliRunLoader::UnloadTrackRefs()
1786 //Unloads Track Refernces
1787 fTrackRefsDataLoader->GetBaseLoader(0)->Unload();
1789 /**************************************************************************/
1791 void AliRunLoader::UnloadgAlice()
1794 if (gAlice == GetAliRun())
1796 if (GetDebug()) Info("UnloadgAlice","Set gAlice = 0x0");
1797 gAlice = 0x0;//if gAlice is the same that in folder (to be deleted by the way of folder)
1799 AliRun* alirun = GetAliRun();
1800 if (GetEventFolder()) GetEventFolder()->Remove(alirun);
1803 /**************************************************************************/
1805 void AliRunLoader::MakeTrackRefsContainer()
1807 // Makes a tree for Track References
1808 fTrackRefsDataLoader->MakeTree();
1810 /**************************************************************************/
1812 Int_t AliRunLoader::LoadTrackRefs(Option_t* option)
1814 //Load track references from file (opens file and posts tree to folder)
1816 return fTrackRefsDataLoader->GetBaseLoader(0)->Load(option);
1818 /**************************************************************************/
1820 void AliRunLoader::SetDirName(TString& dirname)
1822 //sets directory name
1823 if (dirname.IsNull()) return;
1824 fUnixDirName = dirname;
1825 fKineDataLoader->SetDirName(dirname);
1826 fTrackRefsDataLoader->SetDirName(dirname);
1828 TIter next(fLoaders);
1830 while((loader = (AliLoader*)next()))
1832 loader->SetDirName(dirname);
1836 /*****************************************************************************/
1838 Int_t AliRunLoader::GetFileOffset() const
1840 //returns the file number that is added to the file name for current event
1841 return Int_t(fCurrentEvent/fNEventsPerFile);
1844 /*****************************************************************************/
1845 const TString AliRunLoader::SetFileOffset(const TString& fname)
1847 //adds the the number to the file name at proper place for current event
1848 Long_t offset = (Long_t)GetFileOffset();
1849 if (offset < 1) return fname;
1851 soffset += offset;//automatic conversion to string
1852 TString dotroot(".root");
1853 const TString& offfsetdotroot = offset + dotroot;
1854 TString out = fname;
1855 out = out.ReplaceAll(dotroot,offfsetdotroot);
1856 if (GetDebug()) Info("SetFileOffset"," in=%s out=%s",fname.Data(),out.Data());
1859 /*****************************************************************************/
1861 void AliRunLoader::SetDigitsFileNameSuffix(const TString& suffix)
1863 //adds the suffix before ".root",
1864 //e.g. TPC.Digits.root -> TPC.DigitsMerged.root
1865 //made on Jiri Chudoba demand
1867 TIter next(fLoaders);
1869 while((loader = (AliLoader*)next()))
1871 loader->SetDigitsFileNameSuffix(suffix);
1874 /*****************************************************************************/
1876 TString AliRunLoader::GetFileName() const
1878 //returns name of galice file
1880 if (fGAFile == 0x0) return result;
1881 result = fGAFile->GetName();
1884 /*****************************************************************************/
1886 void AliRunLoader::SetDetectorAddresses()
1888 //calls SetTreeAddress for all detectors
1889 if (GetAliRun()==0x0) return;
1890 TIter next(GetAliRun()->Modules());
1892 while((mod = (AliModule*)next()))
1894 AliDetector* det = dynamic_cast<AliDetector*>(mod);
1895 if (det) det->SetTreeAddress();
1898 /*****************************************************************************/
1900 void AliRunLoader::Synchronize()
1902 //synchrinizes all writtable files
1903 TIter next(fLoaders);
1905 while((loader = (AliLoader*)next()))
1907 loader->Synchronize();
1910 fKineDataLoader->Synchronize();
1911 fTrackRefsDataLoader->Synchronize();
1913 if (fGAFile) fGAFile->Flush();
1915 /*****************************************************************************/
1916 /*****************************************************************************/