Fix for #63914: Increasing time per event
[u/mrichter/AliRoot.git] / STEER / STEER / AliDataLoader.cxx
CommitLineData
88cb7938 1/////////////////////////////////////////////////////////////////////////////////////////////
2// //
3// class AliDataLoader //
4// //
5// Container of all data needed for full //
6// description of each data type //
7// (Hits, Kine, ...) //
8// //
9// Each data loader has a basic standard setup of BaseLoaders //
10// which can be identuified by indexes (defined by EStdBasicLoaders) //
11// Data managed by these standard base loaders has fixed naming convention //
12// e.g. - tree with hits is always named TreeH //
13// (defined in AliLoader::fgkDefaultHitsContainerName) //
14// - task DtectorName+Name defined //
15// //
16// EStdBasicLoaders idx Object Type Description //
17// kData 0 TTree or TObject main data itself (hits,digits,...) //
18// kTask 1 TTask object producing main data //
19// kQA 2 TTree quality assurance tree //
20// kQATask 3 TTask task producing QA object //
21// //
22// //
23// User can define and add more basic loaders even Run Time. //
24// Caution: in order to save information about added base loader //
25// user must rewrite Run Loader to galice.file, overwriting old setup //
26// //
27/////////////////////////////////////////////////////////////////////////////////////////////
28
a9bbb414 29/* $Id$ */
30
a9bbb414 31#include "AliDataLoader.h"
88cb7938 32#include "AliRunLoader.h"
c93255fe 33#include "AliLoader.h"
34#include "AliObjectLoader.h"
a9bbb414 35#include "AliTreeLoader.h"
c93255fe 36#include "AliTaskLoader.h"
37#include "AliLog.h"
38
39#include <TFile.h>
40#include <TROOT.h>
41#include <TString.h>
42#include <TBits.h>
88cb7938 43
44ClassImp(AliDataLoader)
45
a9bbb414 46//______________________________________________________________________________
88cb7938 47AliDataLoader::AliDataLoader():
48 fFileName(0),
49 fFile(0x0),
50 fDirectory(0x0),
51 fFileOption(),
52 fCompressionLevel(2),
18b43626 53 fNEventsPerFile(0),
88cb7938 54 fBaseLoaders(0x0),
55 fHasTask(kFALSE),
56 fTaskName(),
57 fParentalTask(0x0),
58 fEventFolder(0x0),
59 fFolder(0x0)
60{
61
62}
88cb7938 63
a9bbb414 64//______________________________________________________________________________
65AliDataLoader::AliDataLoader(const char* filename, const char* contname,
66 const char* name, Option_t* opt):
88cb7938 67 TNamed(name,name),
68 fFileName(filename),
69 fFile(0x0),
70 fDirectory(0x0),
71 fFileOption(0),
72 fCompressionLevel(2),
18b43626 73 fNEventsPerFile(0),
88cb7938 74 fBaseLoaders(new TObjArray(4)),
75 fHasTask(kFALSE),
76 fTaskName(),
77 fParentalTask(0x0),
78 fEventFolder(0x0),
79 fFolder(0x0)
80{
a9bbb414 81 //constructor
82 // creates a 0 loader, depending on option, default "T" is specialized loader for trees
83 // else standard object loader
84 // trees needs special care, becouse we need to set dir before writing
21bf7095 85 AliDebug(1, Form("File name is %s",fFileName.Data()));
a9bbb414 86
88cb7938 87 TString option(opt);
88 AliBaseLoader* bl;
89 if (option.CompareTo("T",TString::kIgnoreCase) == 0)
90 bl = new AliTreeLoader(contname,this);
91 else
92 bl = new AliObjectLoader(contname,this);
93 fBaseLoaders->AddAt(bl,kData);
94
95}
a9bbb414 96
a9bbb414 97//______________________________________________________________________________
88cb7938 98AliDataLoader::~AliDataLoader()
99{
a9bbb414 100 //
101 //dtor
102 //
103 UnloadAll();
88cb7938 104}
88cb7938 105
a9bbb414 106//______________________________________________________________________________
88cb7938 107Int_t AliDataLoader::SetEvent()
108{
a9bbb414 109 //
110 // The same that GetEvent but do not post data to folders
111 //
112 AliRunLoader* rl = GetRunLoader();
113 if (rl == 0x0)
114 {
115 AliError("Can not get RunGettr");
116 return 1;
117 }
118
119 Int_t evno = rl->GetEventNumber();
120
121 TIter next(fBaseLoaders);
122 AliBaseLoader* bl;
123 while ((bl = (AliBaseLoader*)next()))
124 {
125 if (bl->DoNotReload() == kFALSE) bl->Clean();
126 }
127
128 if(fFile)
129 {
130 if (CheckReload())
131 {
132 delete fFile;
133 fFile = 0x0;
134 AliDebug(1, Form("Reloading new file. File opt is %s",fFileOption.Data()));
135 OpenFile(fFileOption);
136 }
137
138 fDirectory = AliLoader::ChangeDir(fFile,evno);
139 if (fDirectory == 0x0)
140 {
141 AliError(Form("Can not chage directory in file %s",fFile->GetName()));
142 return 1;
143 }
144 }
145 return 0;
88cb7938 146}
88cb7938 147
a9bbb414 148//______________________________________________________________________________
88cb7938 149Int_t AliDataLoader::GetEvent()
150{
a9bbb414 151 // posts all loaded data from files to White Board
152 // event number is defined in RunLoader
153 //
154 //returns:
155 // 0 - in case of no error
156 // 1 - event not found
157 //
158 //for each base laoder post, if was loaded before GetEvent
159
160 //call set event to switch to new directory in file
161
162
163 //post all data that were loaded before
164 // ->SetEvent does not call Unload, but only cleans White Board
165 // such IsLoaded flag stays untached
166
167 if ( AliLoader::TestFileOption(fFileOption) == kTRUE ) //if file is read or update mode try to post
168 { //in other case there is no sense to post: file is new
169 TIter nextbl(fBaseLoaders);
170 AliBaseLoader* bl;
171 while ((bl = (AliBaseLoader*)nextbl()))
172 {
173 if (bl->IsLoaded())
174 {
175 if (bl->DoNotReload() == kFALSE) bl->Post();
176 }
177 }
178 }
179 return 0;
88cb7938 180}
88cb7938 181
a9bbb414 182//______________________________________________________________________________
88cb7938 183Int_t AliDataLoader::OpenFile(Option_t* opt)
184{
a9bbb414 185 //Opens file named 'filename', and assigns pointer to it to 'file'
186 //jumps to fDirectoryectory corresponding to current event and stores the pointer to it in 'fDirectory'
187 //option 'opt' is passed to TFile::Open
88cb7938 188 if (fFile)
a9bbb414 189 {
190 if(fFile->IsOpen() == kTRUE)
191 {
192 AliWarning(Form(" File %s already opened. First close it.",fFile->GetName()));
193 return 0;
194 }
195 else
196 {
197 AliWarning(Form("Pointer to file %s is not null, but file is not opened",
198 fFile->GetName()));
199 delete fFile;
200 fFile = 0x0;
201 }
202 }
88cb7938 203
204 TString fname(SetFileOffset(fFileName));
205
206 fFile = (TFile *)(gROOT->GetListOfFiles()->FindObject(fname));
207 if (fFile)
a9bbb414 208 {
209 if(fFile->IsOpen() == kTRUE)
210 {
eeb1fb79 211 TString option1 = fFile->GetOption();
212 if (option1.CompareTo("read",TString::kIgnoreCase) == 0)
213 {
214 AliInfo(Form("File %s already opened in read mode.",fFile->GetName()));
215 }
216 else
217 {
218 TString option2 = opt;
219 if (option2.CompareTo("read",TString::kIgnoreCase) == 0)
220 {
221 AliInfo(Form("Open already opened file %s in read mode.",fFile->GetName()));
222 }
223 else {
224 AliWarning(Form("File %s already opened by sombody else. First close it.",
225 fFile->GetName()));
226 return 0;
227 }
228 }
a9bbb414 229 }
230 }
88cb7938 231
232 fFileOption = opt;
233 fFile = TFile::Open(fname,fFileOption);//open the file
234 if (fFile == 0x0)
a9bbb414 235 {//file is null
236 AliError(Form("Can not open file %s",fname.Data()));
237 return 1;
238 }
88cb7938 239 if (fFile->IsOpen() == kFALSE)
a9bbb414 240 {//file is null
241 AliError(Form("Can not open file %s",fname.Data()));
242 return 1;
243 }
244
88cb7938 245 fFile->SetCompressionLevel(fCompressionLevel);
246
247 AliRunLoader* rg = GetRunLoader();
248 if (rg == 0x0)
a9bbb414 249 {
250 AliError("Can not find Run-Loader in folder.");
251 return 2;
252 }
88cb7938 253 Int_t evno = rg->GetEventNumber();
254
255 fDirectory = AliLoader::ChangeDir(fFile,evno);
256 if (fDirectory == 0x0)
a9bbb414 257 {
258 AliError(Form("Can not chage fDirectory in file %s.",fFile->GetName()));
259 return 3;
260 }
88cb7938 261 return 0;
262}
88cb7938 263
a9bbb414 264//______________________________________________________________________________
88cb7938 265void AliDataLoader::Unload()
266{
a9bbb414 267 //
268 //unloads main data - shortcut method
269 //
88cb7938 270 GetBaseLoader(0)->Unload();
271}
88cb7938 272
a9bbb414 273//______________________________________________________________________________
88cb7938 274void AliDataLoader::UnloadAll()
275{
a9bbb414 276 //
277 // Unloads all data and tasks
278 //
279 if ( fFile == 0x0 ) return; //nothing loaded
280
281 TIter next(fBaseLoaders);
282 AliBaseLoader* bl;
283 while ((bl = (AliBaseLoader*)next()))
284 {
285 bl->Unload();
286 }
88cb7938 287}
88cb7938 288
a9bbb414 289
290//______________________________________________________________________________
88cb7938 291Int_t AliDataLoader::Reload()
292{
a9bbb414 293 //
294 // Unloads and loads data again
295 //
296 if ( fFile == 0x0 ) return 0;
297
298 TBits loaded(fBaseLoaders->GetEntries());
299 TIter next(fBaseLoaders);
300 AliBaseLoader* bl;
301
302 Int_t i = 0;
303 while ((bl = (AliBaseLoader*)next()))
304 {
305 if (bl->IsLoaded())
306 {
307 loaded.SetBitNumber(i++,kTRUE);
308 bl->Unload();
309 }
310 }
311
312 Int_t retval;
313 i = 0;
314 next.Reset();
315 while ((bl = (AliBaseLoader*)next()))
316 {
317 if (loaded.TestBitNumber(i++))
318 {
319 retval = bl->Load(fFileOption);
320 if (retval)
321 {
322 AliError(Form("Error occur while loading %s",bl->GetName()));
323 return retval;
324 }
325 }
326 }
327 return 0;
328}
88cb7938 329
88cb7938 330
a9bbb414 331//______________________________________________________________________________
88cb7938 332Int_t AliDataLoader::WriteData(Option_t* opt)
333{
a9bbb414 334 //
335 // Writes primary data == first BaseLoader
336 //
21bf7095 337 AliDebug(1, Form("Writing %s container for %s data. Option is %s.",
338 GetBaseLoader(0)->GetName(),GetName(),opt));
88cb7938 339 return GetBaseLoader(0)->WriteData(opt);
340}
88cb7938 341
a9bbb414 342//______________________________________________________________________________
88cb7938 343Int_t AliDataLoader::Load(Option_t* opt)
344{
a9bbb414 345 //
346 // Writes primary data == first BaseLoader
347 //
88cb7938 348 return GetBaseLoader(0)->Load(opt);
349}
88cb7938 350
a9bbb414 351//______________________________________________________________________________
88cb7938 352Int_t AliDataLoader::SetEventFolder(TFolder* eventfolder)
353{
a9bbb414 354 //
355 // Sets the event folder
356 //
357 if (eventfolder == 0x0)
358 {
359 AliError("Stupid joke. Argument is NULL");
360 return 1;
361 }
362 AliDebug(1, Form("name = %s Setting Event Folder named %s.",
363 GetName(),eventfolder->GetName()));
364
365 fEventFolder = eventfolder;
366 return 0;
88cb7938 367}
88cb7938 368
a9bbb414 369
370//______________________________________________________________________________
88cb7938 371Int_t AliDataLoader::SetFolder(TFolder* folder)
372{
d0d4a6b3 373 // Sets the folder and the data loaders
a9bbb414 374 if (folder == 0x0)
375 {
376 AliError("Stupid joke. Argument is NULL");
88cb7938 377 return 1;
a9bbb414 378 }
379
380 AliDebug(1, Form("name = %s Setting folder named %s.",GetName(),folder->GetName()));
381
382 fFolder = folder;
383 TIter next(fBaseLoaders);
384 AliBaseLoader* bl;
385
386 while ((bl = (AliBaseLoader*)next()))
387 {
388 bl->SetDataLoader(this);
389 }
390
391 return 0;
88cb7938 392}
88cb7938 393
a9bbb414 394//______________________________________________________________________________
88cb7938 395TFolder* AliDataLoader::GetEventFolder()
396{
a9bbb414 397 //
398 // Get EVENT folder
399 // Data that are changing from event to event, even in single run
400 //
21bf7095 401 AliDebug(1, "EF = %#x");
88cb7938 402 return fEventFolder;
403}
88cb7938 404
a9bbb414 405//______________________________________________________________________________
88cb7938 406AliRunLoader* AliDataLoader::GetRunLoader()
407{
a9bbb414 408 //
409 // Gets the run-loader from event folder
410 //
88cb7938 411 AliRunLoader* rg = 0x0;
412 TFolder* ef = GetEventFolder();
413 if (ef == 0x0)
414 {
21bf7095 415 AliError("Can not get event folder.");
88cb7938 416 return 0;
417 }
024a7e64 418 rg = dynamic_cast<AliRunLoader*>(ef->FindObject(AliRunLoader::GetRunLoaderName()));
88cb7938 419 return rg;
420}
421
a9bbb414 422//______________________________________________________________________________
88cb7938 423void AliDataLoader::CloseFile()
424{
a9bbb414 425 //
426 // Closes file
427 //
88cb7938 428 TIter next(fBaseLoaders);
429 AliBaseLoader* bl;
430 while ((bl = (AliBaseLoader*)next()))
a9bbb414 431 {
432 if (bl->IsLoaded()) return;
433 }
88cb7938 434
1b62c7c8 435 AliDebug(1, "Closing (object) file.");
a9bbb414 436
1b62c7c8 437 if (fFile) {
438 fFile->Close("R");
439 fFile = 0x0;
440 }
88cb7938 441 fDirectory = 0x0;
442}
88cb7938 443
a9bbb414 444
445//______________________________________________________________________________
88cb7938 446void AliDataLoader::Clean()
447{
a9bbb414 448 //
449 // Cleans main data
450 //
88cb7938 451 GetBaseLoader(0)->Clean();
a9bbb414 452}
88cb7938 453
a9bbb414 454//______________________________________________________________________________
88cb7938 455void AliDataLoader::CleanAll()
456{
a9bbb414 457 //
458 // Cleans all folders and tasks
459 //
88cb7938 460 TIter next(fBaseLoaders);
461 AliBaseLoader* bl;
462 while ((bl = (AliBaseLoader*)next()))
a9bbb414 463 {
88cb7938 464 bl->Clean();
a9bbb414 465 }
88cb7938 466}
88cb7938 467
a9bbb414 468//______________________________________________________________________________
88cb7938 469void AliDataLoader::SetFileNameSuffix(const TString& suffix)
470{
a9bbb414 471 //
472 // adds the suffix before ".root",
473 // e.g. TPC.Digits.root -> TPC.DigitsMerged.root
474 // made on Jiri Chudoba demand
475 //
21bf7095 476 AliDebug(1, Form("suffix=%s",suffix.Data()));
477 AliDebug(1, Form(" Digits File Name before: %s",fFileName.Data()));
a9bbb414 478
eeb1fb79 479 static const TString dotroot(".root");
88cb7938 480 const TString& suffixdotroot = suffix + dotroot;
481 fFileName = fFileName.ReplaceAll(dotroot,suffixdotroot);
a9bbb414 482
21bf7095 483 AliDebug(1, Form(" after : %s",fFileName.Data()));
88cb7938 484}
88cb7938 485
a9bbb414 486//______________________________________________________________________________
88cb7938 487Bool_t AliDataLoader::CheckReload()
488{
a9bbb414 489 //
490 // Checks if we have to reload given file
491 //
492 if (fFile == 0x0) return kFALSE;
493 TString tmp = SetFileOffset(fFileName);
494 if (tmp.CompareTo(fFile->GetName())) return kTRUE; //file must be reloaded
495 return kFALSE;
88cb7938 496}
88cb7938 497
a9bbb414 498//______________________________________________________________________________
88cb7938 499const TString AliDataLoader::SetFileOffset(const TString& fname)
500{
a9bbb414 501 //
502 // Return fname
503 //
88cb7938 504 Long_t offset = (Long_t)GetRunLoader()->GetFileOffset();
18b43626 505 if (fNEventsPerFile > 0) {
506 offset = GetRunLoader()->GetEventNumber()/fNEventsPerFile;
507 }
88cb7938 508 if (offset < 1) return fname;
a9bbb414 509
88cb7938 510 TString soffset;
511 soffset += offset;//automatic conversion to string
512 TString dotroot(".root");
513 const TString& offfsetdotroot = offset + dotroot;
514 TString out = fname;
515 out = out.ReplaceAll(dotroot,offfsetdotroot);
21bf7095 516 AliDebug(1, Form("in=%s out=%s.",fname.Data(),out.Data()));
88cb7938 517 return out;
88cb7938 518}
88cb7938 519
a9bbb414 520//______________________________________________________________________________
88cb7938 521void AliDataLoader::SetFileOption(Option_t* newopt)
522{
a9bbb414 523 //
524 // Sets file option
525 //
88cb7938 526 if (fFileOption.CompareTo(newopt) == 0) return;
527 fFileOption = newopt;
528 Reload();
529}
88cb7938 530
a9bbb414 531//______________________________________________________________________________
88cb7938 532void AliDataLoader::SetCompressionLevel(Int_t cl)
533{
a9bbb414 534 //
535 // Sets comression level for data defined by di
536 //
88cb7938 537 fCompressionLevel = cl;
538 if (fFile) fFile->SetCompressionLevel(cl);
539}
88cb7938 540
a9bbb414 541//______________________________________________________________________________
88cb7938 542void AliDataLoader::MakeTree()
543{
a9bbb414 544 //
d0d4a6b3 545 // Makes tree for the current data loader
a9bbb414 546 //
88cb7938 547 AliTreeLoader* tl = dynamic_cast<AliTreeLoader*>(fBaseLoaders->At(0));
548 if (tl == 0x0)
549 {
21bf7095 550 AliError("Can not make a tree because main base loader is not a tree loader");
88cb7938 551 return;
552 }
553 tl->MakeTree();
554}
88cb7938 555
a9bbb414 556//______________________________________________________________________________
88cb7938 557Bool_t AliDataLoader::IsFileWritable() const
558{
a9bbb414 559 //
560 // Returns true if file is writable
561 //
562 return (fFile)?fFile->IsWritable():kFALSE;
88cb7938 563}
88cb7938 564
a9bbb414 565//______________________________________________________________________________
88cb7938 566Bool_t AliDataLoader::IsFileOpen() const
567{
a9bbb414 568 //
569 // Returns true if file is writable
570 //
571 return (fFile)?fFile->IsOpen():kFALSE;
88cb7938 572}
88cb7938 573
a9bbb414 574//______________________________________________________________________________
88cb7938 575Bool_t AliDataLoader::IsOptionContrary(const TString& option) const
576{
a9bbb414 577 // Checks if passed option is contrary with file open option
578 // which is passed option "writable" and existing option not wriable
579 // in reverse case it is no harm so it is NOT contrary
88cb7938 580 if (fFile == 0x0) return kFALSE; //file is not opened - no problem
581
582 if ( ( AliLoader::IsOptionWritable(option) == kTRUE ) && // passed option is writable and
583 ( AliLoader::IsOptionWritable(fFileOption) == kFALSE ) ) // existing one is not writable
584 {
585 return kTRUE;
586 }
a9bbb414 587
88cb7938 588 return kFALSE;
589}
a9bbb414 590
591
592//______________________________________________________________________________
88cb7938 593void AliDataLoader::AddBaseLoader(AliBaseLoader* bl)
594{
a9bbb414 595 //Adds a base loader to lits of base loaders managed by this data loader
596 //Managed data/task will be stored in proper root directory,
597 //and posted to
598 // - in case of tree/object - data folder connected with detector associated with this data loader
599 // - in case of task - parental task which defined in this AliTaskLoader
600
601 if (bl == 0x0)
602 {
603 AliWarning("Pointer is null.");
604 return;
605 }
606
607 TObject* obj = fBaseLoaders->FindObject(bl->GetName());
608 if (obj)
609 {
610 AliError("Can not add this base loader.");
611 AliError(Form("There exists already base loader which manages data named %s for this detector.",obj->GetName()));
612 return;
613 }
88cb7938 614
a9bbb414 615 fBaseLoaders->Add(bl);
88cb7938 616}
617
a9bbb414 618//______________________________________________________________________________
88cb7938 619AliBaseLoader* AliDataLoader::GetBaseLoader(const TString& name) const
620{
a9bbb414 621 //
622 // Return pointer to base loader
623 //
88cb7938 624 return dynamic_cast<AliBaseLoader*>(fBaseLoaders->FindObject(name));
625}
88cb7938 626
a9bbb414 627//______________________________________________________________________________
88cb7938 628AliBaseLoader* AliDataLoader::GetBaseLoader(Int_t n) const
629{
a9bbb414 630 //
d0d4a6b3 631 // Gets the n-th base loader (what is n?)
a9bbb414 632 //
633 return dynamic_cast<AliBaseLoader*>(fBaseLoaders->At(n));
88cb7938 634}
88cb7938 635
a9bbb414 636//______________________________________________________________________________
88cb7938 637TTree* AliDataLoader::Tree() const
638{
a9bbb414 639 // Returns tree from the main base loader
640 // it is just shortcut method for comfort of user
641 // main storage object does not have to be Tree -
642 // that is why first we need to check if it is a TreeLoader
643 AliTreeLoader* tl = dynamic_cast<AliTreeLoader*>(GetBaseLoader(0));
644 if (tl == 0x0) return 0x0;
645 return tl->Tree();
88cb7938 646}
88cb7938 647
a9bbb414 648//______________________________________________________________________________
88cb7938 649void AliDataLoader::SetDirName(TString& dirname)
650{
a9bbb414 651 //
d0d4a6b3 652 // Sets the directory name where the files will be stored
a9bbb414 653 //
21bf7095 654 AliDebug(10, Form("FileName before %s",fFileName.Data()));
88cb7938 655 Int_t n = fFileName.Last('/');
21bf7095 656 AliDebug(10, Form("Slash found on pos %d",n));
88cb7938 657 if (n > 0) fFileName = fFileName.Remove(0,n+1);
21bf7095 658 AliDebug(10, Form("Core FileName %s",fFileName.Data()));
fca6cd9f 659 fFileName = dirname + fFileName;
21bf7095 660 AliDebug(10, Form("FileName after %s",fFileName.Data()));
88cb7938 661}
a9bbb414 662
663//______________________________________________________________________________
88cb7938 664AliObjectLoader* AliDataLoader::GetBaseDataLoader()
665{
a9bbb414 666 //
d0d4a6b3 667 // Gets the base data loader
a9bbb414 668 //
669 return dynamic_cast<AliObjectLoader*>(GetBaseLoader(kData));
88cb7938 670}
a9bbb414 671
672//______________________________________________________________________________
88cb7938 673AliTaskLoader* AliDataLoader::GetBaseTaskLoader()
674{
a9bbb414 675 //
d0d4a6b3 676 // Gets the base task loader
a9bbb414 677 //
678 return dynamic_cast<AliTaskLoader*>(GetBaseLoader(kTask));
88cb7938 679}
a9bbb414 680
681//______________________________________________________________________________
88cb7938 682AliBaseLoader* AliDataLoader::GetBaseQALoader()
683{
a9bbb414 684 //
d0d4a6b3 685 // Gets the base QA loader
a9bbb414 686 //
88cb7938 687 return GetBaseLoader(kQA);
688}
a9bbb414 689
690//______________________________________________________________________________
88cb7938 691AliTaskLoader* AliDataLoader::GetBaseQATaskLoader()
692{
a9bbb414 693 //
694 // Returns pointer to QA base loader
695 //
696 return dynamic_cast<AliTaskLoader*>(GetBaseLoader(kQATask));
88cb7938 697}
a9bbb414 698
699//______________________________________________________________________________
88cb7938 700void AliDataLoader::SetBaseDataLoader(AliBaseLoader* bl)
701{
a9bbb414 702 //
703 // Sets data base loader
704 //
88cb7938 705 if (bl == 0x0)
a9bbb414 706 {
707 AliError("Parameter is null");
708 return;
709 }
88cb7938 710 if (GetBaseDataLoader()) delete GetBaseDataLoader();
711 fBaseLoaders->AddAt(bl,kData);
712}
a9bbb414 713
714//______________________________________________________________________________
88cb7938 715void AliDataLoader::SetBaseTaskLoader(AliTaskLoader* bl)
716{
a9bbb414 717 //
718 // Sets Task base loader
719 //
88cb7938 720 if (bl == 0x0)
721 {
21bf7095 722 AliError("Parameter is null");
88cb7938 723 return;
724 }
725 if (GetBaseTaskLoader()) delete GetBaseTaskLoader();
726 fBaseLoaders->AddAt(bl,kTask);
727}
a9bbb414 728
729//______________________________________________________________________________
88cb7938 730void AliDataLoader::SetBaseQALoader(AliBaseLoader* bl)
731{
a9bbb414 732 //
733 // Sets QA base loader
734 //
88cb7938 735 if (bl == 0x0)
a9bbb414 736 {
737 AliError("Parameter is null");
738 return;
739 }
88cb7938 740 if (GetBaseQALoader()) delete GetBaseQALoader();
741 fBaseLoaders->AddAt(bl,kQA);
742}
a9bbb414 743
744//______________________________________________________________________________
88cb7938 745void AliDataLoader::SetBaseQATaskLoader(AliTaskLoader* bl)
746{
a9bbb414 747 //
748 // Sets QA Task base loader
749 //
88cb7938 750 if (bl == 0x0)
a9bbb414 751 {
752 AliError("Parameter is null");
753 return;
88cb7938 754 }
755 if (GetBaseQATaskLoader()) delete GetBaseQATaskLoader();
756 fBaseLoaders->AddAt(bl,kQATask);
757}
a9bbb414 758
759//______________________________________________________________________________
f0f6f856 760void AliDataLoader::Synchronize()
761{
a9bbb414 762 //
763 // Synchronizes all writable files
764 //
504b172d 765 if ( fFile ) fFile->Flush();
f0f6f856 766}
88cb7938 767
88cb7938 768
769