MilleBinary.h 2.27 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
/*
 * MilleBinary.h
 *
 *  Created on: Aug 31, 2011
 *      Author: kleinwrt
 */

#ifndef MILLEBINARY_H_
#define MILLEBINARY_H_

#include<fstream>
#include<vector>

14
//! Namespace for the general broken lines package
Claus Kleinwort's avatar
Claus Kleinwort committed
15
namespace gbl {
16

17
18
19
20
///  Millepede-II (binary) record.
/**
 *  Containing information for local (track) and global fit.
 *
21
22
23
24
 *  The data blocks are collected in two arrays, a real array
 *  (containing float or double values) and integer array, of same length.
 *  A positive record length indicate _float_ and a negative one _double_ values.
 *  The content of the record is:
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 *\verbatim
 *         real array              integer array
 *     0   0.0                     error count (this record)
 *     1   RMEAS, measured value   0                            -+
 *     2   local derivative        index of local derivative     |
 *     3   local derivative        index of local derivative     |
 *     4    ...                                                  | block
 *         SIGMA, error (>0)       0                             |
 *         global derivative       label of global derivative    |
 *         global derivative       label of global derivative   -+
 *         RMEAS, measured value   0
 *         local derivative        index of local derivative
 *         local derivative        index of local derivative
 *         ...
 *         SIGMA, error            0
 *         global derivative       label of global derivative
 *         global derivative       label of global derivative
 *         ...
 *         global derivative       label of global derivative
 *\endverbatim
 */
class MilleBinary {
public:
48
	MilleBinary(const std::string fileName = "milleBinaryISN.dat",
49
			bool doublePrec = false, unsigned int aSize = 2000);
50
	virtual ~MilleBinary();
51
	void addData(double aMeas, double aPrec,
52
53
54
55
56
57
58
59
60
61
			const std::vector<unsigned int> &indLocal,
			const std::vector<double> &derLocal,
			const std::vector<int> &labGlobal,
			const std::vector<double> &derGlobal);
	void writeRecord();

private:
	std::ofstream binaryFile; ///< Binary File
	std::vector<int> intBuffer; ///< Integer buffer
	std::vector<float> floatBuffer; ///< Float buffer
62
63
	std::vector<double> doubleBuffer; ///< Double buffer
	bool doublePrecision; ///< Flag for storage in as *double* values
64
};
65
}
66
#endif /* MILLEBINARY_H_ */