Message: Re: 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 Re: Create a new 1D histogram at each run in the same ROOT file 

Forum: Analysis
Re: None Create a new 1D histogram at each run in the same ROOT file (Delaune Olivier)
Date: 05 Sep, 2017
From: Ivana Hrivnacova <Ivana Hrivnacova>

Hello,

I don't think that we have an example with such use case, but you can adapt your application code to do this with the existing analysis functions.

It is not necessary to open/close your output file with each run. To handle this, you can add the options fOpenFile, fCloseFile to your run action class and define command which will allow to set them interactively.

If you want to keep histograms from the first run only, you can inactivate them after the first run was processed, and activate them back in the end of run action for the last run to get them written in a file.

Below, I give an example of a macro, where the histograms are filled in the last run (as this can be completely handled from a macro) and ntuples are filled during all runs.

  /run/initialize

  # switch on histograms activation
  # and inactivate histograms 
  /analysis/setActivation true
  /analysis/h1/setActivationToAll  false

  # (In)activate open/close file 
  /B4/run/setOpenFile true
  /B4/run/setCloseFile false

  # First run
  /run/beamOn 1000

  # Inactivate open file
  /B4/run/setOpenFile false

  # Two more runs
  /run/beamOn 1000
  /run/beamOn 1000

  # Last run
  # Activate write file
  /B4/run/setCloseFile true
  # Activate histograms
  /analysis/h1/setActivationToAll  true
  /run/beamOn 1000

Best regards,

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   (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: "Re: 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 ]