Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 1a16614d authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

Merge branch 'TBVamos' into 'preprod'

Change the file incrementation method

See merge request IPNL_GAMMA/narval_emulator!47
parents 0faa6aa2 0ca57e77
...@@ -177,14 +177,14 @@ Int_t TreeBuilder::SetInput() ...@@ -177,14 +177,14 @@ Int_t TreeBuilder::SetInput()
timestamp = ((AgataKey*)fAgataComposite->GetKey())->GetTimeStamp(); timestamp = ((AgataKey*)fAgataComposite->GetKey())->GetTimeStamp();
} }
// cout<<AgataKeyFactory::theFactory()->GetMessage(((AgataKey*)fAgataComposite->GetKey())->GetMessage())<<endl; // cout<<AgataKeyFactory::theFactory()->GetMessage(((AgataKey*)fAgataComposite->GetKey())->GetMessage())<<endl;
// for(int i=0 ; i<fAgataComposite->GetNbSubFrame() ; i++) // for(int i=0 ; i<fAgataComposite->GetNbSubFrame() ; i++)
// { // {
// cout<<AgataKeyFactory::theFactory()->GetMessage( ((AgataKey*)fAgataComposite->GetSubKey(i))->GetMessage() )<<" "; // cout<<AgataKeyFactory::theFactory()->GetMessage( ((AgataKey*)fAgataComposite->GetSubKey(i))->GetMessage() )<<" ";
// } // }
// cout<<endl; // cout<<endl;
for(int idet=0 ; idet<fListOfDets.size() ; idet ++) { for(int idet=0 ; idet<fListOfDets.size() ; idet ++) {
TB_Detector *det = fListOfDets[idet]; TB_Detector *det = fListOfDets[idet];
...@@ -238,6 +238,10 @@ UInt_t TreeBuilder::ProcessBlock(ADF::FrameBlock &inBlock) ...@@ -238,6 +238,10 @@ UInt_t TreeBuilder::ProcessBlock(ADF::FrameBlock &inBlock)
nevs++; nevs++;
fReadEvts++; fReadEvts++;
if(fReadEvts%fAutoSave == 0) {
fTree->AutoSave("SaveSelf");
}
} }
fFrameIO.Detach(&inBlock, 0x0); fFrameIO.Detach(&inBlock, 0x0);
...@@ -256,24 +260,29 @@ void TreeBuilder::NewTree() ...@@ -256,24 +260,29 @@ void TreeBuilder::NewTree()
if(fFile) { if(fFile) {
fFile->cd(); fFile->cd();
fTree->Write(); fTree->Write();
fTree->SetDirectory(nullptr);
fFile->Close(); fFile->Close();
} }
TString Name = Form("%s/%s%.4d.root",fSaveDir.data(),fNamePatern.data(),fCurrentFileNumber); TString Name = Form("%s/%s%.4d.root",fSaveDir.data(),fNamePatern.data(),fCurrentFileNumber);
fFile = new TFile(Name,"recreate"); fFile = new TFile(Name,"recreate");
// default compression level, good compression and processing time // default compression level, good compression and processing time
fFile->SetCompressionLevel(); fFile->SetCompressionLevel();
fTree = new TTree(fTreeName.data(),fTreeName.data()); if(fTree == nullptr) {
fTree->SetAutoSave(-50000000); // Auto save all 50MBytes fTree = new TTree(fTreeName.data(),fTreeName.data());
fCurrentFileNumber++;
for(int idet=0 ; idet < fListOfDets.size() ; idet++) { for(int idet=0 ; idet < fListOfDets.size() ; idet++) {
fListOfDets[idet]->SetTree(fTree); fListOfDets[idet]->SetTree(fTree);
fListOfDets[idet]->InitTree(); fListOfDets[idet]->InitTree();
}
}
else {
fTree->Reset();
fTree->SetDirectory(fFile);
} }
fCurrentFileNumber++;
} }
UInt_t TreeBuilder::GetParameters(const std::string& confFile, Bool_t doList) UInt_t TreeBuilder::GetParameters(const std::string& confFile, Bool_t doList)
......
...@@ -57,7 +57,8 @@ protected: ...@@ -57,7 +57,8 @@ protected:
protected: protected:
static const Long64_t fMaxFileSize = 2*1024*1024*1024LL; static const Long64_t fMaxFileSize = 2*1024*1024*1024LL; //! the output file number is incremented all fMaxFileSize (Here 2GB)
static const Long64_t fAutoSave = 1*100*1000; //! the tree is saved all fAutoSave events (Here, 1e5 evts)
string fSaveDir = ""; string fSaveDir = "";
string fNamePatern = ""; string fNamePatern = "";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment