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)
Re: None Re: Memory use by ROOT histograms (Alexander Zyazin)
Re: None Re: Memory use by ROOT histograms (Ivana Hrivnacova)
Date: 28 May, 2014
From: Alexander Zyazin <Alexander Zyazin>

Hi Ivana,

For me simulation time is more important than memory considerations, therefore solution must work in MT mode. Also I expect writing in a file at the end of each event to be time-consuming. Actually, defining a pointer to the master instance of analysis manager with external linkage and then declaring it in the Run class helps to circumvent the problem for now.

MasterRunAction.cc:

...
G4AnalysisManager* masterManager;
...
void MasterRunAction::MasterRunAction()
{
  ...
  masterManager = G4AnalysisManager::Instance();
  ...
  }
}

Run.cc:

... extern G4AnalysisManager* masterManager;

namespace
{
  G4Mutex h2Mutex = G4MUTEX_INITIALIZER;
}

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

I still don't like this trick though because it's quick and dirty, but not really scalable: histograms still consume considerable amount of memory. Are there any plans to introduce histograms of types different than double? For example in ROOT there is a class THnSparse. Is it feasible to define it also in g4tools? It could work for me, because I have only ~50 entries in average per histogram (typically between 100x100 and 200x200 bins). But even trivial TH2I or TH2S would be helpful. I know that ntuples of int are supported, but I haven't looked at ntuples in detail yet, because switching to ntuples will also require changes in post-processing scripts, and I'm not sure that the effort will be justified.

Alexander

 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 ]