## Not run:
# # Load required libraries
# require(libamtrack)
# require(lattice)
# # Use example data set
# file.name <- system.file("extdata", "libamtrack.12C.H2O.active3.MeV27000.zip",
# package = "libamtrack")
# endian <- c("big", "little")[2]
# # Read in spc data, we use old style R reader, so endianess has to be given
# spc <- AT.SPC.read ( file.name = file.name,
# endian = endian,
# flavour = "vanilla")$spc
# # Get name and Z of particles in spectrum
# spc$particle.name <- AT.particle.name.from.particle.no(particle.no =
# spc$particle.no)
# spc$particle.name <- factor(spc$particle.name, levels =
# unique(spc$particle.name))
# spc$Z <- AT.Z.from.particle.no(particle.no =
# spc$particle.no)$Z
#
# #####################################################################
# # Plot parts of spectra
# ii <- spc$depth.step
#
# #xyplot( log10(dN.dE.per.MeV.u.per.primary) ~ E.mid.MeV.u|sprintf("
# # depth.step),
# # spc[ii,],
# # type = 's',
# # subset = log10(dN.dE.per.MeV.u.per.primary) >= -4,
# # groups = particle.name,
# # as.table = TRUE,
# # ylab = 'log (fluence per primary per bin width / (1/MeV.u)',
# # xlab = 'kinetic energy / MeV.u',
# # auto.key = list(space = 'right', lines = TRUE, points = FALSE),
# # main = 'Energy spectra at selected depth steps')
# #####################################################################
# # Process data, compute total dose and dose-weighted LET with depth
# df.total <- AT.SPC.tapply( spc = spc,
# INDEX =
# "depth.g.cm2",
# FUN =
# AT.total.D.Gy,
# additional.arguments =
# list(c("material.no", "AT.material.no.from.material.name('Water, Liquid')",
# FALSE),
#
# c("stopping.power.source.no", "0", FALSE)),
# names.results = "D.Gy")
# df.total$LET.MeV.cm2.g <- AT.SPC.tapply( spc = spc,
# INDEX =
# "depth.g.cm2",
# FUN =
# AT.dose.weighted.LET.MeV.cm2.g,
# additional.arguments =
# list(c("material.no", "AT.material.no.from.material.name('Water, Liquid')",
# FALSE),
#
# c("stopping.power.source.no", "0", FALSE)))$returnValue
# df.total$fLET.MeV.cm2.g <- AT.SPC.tapply( spc = spc,
# INDEX =
# "depth.g.cm2",
# FUN =
# AT.fluence.weighted.LET.MeV.cm2.g,
# additional.arguments =
# list(c("material.no", "AT.material.no.from.material.name('Water, Liquid')",
# FALSE),
#
# c("stopping.power.source.no", "0", FALSE)))$returnValue
# df.total$Mean.E.C.MeV.u <- AT.SPC.tapply( spc =
# spc[spc$particle.no == 6012,],
# INDEX =
# "depth.g.cm2",
# FUN =
# AT.dose.weighted.E.MeV.u,
# additional.arguments =
# list(c("material.no", "AT.material.no.from.material.name('Water, Liquid')",
# FALSE),
#
# c("stopping.power.source.no", "0", FALSE)))$returnValue
# xyplot( D.Gy ~ depth.g.cm2,
# df.total,
# grid = TRUE,
# type = 'o',
# ylab = 'total dose / Gy',
# xlab = 'depth / (g/cm2)')
# xyplot( LET.MeV.cm2.g + fLET.MeV.cm2.g ~ depth.g.cm2,
# df.total,
# type = 'o',
# main = 'Fluence (fLET) and dose (LET) weighted LET',
# grid = TRUE,
# auto.key = list(space = 'right', lines = TRUE, points = FALSE),
# ylab = 'LET / (MeV*cm2/g)',
# xlab = 'depth / (g/cm2)')
# xyplot( Mean.E.C.MeV.u ~ depth.g.cm2,
# df.total,
# type = 'o',
# grid = TRUE,
# main = file.name,
# ylab = 'Average kinetic energy of C / (MeV/u)',
# xlab = 'depth / (g/cm2)')
# ## End(Not run)
Run the code above in your browser using DataLab