Message: Re: root histograms for more run in a macro file Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: root histograms for more run in a macro file 

Forum: Analysis
Re: None root histograms for more run in a macro file (elnaz yazd)
Date: 01 Oct, 2013
From: Ivana Hrivnacova <Ivana Hrivnacova>

You can select a different file name for each run in your macro

 /analysis/setFileName MyFile_run1
 /run/beamOn 1000
 /analysis/setFileName MyFile_run2
 /run/beamOn 1000

Then, in your RunAction::BeginOfRunAction(), you should put just:

 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
 analysisManager->OpenFile();

to use the file name set via a macro.

To avoid re-creating your histograms/ntuples for each run, you should also better create them in your RunAction::RunAction (constructor), and move the line

 delete G4AnalysisManager::Instance(); 

in the RunAction::~RunAction (destructor). Then the histograms/ntuples will be just reset when executing analysisManager->CloseFile(), which call should be kept together with analysisManager->Write() in RunAction::EndOfRunAction().

Best regards,

 Add Message Add Message
to: "Re: root histograms for more run in a macro file"

 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 ]