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