Skip to content

Commit

Permalink
Merge 57bf2d7 into 40e32ae
Browse files Browse the repository at this point in the history
  • Loading branch information
peremato authored May 6, 2024
2 parents 40e32ae + 57bf2d7 commit 315eb4a
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 1,250 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Accessors = "0.1"
Corpuscles = "2"
FHist = "0.10"
Graphs = "1"
PrettyTables = "2"
StaticArrays = "1.9"
StructArrays = "0.6"
UnROOT = "0.10"
YAML = "0.4"
PrettyTables = "2"
julia = "1"

[extras]
Expand Down
7 changes: 7 additions & 0 deletions docs/src/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@

# Release Notes


## 0.4.0
### New Functionality
- Added function `RootIO.create_getter(reader::Reader, bname::String; selection=nothing)` to create a getter function for a specific branch.
The optional argument allows to select leaves to be read.
- The overall performance is highly improved (factor 3 with respect previous version)

## 0.3.1
### Bug Fixes
- Legacy podio test fixed
Expand Down
1 change: 1 addition & 0 deletions examples/FCC/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
EDM4hep = "eb32b910-dde9-4347-8fce-cd6be3498f0c"
Expand Down
36 changes: 22 additions & 14 deletions examples/FCC/analysis_MT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,25 @@ using DataFrames
include("analysis_functions.jl")

fnames = """
events_000189367.root
events_000787350.root
events_001145354.root
events_001680909.root
events_001893485.root
events_002227306.root
events_002498645.root
events_002528960.root
events_002763770.root
events_003579490.root
events_017670037.root
events_020572434.root
events_031357685.root
events_043326581.root
events_063734251.root
events_067932171.root
events_100167569.root
events_115460704.root
events_137485372.root
events_184128869.root
events_192636993.root
events_193400175.root
"""
froot = "root://eospublic.cern.ch//eos/experiment/fcc/ee/generation/DelphesEvents/winter2023/IDEA/p8_ee_ZZ_ecm240"
froot = "root://eospublic.cern.ch//eos/experiment/fcc/ee/generation/DelphesEvents/winter2023/IDEA/wzp6_ee_mumuH_ecm240"
files = joinpath.(Ref(froot),split(fnames))

#files = "root://eospublic.cern.ch//eos/experiment/fcc/ee/generation/DelphesEvents/winter2023/IDEA/p8_ee_ZZ_ecm240/events_000189367.root"
files = "/Users/mato/cernbox/Data/events_000189367-rntuple-rc2.root"
#files = "/Users/mato/cernbox/Data/events_000189367-rntuple-rc2.root"
#files = "/Users/mato/cernbox/Data/events_017670037.root"

reader = RootIO.Reader(files);
events = RootIO.get(reader, "events");
Expand All @@ -38,13 +41,18 @@ mutable struct MyData <: AbstractAnalysisData
MyData() = new(DataFrame(Zcand_m = Float32[], Zcand_recoil_m = Float32[], Zcand_q = Int32[]), 0, 0)
end

get_μIDs = RootIO.create_getter(reader, "Muon#0")
get_recps = RootIO.create_getter(reader, "ReconstructedParticles"; selection=[:energy,:momentum,:charge,:mass])

function myanalysis!(data::MyData, reader, events)
for evt in events
data.pevts += 1 # count process events
μIDs = RootIO.get(reader, evt, "Muon_objIdx"; register=false) # get the ids of muons
#μIDs = RootIO.get(reader, evt, "Muon#0"; register=false) # get the ids of muons
μIDs = get_μIDs(evt)
length(μIDs) < 2 && continue # skip if less than 2

recps = RootIO.get(reader, evt, "ReconstructedParticles"; register=false)
#recps = RootIO.get(reader, evt, "ReconstructedParticles"; register=false)
recps = get_recps(evt)
muons = recps[μIDs] # use the ids to subset the reco particles

sel_muons = filter(x -> pₜ(x) > 10GeV, muons) # select the the Pt of muons
Expand Down
42 changes: 42 additions & 0 deletions examples/LCIO/edm4heo_hrecoil.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using EDM4hep
using EDM4hep.RootIO


#file = "/Users/gaede/data/rv02-02.sv02-02.mILD_l5_o1_v02.E250-SetA.I402003.Pe2e2h.eL.pR.n000.d_dstm_15089_0.edm4hep_v02-03-02.root"
#file = "/Users/gaede/data/rv02-02.sv02-02.mILD_l5_o1_v02.E250-SetA.I402003.Pe2e2h.eL.pR.n000.d_dstm_15089_0.edm4hep.root"
#file = "/Users/gaede/data/rv02-02.sv02-02.mILD_l5_o1_v02.E250-SetA.I402003.Pe2e2h.eL.pR.n000.d_dstm_15089_0_NEW.edm4hep.root"

#file = "/Users/mato/Downloads/rv02-02.sv02-02.mILD_l5_o1_v02.E250-SetA.I402003.Pe2e2h.eL.pR.n000.d_dstm_15089_0.edm4hep.root"
#file = "/Users/mato/Downloads/rv02-02.sv02-02.mILD_l5_o1_v02.E250-SetA.I402003.Pe2e2h.eL.pR.n000.d_dstm_15089_0_NEW.edm4hep.root"
file = "/Users/mato/Downloads/rv02-02.sv02-02.mILD_l5_o1_v02.E250-SetA.I402003.Pe2e2h.eL.pR.n000.d_dstm_15089_0.edm4hep_v02-03-02.root"
##file = "/Users/mato/Downloads/rv02-02.sv02-02.mILD_l5_o1_v02.E250_pandorapfo_10evt_edm4hep.root"
reader = RootIO.Reader(file)

dimuonmass = Float64[]
recoilmass = Float64[]

mass4v( a ) = sqrt( a[1]^2 - a[2]^2 - a[3]^2 - a[4]^2 )



events = RootIO.get(reader, "events");
#for evt in events
# evt
#if 1==1
evt = events[1];
pfos = RootIO.get(reader, evt, "PandoraPFOs");

muons = []
for pfo in pfos

if abs( pfo.type ) == 13

# --- save the muon 4-vector (a simple julia vector w/ 4 elements)
push!( muons, [ pfo.energy, pfo.momentum.x, pfo.momentum.y, pfo.momentum.z ] )
print( pfo.type )

end
end
#end

muons
Loading

0 comments on commit 315eb4a

Please sign in to comment.