From f0f6f85615154d428afd39751009ec53ff441bb7 Mon Sep 17 00:00:00 2001 From: hristov Date: Wed, 13 Aug 2003 16:41:51 +0000 Subject: [PATCH] Method for file synchronization (P.Skowronski) --- STEER/AliDataLoader.cxx | 7 +++++++ STEER/AliDataLoader.h | 3 +++ STEER/AliLoader.cxx | 13 +++++++++++++ STEER/AliLoader.h | 2 ++ STEER/AliRun.cxx | 3 ++- STEER/AliRunLoader.cxx | 15 +++++++++++++++ STEER/AliRunLoader.h | 3 ++- 7 files changed, 44 insertions(+), 2 deletions(-) diff --git a/STEER/AliDataLoader.cxx b/STEER/AliDataLoader.cxx index 2ec209cd768..76b0e91846c 100644 --- a/STEER/AliDataLoader.cxx +++ b/STEER/AliDataLoader.cxx @@ -665,6 +665,13 @@ void AliDataLoader::SetBaseQATaskLoader(AliTaskLoader* bl) if (GetBaseQATaskLoader()) delete GetBaseQATaskLoader(); fBaseLoaders->AddAt(bl,kQATask); } +void AliDataLoader::Synchronize() +{ + //synchrinizes all writtable files + if ( fFile == 0x0 ) return; + if ( fFile->IsWritable() == kFALSE ) return; + fFile->Write(0,TObject::kOverwrite); +} /*****************************************************************************/ /*****************************************************************************/ diff --git a/STEER/AliDataLoader.h b/STEER/AliDataLoader.h index e04db605b4a..423dc36910b 100644 --- a/STEER/AliDataLoader.h +++ b/STEER/AliDataLoader.h @@ -96,6 +96,9 @@ class AliDataLoader: public TNamed Bool_t IsFileWritable() const; Bool_t IsFileOpen() const; Bool_t IsOptionContrary(const TString& option) const; + + void Synchronize(); + protected: Int_t GetDebug() const; AliRunLoader* GetRunLoader();//gets the run-loader from event folder diff --git a/STEER/AliLoader.cxx b/STEER/AliLoader.cxx index fb05bb94adc..c38995bb732 100644 --- a/STEER/AliLoader.cxx +++ b/STEER/AliLoader.cxx @@ -860,6 +860,19 @@ void AliLoader::SetTAddrInDet() det->SetTreeAddress(); } /*****************************************************************************/ + +void AliLoader::Synchronize() +{ + //synchrinizes all writtable files + TIter next(fDataLoaders); + AliDataLoader* dl; + while ((dl = (AliDataLoader*)next())) + { + dl->Synchronize(); + } + +} +/*****************************************************************************/ /*****************************************************************************/ /*****************************************************************************/ diff --git a/STEER/AliLoader.h b/STEER/AliLoader.h index 517b8a6a59d..374c0479648 100644 --- a/STEER/AliLoader.h +++ b/STEER/AliLoader.h @@ -202,6 +202,8 @@ class AliLoader: public TNamed void SetDigitsFileNameSuffix(const TString& suffix);//adds the suffix before ".root", //e.g. TPC.Digits.root -> TPC.DigitsMerged.root //made on Jiri Chudoba demand + void Synchronize(); + protected: /*********************************************/ diff --git a/STEER/AliRun.cxx b/STEER/AliRun.cxx index e543370b762..9f39bb9aef9 100644 --- a/STEER/AliRun.cxx +++ b/STEER/AliRun.cxx @@ -429,7 +429,6 @@ void AliRun::FinishRun() // Called at the end of the run. // - if(fLego) { if (GetDebug()) Info("FinishRun"," Finish Lego"); @@ -464,6 +463,8 @@ void AliRun::FinishRun() // Clean detector information if (GetDebug()) Info("FinishRun"," fGenerator->FinishRun()"); fGenerator->FinishRun(); + + fRunLoader->Synchronize(); } //_______________________________________________________________________ diff --git a/STEER/AliRunLoader.cxx b/STEER/AliRunLoader.cxx index c1a6facd751..5c6a81aa57b 100644 --- a/STEER/AliRunLoader.cxx +++ b/STEER/AliRunLoader.cxx @@ -1601,5 +1601,20 @@ void AliRunLoader::SetDetectorAddresses() } } /*****************************************************************************/ + +void AliRunLoader::Synchronize() +{ + //synchrinizes all writtable files + TIter next(fLoaders); + AliLoader *loader; + while((loader = (AliLoader*)next())) + { + loader->Synchronize(); + } + + fKineDataLoader->Synchronize(); + fTrackRefsDataLoader->Synchronize(); + +} /*****************************************************************************/ /*****************************************************************************/ diff --git a/STEER/AliRunLoader.h b/STEER/AliRunLoader.h index ea1634a5e39..8ce45729642 100644 --- a/STEER/AliRunLoader.h +++ b/STEER/AliRunLoader.h @@ -143,7 +143,8 @@ class AliRunLoader: public TNamed const TObjArray* GetArrayOfLoaders() const {return fLoaders;} Int_t GetDebug() const {return AliLoader::GetDebug();} void cd(){fgRunLoader = this;} - + void Synchronize(); + protected: /**********************************************/ /************ PROTECTED ***************/ -- 2.43.0