Skip to content

Commit

Permalink
fix the ntuple processor and add an example macro
Browse files Browse the repository at this point in the history
  • Loading branch information
mastbaum committed Sep 16, 2014
1 parent 547da48 commit 2479355
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
8 changes: 3 additions & 5 deletions data/NTUPLE.ratdb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ valid_begin: [0, 0],
valid_end: [0, 0],

fields: [
"mc_id", "mc.mcEventID",
"mc_id", "mc.id",
"mc_numPE", "mc.numPE",
"mc_numNoise", "mc.numNoise",
"mc_fprompt", "mc.mcFprompt",
"mc_pdgcode", "mc.particle.pdgcode",
"mc_t", "mc.particle.t",
"mc_ke", "mc.particle.ke",
Expand All @@ -19,8 +17,8 @@ fields: [
"mc_px", "mc.particle.mom.X()",
"mc_py", "mc.particle.mom.Y()",
"mc_pz", "mc.particle.mom.Z()",
"mc_edep", "mc.summary.totalScintEdep",
"mc_edep_quenched", "mc.summary.totalScintEdepQuenched",
"mc_edep", "mc.GetMCSummary().totalScintEdep",
"mc_edep_quenched", "mc.GetMCSummary().totalScintEdepQuenched",
"mc_nhit", "mc.@pmt.size()",
],
}
Expand Down
30 changes: 30 additions & 0 deletions mac/ntuple.mac
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Example of creating a ROOT Ntuple output file

/glg4debug/glg4param omit_muon_processes 1.0
/glg4debug/glg4param omit_hadronic_processes 1.0

/rat/db/set DETECTOR experiment "cylinder"
/rat/db/set DETECTOR geo_file "cylinder/cylinder.geo"

/run/initialize

# BEGIN EVENT LOOP

/rat/proc count
/rat/procset update 10

# The first argument is the output filename, and the following arguments
# are a list of the Ntuples to write. The fields in these Ntuples are defined
# in NTUPLE.ratdb.
/rat/proc python
/rat/procset class "ratproc.Ntuple('ntuple.root', 'mc')"

#END EVENT LOOP

/generator/add combo gun:fill
/generator/vtx/set e- 0 0 0 10.0
/generator/pos/set 0 0 0
/generator/rate/set 1.0

/run/beamOn 100

1 change: 1 addition & 0 deletions python/ratproc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from count import Count
from hist import Hist
from deltat import DeltaT
from ntuple import Ntuple
2 changes: 1 addition & 1 deletion src/core/PythonProc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace RAT {

PythonProc::PythonProc() : Processor("python")
{
fPyProcName = dformat("proc_%d", fgProcCounter++);
fPyProcName = dformat("proc_%i", fgProcCounter++);
}

PythonProc::~PythonProc()
Expand Down

0 comments on commit 2479355

Please sign in to comment.