Message: creating one Ntuple Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None creating one Ntuple  

Forum: Analysis
Date: 20 May, 2018
From: elnaz yazd <elnaz yazd>

Dear Sir/Madam

Thank You a lot for your time and consideration.

I want to score my result of more runs in same histo or Ntuple inside same root file. I do this in the following three step 1) I call a method to book histogram in main method after initialization

// User action initialization
  runManager->SetUserInitialization(new B1ActionInitialization());
  HistoManager* histoAnalysis = HistoManager::GetInstance();
  histoAnalysis->Book();

The Book() method is as follows:
void HistoManager::Book()
{
  // Create or get analysis manager
  G4AnalysisManager*  fAnalysisManager = G4AnalysisManager::Instance();
  fAnalysisManager->SetFileName("proton");
  fAnalysisManager->SetVerboseLevel(1);
  fAnalysisManager->SetFirstHistoId(1);
  fAnalysisManager->SetActivation(true);  // enable inactivation of histograms

  // Creating histograms
  //
fAnalysisManager->CreateH1("h0","Residual Energy (MeV)",400,-200,200.*mm);

  if ( fAnalysisManager->IsActive() ) {
    fAnalysisManager->OpenFile();
  }
 }

2) Then I call a function to fill histogram in Stepping function

HistoManager* histoAnalysis = HistoManager::GetInstance(); histoAnalysis->Fill(PostStepX, eKinPost);

The Fill method is as follows: void HistoManager::Fill(G4double pos, G4double eneKin) {

    // fill histograms
  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
   analysisManager->FillH1(1, pos, eneKin);

 }

3) and at last I call a Method to write and close the file after job termination in main method.

// Job termination
  histoAnalysis->Save();
  delete visManager;
  delete runManager;
  delete histoAnalysis;

The Save method is as follows:
 void HistoManager::Save()
{

  // save histograms
  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();  
  if ( analysisManager->IsActive() ) {  
    analysisManager->Write();
    analysisManager->CloseFile();
  }      
 }

When I execute the program, the following message appears and  a empty root file with empty histogram is created.
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : Analysis_W011
      issued by : G4THnManager::FillH1
      histogram 1 does not exist.
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

Would you please help me to resole this problem.

If it is another way to do this job (Filling results of more run in same root histogram in same root file), pleases hint me to use that.

With Best regards, yazdan

With Best Regard

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: creating one Ntuple   (Ivana Hrivnacova - 31 May, 2018)
 Add Message Add Message
to: "creating one Ntuple "

 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 ]