packages feed

hepevt 0.3.2 → 0.4

raw patch · 3 files changed

+33/−37 lines, 3 filesdep +lhaPVP ok

version bump matches the API change (PVP)

Dependencies added: lha

API changes (from Hackage documentation)

- Data.HEPEVT: Particle :: Int -> Int -> Double -> Double -> Double -> Double -> Double -> Int -> Double -> Double -> Particle
- Data.HEPEVT: barcode :: Particle -> Int
- Data.HEPEVT: data Particle
- Data.HEPEVT: energy :: Particle -> Double
- Data.HEPEVT: instance Eq Line
- Data.HEPEVT: instance Eq Particle
- Data.HEPEVT: instance Show Line
- Data.HEPEVT: instance Show Particle
- Data.HEPEVT: mass :: Particle -> Double
- Data.HEPEVT: pid :: Particle -> Int
- Data.HEPEVT: pphi :: Particle -> Double
- Data.HEPEVT: ptheta :: Particle -> Double
- Data.HEPEVT: px :: Particle -> Double
- Data.HEPEVT: py :: Particle -> Double
- Data.HEPEVT: pz :: Particle -> Double
- Data.HEPEVT: stat :: Particle -> Int
- Data.HEPEVT: type Event = ([Double], [Particle])

Files

Data/HEPEVT.hs view
@@ -1,21 +1,21 @@ {-| -This module provides a pure haskell implementation of a reader and writer for-the ASCII HEPEVT file format, rougly as described at+This module provides a pure haskell implementation of a reader for the ASCII+HEPEVT file format, rougly as described at <http://cepa.fnal.gov/psm/simulation/mcgen/lund/pythia_manual/pythia6.3/pythia6301/node39.html>. Compatibility with the extended format used by HepMC (<http://lcgapp.cern.ch/project/simu/HepMC/>) is given priority.  -} module Data.HEPEVT (-  Event, Particle(..),-   parseEventFile,   parseEvents, ) where  import qualified Data.ByteString.Char8 as S +import Data.LHA+ {- int: barcode int: PDG id@@ -31,43 +31,28 @@ int: number of entries in flow list (may be zero) int, int: optional code index and code for each entry in the flow list -}-data Particle = Particle-  { barcode :: Int-  , pid     :: Int-  , px      :: Double-  , py      :: Double-  , pz      :: Double-  , energy  :: Double-  , mass    :: Double-  , stat    :: Int-  , ptheta  :: Double-  , pphi    :: Double-  }-  deriving (Eq, Show)  mkParticle :: [String] -> Particle mkParticle (barcode:pid:px:py:pz:energy:mass:stat:ptheta:pphi:_) =   Particle-    { barcode = read barcode-    , pid     = read pid-    , px      = parseDouble px-    , py      = parseDouble py-    , pz      = parseDouble pz-    , energy  = parseDouble energy-    , mass    = parseDouble mass-    , stat    = read stat-    , ptheta  = parseDouble ptheta-    , pphi    = parseDouble pphi+    { partPDG   = read pid+    , partPx    = parseDouble px+    , partPy    = parseDouble py+    , partPz    = parseDouble pz+    , partE     = parseDouble energy+    , partM     = parseDouble mass+    , status    = statusFromInt $ read stat+    , mothers   = (-1, Nothing)+    , iColor    = (0, 0)+    , lifetime  = 0+    , spin      = 0     } -type Event = ([Double], [Particle])- parseEventFile :: String -> IO [Event] parseEventFile fname = do   S.readFile fname >>= return . parseEvents  data Line = Meta String | E [Double] | P Particle | V [Double] | Blank-  deriving (Show, Eq)  parseLine :: S.ByteString -> Line parseLine line =@@ -84,13 +69,24 @@  type ParseState = [Event] +eventOf :: ([Double], [Particle]) -> Event+eventOf ((_:_:scale:aQCD:aQED:_), ps) = Event+  { nPart = length ps+  , evProcId = 0+  , evWeight = 0+  , scale = scale+  , aQCD = aQCD+  , aQED = aQED+  , parts = ps+  }+ parseEvents :: S.ByteString -> [Event]-parseEvents dat =+parseEvents dat = map eventOf $   let ls = S.split '\n' dat in      reverse $ foldl process [] $ getLines ls   where     process events (E ds) = (ds, []):events-    process ((el, pl):events) (P p) = (el, p:pl):events+    process ((el, pl):events) (P p) = (el,p:pl):events     process events _ = events  parseDouble :: String -> Double
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2011 Scott Lawrence <bytbox@gmail.com>+Copyright (c) 2011, 2012 Scott Lawrence <bytbox@gmail.com>  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
hepevt.cabal view
@@ -1,7 +1,7 @@ Name:                hepevt-Version:             0.3.2-Synopsis:            HEPEVT parser and writer-Description:         This package implements a parser and writer for the ASCII HEPEVT event log file format+Version:             0.4+Synopsis:            HEPEVT parser+Description:         This package implements a parser for the ASCII HEPEVT event log file format License:             MIT License-file:        LICENSE Author:              Scott Lawrence@@ -13,7 +13,7 @@ Library   Default-language:    Haskell2010   Exposed-modules:     Data.HEPEVT-  Build-depends:       haskell2010 >= 1.0, bytestring>=0.9+  Build-depends:       haskell2010 >= 1.0, bytestring>=0.9, lha>=0.1.1   -- Other-modules:         source-repository head