Message: Re: Memory use by ROOT histograms Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Memory use by ROOT histograms 

Forum: Analysis
Re: Question Memory use by ROOT histograms (Alexander Zyazin)
Re: None Re: Memory use by ROOT histograms (Andreas Pfeiffer)
Re: None Re: Memory use by ROOT histograms (Ivana Hrivnacova)
Date: 23 May, 2014
From: Alexander Zyazin <Alexander Zyazin>

Hi Andreas and Ivana,

Thank you for your fast reaction. Indeed I'm using g4tools-based analysis manager, and I would like to keep using it at least for the time being. How do you instantiate the master object for use in workers? I tried simply to create different classes for MasterRunAction and WorkerRunAction skipping the for loop in the latter and then trying to fill the histograms from Run::RecordEvent():

void Run::RecordEvent(const G4Event* evt)
{
  G4AnalysisManager* anManager = G4AnalysisManager::Instance();
  G4int evtID = evt->GetEventID();
  std::ostringstream ostr;
  ostr<<"h"<<evtID+1;
  G4int histID = anManager->GetH2Id(G4String(ostr.str()));
  ....
  anManager->FillH2(histID,xBin,yBin,value);
  ....
}

As I understand it, this doesn't work, because GetH2Id() tries to retrieve histogram ID from a thread-local vector of histograms, which is empty. I also tried to move histogram booking to BeginOfEventAction(), using the same code as before in RecordEvent() and initializing event action per worker (in Build() method):

void EventAction::BeginOfEventAction(const G4Event* evt)
{
  evtID = evt->GetEventID();
  std::ostringstream ostr;
  ostr<<"h"<<evtID+1;
  G4String histName;
  histName = G4String(ostr.str());
  G4AnalysisManager* anManager = G4AnalysisManager::Instance();
  histID = anManager->CreateH2(histName, histName,nbXbins,1,nbXbins,nbYbins,1,nbYbins);
}

This actually saves memory and fills histograms, but causes a segfault when trying to merge them. I'm also afraid though that even with successful merging resulting histograms would be different from what I wanted, because they are merged by ID and not by name, as far as I understand.

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

1 None: Re: Memory use by ROOT histograms   (Ivana Hrivnacova - 27 May, 2014)
(_ None: Re: Memory use by ROOT histograms   (Alexander Zyazin - 28 May, 2014)
 Add Message Add Message
to: "Re: Memory use by ROOT histograms"

 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 ]