Message: Re: AnalysisManager root performance for large numbers of ntuples Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: AnalysisManager root performance for large numbers of ntuples 

Forum: Analysis
Re: None AnalysisManager root performance for large numbers of ntuples (Sebastian Heil)
Date: 15 Jan, 2014
From: Sebastian Heil <Sebastian Heil>

Hi everyone,

if someone else should stumble upon this, I can provide a workaround for the time being:

Reducing the size of the ntuple and instead generating multiple ntuples with less columns the performance increases significantly. (At that point I have to admit that previously I was very sloppy regarding the word ntuples and thus the title of this thread is a little missleading. Actually the problem is with ntuples with large numbers of columns.)

If the ntuple was generated with a loop, this can be done with something like:

MyRunAction::MyRunAction() :
		G4UserRunAction() {
[...]
	analysisManager->CreateNtuple("Etot", "Total Energy");
	analysisManager->CreateNtupleDColumn("E_tot");
	for (int i = 0; i < numberOfDetectors; i++) {
		if (i % columnsInNtuple == 0) { 
                        // for every ith detector make a new ntuple with name Det_i
			std::stringstream ss;
			ss << "Det_";
			ss << i / properties->getTreeEntries();
			G4String str = ss.str();
			analysisManager->FinishNtuple();
			analysisManager->CreateNtuple(str, "E for Det");
		}
        analysisManager->CreateNtupleDColumn(name[i]);
	}
analysisManager->FinishNtuple();
}

Of course the filling of the ntuples has to be adapted as well:

void MyEventAction::EndOfEventAction(const G4Event* event) {
[...]
        for (int i = 0; i < numberOfDetectors; i++) {
		G4double eDep = ((*detectorHC)[i])->GetEdep();
		analysisManager->FillNtupleDColumn(1 + i / columnsInNtuple,i % columnsInNtuple, eDep); 
                // The offset 1 is because of the ntuple named "Etot"
	}
}

Best regards,

Sebastian Heil

 Add Message Add Message
to: "Re: AnalysisManager root performance for large numbers of ntuples"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]