1 #include "AliRunLoader.h"
2 //_____________________________________
3 /////////////////////////////////////////////////////////////////////////////////////
7 //This class aims to be the only one interface for manging data
8 //It stores Loaders for all modules which knows the filenames
9 //of the data files to be stored.
10 //It aims to substitude AliRun in automatic maging of data positioning
11 //thus there won't be necessity of loading gAlice from file in order to
12 //get fast ccess to the data
14 //logical place for putting the Loader specific to the given detector is detector itself
15 // but, to load detector one need to load gAlice, and by the way all other detectors
16 // with their geometries and so on.
17 // So, if one need to open TPC clusters there is no principal need to read everything
19 // When RunLoader is read from the file it does not connect to the folder structure
20 // it must be connected (mounted) manualy in the macro or class code.
21 // Default event folder is defined by AliConfig::fgkDefaultEventFolderName
22 // but can be mounted elsewhere. Usefull specially in merging, when more than session
25 //////////////////////////////////////////////////////////////////////////////////////
26 /**************************************************************************/
35 #include <TGeometry.h>
37 #include <TObjArray.h>
40 #include "AliConfig.h"
41 #include "AliLoader.h"
42 #include "AliHeader.h"
44 #include "AliDetector.h"
45 #include "AliRunDigitizer.h"
47 ClassImp(AliRunLoader)
49 AliRunLoader* AliRunLoader::fgRunLoader = 0x0;
51 const TString AliRunLoader::fgkRunLoaderName("RunLoader");
53 const TString AliRunLoader::fgkHeaderBranchName("Header");
54 const TString AliRunLoader::fgkHeaderContainerName("TE");
55 const TString AliRunLoader::fgkKineContainerName("TreeK");
56 const TString AliRunLoader::fgkTrackRefsContainerName("TreeTR");
57 const TString AliRunLoader::fgkKineBranchName("Particles");
58 const TString AliRunLoader::fgkDefaultKineFileName("Kinematics.root");
59 const TString AliRunLoader::fgkDefaultTrackRefsFileName("TrackRefs.root");
60 const TString AliRunLoader::fgkGAliceName("gAlice");
61 /**************************************************************************/
63 AliRunLoader::AliRunLoader():
71 fTrackRefsDataLoader(0x0),
75 AliConfig::Instance();//force to build the folder structure
77 /**************************************************************************/
79 AliRunLoader::AliRunLoader(const char* eventfoldername):
80 TNamed(fgkRunLoaderName,fgkRunLoaderName),
81 fLoaders(new TObjArray()),
87 fKineDataLoader(new AliDataLoader(fgkDefaultKineFileName,fgkKineContainerName,"Kinematics")),
88 fTrackRefsDataLoader(new AliDataLoader(fgkDefaultTrackRefsFileName,fgkTrackRefsContainerName,"Track References")),
93 SetEventFolderName(eventfoldername);
95 /**************************************************************************/
97 AliRunLoader::~AliRunLoader()
100 if (fgRunLoader == this) fgRunLoader = 0x0;
106 fLoaders->SetOwner();
110 delete fKineDataLoader;
111 delete fTrackRefsDataLoader;
116 //fEventFolder is deleted by the way of removing - TopAliceFolder owns it
121 /**************************************************************************/
123 AliRunLoader::AliRunLoader(TFolder* topfolder):TNamed(fgkRunLoaderName,fgkRunLoaderName)
128 Fatal("AliRunLoader(TFolder*)","Parameter is NULL");
131 fEventFolder = topfolder;
133 TObject* obj = fEventFolder->FindObject(fgkRunLoaderName);
135 { //if it is, then sth. is going wrong... exits aliroot session
136 Fatal("AliRunLoader(const char*)",
137 "In Event Folder Named %s object named %s already exists. I am confused ...",
138 fEventFolder->GetName(),fgkRunLoaderName.Data());
139 return;//never reached
142 fLoaders = new TObjArray();
143 fEventFolder->Add(this);//put myself to the folder to accessible for all
146 /**************************************************************************/
148 Int_t AliRunLoader::GetEvent(Int_t evno)
150 //Gets event number evno
151 //Reloads all data properly
152 if (fCurrentEvent == evno) return 0;
156 Error("GetEvent","Can not give the event with negative number");
160 if (evno >= GetNumberOfEvents())
162 Error("GetEvent","There is no event with number %d",evno);
168 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
169 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
170 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
171 Info("GetEvent"," GETTING EVENT %d",evno);
172 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
173 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
174 Info("GetEvent",">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
177 fCurrentEvent = evno;
181 //Reload header (If header was loaded)
184 retval = TreeE()->GetEvent(fCurrentEvent);
187 Error("GetEvent","Cannot find event: %d\n ",fCurrentEvent);
191 //Reload stack (If header was loaded)
192 if (TreeE()) fStack = GetHeader()->Stack();
193 //Set event folder in stack (it does not mean that we read kinematics from file)
196 fStack->SetEventFolderName(fEventFolder->GetName());
200 Warning("GetEvent","Stack not found in header");
206 Error("GetEvent","Error occured while setting event %d",evno);
210 //Post Track References
211 retval = fTrackRefsDataLoader->GetEvent();
214 Error("GetEvent","Error occured while GetEvent for Track References. Event %d",evno);
218 //Read Kinematics if loaded
219 fKineDataLoader->GetEvent();
222 Error("GetEvent","Error occured while GetEvent for Kinematics. Event %d",evno);
226 if (fStack && fKineDataLoader->GetBaseLoader(0)->IsLoaded()) fStack->GetEvent();
228 //Trigger data reloading in all loaders
229 TIter next(fLoaders);
231 while((loader = (AliLoader*)next()))
233 retval = loader->GetEvent();
236 Error("GetEvent","Error occured while getting event for %s. Event %d.",
237 loader->GetDetectorName().Data(), evno);
242 SetDetectorAddresses();
246 /**************************************************************************/
247 Int_t AliRunLoader::SetEvent()
249 //if kinematics was loaded Cleans folder data
253 retval = fKineDataLoader->SetEvent();
256 Error("SetEvent","SetEvent for Kinamtics Data Loader retutned error.");
259 retval = fTrackRefsDataLoader->SetEvent();
262 Error("SetEvent","SetEvent for Track References Data Loader retutned error.");
266 TIter next(fLoaders);
268 while((loader = (AliLoader*)next()))
270 retval = loader->SetEvent();
273 Error("SetEvent","SetEvent for %s Data Loader retutned error.",loader->GetName());
280 /**************************************************************************/
282 Int_t AliRunLoader::SetEventNumber(Int_t evno)
284 //cleans folders and sets the root dirs in files
285 if (fCurrentEvent == evno) return 0;
286 fCurrentEvent = evno;
290 /**************************************************************************/
291 AliRunLoader* AliRunLoader::Open
292 (const char* filename, const char* eventfoldername, Option_t* option)
294 //Opens a desired file 'filename'
295 //gets the the run-Loader and mounts it desired folder
296 //returns the pointer to run Loader which can be further used for accessing data
297 //in case of error returns NULL
299 static const TString webaddress("http://alisoft.cern.ch/people/skowron/codedoc/split/index.html");
300 if (AliLoader::fgDebug)
301 ::Info("AliRunLoader::Open",
302 "\n\n\nNew I/O strcture: See more info:\n %s\n\n\n",webaddress.Data());
304 AliRunLoader* result = 0x0;
306 /* ************************************************ */
307 /* Chceck if folder with given name already exists */
308 /* ************************************************ */
310 TObject* obj = AliConfig::Instance()->GetTopFolder()->FindObject(eventfoldername);
313 TFolder* fold = dynamic_cast<TFolder*>(obj);
316 ::Error("AliRunLoader::Open","Such a obejct already exists in top alice folder and it is not a folder.");
320 //check if we can get RL from that folder
321 result = AliRunLoader::GetRunLoader(eventfoldername);
324 ::Error("AliRunLoader::Open",
325 "Folder %s already exists, and can not find session there. Can not mount.",eventfoldername);
329 if (result->GetFileName().CompareTo(filename) != 0)
331 ::Error("AliRunLoader::Open","Other file is mounted in demanded folder. Can not mount.");
335 //check if now is demanded (re)creation
336 if ( AliLoader::TestFileOption(option) == kFALSE)
338 ::Error("AliRunLoader::Open",
339 "Session already exists in folder %s and this session option is %s. Unable to proceed.",
340 eventfoldername,option);
344 //check if demanded option is update and existing one
345 TString tmpstr(option);
346 if ( (tmpstr.CompareTo("update",TString::kIgnoreCase) == 0) &&
347 (result->fGAFile->IsWritable() == kFALSE) )
349 ::Error("AliRunLoader::Open",
350 "Session already exists in folder %s and is not writable while this session option is %s. Unable to proceed.",
351 eventfoldername,option);
355 ::Warning("AliRunLoader::Open","Session is already opened and mounted in demanded folder");
357 } //end of checking in case of existance of object named identically that folder session is being opened
360 TFile * gAliceFile = TFile::Open(filename,option);//open a file
362 {//null pointer returned
363 ::Error("AliRunLoader::Open","Can not open file %s.",filename);
367 if (gAliceFile->IsOpen() == kFALSE)
368 {//pointer to valid object returned but file is not opened
369 ::Error("AliRunLoader::Open","Can not open file %s.",filename);
373 //if file is "read" or "update" than we try to find AliRunLoader there - if not found cry and exit
374 //else create new AliRunLoader
375 if ( AliLoader::TestFileOption(option) )
377 if (AliLoader::fgDebug)
378 ::Info("AliRunLoader::Open","Reading RL from file");
380 result = dynamic_cast<AliRunLoader*>(gAliceFile->Get(fgkRunLoaderName));//get the run Loader from the file
383 ::Error("AliRunLoader::Open","Can not find run-Loader in file %s.",filename);
384 delete gAliceFile;//close the file
387 Int_t tmp = result->SetEventFolderName(eventfoldername);//mount a event folder
388 if (tmp)//if SetEvent returned error
390 ::Error("AliRunLoader::Open","Can not mount event in folder %s.",eventfoldername);
391 delete result; //delete run-Loader
392 delete gAliceFile;//close the file
398 if (AliLoader::fgDebug)
399 ::Info("AliRunLoader::Open","Creating new AliRunLoader. Folder name is %s",eventfoldername);
400 result = new AliRunLoader(eventfoldername);
403 //procedure for extracting dir name from the file name
404 TString fname(filename);
405 Int_t nsl = fname.Last('/');//look for slash in file name
409 Int_t nsl = fname.Last(':');//look for colon e.g. rfio:galice.root
410 if (nsl < 0) dirname = ".";//not found
411 else dirname = fname.Remove(nsl);//found
413 else dirname = fname.Remove(nsl);//slash found
415 if (AliLoader::fgDebug)
416 ::Info("AliRunLoader::Open","Dir name is : %s",dirname.Data());
418 result->SetDirName(dirname);
419 result->SetGAliceFile(gAliceFile);//set the pointer to gAliceFile
420 fgRunLoader = result; //PH get access from any place
423 /**************************************************************************/
424 Int_t AliRunLoader::GetNumberOfEvents()
426 //returns number of events in Run
430 retval = LoadHeader();
433 Error("GetNumberOfEvents","Error occured while loading header");
437 return (Int_t)TreeE()->GetEntries();
439 /**************************************************************************/
441 void AliRunLoader::MakeHeader()
443 //Makes header and connects it to header tree (if it exists)
444 if (GetDebug()) Info("MakeHeader","");
447 if (GetDebug()) Info("MakeHeader","Creating new Header Object");
448 fHeader= new AliHeader();
450 TTree* tree = TreeE();
453 if (GetDebug()) Info("MakeHeader","Got Tree from folder.");
454 TBranch* branch = tree->GetBranch(fgkHeaderBranchName);
457 if (GetDebug()) Info("MakeHeader","Creating new branch");
458 branch = tree->Branch(fgkHeaderBranchName, "AliHeader", &fHeader, 4000, 0);
459 branch->SetAutoDelete(kFALSE);
463 if (GetDebug()) Info("MakeHeader","Got Branch from Tree");
464 branch->SetAddress(&fHeader);
465 tree->GetEvent(fCurrentEvent);
466 fStack = fHeader->Stack(); //should be safe - if we created Stack, header returns pointer to the same object
469 fStack->SetEventFolderName(fEventFolder->GetName());
470 if (TreeK()) fStack->GetEvent();
474 if (GetDebug()) Info("MakeHeader","Haeder do not have a stack.");
478 if (GetDebug()) Info("MakeHeader","Exiting MakeHeader method");
480 /**************************************************************************/
482 void AliRunLoader::MakeStack()
484 //Creates the stack object - do not connect the tree
487 fStack = new AliStack(10000);
488 fStack->SetEventFolderName(fEventFolder->GetName());
492 /**************************************************************************/
494 void AliRunLoader::MakeTree(Option_t *option)
497 const char *oK = strstr(option,"K"); //Kine
498 const char *oE = strstr(option,"E"); //Header
502 if (fKineDataLoader->GetBaseLoader(0)->IsLoaded() == kFALSE)
504 Error("MakeTree(\"K\")","Load Kinematics first");
508 fKineDataLoader->MakeTree();
510 fStack->ConnectTree();
511 WriteKinematics("OVERWRITE");
518 TTree* tree = new TTree(fgkHeaderContainerName,"Tree with Headers");
519 GetEventFolder()->Add(tree);
521 WriteHeader("OVERWRITE");
524 TIter next(fLoaders);
526 while((loader = (AliLoader*)next()))
528 loader->MakeTree(option);
532 /**************************************************************************/
534 Int_t AliRunLoader::LoadgAlice()
536 //Loads gAlice from file
539 Warning("LoadgAlice","AliRun is already in folder. Unload first.");
542 AliRun* alirun = dynamic_cast<AliRun*>(fGAFile->Get(fgkGAliceName));
545 Error("LoadgAlice"," Can not find gAlice in file %s",fGAFile->GetName());
548 alirun->SetRunLoader(this);
551 Warning("LoadgAlice","gAlice already exists. Putting retrived object in folder named %s",
552 GetEventFolder()->GetName());
558 SetDetectorAddresses();//calls SetTreeAddress for all detectors
561 /**************************************************************************/
563 Int_t AliRunLoader::LoadHeader()
565 //loads treeE and reads header object for current event
568 Warning("LoadHeader","Header is already loaded. Use ReloadHeader to force reload. Nothing done");
572 if (GetEventFolder() == 0x0)
574 Error("LoadHaeder","Event folder not specified yet");
580 Error("LoadHaeder","Session not opened. Use AliRunLoader::Open");
584 if (fGAFile->IsOpen() == kFALSE)
586 Error("LoadHaeder","Session not opened. Use AliRunLoader::Open");
590 TTree* tree = dynamic_cast<TTree*>(fGAFile->Get(fgkHeaderContainerName));
593 Fatal("LoadHaeder","Can not find header tree named %s in file %s",
594 fgkHeaderContainerName.Data(),fGAFile->GetName());
598 if (tree == TreeE()) return 0;
601 GetEventFolder()->Add(tree);
602 MakeHeader();//creates header object and connects to tree
606 /**************************************************************************/
608 Int_t AliRunLoader::LoadKinematics(Option_t* option)
610 //Loads the kinematics
611 Int_t retval = fKineDataLoader->GetBaseLoader(0)->Load(option);
614 Error("LoadKinematics","Error occured while loading kinamatics tree.");
617 if (fStack) fStack->GetEvent();
620 /**************************************************************************/
622 Int_t AliRunLoader::OpenDataFile(const TString& filename,TFile*& file,TDirectory*& dir,Option_t* opt,Int_t cl)
624 //Opens File with kinematics
627 if (file->IsOpen() == kFALSE)
628 {//pointer is not null but file is not opened
629 Warning("OpenDataFile","Pointer to file is not null, but file is not opened");//risky any way
631 file = 0x0; //proceed with opening procedure
635 Warning("OpenDataFile","File %s already opened",filename.Data());
639 //try to find if that file is opened somewere else
640 file = (TFile *)( gROOT->GetListOfFiles()->FindObject(filename) );
643 if(file->IsOpen() == kTRUE)
645 Warning("OpenDataFile","File %s already opened by sombody else.",file->GetName());
650 file = TFile::Open(filename,opt);
653 Error("LoadKinematics","Can not open file %s",filename.Data());
656 if (file->IsOpen() == kFALSE)
657 {//file is not opened
658 Error("LoadKinematics","Can not open file %s",filename.Data());
662 file->SetCompressionLevel(cl);
664 dir = AliLoader::ChangeDir(file,fCurrentEvent);
667 Error("OpenKineFile","Can not change to root directory in file %s",filename.Data());
672 /**************************************************************************/
674 TTree* AliRunLoader::TreeE() const
676 //returns the tree from folder; shortcut method
677 TObject *obj = fEventFolder->FindObject(fgkHeaderContainerName);
678 return (obj)?dynamic_cast<TTree*>(obj):0x0;
680 /**************************************************************************/
682 AliHeader* AliRunLoader::GetHeader() const
684 //returns pointer header object
687 /**************************************************************************/
689 TTree* AliRunLoader::TreeK() const
691 //returns the tree from folder; shortcut method
692 TObject *obj = GetEventFolder()->FindObject(fgkKineContainerName);
693 return (obj)?dynamic_cast<TTree*>(obj):0x0;
695 /**************************************************************************/
697 TTree* AliRunLoader::TreeTR() const
699 //returns the tree from folder; shortcut method
700 TObject* obj = GetEventFolder()->FindObject(fgkTrackRefsContainerName);
701 return (obj)?dynamic_cast<TTree*>(obj):0x0;
703 /**************************************************************************/
705 AliRun* AliRunLoader::GetAliRun() const
707 //returns AliRun which sits in the folder
708 if (fEventFolder == 0x0) return 0x0;
709 TObject *obj = fEventFolder->FindObject(fgkGAliceName);
710 return (obj)?dynamic_cast<AliRun*>(obj):0x0;
712 /**************************************************************************/
714 Int_t AliRunLoader::WriteGeometry(Option_t* /*opt*/)
716 //writes geometry to the file
718 TGeometry* geo = GetAliRun()->GetGeometry();
721 Error("WriteGeometry","Can not get geometry from gAlice");
727 /**************************************************************************/
729 Int_t AliRunLoader::WriteHeader(Option_t* opt)
732 if (GetDebug()) Info("WriteHeader"," WRITING HEADER");
734 TTree* tree = TreeE();
737 Warning("WriteHeader","Can not find Header Tree in Folder");
740 if (fGAFile->IsWritable() == kFALSE)
742 Error("WriteHeader","File %s is not writable",fGAFile->GetName());
746 TObject* obj = fGAFile->Get(fgkHeaderContainerName);
748 { //if they exist, see if option OVERWRITE is used
750 if(tmp.Contains("OVERWRITE",TString::kIgnoreCase) == 0)
751 {//if it is not used - give an error message and return an error code
752 Error("WriteHeader","Tree already exisists. Use option \"OVERWRITE\" to overwrite previous data");
757 tree->SetDirectory(fGAFile);
758 tree->Write(0,TObject::kOverwrite);
760 if (GetDebug()) Info("WriteHeader","WRITTEN\n\n");
764 /**************************************************************************/
766 Int_t AliRunLoader::WriteAliRun(Option_t* /*opt*/)
768 //writes AliRun object to the file
770 if (GetAliRun()) GetAliRun()->Write();
773 /**************************************************************************/
775 Int_t AliRunLoader::WriteKinematics(Option_t* opt)
778 return fKineDataLoader->GetBaseLoader(0)->WriteData(opt);
780 /**************************************************************************/
781 Int_t AliRunLoader::WriteTrackRefs(Option_t* opt)
783 //writes Track References tree
784 return fTrackRefsDataLoader->GetBaseLoader(0)->WriteData(opt);
786 /**************************************************************************/
788 Int_t AliRunLoader::WriteHits(Option_t* opt)
790 //Calls WriteHits for all loaders
793 TIter next(fLoaders);
795 while((loader = (AliLoader*)next()))
797 res = loader->WriteHits(opt);
800 Error("WriteHits","Failed to write hits for %s (%d)",loader->GetDetectorName().Data(),res);
806 /**************************************************************************/
808 Int_t AliRunLoader::WriteSDigits(Option_t* opt)
810 //Calls WriteSDigits for all loaders
813 TIter next(fLoaders);
815 while((loader = (AliLoader*)next()))
817 res = loader->WriteSDigits(opt);
820 Error("WriteSDigits","Failed to write summable digits for %s.",loader->GetDetectorName().Data());
826 /**************************************************************************/
828 Int_t AliRunLoader::WriteDigits(Option_t* opt)
830 //Calls WriteDigits for all loaders
833 TIter next(fLoaders);
835 while((loader = (AliLoader*)next()))
837 res = loader->WriteDigits(opt);
840 Error("WriteDigits","Failed to write digits for %s.",loader->GetDetectorName().Data());
846 /**************************************************************************/
848 Int_t AliRunLoader::WriteRecPoints(Option_t* opt)
850 //Calls WriteRecPoints for all loaders
853 TIter next(fLoaders);
855 while((loader = (AliLoader*)next()))
857 res = loader->WriteRecPoints(opt);
860 Error("WriteRecPoints","Failed to write Reconstructed Points for %s.",
861 loader->GetDetectorName().Data());
867 /**************************************************************************/
869 Int_t AliRunLoader::WriteTracks(Option_t* opt)
871 //Calls WriteTracks for all loaders
874 TIter next(fLoaders);
876 while((loader = (AliLoader*)next()))
878 res = loader->WriteTracks(opt);
881 Error("WriteTracks","Failed to write Tracks for %s.",
882 loader->GetDetectorName().Data());
888 /**************************************************************************/
890 Int_t AliRunLoader::WriteRunLoader(Option_t* /*opt*/)
892 //Writes itself to the file
894 this->Write(0,TObject::kOverwrite);
897 /**************************************************************************/
899 Int_t AliRunLoader::SetEventFolderName(const TString& name)
901 //sets top folder name for this run; of alread
904 Error("SetTopFolderName","Name is empty");
908 //check if such a folder already exists - try to find it in alice top folder
909 TObject* obj = AliConfig::Instance()->GetTopFolder()->FindObject(name);
912 TFolder* fold = dynamic_cast<TFolder*>(obj);
915 Error("SetTopFolderName","Such a obejct already exists in top alice folder and it is not a folder.");
918 //folder which was found is our folder
919 if (fEventFolder == fold)
925 Error("SetTopFolderName","Such a folder already exists in top alice folder. Can not mount.");
930 //event is alredy connected, just change name of the folder
933 fEventFolder->SetName(name);
937 if (fKineDataLoader == 0x0)
938 fKineDataLoader = new AliDataLoader(fgkDefaultKineFileName,fgkKineContainerName,"Kinematics");
940 if ( fTrackRefsDataLoader == 0x0)
941 fTrackRefsDataLoader = new AliDataLoader(fgkDefaultTrackRefsFileName,fgkTrackRefsContainerName,"Track References");
943 //build the event folder structure
944 if (GetDebug()) Info("SetEventFolderName","Creating new event folder named %s",name.Data());
945 fEventFolder = AliConfig::Instance()->BuildEventFolder(name,"Event Folder");
946 fEventFolder->Add(this);//put myself to the folder to accessible for all
948 if (Stack()) Stack()->SetEventFolderName(fEventFolder->GetName());
949 TIter next(fLoaders);
951 while((loader = (AliLoader*)next()))
953 loader->Register(fEventFolder);//build folder structure for this detector
956 fKineDataLoader->SetEventFolder(GetEventFolder());
957 fTrackRefsDataLoader->SetEventFolder(GetEventFolder());
958 fKineDataLoader->SetFolder(GetEventFolder());
959 fTrackRefsDataLoader->SetFolder(GetEventFolder());
961 fEventFolder->SetOwner();
964 /**************************************************************************/
966 void AliRunLoader::AddLoader(AliLoader* loader)
968 //Adds the Loader for given detector
969 if (loader == 0x0) //if null shout and exit
971 Error("AddLoader","Parameter is NULL");
974 loader->SetDirName(fUnixDirName);
975 if (fEventFolder) loader->SetEventFolder(fEventFolder); //if event folder is already defined,
976 //pass information to the Loader
977 fLoaders->Add(loader);//add the Loader to the array
979 /**************************************************************************/
981 void AliRunLoader::AddLoader(AliDetector* det)
983 //Asks module (detector) ro make a Loader and stores in the array
984 if (det == 0x0) return;
985 AliLoader* get = det->GetLoader();//try to get loader
986 if (get == 0x0) get = det->MakeLoader(fEventFolder->GetName());//if did not obtain, ask to make it
990 if (GetDebug()) Info("AddLoader","Detector: %s Loader : %s",det->GetName(),get->GetName());
995 /**************************************************************************/
997 AliLoader* AliRunLoader::GetLoader(const char* detname) const
999 //returns loader for given detector
1000 //note that naming convention is TPCLoader not just TPC
1001 return (AliLoader*)fLoaders->FindObject(detname);
1004 /**************************************************************************/
1006 AliLoader* AliRunLoader::GetLoader(AliDetector* det) const
1008 //get loader for detector det
1009 if(det == 0x0) return 0x0;
1010 TString getname(det->GetName());
1012 if (GetDebug()) Info("GetLoader(AliDetector* det)"," Loader name is %s",getname.Data());
1013 return GetLoader(getname);
1016 /**************************************************************************/
1018 void AliRunLoader::CleanFolders()
1020 // fEventFolder->Add(this);//put myself to the folder to accessible for all
1026 /**************************************************************************/
1028 void AliRunLoader::CleanDetectors()
1030 //Calls CleanFolders for all detectors
1031 TIter next(fLoaders);
1033 while((Loader = (AliLoader*)next()))
1035 Loader->CleanFolders();
1038 /**************************************************************************/
1040 void AliRunLoader::RemoveEventFolder()
1042 //remove all the tree of event
1043 //all the stuff changing EbE stays untached (PDGDB, tasks, etc.)
1045 if (fEventFolder == 0x0) return;
1046 fEventFolder->SetOwner(kFALSE);//don't we want to deleted while removing the folder that we are sitting in
1047 fEventFolder->Remove(this);//remove us drom folder
1049 AliConfig::Instance()->GetTopFolder()->SetOwner(); //brings ownership back for fEventFolder since it sits in top folder
1050 AliConfig::Instance()->GetTopFolder()->Remove(fEventFolder); //remove the event tree
1051 delete fEventFolder;
1053 /**************************************************************************/
1055 void AliRunLoader::SetGAliceFile(TFile* gafile)
1057 //sets pointer to galice.root file
1061 /**************************************************************************/
1063 Int_t AliRunLoader::LoadHits(Option_t* detectors,Option_t* opt)
1065 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1067 if (GetDebug()) Info("LoadHits","Loading Hits");
1071 const char* oAll = strstr(detectors,"all");
1074 if (GetDebug()) Info("LoadHits","Option is All");
1079 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1080 loaders = &arr;//get the pointer array
1083 if (GetDebug()) Info("LoadHits","For detectors. Number of detectors chosen for loading %d",loaders->GetEntries());
1085 TIter next(loaders);
1087 while((loader = (AliLoader*)next()))
1089 if (GetDebug()) Info("LoadHits"," Calling LoadHits(%s) for %s",opt,loader->GetName());
1090 loader->LoadHits(opt);
1092 if (GetDebug()) Info("LoadHits","Done");
1096 /**************************************************************************/
1098 Int_t AliRunLoader::LoadSDigits(Option_t* detectors,Option_t* opt)
1100 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1105 const char* oAll = strstr(detectors,"all");
1112 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1113 loaders = &arr;//get the pointer to array
1116 TIter next(loaders);
1118 while((loader = (AliLoader*)next()))
1120 loader->LoadSDigits(opt);
1125 /**************************************************************************/
1127 Int_t AliRunLoader::LoadDigits(Option_t* detectors,Option_t* opt)
1129 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1134 const char* oAll = strstr(detectors,"all");
1141 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1142 Loaders = &arr;//get the pointer array
1145 TIter next(Loaders);
1147 while((Loader = (AliLoader*)next()))
1149 Loader->LoadDigits(opt);
1153 /**************************************************************************/
1155 Int_t AliRunLoader::LoadRecPoints(Option_t* detectors,Option_t* opt)
1157 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1162 const char* oAll = strstr(detectors,"all");
1169 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1170 Loaders = &arr;//get the pointer array
1173 TIter next(Loaders);
1175 while((Loader = (AliLoader*)next()))
1177 Loader->LoadRecPoints(opt);
1181 /**************************************************************************/
1183 Int_t AliRunLoader::LoadRecParticles(Option_t* detectors,Option_t* opt)
1185 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1190 const char* oAll = strstr(detectors,"all");
1197 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1198 Loaders = &arr;//get the pointer array
1201 TIter next(Loaders);
1203 while((Loader = (AliLoader*)next()))
1205 Loader->LoadRecParticles(opt);
1209 /**************************************************************************/
1211 Int_t AliRunLoader::LoadTracks(Option_t* detectors,Option_t* opt)
1213 //LoadHits in selected detectors i.e. detectors="ITS TPC TRD" or "all"
1218 const char* oAll = strstr(detectors,"all");
1225 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1226 Loaders = &arr;//get the pointer array
1229 TIter next(Loaders);
1231 while((Loader = (AliLoader*)next()))
1233 Loader->LoadTracks(opt);
1237 /**************************************************************************/
1239 void AliRunLoader::UnloadHits(Option_t* detectors)
1241 //unloads hits for detectors specified in parameter
1245 const char* oAll = strstr(detectors,"all");
1252 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1253 loaders = &arr;//get the pointer to array
1256 TIter next(loaders);
1258 while((loader = (AliLoader*)next()))
1260 loader->UnloadHits();
1263 /**************************************************************************/
1265 void AliRunLoader::UnloadSDigits(Option_t* detectors)
1267 //unloads SDigits for detectors specified in parameter
1271 const char* oAll = strstr(detectors,"all");
1278 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1279 loaders = &arr;//get the pointer to array
1282 TIter next(loaders);
1284 while((loader = (AliLoader*)next()))
1286 loader->UnloadSDigits();
1289 /**************************************************************************/
1291 void AliRunLoader::UnloadDigits(Option_t* detectors)
1293 //unloads Digits for detectors specified in parameter
1297 const char* oAll = strstr(detectors,"all");
1304 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1305 loaders = &arr;//get the pointer to array
1308 TIter next(loaders);
1310 while((loader = (AliLoader*)next()))
1312 loader->UnloadDigits();
1315 /**************************************************************************/
1317 void AliRunLoader::UnloadRecPoints(Option_t* detectors)
1319 //unloads RecPoints for detectors specified in parameter
1323 const char* oAll = strstr(detectors,"all");
1330 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1331 loaders = &arr;//get the pointer to array
1334 TIter next(loaders);
1336 while((loader = (AliLoader*)next()))
1338 loader->UnloadRecPoints();
1341 /**************************************************************************/
1343 void AliRunLoader::UnloadAll(Option_t* detectors)
1345 //calls UnloadAll for detectors names specified in parameter
1346 // option "all" passed can be passed
1350 const char* oAll = strstr(detectors,"all");
1357 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1358 loaders = &arr;//get the pointer to array
1361 TIter next(loaders);
1363 while((loader = (AliLoader*)next()))
1365 loader->UnloadAll();
1368 /**************************************************************************/
1370 void AliRunLoader::UnloadTracks(Option_t* detectors)
1372 //unloads Tracks for detectors specified in parameter
1376 const char* oAll = strstr(detectors,"all");
1383 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1384 loaders = &arr;//get the pointer to array
1387 TIter next(loaders);
1389 while((loader = (AliLoader*)next()))
1391 loader->UnloadTracks();
1394 /**************************************************************************/
1396 void AliRunLoader::UnloadRecParticles(Option_t* detectors)
1398 //unloads Particles for detectors specified in parameter
1402 const char* oAll = strstr(detectors,"all");
1409 GetListOfDetectors(detectors,arr);//this method looks for all Loaders corresponding to names (many) specified in detectors option
1410 loaders = &arr;//get the pointer to array
1413 TIter next(loaders);
1415 while((loader = (AliLoader*)next()))
1417 loader->UnloadRecParticles();
1420 /**************************************************************************/
1422 AliRunLoader* AliRunLoader::GetRunLoader(const char* eventfoldername)
1424 //returns RunLoader from folder named eventfoldername
1425 TFolder* evfold= dynamic_cast<TFolder*>(AliConfig::Instance()->GetTopFolder()->FindObject(eventfoldername));
1430 AliRunLoader* runget = dynamic_cast<AliRunLoader*>(evfold->FindObject(AliRunLoader::fgkRunLoaderName));
1434 /**************************************************************************/
1436 AliLoader* AliRunLoader::GetDetectorLoader(const char* detname, const char* eventfoldername)
1438 //get the loader of the detector with the given name from the global
1440 AliRunLoader* runLoader = GetRunLoader(eventfoldername);
1442 ::Error("AliRunLoader::GetDetectorLoader","No run loader found");
1445 return runLoader->GetDetectorLoader(detname);
1447 /**************************************************************************/
1449 AliLoader* AliRunLoader::GetDetectorLoader(const char* detname)
1451 //get the loader of the detector with the given name from the global
1454 char loadername[256];
1455 sprintf(loadername, "%sLoader", detname);
1456 AliLoader* loader = GetLoader(loadername);
1458 Error("GetDetectorLoader", "No loader for %s found", detname);
1463 /**************************************************************************/
1465 TTree* AliRunLoader::GetTreeH(const char* detname, Bool_t maketree, const char* eventfoldername)
1467 //get the tree with hits of the detector with the given name
1468 //if maketree is true and the tree does not exist, the tree is created
1469 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1470 if (!loader) return NULL;
1471 if (!loader->TreeH() && maketree) loader->MakeTree("H");
1472 return loader->TreeH();
1475 /**************************************************************************/
1477 TTree* AliRunLoader::GetTreeH(const char* detname, Bool_t maketree)
1479 //get the tree with hits of the detector with the given name
1480 //if maketree is true and the tree does not exist, the tree is created
1481 AliLoader* loader = GetDetectorLoader(detname);
1482 if (!loader) return NULL;
1483 if (!loader->TreeH() && maketree) loader->MakeTree("H");
1484 return loader->TreeH();
1486 /**************************************************************************/
1488 TTree* AliRunLoader::GetTreeS(const char* detname, Bool_t maketree,const char* eventfoldername)
1490 //get the tree with summable digits of the detector with the given name
1491 //if maketree is true and the tree does not exist, the tree is created
1492 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1493 if (!loader) return NULL;
1494 if (!loader->TreeS() && maketree) loader->MakeTree("S");
1495 return loader->TreeS();
1497 /**************************************************************************/
1499 TTree* AliRunLoader::GetTreeS(const char* detname, Bool_t maketree)
1501 //get the tree with summable digits of the detector with the given name
1502 //if maketree is true and the tree does not exist, the tree is created
1503 AliLoader* loader = GetDetectorLoader(detname);
1504 if (!loader) return NULL;
1505 if (!loader->TreeS() && maketree) loader->MakeTree("S");
1506 return loader->TreeS();
1508 /**************************************************************************/
1510 TTree* AliRunLoader::GetTreeD(const char* detname, Bool_t maketree,const char* eventfoldername)
1512 //get the tree with digits of the detector with the given name
1513 //if maketree is true and the tree does not exist, the tree is created
1514 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1515 if (!loader) return NULL;
1516 if (!loader->TreeD() && maketree) loader->MakeTree("D");
1517 return loader->TreeD();
1519 /**************************************************************************/
1521 TTree* AliRunLoader::GetTreeD(const char* detname, Bool_t maketree)
1523 //get the tree with digits of the detector with the given name
1524 //if maketree is true and the tree does not exist, the tree is created
1525 AliLoader* loader = GetDetectorLoader(detname);
1526 if (!loader) return NULL;
1527 if (!loader->TreeD() && maketree) loader->MakeTree("D");
1528 return loader->TreeD();
1530 /**************************************************************************/
1531 TTree* AliRunLoader::GetTreeR(const char* detname, Bool_t maketree,const char* eventfoldername)
1533 //get the tree with clusters of the detector with the given name
1534 //if maketree is true and the tree does not exist, the tree is created
1535 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1536 if (!loader) return NULL;
1537 if (!loader->TreeR() && maketree) loader->MakeTree("R");
1538 return loader->TreeR();
1540 /**************************************************************************/
1542 TTree* AliRunLoader::GetTreeR(const char* detname, Bool_t maketree)
1544 //get the tree with clusters of the detector with the given name
1545 //if maketree is true and the tree does not exist, the tree is created
1546 AliLoader* loader = GetDetectorLoader(detname);
1547 if (!loader) return NULL;
1548 if (!loader->TreeR() && maketree) loader->MakeTree("R");
1549 return loader->TreeR();
1551 /**************************************************************************/
1553 TTree* AliRunLoader::GetTreeT(const char* detname, Bool_t maketree,const char* eventfoldername)
1555 //get the tree with tracks of the detector with the given name
1556 //if maketree is true and the tree does not exist, the tree is created
1557 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1558 if (!loader) return NULL;
1559 if (!loader->TreeT() && maketree) loader->MakeTree("T");
1560 return loader->TreeT();
1562 /**************************************************************************/
1564 TTree* AliRunLoader::GetTreeT(const char* detname, Bool_t maketree)
1566 //get the tree with tracks of the detector with the given name
1567 //if maketree is true and the tree does not exist, the tree is created
1568 AliLoader* loader = GetDetectorLoader(detname);
1569 if (!loader) return NULL;
1570 if (!loader->TreeT() && maketree) loader->MakeTree("T");
1571 return loader->TreeT();
1573 /**************************************************************************/
1575 TTree* AliRunLoader::GetTreeP(const char* detname, Bool_t maketree,const char* eventfoldername)
1577 //get the tree with particles of the detector with the given name
1578 //if maketree is true and the tree does not exist, the tree is created
1579 AliLoader* loader = GetDetectorLoader(detname,eventfoldername);
1580 if (!loader) return NULL;
1581 if (!loader->TreeP() && maketree) loader->MakeTree("P");
1582 return loader->TreeP();
1584 /**************************************************************************/
1586 TTree* AliRunLoader::GetTreeP(const char* detname, Bool_t maketree)
1588 //get the tree with particles of the detector with the given name
1589 //if maketree is true and the tree does not exist, the tree is created
1590 AliLoader* loader = GetDetectorLoader(detname);
1591 if (!loader) return NULL;
1592 if (!loader->TreeP() && maketree) loader->MakeTree("P");
1593 return loader->TreeP();
1596 /**************************************************************************/
1598 void AliRunLoader::CdGAFile()
1600 //sets gDirectory to galice file
1602 if(fGAFile) fGAFile->cd();
1605 /**************************************************************************/
1607 void AliRunLoader::GetListOfDetectors(const char * namelist,TObjArray& pointerarray) const
1609 //this method looks for all Loaders corresponding
1610 //to names (many) specified in namelist i.e. namelist ("ITS TPC TRD")
1614 strcpy(dets,namelist);//compiler cries when char* = const Option_t*;
1615 dets[strlen(dets)+1] = '\n';//set endl at the end of string
1620 tmp = sscanf(pdet,"%s",buff);//read the string from the input string pdet into buff
1621 if ( (buff[0] == 0) || (tmp == 0) ) break; //if not read
1623 pdet = strstr(pdet,buff) + strlen(buff);//move the input pointer about number of bytes (letters) read
1624 //I am aware that is a little complicated. I don't know the number of spaces between detector names
1625 //so I read the string, than I find where it starts (strstr) and move the pointer about length of a string
1626 //If there is a better way, please write me (Piotr.Skowronski@cern.ch)
1627 //construct the Loader name
1628 TString getname(buff);
1630 AliLoader* loader = GetLoader(getname);//get the Loader
1633 pointerarray.Add(loader);
1637 Error("GetListOfDetectors","Can not find Loader for %s",buff);
1643 /*****************************************************************************/
1645 void AliRunLoader::Clean(const TString& name)
1647 //removes object with given name from event folder and deletes it
1648 if (GetEventFolder() == 0x0) return;
1649 TObject* obj = GetEventFolder()->FindObject(name);
1652 if (GetDebug()) Info("Clean(const TString&)","name=%s, cleaning %s.",GetName(),name.Data());
1653 GetEventFolder()->Remove(obj);
1658 /*****************************************************************************/
1660 TTask* AliRunLoader::GetRunDigitizer()
1662 //returns Run Digitizer from folder
1664 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1665 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetDigitizerTaskName());
1666 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1668 /*****************************************************************************/
1670 TTask* AliRunLoader::GetRunSDigitizer()
1672 //returns SDigitizer Task from folder
1674 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1675 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetSDigitizerTaskName());
1676 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1678 /*****************************************************************************/
1680 TTask* AliRunLoader::GetRunReconstructioner()
1682 //returns Reconstructioner Task from folder
1683 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1684 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetReconstructionerTaskName());
1685 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1687 /*****************************************************************************/
1689 TTask* AliRunLoader::GetRunTracker()
1691 //returns Tracker Task from folder
1692 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1693 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetTrackerTaskName());
1694 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1696 /*****************************************************************************/
1698 TTask* AliRunLoader::GetRunPIDTask()
1700 //returns Tracker Task from folder
1701 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1702 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetPIDTaskName());
1703 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1705 /*****************************************************************************/
1707 TTask* AliRunLoader::GetRunQATask()
1709 //returns Quality Assurance Task from folder
1710 TFolder* topf = AliConfig::Instance()->GetTaskFolder();
1713 ::Error("AliRunLoader::GetRunQATask","Can not get task folder from AliConfig");
1716 TObject* obj = topf->FindObjectAny(AliConfig::Instance()->GetQATaskName());
1717 return (obj)?dynamic_cast<TTask*>(obj):0x0;
1720 /*****************************************************************************/
1722 void AliRunLoader::SetCompressionLevel(Int_t cl)
1724 //Sets Compression Level in all files
1725 if (fGAFile) fGAFile->SetCompressionLevel(cl);
1726 SetKineComprLevel(cl);
1727 SetTrackRefsComprLevel(cl);
1728 TIter next(fLoaders);
1730 while((loader = (AliLoader*)next()))
1732 loader->SetCompressionLevel(cl);
1735 /**************************************************************************/
1737 void AliRunLoader::SetKineComprLevel(Int_t cl)
1739 //Sets comression level in Kine File
1740 fKineDataLoader->SetCompressionLevel(cl);
1742 /**************************************************************************/
1744 void AliRunLoader::SetTrackRefsComprLevel(Int_t cl)
1746 //Sets comression level in Track Refences File
1747 fTrackRefsDataLoader->SetCompressionLevel(cl);
1749 /**************************************************************************/
1751 void AliRunLoader::UnloadHeader()
1753 //removes TreeE from folder and deletes it
1754 // as well as fHeader object
1759 /**************************************************************************/
1761 void AliRunLoader::UnloadKinematics()
1763 //Unloads Kinematics
1764 fKineDataLoader->GetBaseLoader(0)->Unload();
1766 /**************************************************************************/
1768 void AliRunLoader::UnloadTrackRefs()
1770 //Unloads Track Refernces
1771 fTrackRefsDataLoader->GetBaseLoader(0)->Unload();
1773 /**************************************************************************/
1775 void AliRunLoader::UnloadgAlice()
1778 if (gAlice == GetAliRun())
1780 if (GetDebug()) Info("UnloadgAlice","Set gAlice = 0x0");
1781 gAlice = 0x0;//if gAlice is the same that in folder (to be deleted by the way of folder)
1783 AliRun* alirun = GetAliRun();
1784 if (GetEventFolder()) GetEventFolder()->Remove(alirun);
1787 /**************************************************************************/
1789 void AliRunLoader::MakeTrackRefsContainer()
1791 // Makes a tree for Track References
1792 fTrackRefsDataLoader->MakeTree();
1794 /**************************************************************************/
1796 Int_t AliRunLoader::LoadTrackRefs(Option_t* option)
1798 //Load track references from file (opens file and posts tree to folder)
1800 return fTrackRefsDataLoader->GetBaseLoader(0)->Load(option);
1802 /**************************************************************************/
1804 void AliRunLoader::SetDirName(TString& dirname)
1806 //sets directory name
1807 if (dirname.IsNull()) return;
1808 fUnixDirName = dirname;
1809 fKineDataLoader->SetDirName(dirname);
1810 fTrackRefsDataLoader->SetDirName(dirname);
1812 TIter next(fLoaders);
1814 while((loader = (AliLoader*)next()))
1816 loader->SetDirName(dirname);
1820 /*****************************************************************************/
1822 Int_t AliRunLoader::GetFileOffset() const
1824 //returns the file number that is added to the file name for current event
1825 return Int_t(fCurrentEvent/fNEventsPerFile);
1828 /*****************************************************************************/
1829 const TString AliRunLoader::SetFileOffset(const TString& fname)
1831 //adds the the number to the file name at proper place for current event
1832 Long_t offset = (Long_t)GetFileOffset();
1833 if (offset < 1) return fname;
1835 soffset += offset;//automatic conversion to string
1836 TString dotroot(".root");
1837 const TString& offfsetdotroot = offset + dotroot;
1838 TString out = fname;
1839 out = out.ReplaceAll(dotroot,offfsetdotroot);
1840 if (GetDebug()) Info("SetFileOffset"," in=%s out=%s",fname.Data(),out.Data());
1843 /*****************************************************************************/
1845 void AliRunLoader::SetDigitsFileNameSuffix(const TString& suffix)
1847 //adds the suffix before ".root",
1848 //e.g. TPC.Digits.root -> TPC.DigitsMerged.root
1849 //made on Jiri Chudoba demand
1851 TIter next(fLoaders);
1853 while((Loader = (AliLoader*)next()))
1855 Loader->SetDigitsFileNameSuffix(suffix);
1858 /*****************************************************************************/
1860 TString AliRunLoader::GetFileName() const
1862 //returns name of galice file
1864 if (fGAFile == 0x0) return result;
1865 result = fGAFile->GetName();
1868 /*****************************************************************************/
1870 void AliRunLoader::SetDetectorAddresses()
1872 //calls SetTreeAddress for all detectors
1873 if (GetAliRun()==0x0) return;
1874 TIter next(GetAliRun()->Modules());
1876 while((mod = (AliModule*)next()))
1878 AliDetector* det = dynamic_cast<AliDetector*>(mod);
1879 if (det) det->SetTreeAddress();
1882 /*****************************************************************************/
1884 void AliRunLoader::Synchronize()
1886 //synchrinizes all writtable files
1887 TIter next(fLoaders);
1889 while((loader = (AliLoader*)next()))
1891 loader->Synchronize();
1894 fKineDataLoader->Synchronize();
1895 fTrackRefsDataLoader->Synchronize();
1898 /*****************************************************************************/
1899 /*****************************************************************************/