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
81 /**************************************************************************/
83 AliRunLoader::AliRunLoader(const char* eventfoldername):
84 TNamed(fgkRunLoaderName,fgkRunLoaderName),
85 fLoaders(new TObjArray()),
91 fKineDataLoader(new AliDataLoader(fgkDefaultKineFileName,fgkKineContainerName,"Kinematics")),
92 fTrackRefsDataLoader(new AliDataLoader(fgkDefaultTrackRefsFileName,fgkTrackRefsContainerName,"Track References")),
97 SetEventFolderName(eventfoldername);
99 /**************************************************************************/
101 AliRunLoader::~AliRunLoader()
104 if (fgRunLoader == this) fgRunLoader = 0x0;
110 fLoaders->SetOwner();
114 delete fKineDataLoader;
115 delete fTrackRefsDataLoader;
120 //fEventFolder is deleted by the way of removing - TopAliceFolder owns it
125 /**************************************************************************/
127 AliRunLoader::AliRunLoader(TFolder* topfolder):TNamed(fgkRunLoaderName,fgkRunLoaderName)
132 Fatal("AliRunLoader(TFolder*)","Parameter is NULL");
135 fEventFolder = topfolder;
137 TObject* obj = fEventFolder->FindObject(fgkRunLoaderName);
139 { //if it is, then sth. is going wrong... exits aliroot session
140 Fatal("AliRunLoader(const char*)",
141 "In Event Folder Named %s object named %s already exists. I am confused ...",
142 fEventFolder->GetName(),fgkRunLoaderName.Data());
143 return;//never reached
146 fLoaders = new TObjArray();
147 fEventFolder->Add(this);//put myself to the folder to accessible for all
150 /**************************************************************************/
152 Int_t AliRunLoader::GetEvent(Int_t evno)
154 //Gets event number evno
155 //Reloads all data properly
156 if (fCurrentEvent == evno) return 0;
160 Error("GetEvent","Can not give the event with negative number");
164 if (evno >= GetNumberOfEvents())
166 Error("GetEvent","There is no event with number %d",evno);
172 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
173 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
174 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
175 Info("GetEvent"," GETTING EVENT %d",evno);
176 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
177 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
178 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
181 fCurrentEvent = evno;
185 //Reload header (If header was loaded)
188 retval = TreeE()->GetEvent(fCurrentEvent);
191 Error("GetEvent","Cannot find event: %d\n ",fCurrentEvent);
195 //Reload stack (If header was loaded)
196 if (TreeE()) fStack = GetHeader()->Stack();
197 //Set event folder in stack (it does not mean that we read kinematics from file)
200 fStack->SetEventFolderName(fEventFolder->GetName());
204 Warning("GetEvent","Stack not found in header");
210 Error("GetEvent","Error occured while setting event %d",evno);
214 //Post Track References
215 retval = fTrackRefsDataLoader->GetEvent();
218 Error("GetEvent","Error occured while GetEvent for Track References. Event %d",evno);
222 //Read Kinematics if loaded
223 fKineDataLoader->GetEvent();
226 Error("GetEvent","Error occured while GetEvent for Kinematics. Event %d",evno);
230 if (fStack && fKineDataLoader->GetBaseLoader(0)->IsLoaded()) fStack->GetEvent();
232 //Trigger data reloading in all loaders
233 TIter next(fLoaders);
235 while((loader = (AliLoader*)next()))
237 retval = loader->GetEvent();
240 Error("GetEvent","Error occured while getting event for %s. Event %d.",
241 loader->GetDetectorName().Data(), evno);
246 SetDetectorAddresses();
250 /**************************************************************************/
251 Int_t AliRunLoader::SetEvent()
253 //if kinematics was loaded Cleans folder data
257 retval = fKineDataLoader->SetEvent();
260 Error("SetEvent","SetEvent for Kinamtics Data Loader retutned error.");
263 retval = fTrackRefsDataLoader->SetEvent();
266 Error("SetEvent","SetEvent for Track References Data Loader retutned error.");
270 TIter next(fLoaders);
272 while((loader = (AliLoader*)next()))
274 retval = loader->SetEvent();
277 Error("SetEvent","SetEvent for %s Data Loader retutned error.",loader->GetName());
284 /**************************************************************************/
286 Int_t AliRunLoader::SetEventNumber(Int_t evno)
288 //cleans folders and sets the root dirs in files
289 if (fCurrentEvent == evno) return 0;
290 fCurrentEvent = evno;
294 /**************************************************************************/
295 AliRunLoader* AliRunLoader::Open
296 (const char* filename, const char* eventfoldername, Option_t* option)
298 //Opens a desired file 'filename'
299 //gets the the run-Loader and mounts it desired folder
300 //returns the pointer to run Loader which can be further used for accessing data
301 //in case of error returns NULL
303 static const TString webaddress("http://alisoft.cern.ch/people/skowron/codedoc/split/index.html");
304 if (AliLoader::GetDebug())
305 ::Info("AliRunLoader::Open",
306 "\n\n\nNew I/O strcture: See more info:\n %s\n\n\n",webaddress.Data());
308 AliRunLoader* result = 0x0;
310 /* ************************************************ */
311 /* Chceck if folder with given name already exists */
312 /* ************************************************ */
314 TObject* obj = AliConfig::Instance()->GetTopFolder()->FindObject(eventfoldername);
317 TFolder* fold = dynamic_cast<TFolder*>(obj);
320 ::Error("AliRunLoader::Open","Such a obejct already exists in top alice folder and it is not a folder.");
324 //check if we can get RL from that folder
325 result = AliRunLoader::GetRunLoader(eventfoldername);
328 ::Error("AliRunLoader::Open",
329 "Folder %s already exists, and can not find session there. Can not mount.",eventfoldername);
333 if (result->GetFileName().CompareTo(filename) != 0)
335 ::Error("AliRunLoader::Open","Other file is mounted in demanded folder. Can not mount.");
339 //check if now is demanded (re)creation
340 if ( AliLoader::TestFileOption(option) == kFALSE)
342 ::Error("AliRunLoader::Open",
343 "Session already exists in folder %s and this session option is %s. Unable to proceed.",
344 eventfoldername,option);
348 //check if demanded option is update and existing one
349 TString tmpstr(option);
350 if ( (tmpstr.CompareTo("update",TString::kIgnoreCase) == 0) &&
351 (result->fGAFile->IsWritable() == kFALSE) )
353 ::Error("AliRunLoader::Open",
354 "Session already exists in folder %s and is not writable while this session option is %s. Unable to proceed.",
355 eventfoldername,option);
359 ::Warning("AliRunLoader::Open","Session is already opened and mounted in demanded folder");
361 } //end of checking in case of existance of object named identically that folder session is being opened
364 TFile * gAliceFile = TFile::Open(filename,option);//open a file
366 {//null pointer returned
367 ::Error("AliRunLoader::Open","Can not open file %s.",filename);
371 if (gAliceFile->IsOpen() == kFALSE)
372 {//pointer to valid object returned but file is not opened
373 ::Error("AliRunLoader::Open","Can not open file %s.",filename);
377 //if file is "read" or "update" than we try to find AliRunLoader there - if not found cry and exit
378 //else create new AliRunLoader
379 if ( AliLoader::TestFileOption(option) )
381 if (AliLoader::GetDebug())
382 ::Info("AliRunLoader::Open","Reading RL from file");
384 result = dynamic_cast<AliRunLoader*>(gAliceFile->Get(fgkRunLoaderName));//get the run Loader from the file
387 ::Error("AliRunLoader::Open","Can not find run-Loader in file %s.",filename);
388 delete gAliceFile;//close the file
391 Int_t tmp = result->SetEventFolderName(eventfoldername);//mount a event folder
392 if (tmp)//if SetEvent returned error
394 ::Error("AliRunLoader::Open","Can not mount event in folder %s.",eventfoldername);
395 delete result; //delete run-Loader
396 delete gAliceFile;//close the file
402 if (AliLoader::GetDebug())
403 ::Info("AliRunLoader::Open","Creating new AliRunLoader. Folder name is %s",eventfoldername);
404 result = new AliRunLoader(eventfoldername);
407 //procedure for extracting dir name from the file name
408 TString fname(filename);
409 Int_t nsl = fname.Last('/');//look for slash in file name
413 Int_t nsl = fname.Last(':');//look for colon e.g. rfio:galice.root
414 if (nsl < 0) dirname = ".";//not found
415 else dirname = fname.Remove(nsl);//found
417 else dirname = fname.Remove(nsl);//slash found
419 if (AliLoader::GetDebug())
420 ::Info("AliRunLoader::Open","Dir name is : %s",dirname.Data());
422 result->SetDirName(dirname);
423 result->SetGAliceFile(gAliceFile);//set the pointer to gAliceFile
424 fgRunLoader = result; //PH get access from any place
427 /**************************************************************************/
428 Int_t AliRunLoader::GetNumberOfEvents()
430 //returns number of events in Run
434 retval = LoadHeader();
437 Error("GetNumberOfEvents","Error occured while loading header");
441 return (Int_t)TreeE()->GetEntries();
443 /**************************************************************************/
445 void AliRunLoader::MakeHeader()
447 //Makes header and connects it to header tree (if it exists)
448 if (GetDebug()) Info("MakeHeader","");
451 if (GetDebug()) Info("MakeHeader","Creating new Header Object");
452 fHeader= new AliHeader();
454 TTree* tree = TreeE();
457 if (GetDebug()) Info("MakeHeader","Got Tree from folder.");
458 TBranch* branch = tree->GetBranch(fgkHeaderBranchName);
461 if (GetDebug()) Info("MakeHeader","Creating new branch");
462 branch = tree->Branch(fgkHeaderBranchName, "AliHeader", &fHeader, 4000, 0);
463 branch->SetAutoDelete(kFALSE);
467 if (GetDebug()) Info("MakeHeader","Got Branch from Tree");
468 branch->SetAddress(&fHeader);
469 tree->GetEvent(fCurrentEvent);
470 fStack = fHeader->Stack(); //should be safe - if we created Stack, header returns pointer to the same object
473 fStack->SetEventFolderName(fEventFolder->GetName());
474 if (TreeK()) fStack->GetEvent();
478 if (GetDebug()) Info("MakeHeader","Haeder do not have a stack.");
482 if (GetDebug()) Info("MakeHeader","Exiting MakeHeader method");
484 /**************************************************************************/
486 void AliRunLoader::MakeStack()
488 //Creates the stack object - do not connect the tree
491 fStack = new AliStack(10000);
492 fStack->SetEventFolderName(fEventFolder->GetName());
496 /**************************************************************************/
498 void AliRunLoader::MakeTree(Option_t *option)
501 const char *oK = strstr(option,"K"); //Kine
502 const char *oE = strstr(option,"E"); //Header
506 if (fKineDataLoader->GetBaseLoader(0)->IsLoaded() == kFALSE)
508 Error("MakeTree(\"K\")","Load Kinematics first");
512 fKineDataLoader->MakeTree();
514 fStack->ConnectTree();
515 WriteKinematics("OVERWRITE");
522 TTree* tree = new TTree(fgkHeaderContainerName,"Tree with Headers");
523 GetEventFolder()->Add(tree);
525 WriteHeader("OVERWRITE");
528 TIter next(fLoaders);
530 while((loader = (AliLoader*)next()))
532 loader->MakeTree(option);
536 /**************************************************************************/
538 Int_t AliRunLoader::LoadgAlice()
540 //Loads gAlice from file
543 Warning("LoadgAlice","AliRun is already in folder. Unload first.");
546 AliRun* alirun = dynamic_cast<AliRun*>(fGAFile->Get(fgkGAliceName));
549 Error("LoadgAlice"," Can not find gAlice in file %s",fGAFile->GetName());
552 alirun->SetRunLoader(this);
555 Warning("LoadgAlice","gAlice already exists. Putting retrived object in folder named %s",
556 GetEventFolder()->GetName());
562 SetDetectorAddresses();//calls SetTreeAddress for all detectors
565 /**************************************************************************/
567 Int_t AliRunLoader::LoadHeader()
569 //loads treeE and reads header object for current event
572 Warning("LoadHeader","Header is already loaded. Use ReloadHeader to force reload. Nothing done");
576 if (GetEventFolder() == 0x0)
578 Error("LoadHaeder","Event folder not specified yet");
584 Error("LoadHaeder","Session not opened. Use AliRunLoader::Open");
588 if (fGAFile->IsOpen() == kFALSE)
590 Error("LoadHaeder","Session not opened. Use AliRunLoader::Open");
594 TTree* tree = dynamic_cast<TTree*>(fGAFile->Get(fgkHeaderContainerName));
597 Fatal("LoadHaeder","Can not find header tree named %s in file %s",
598 fgkHeaderContainerName.Data(),fGAFile->GetName());
602 if (tree == TreeE()) return 0;
605 GetEventFolder()->Add(tree);
606 MakeHeader();//creates header object and connects to tree
610 /**************************************************************************/
612 Int_t AliRunLoader::LoadKinematics(Option_t* option)
614 //Loads the kinematics
615 Int_t retval = fKineDataLoader->GetBaseLoader(0)->Load(option);
618 Error("LoadKinematics","Error occured while loading kinamatics tree.");
621 if (fStack) fStack->GetEvent();
624 /**************************************************************************/
626 Int_t AliRunLoader::OpenDataFile(const TString& filename,TFile*& file,TDirectory*& dir,Option_t* opt,Int_t cl)
628 //Opens File with kinematics
631 if (file->IsOpen() == kFALSE)
632 {//pointer is not null but file is not opened
633 Warning("OpenDataFile","Pointer to file is not null, but file is not opened");//risky any way
635 file = 0x0; //proceed with opening procedure
639 Warning("OpenDataFile","File %s already opened",filename.Data());
643 //try to find if that file is opened somewere else
644 file = (TFile *)( gROOT->GetListOfFiles()->FindObject(filename) );
647 if(file->IsOpen() == kTRUE)
649 Warning("OpenDataFile","File %s already opened by sombody else.",file->GetName());
654 file = TFile::Open(filename,opt);
657 Error("LoadKinematics","Can not open file %s",filename.Data());
660 if (file->IsOpen() == kFALSE)
661 {//file is not opened
662 Error("LoadKinematics","Can not open file %s",filename.Data());
666 file->SetCompressionLevel(cl);
668 dir = AliLoader::ChangeDir(file,fCurrentEvent);
671 Error("OpenKineFile","Can not change to root directory in file %s",filename.Data());
676 /**************************************************************************/
678 TTree* AliRunLoader::TreeE() const
680 //returns the tree from folder; shortcut method
681 TObject *obj = fEventFolder->FindObject(fgkHeaderContainerName);
682 return (obj)?dynamic_cast<TTree*>(obj):0x0;
684 /**************************************************************************/
686 AliHeader* AliRunLoader::GetHeader() const
688 //returns pointer header object
691 /**************************************************************************/
693 TTree* AliRunLoader::TreeK() const
695 //returns the tree from folder; shortcut method
696 TObject *obj = GetEventFolder()->FindObject(fgkKineContainerName);
697 return (obj)?dynamic_cast<TTree*>(obj):0x0;
699 /**************************************************************************/
701 TTree* AliRunLoader::TreeTR() const
703 //returns the tree from folder; shortcut method
704 TObject* obj = GetEventFolder()->FindObject(fgkTrackRefsContainerName);
705 return (obj)?dynamic_cast<TTree*>(obj):0x0;
707 /**************************************************************************/
709 AliRun* AliRunLoader::GetAliRun() const
711 //returns AliRun which sits in the folder
712 if (fEventFolder == 0x0) return 0x0;
713 TObject *obj = fEventFolder->FindObject(fgkGAliceName);
714 return (obj)?dynamic_cast<AliRun*>(obj):0x0;
716 /**************************************************************************/
718 Int_t AliRunLoader::WriteGeometry(Option_t* /*opt*/)
720 //writes geometry to the file
722 TGeometry* geo = GetAliRun()->GetGeometry();
725 Error("WriteGeometry","Can not get geometry from gAlice");
731 /**************************************************************************/
733 Int_t AliRunLoader::WriteHeader(Option_t* opt)
736 if (GetDebug()) Info("WriteHeader"," WRITING HEADER");
738 TTree* tree = TreeE();
741 Warning("WriteHeader","Can not find Header Tree in Folder");
744 if (fGAFile->IsWritable() == kFALSE)
746 Error("WriteHeader","File %s is not writable",fGAFile->GetName());
750 TObject* obj = fGAFile->Get(fgkHeaderContainerName);
752 { //if they exist, see if option OVERWRITE is used
754 if(tmp.Contains("OVERWRITE",TString::kIgnoreCase) == 0)
755 {//if it is not used - give an error message and return an error code
756 Error("WriteHeader","Tree already exisists. Use option \"OVERWRITE\" to overwrite previous data");
761 tree->SetDirectory(fGAFile);
762 tree->Write(0,TObject::kOverwrite);
764 if (GetDebug()) Info("WriteHeader","WRITTEN\n\n");
768 /**************************************************************************/
770 Int_t AliRunLoader::WriteAliRun(Option_t* /*opt*/)
772 //writes AliRun object to the file
774 if (GetAliRun()) GetAliRun()->Write();
777 /**************************************************************************/
779 Int_t AliRunLoader::WriteKinematics(Option_t* opt)
782 return fKineDataLoader->GetBaseLoader(0)->WriteData(opt);
784 /**************************************************************************/
785 Int_t AliRunLoader::WriteTrackRefs(Option_t* opt)
787 //writes Track References tree
788 return fTrackRefsDataLoader->GetBaseLoader(0)->WriteData(opt);
790 /**************************************************************************/
792 Int_t AliRunLoader::WriteHits(Option_t* opt)
794 //Calls WriteHits for all loaders
797 TIter next(fLoaders);
799 while((loader = (AliLoader*)next()))
801 res = loader->WriteHits(opt);
804 Error("WriteHits","Failed to write hits for %s (%d)",loader->GetDetectorName().Data(),res);
810 /**************************************************************************/
812 Int_t AliRunLoader::WriteSDigits(Option_t* opt)
814 //Calls WriteSDigits for all loaders
817 TIter next(fLoaders);
819 while((loader = (AliLoader*)next()))
821 res = loader->WriteSDigits(opt);
824 Error("WriteSDigits","Failed to write summable digits for %s.",loader->GetDetectorName().Data());
830 /**************************************************************************/
832 Int_t AliRunLoader::WriteDigits(Option_t* opt)
834 //Calls WriteDigits for all loaders
837 TIter next(fLoaders);
839 while((loader = (AliLoader*)next()))
841 res = loader->WriteDigits(opt);
844 Error("WriteDigits","Failed to write digits for %s.",loader->GetDetectorName().Data());
850 /**************************************************************************/
852 Int_t AliRunLoader::WriteRecPoints(Option_t* opt)
854 //Calls WriteRecPoints for all loaders
857 TIter next(fLoaders);
859 while((loader = (AliLoader*)next()))
861 res = loader->WriteRecPoints(opt);
864 Error("WriteRecPoints","Failed to write Reconstructed Points for %s.",
865 loader->GetDetectorName().Data());
871 /**************************************************************************/
873 Int_t AliRunLoader::WriteTracks(Option_t* opt)
875 //Calls WriteTracks for all loaders
878 TIter next(fLoaders);
880 while((loader = (AliLoader*)next()))
882 res = loader->WriteTracks(opt);
885 Error("WriteTracks","Failed to write Tracks for %s.",
886 loader->GetDetectorName().Data());
892 /**************************************************************************/
894 Int_t AliRunLoader::WriteRunLoader(Option_t* /*opt*/)
896 //Writes itself to the file
898 this->Write(0,TObject::kOverwrite);
901 /**************************************************************************/
903 Int_t AliRunLoader::SetEventFolderName(const TString& name)
905 //sets top folder name for this run; of alread
908 Error("SetTopFolderName","Name is empty");
912 //check if such a folder already exists - try to find it in alice top folder
913 TObject* obj = AliConfig::Instance()->GetTopFolder()->FindObject(name);
916 TFolder* fold = dynamic_cast<TFolder*>(obj);
919 Error("SetTopFolderName","Such a obejct already exists in top alice folder and it is not a folder.");
922 //folder which was found is our folder
923 if (fEventFolder == fold)
929 Error("SetTopFolderName","Such a folder already exists in top alice folder. Can not mount.");
934 //event is alredy connected, just change name of the folder
937 fEventFolder->SetName(name);
941 if (fKineDataLoader == 0x0)
942 fKineDataLoader = new AliDataLoader(fgkDefaultKineFileName,fgkKineContainerName,"Kinematics");
944 if ( fTrackRefsDataLoader == 0x0)
945 fTrackRefsDataLoader = new AliDataLoader(fgkDefaultTrackRefsFileName,fgkTrackRefsContainerName,"Track References");
947 //build the event folder structure
948 if (GetDebug()) Info("SetEventFolderName","Creating new event folder named %s",name.Data());
949 fEventFolder = AliConfig::Instance()->BuildEventFolder(name,"Event Folder");
950 fEventFolder->Add(this);//put myself to the folder to accessible for all
952 if (Stack()) Stack()->SetEventFolderName(fEventFolder->GetName());
953 TIter next(fLoaders);
955 while((loader = (AliLoader*)next()))
957 loader->Register(fEventFolder);//build folder structure for this detector
960 fKineDataLoader->SetEventFolder(GetEventFolder());
961 fTrackRefsDataLoader->SetEventFolder(GetEventFolder());
962 fKineDataLoader->SetFolder(GetEventFolder());
963 fTrackRefsDataLoader->SetFolder(GetEventFolder());
965 fEventFolder->SetOwner();
968 /**************************************************************************/
970 void AliRunLoader::AddLoader(AliLoader* loader)
972 //Adds the Loader for given detector
973 if (loader == 0x0) //if null shout and exit
975 Error("AddLoader","Parameter is NULL");
978 loader->SetDirName(fUnixDirName);
979 if (fEventFolder) loader->SetEventFolder(fEventFolder); //if event folder is already defined,
980 //pass information to the Loader
981 fLoaders->Add(loader);//add the Loader to the array
983 /**************************************************************************/
985 void AliRunLoader::AddLoader(AliDetector* det)
987 //Asks module (detector) ro make a Loader and stores in the array
988 if (det == 0x0) return;
989 AliLoader* get = det->GetLoader();//try to get loader
990 if (get == 0x0) get = det->MakeLoader(fEventFolder->GetName());//if did not obtain, ask to make it
994 if (GetDebug()) Info("AddLoader","Detector: %s Loader : %s",det->GetName(),get->GetName());
999 /**************************************************************************/
1001 AliLoader* AliRunLoader::GetLoader(const char* detname) const
1003 //returns loader for given detector
1004 //note that naming convention is TPCLoader not just TPC
1005 return (AliLoader*)fLoaders->FindObject(detname);
1008 /**************************************************************************/
1010 AliLoader* AliRunLoader::GetLoader(AliDetector* det) const
1012 //get loader for detector det
1013 if(det == 0x0) return 0x0;
1014 TString getname(det->GetName());
1016 if (GetDebug()) Info("GetLoader(AliDetector* det)"," Loader name is %s",getname.Data());
1017 return GetLoader(getname);
1020 /**************************************************************************/
1022 void AliRunLoader::CleanFolders()
1024 // fEventFolder->Add(this);//put myself to the folder to accessible for all
1030 /**************************************************************************/
1032 void AliRunLoader::CleanDetectors()
1034 //Calls CleanFolders for all detectors
1035 TIter next(fLoaders);
1037 while((loader = (AliLoader*)next()))
1039 loader->CleanFolders();
1042 /**************************************************************************/
1044 void AliRunLoader::RemoveEventFolder()
1046 //remove all the tree of event
1047 //all the stuff changing EbE stays untached (PDGDB, tasks, etc.)
1049 if (fEventFolder == 0x0) return;
1050 fEventFolder->SetOwner(kFALSE);//don't we want to deleted while removing the folder that we are sitting in
1051 fEventFolder->Remove(this);//remove us drom folder
1053 AliConfig::Instance()->GetTopFolder()->SetOwner(); //brings ownership back for fEventFolder since it sits in top folder
1054 AliConfig::Instance()->GetTopFolder()->Remove(fEventFolder); //remove the event tree
1055 delete fEventFolder;
1057 /**************************************************************************/
1059 void AliRunLoader::SetGAliceFile(TFile* gafile)
1061 //sets pointer to galice.root file
1065 /**************************************************************************/
1067 Int_t AliRunLoader::LoadHits(Option_t* detectors,Option_t* opt)
1069 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1071 if (GetDebug()) Info("LoadHits","Loading Hits");
1075 const char* oAll = strstr(detectors,"all");
1078 if (GetDebug()) Info("LoadHits","Option is All");
1083 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1084 loaders = &arr;//get the pointer array
1087 if (GetDebug()) Info("LoadHits","For detectors. Number of detectors chosen for loading %d",loaders->GetEntries());
1089 TIter next(loaders);
1091 while((loader = (AliLoader*)next()))
1093 if (GetDebug()) Info("LoadHits"," Calling LoadHits(%s) for %s",opt,loader->GetName());
1094 loader->LoadHits(opt);
1096 if (GetDebug()) Info("LoadHits","Done");
1100 /**************************************************************************/
1102 Int_t AliRunLoader::LoadSDigits(Option_t* detectors,Option_t* opt)
1104 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1109 const char* oAll = strstr(detectors,"all");
1116 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1117 loaders = &arr;//get the pointer to array
1120 TIter next(loaders);
1122 while((loader = (AliLoader*)next()))
1124 loader->LoadSDigits(opt);
1129 /**************************************************************************/
1131 Int_t AliRunLoader::LoadDigits(Option_t* detectors,Option_t* opt)
1133 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1138 const char* oAll = strstr(detectors,"all");
1145 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1146 loaders = &arr;//get the pointer array
1149 TIter next(loaders);
1151 while((loader = (AliLoader*)next()))
1153 loader->LoadDigits(opt);
1157 /**************************************************************************/
1159 Int_t AliRunLoader::LoadRecPoints(Option_t* detectors,Option_t* opt)
1161 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1166 const char* oAll = strstr(detectors,"all");
1173 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1174 loaders = &arr;//get the pointer array
1177 TIter next(loaders);
1179 while((loader = (AliLoader*)next()))
1181 loader->LoadRecPoints(opt);
1185 /**************************************************************************/
1187 Int_t AliRunLoader::LoadRecParticles(Option_t* detectors,Option_t* opt)
1189 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1194 const char* oAll = strstr(detectors,"all");
1201 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1202 loaders = &arr;//get the pointer array
1205 TIter next(loaders);
1207 while((loader = (AliLoader*)next()))
1209 loader->LoadRecParticles(opt);
1213 /**************************************************************************/
1215 Int_t AliRunLoader::LoadTracks(Option_t* detectors,Option_t* opt)
1217 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1222 const char* oAll = strstr(detectors,"all");
1229 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1230 loaders = &arr;//get the pointer array
1233 TIter next(loaders);
1235 while((loader = (AliLoader*)next()))
1237 loader->LoadTracks(opt);
1241 /**************************************************************************/
1243 void AliRunLoader::UnloadHits(Option_t* detectors)
1245 //unloads hits for detectors specified in parameter
1249 const char* oAll = strstr(detectors,"all");
1256 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1257 loaders = &arr;//get the pointer to array
1260 TIter next(loaders);
1262 while((loader = (AliLoader*)next()))
1264 loader->UnloadHits();
1267 /**************************************************************************/
1269 void AliRunLoader::UnloadSDigits(Option_t* detectors)
1271 //unloads SDigits for detectors specified in parameter
1275 const char* oAll = strstr(detectors,"all");
1282 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1283 loaders = &arr;//get the pointer to array
1286 TIter next(loaders);
1288 while((loader = (AliLoader*)next()))
1290 loader->UnloadSDigits();
1293 /**************************************************************************/
1295 void AliRunLoader::UnloadDigits(Option_t* detectors)
1297 //unloads Digits for detectors specified in parameter
1301 const char* oAll = strstr(detectors,"all");
1308 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1309 loaders = &arr;//get the pointer to array
1312 TIter next(loaders);
1314 while((loader = (AliLoader*)next()))
1316 loader->UnloadDigits();
1319 /**************************************************************************/
1321 void AliRunLoader::UnloadRecPoints(Option_t* detectors)
1323 //unloads RecPoints for detectors specified in parameter
1327 const char* oAll = strstr(detectors,"all");
1334 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1335 loaders = &arr;//get the pointer to array
1338 TIter next(loaders);
1340 while((loader = (AliLoader*)next()))
1342 loader->UnloadRecPoints();
1345 /**************************************************************************/
1347 void AliRunLoader::UnloadAll(Option_t* detectors)
1349 //calls UnloadAll for detectors names specified in parameter
1350 // option "all" passed can be passed
1354 const char* oAll = strstr(detectors,"all");
1361 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1362 loaders = &arr;//get the pointer to array
1365 TIter next(loaders);
1367 while((loader = (AliLoader*)next()))
1369 loader->UnloadAll();
1372 /**************************************************************************/
1374 void AliRunLoader::UnloadTracks(Option_t* detectors)
1376 //unloads Tracks for detectors specified in parameter
1380 const char* oAll = strstr(detectors,"all");
1387 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1388 loaders = &arr;//get the pointer to array
1391 TIter next(loaders);
1393 while((loader = (AliLoader*)next()))
1395 loader->UnloadTracks();
1398 /**************************************************************************/
1400 void AliRunLoader::UnloadRecParticles(Option_t* detectors)
1402 //unloads Particles for detectors specified in parameter
1406 const char* oAll = strstr(detectors,"all");
1413 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1414 loaders = &arr;//get the pointer to array
1417 TIter next(loaders);
1419 while((loader = (AliLoader*)next()))
1421 loader->UnloadRecParticles();
1424 /**************************************************************************/
1426 AliRunLoader* AliRunLoader::GetRunLoader(const char* eventfoldername)
1428 //returns RunLoader from folder named eventfoldername
1429 TFolder* evfold= dynamic_cast<TFolder*>(AliConfig::Instance()->GetTopFolder()->FindObject(eventfoldername));
1434 AliRunLoader* runget = dynamic_cast<AliRunLoader*>(evfold->FindObject(AliRunLoader::fgkRunLoaderName));
1438 /**************************************************************************/
1440 AliLoader* AliRunLoader::GetDetectorLoader(const char* detname, const char* eventfoldername)
1442 //get the loader of the detector with the given name from the global
1444 AliRunLoader* runLoader = GetRunLoader(eventfoldername);
1446 ::Error("AliRunLoader::GetDetectorLoader","No run loader found");
1449 return runLoader->GetDetectorLoader(detname);
1451 /**************************************************************************/
1453 AliLoader* AliRunLoader::GetDetectorLoader(const char* detname)
1455 //get the loader of the detector with the given name from the global
1458 char loadername[256];
1459 sprintf(loadername, "%sLoader", detname);
1460 AliLoader* loader = GetLoader(loadername);
1462 Error("GetDetectorLoader", "No loader for %s found", detname);
1467 /**************************************************************************/
1469 TTree* AliRunLoader::GetTreeH(const char* detname, Bool_t maketree, const char* eventfoldername)
1471 //get the tree with hits of the detector with the given name
1472 //if maketree is true and the tree does not exist, the tree is created
1473 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1474 if (!loader) return NULL;
1475 if (!loader->TreeH() && maketree) loader->MakeTree("H");
1476 return loader->TreeH();
1479 /**************************************************************************/
1481 TTree* AliRunLoader::GetTreeH(const char* detname, Bool_t maketree)
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);
1486 if (!loader) return NULL;
1487 if (!loader->TreeH() && maketree) loader->MakeTree("H");
1488 return loader->TreeH();
1490 /**************************************************************************/
1492 TTree* AliRunLoader::GetTreeS(const char* detname, Bool_t maketree,const char* eventfoldername)
1494 //get the tree with summable digits of the detector with the given name
1495 //if maketree is true and the tree does not exist, the tree is created
1496 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1497 if (!loader) return NULL;
1498 if (!loader->TreeS() && maketree) loader->MakeTree("S");
1499 return loader->TreeS();
1501 /**************************************************************************/
1503 TTree* AliRunLoader::GetTreeS(const char* detname, Bool_t maketree)
1505 //get the tree with summable digits of the detector with the given name
1506 //if maketree is true and the tree does not exist, the tree is created
1507 AliLoader* loader = GetDetectorLoader(detname);
1508 if (!loader) return NULL;
1509 if (!loader->TreeS() && maketree) loader->MakeTree("S");
1510 return loader->TreeS();
1512 /**************************************************************************/
1514 TTree* AliRunLoader::GetTreeD(const char* detname, Bool_t maketree,const char* eventfoldername)
1516 //get the tree with digits of the detector with the given name
1517 //if maketree is true and the tree does not exist, the tree is created
1518 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1519 if (!loader) return NULL;
1520 if (!loader->TreeD() && maketree) loader->MakeTree("D");
1521 return loader->TreeD();
1523 /**************************************************************************/
1525 TTree* AliRunLoader::GetTreeD(const char* detname, Bool_t maketree)
1527 //get the tree with digits of the detector with the given name
1528 //if maketree is true and the tree does not exist, the tree is created
1529 AliLoader* loader = GetDetectorLoader(detname);
1530 if (!loader) return NULL;
1531 if (!loader->TreeD() && maketree) loader->MakeTree("D");
1532 return loader->TreeD();
1534 /**************************************************************************/
1535 TTree* AliRunLoader::GetTreeR(const char* detname, Bool_t maketree,const char* eventfoldername)
1537 //get the tree with clusters of the detector with the given name
1538 //if maketree is true and the tree does not exist, the tree is created
1539 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1540 if (!loader) return NULL;
1541 if (!loader->TreeR() && maketree) loader->MakeTree("R");
1542 return loader->TreeR();
1544 /**************************************************************************/
1546 TTree* AliRunLoader::GetTreeR(const char* detname, Bool_t maketree)
1548 //get the tree with clusters of the detector with the given name
1549 //if maketree is true and the tree does not exist, the tree is created
1550 AliLoader* loader = GetDetectorLoader(detname);
1551 if (!loader) return NULL;
1552 if (!loader->TreeR() && maketree) loader->MakeTree("R");
1553 return loader->TreeR();
1555 /**************************************************************************/
1557 TTree* AliRunLoader::GetTreeT(const char* detname, Bool_t maketree,const char* eventfoldername)
1559 //get the tree with tracks of the detector with the given name
1560 //if maketree is true and the tree does not exist, the tree is created
1561 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1562 if (!loader) return NULL;
1563 if (!loader->TreeT() && maketree) loader->MakeTree("T");
1564 return loader->TreeT();
1566 /**************************************************************************/
1568 TTree* AliRunLoader::GetTreeT(const char* detname, Bool_t maketree)
1570 //get the tree with tracks of the detector with the given name
1571 //if maketree is true and the tree does not exist, the tree is created
1572 AliLoader* loader = GetDetectorLoader(detname);
1573 if (!loader) return NULL;
1574 if (!loader->TreeT() && maketree) loader->MakeTree("T");
1575 return loader->TreeT();
1577 /**************************************************************************/
1579 TTree* AliRunLoader::GetTreeP(const char* detname, Bool_t maketree,const char* eventfoldername)
1581 //get the tree with particles of the detector with the given name
1582 //if maketree is true and the tree does not exist, the tree is created
1583 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1584 if (!loader) return NULL;
1585 if (!loader->TreeP() && maketree) loader->MakeTree("P");
1586 return loader->TreeP();
1588 /**************************************************************************/
1590 TTree* AliRunLoader::GetTreeP(const char* detname, Bool_t maketree)
1592 //get the tree with particles of the detector with the given name
1593 //if maketree is true and the tree does not exist, the tree is created
1594 AliLoader* loader = GetDetectorLoader(detname);
1595 if (!loader) return NULL;
1596 if (!loader->TreeP() && maketree) loader->MakeTree("P");
1597 return loader->TreeP();
1600 /**************************************************************************/
1602 void AliRunLoader::CdGAFile()
1604 //sets gDirectory to galice file
1606 if(fGAFile) fGAFile->cd();
1609 /**************************************************************************/
1611 void AliRunLoader::GetListOfDetectors(const char * namelist,TObjArray& pointerarray) const
1613 //this method looks for all Loaders corresponding
1614 //to names (many) specified in namelist i.e. namelist ("ITS TPC TRD")
1618 strcpy(dets,namelist);//compiler cries when char* = const Option_t*;
1619 dets[strlen(dets)+1] = '\n';//set endl at the end of string
1624 tmp = sscanf(pdet,"%s",buff);//read the string from the input string pdet into buff
1625 if ( (buff[0] == 0) || (tmp == 0) ) break; //if not read
1627 pdet = strstr(pdet,buff) + strlen(buff);//move the input pointer about number of bytes (letters) read
1628 //I am aware that is a little complicated. I don't know the number of spaces between detector names
1629 //so I read the string, than I find where it starts (strstr) and move the pointer about length of a string
1630 //If there is a better way, please write me (Piotr.Skowronski@cern.ch)
1631 //construct the Loader name
1632 TString getname(buff);
1634 AliLoader* loader = GetLoader(getname);//get the Loader
1637 pointerarray.Add(loader);
1641 Error("GetListOfDetectors","Can not find Loader for %s",buff);
1647 /*****************************************************************************/
1649 void AliRunLoader::Clean(const TString& name)
1651 //removes object with given name from event folder and deletes it
1652 if (GetEventFolder() == 0x0) return;
1653 TObject* obj = GetEventFolder()->FindObject(name);
1656 if (GetDebug()) Info("Clean(const TString&)","name=%s, cleaning %s.",GetName(),name.Data());
1657 GetEventFolder()->Remove(obj);
1662 /*****************************************************************************/
1664 TTask* AliRunLoader::GetRunDigitizer()
1666 //returns Run Digitizer from folder
1668 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1669 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetDigitizerTaskName());
1670 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1672 /*****************************************************************************/
1674 TTask* AliRunLoader::GetRunSDigitizer()
1676 //returns SDigitizer Task from folder
1678 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1679 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetSDigitizerTaskName());
1680 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1682 /*****************************************************************************/
1684 TTask* AliRunLoader::GetRunReconstructioner()
1686 //returns Reconstructioner Task from folder
1687 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1688 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetReconstructionerTaskName());
1689 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1691 /*****************************************************************************/
1693 TTask* AliRunLoader::GetRunTracker()
1695 //returns Tracker Task from folder
1696 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1697 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetTrackerTaskName());
1698 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1700 /*****************************************************************************/
1702 TTask* AliRunLoader::GetRunPIDTask()
1704 //returns Tracker Task from folder
1705 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1706 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetPIDTaskName());
1707 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1709 /*****************************************************************************/
1711 TTask* AliRunLoader::GetRunQATask()
1713 //returns Quality Assurance Task from folder
1714 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1717 ::Error("AliRunLoader::GetRunQATask","Can not get task folder from AliConfig");
1720 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetQATaskName());
1721 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1724 /*****************************************************************************/
1726 void AliRunLoader::SetCompressionLevel(Int_t cl)
1728 //Sets Compression Level in all files
1729 if (fGAFile) fGAFile->SetCompressionLevel(cl);
1730 SetKineComprLevel(cl);
1731 SetTrackRefsComprLevel(cl);
1732 TIter next(fLoaders);
1734 while((loader = (AliLoader*)next()))
1736 loader->SetCompressionLevel(cl);
1739 /**************************************************************************/
1741 void AliRunLoader::SetKineComprLevel(Int_t cl)
1743 //Sets comression level in Kine File
1744 fKineDataLoader->SetCompressionLevel(cl);
1746 /**************************************************************************/
1748 void AliRunLoader::SetTrackRefsComprLevel(Int_t cl)
1750 //Sets comression level in Track Refences File
1751 fTrackRefsDataLoader->SetCompressionLevel(cl);
1753 /**************************************************************************/
1755 void AliRunLoader::UnloadHeader()
1757 //removes TreeE from folder and deletes it
1758 // as well as fHeader object
1763 /**************************************************************************/
1765 void AliRunLoader::UnloadKinematics()
1767 //Unloads Kinematics
1768 fKineDataLoader->GetBaseLoader(0)->Unload();
1770 /**************************************************************************/
1772 void AliRunLoader::UnloadTrackRefs()
1774 //Unloads Track Refernces
1775 fTrackRefsDataLoader->GetBaseLoader(0)->Unload();
1777 /**************************************************************************/
1779 void AliRunLoader::UnloadgAlice()
1782 if (gAlice == GetAliRun())
1784 if (GetDebug()) Info("UnloadgAlice","Set gAlice = 0x0");
1785 gAlice = 0x0;//if gAlice is the same that in folder (to be deleted by the way of folder)
1787 AliRun* alirun = GetAliRun();
1788 if (GetEventFolder()) GetEventFolder()->Remove(alirun);
1791 /**************************************************************************/
1793 void AliRunLoader::MakeTrackRefsContainer()
1795 // Makes a tree for Track References
1796 fTrackRefsDataLoader->MakeTree();
1798 /**************************************************************************/
1800 Int_t AliRunLoader::LoadTrackRefs(Option_t* option)
1802 //Load track references from file (opens file and posts tree to folder)
1804 return fTrackRefsDataLoader->GetBaseLoader(0)->Load(option);
1806 /**************************************************************************/
1808 void AliRunLoader::SetDirName(TString& dirname)
1810 //sets directory name
1811 if (dirname.IsNull()) return;
1812 fUnixDirName = dirname;
1813 fKineDataLoader->SetDirName(dirname);
1814 fTrackRefsDataLoader->SetDirName(dirname);
1816 TIter next(fLoaders);
1818 while((loader = (AliLoader*)next()))
1820 loader->SetDirName(dirname);
1824 /*****************************************************************************/
1826 Int_t AliRunLoader::GetFileOffset() const
1828 //returns the file number that is added to the file name for current event
1829 return Int_t(fCurrentEvent/fNEventsPerFile);
1832 /*****************************************************************************/
1833 const TString AliRunLoader::SetFileOffset(const TString& fname)
1835 //adds the the number to the file name at proper place for current event
1836 Long_t offset = (Long_t)GetFileOffset();
1837 if (offset < 1) return fname;
1839 soffset += offset;//automatic conversion to string
1840 TString dotroot(".root");
1841 const TString& offfsetdotroot = offset + dotroot;
1842 TString out = fname;
1843 out = out.ReplaceAll(dotroot,offfsetdotroot);
1844 if (GetDebug()) Info("SetFileOffset"," in=%s out=%s",fname.Data(),out.Data());
1847 /*****************************************************************************/
1849 void AliRunLoader::SetDigitsFileNameSuffix(const TString& suffix)
1851 //adds the suffix before ".root",
1852 //e.g. TPC.Digits.root -> TPC.DigitsMerged.root
1853 //made on Jiri Chudoba demand
1855 TIter next(fLoaders);
1857 while((loader = (AliLoader*)next()))
1859 loader->SetDigitsFileNameSuffix(suffix);
1862 /*****************************************************************************/
1864 TString AliRunLoader::GetFileName() const
1866 //returns name of galice file
1868 if (fGAFile == 0x0) return result;
1869 result = fGAFile->GetName();
1872 /*****************************************************************************/
1874 void AliRunLoader::SetDetectorAddresses()
1876 //calls SetTreeAddress for all detectors
1877 if (GetAliRun()==0x0) return;
1878 TIter next(GetAliRun()->Modules());
1880 while((mod = (AliModule*)next()))
1882 AliDetector* det = dynamic_cast<AliDetector*>(mod);
1883 if (det) det->SetTreeAddress();
1886 /*****************************************************************************/
1888 void AliRunLoader::Synchronize()
1890 //synchrinizes all writtable files
1891 TIter next(fLoaders);
1893 while((loader = (AliLoader*)next()))
1895 loader->Synchronize();
1898 fKineDataLoader->Synchronize();
1899 fTrackRefsDataLoader->Synchronize();
1901 if (fGAFile) fGAFile->Flush();
1903 /*****************************************************************************/
1904 /*****************************************************************************/