From: shahoian Date: Mon, 19 Aug 2013 11:55:12 +0000 (+0000) Subject: Possibility to limit the memory allocated for trees created in the reconstruction X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=5ee8b64f181b8435693e322a8044cdf2a3997158 Possibility to limit the memory allocated for trees created in the reconstruction Use reco.SetTreeBuffSize(xxx) from the rec.C to change the memory in bytes (by default: 30mb per tree) --- diff --git a/STEER/STEER/AliReconstruction.cxx b/STEER/STEER/AliReconstruction.cxx index 4446c6c6ac6..fa8deb1b87a 100644 --- a/STEER/STEER/AliReconstruction.cxx +++ b/STEER/STEER/AliReconstruction.cxx @@ -317,6 +317,12 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename) : fSspecie(0), fNhighPt(0), fShighPt(0), + // + fTreeBuffSize(30000000), + fMemCountESD(0), + fMemCountESDF(0), + fMemCountESDHLT(0), + // fUpgradeModule(""), fAnalysisMacro(), fAnalysis(0), @@ -442,6 +448,12 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : fSspecie(0), fNhighPt(0), fShighPt(0), + // + fTreeBuffSize(rec.fTreeBuffSize), + fMemCountESD(0), + fMemCountESDF(0), + fMemCountESDHLT(0), + // fUpgradeModule(""), fAnalysisMacro(rec.fAnalysisMacro), fAnalysis(0), @@ -615,6 +627,12 @@ AliReconstruction& AliReconstruction::operator = (const AliReconstruction& rec) fSspecie = 0; fNhighPt = 0; fShighPt = 0; + // + fTreeBuffSize = rec.fTreeBuffSize; + fMemCountESD = 0; + fMemCountESDF = 0; + fMemCountESDHLT = 0; + // fUpgradeModule=""; fAnalysisMacro = rec.fAnalysisMacro; fAnalysis = 0; @@ -2358,7 +2376,16 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) } // - ftree->Fill(); + Long64_t nbf; + nbf = ftree->Fill(); + if (fTreeBuffSize>0 && ftree->GetAutoFlush()<0 && (fMemCountESD += nbf)>fTreeBuffSize ) { // default limit is still not reached + nbf = ftree->GetZipBytes(); + if (nbf>0) nbf = -nbf; + else nbf = ftree->GetEntries(); + ftree->SetAutoFlush(nbf); + AliInfo(Form("Calling ftree->SetAutoFlush(%lld) | W:%lld T:%lld Z:%lld", + nbf,fMemCountESD,ftree->GetTotBytes(),ftree->GetZipBytes())); + } AliSysInfo::AddStamp(Form("ESDFill_%d",iEvent), 0,0,iEvent); // if (fWriteESDfriend) { @@ -2372,8 +2399,18 @@ Bool_t AliReconstruction::ProcessEvent(Int_t iEvent) ftree->AutoSave("SaveSelf"); if (fWriteESDfriend) ftreeF->AutoSave("SaveSelf"); } - // write HLT ESD - fhlttree->Fill(); + // write HLT ESD + + nbf = fhlttree->Fill(); + if (fTreeBuffSize>0 && fhlttree->GetAutoFlush()<0 && (fMemCountESDHLT += nbf)>fTreeBuffSize ) { // default limit is still not reached + nbf = fhlttree->GetZipBytes(); + if (nbf>0) nbf = -nbf; + else nbf = fhlttree->GetEntries(); + fhlttree->SetAutoFlush(nbf); + AliInfo(Form("Calling fhlttree->SetAutoFlush(%lld) | W:%lld T:%lld Z:%lld", + nbf,fMemCountESDHLT,fhlttree->GetTotBytes(),fhlttree->GetZipBytes())); + } + // call AliEVE if (fRunAliEVE) RunAliEVE(); @@ -4359,7 +4396,16 @@ void AliReconstruction::WriteESDfriend() { fesdf->SetSkipBit(kTRUE); } // - ftreeF->Fill(); + Long64_t nbf = ftreeF->Fill(); + if (fTreeBuffSize>0 && ftreeF->GetAutoFlush()<0 && (fMemCountESDF += nbf)>fTreeBuffSize ) { // default limit is still not reached + nbf = ftreeF->GetZipBytes(); + if (nbf>0) nbf = -nbf; + else nbf = ftreeF->GetEntries(); + ftreeF->SetAutoFlush(nbf); + AliInfo(Form("Calling ftreeF->SetAutoFlush(%lld) | W:%lld T:%lld Z:%lld", + nbf,fMemCountESDF,ftreeF->GetTotBytes(),ftreeF->GetZipBytes())); + } + } //_________________________________________________________________ diff --git a/STEER/STEER/AliReconstruction.h b/STEER/STEER/AliReconstruction.h index 309f685f7e2..207149ffd16 100644 --- a/STEER/STEER/AliReconstruction.h +++ b/STEER/STEER/AliReconstruction.h @@ -91,6 +91,7 @@ public: void SetLoadAlignData(const char* detectors) {fLoadAlignData = detectors;}; + void SetTreeBuffSize(Long64_t sz=30000000) {fTreeBuffSize = sz;} //*** Global reconstruction flag setters void SetRunMultFinder(Bool_t flag=kTRUE) {fRunMultFinder=flag;}; void SetRunVertexFinder(Bool_t flag=kTRUE) {fRunVertexFinder=flag;}; @@ -374,6 +375,12 @@ private: Int_t fNhighPt; //! Number of events, selected by IsHighPt Int_t fShighPt; //! Number of events, sampled from fNhighPt + // Counters for SetAutoFlush configuration + Long64_t fTreeBuffSize; // allowed uncompressed buffer size per tree + Long64_t fMemCountESD; //! accumulated ESD size before AutoSave + Long64_t fMemCountESDF; //! accumulated ESD size before AutoSave + Long64_t fMemCountESDHLT; //! accumulated ESD size before AutoSave + // // Upgrade detector reconstruction TString fUpgradeModule; Bool_t fUpgradeMask[kNDetectors]; @@ -388,7 +395,7 @@ private: Int_t fMaxVMEM; // max VMEM memory, MB static const char* fgkStopEvFName; // filename for stop.event stamp // - ClassDef(AliReconstruction, 45) // class for running the reconstruction + ClassDef(AliReconstruction, 46) // class for running the reconstruction }; #endif