Millepede-II V04-16-01
Namespaces | Functions | Variables
readMilleBinary.py File Reference

Read millepede binary file and print records. More...

Go to the source code of this file.

Namespaces

namespace  readMilleBinary
 

Functions

def readMilleBinary.unpack (typechar, number=1)
 

Variables

 readMilleBinary.parser
 
 readMilleBinary.choices
 
 readMilleBinary.default
 
 readMilleBinary.help
 
 readMilleBinary.type
 
 readMilleBinary.int
 
 readMilleBinary.action
 
 readMilleBinary.arg = parser.parse_args()
 
int readMilleBinary.Cfiles = -1
 
int readMilleBinary.CFiles = 1
 
 readMilleBinary.f = open(arg.filename, "rb")
 
 readMilleBinary.header_words = struct.unpack('ii', f.read(8))
 
int readMilleBinary.nrec = 0
 
int readMilleBinary.nr = 0
 
def readMilleBinary.lenf = struct.unpack('i', f.read(4))
 
def readMilleBinary.length = unpack('i')
 
string readMilleBinary.floattype = 'f'
 
def readMilleBinary.glder = unpack(floattype, nr)
 
def readMilleBinary.inder = unpack('i', nr)
 
int readMilleBinary.i = 0
 
int readMilleBinary.nh = 0
 
int readMilleBinary.ja = 0
 
int readMilleBinary.jb = 0
 
int readMilleBinary.jsp = 0
 
int readMilleBinary.nsp = 0
 
list readMilleBinary.lab = []
 
list readMilleBinary.val = []
 

Detailed Description

Read millepede binary file and print records.

Author
Claus Kleinwort, DESY, 2009-2022 (Claus.nosp@m..Kle.nosp@m.inwor.nosp@m.t@de.nosp@m.sy.de)
Thomas Eichlersmith, Univ. Minnesota, 2023 (eichl.nosp@m.008@.nosp@m.umn.e.nosp@m.du), major upgrade for python3 and CLI

Use the -h or --help command options to print out the full list of options. Here are a few helpful examples for what this script is helpful for.

Select a Few Tracks:

You can look at specific tracks by changing the number of records to print and the number of records to skip before starting to print. Perhaps, you know that the 100'th track is "bad" for some reason, then you could look at it and its neighbors with

./readMilleBinary.py –num_records 3 –skip-records 99 input.bin

Check Format:

You can check the format of a mille data file by running over all the records and keeping the printout quiet.

./readMilleBinary.py –num-records -1 –quiet input.bin

If the format is correct, it will just printout the number of records and have an exit status of 0. If it is incorrect, it will print an error and have an non-zero exist status. Warning: The binary format cannot by itself distinguish between a file that has been broken at a record boundary and one that has successfully been closed correctly. For this reason, more thorough testing will be needed by the user if they wish to eliminate this possibility.

Description of the output from readMilleBinary.py


Tested with SL4, SL5, SL6

Used containers to manually test Python 2.7.18 and Python 3.11.2

One can check how this performs against a corrupted mille data file by using dd to intentionally only copy the first N bytes of a file.

dd count=10 if=uncorrupted.bin of=corrupted.bin

will work if 'uncorrupted.bin' is greater than 512*10 bytes large.

Definition in file readMilleBinary.py.