Message: Create a new 1D histogram at each run in the same ROOT file Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Create a new 1D histogram at each run in the same ROOT file 

Forum: Analysis
Date: 01 Sep, 2017
From: Delaune Olivier <Delaune Olivier>

Hello, my simulation uses an input file like this one

/control/verbose 2

/run/initialize

/gun/particle gamma

/gun/energy 1173.228 keV /run/beamOn 1000000 #99.85%

/gun/energy 1332.492 keV /run/beamOn 1000000 #99.9826%

/gun/particle ion /gun/ion 27 60 /run/beamOn 1000000

I am looking for a way to create a ROOT file with the following content

file.root

|->t
|->H0
|->H1
|->H2

with

* t, a ntuple that contains all the event of the three runs (1173 keV gamma-ray, 1332 keV gamma-ray and 60Co decay), 
* H0, an 1D histogram that contains the output of the first run (1173 keV gamma-ray),
* H1, an 1D histogram that contains the output of the first run (1332 keV gamma-ray),
* H2, an 1D histogram that contains the output of the first run (60Co decay).

My code works if I have only one histogram in my ROOT file. The "problem" is that the ROOT file is opened and that the histograms are booked in RunAction::BeginOfRunAction (and the ROOT file is saved and closed in RunAction::EndOfRunAction). This means that the ROOT file is overwritten at each new run.

Do you know any example where the analysisManager is defined "globally" (in the main function for example) in such way it is created and opened at the beginning of the macro and saved and closed when all the runs within the macro have been passed? Of course, I am interested in by a solution that is thread-safe and with which I can use multithreading.

If no such example exists, could you give me some hints on the way to do that?

Thanks in advance

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

1 None: Re: Create a new 1D histogram at each run in the same ROOT file   (Ivana Hrivnacova - 05 Sep, 2017)
(_ None: Re: Create a new 1D histogram at each run in the same ROOT file   (Delaune Olivier - 06 Sep, 2017)
(_ None: Re: Create a new 1D histogram at each run in the same ROOT file   (Ivana Hrivnacova - 07 Sep, 2017)
 Add Message Add Message
to: "Create a new 1D histogram at each run in the same ROOT 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 ]