Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MilleFieldOff/Mille.h
Go to the documentation of this file.
1 #ifndef MILLE_H
2 #define MILLE_H
3 
4 #include <fstream>
5 
6 /**
7  * \class Mille
8  *
9  * Class to write a C binary (cf. below) file of a given name and to fill it
10  * with information used as input to **pede**.
11  * Use its member functions \c mille(), \c special(), \c kill() and \c end()
12  * as you would use the fortran \ref mille.f90 "MILLE"
13  * and its entry points \c MILLSP, \c KILLE and \c ENDLE.
14  *
15  * For debugging purposes constructor flags enable switching to text output and/or
16  * to write also derivatives and labels which are ==0.
17  * But note that **pede** will not be able to read text output and has not been tested with
18  * derivatives/labels ==0.
19  *
20  * \author : Gero Flucke
21  * date : October 2006
22  * $Revision: 1.3 $
23  * $Date: 2007/04/16 17:47:38 $
24  * (last update by $Author: flucke $)
25  */
26 
27 /// Class to write C binary file.
28 class Mille
29 {
30  public:
31  Mille(const char *outFileName, bool asBinary = true, bool writeZero = false);
32  ~Mille();
33 
34  void mille(int NLC, const float *derLc, int NGL, const float *derGl,
35  const int *label, float rMeas, float sigma);
36  void special(int nSpecial, const float *floatings, const int *integers);
37  void kill();
38  void end();
39 
40  private:
41  void newSet();
42  bool checkBufferSize(int nLocal, int nGlobal);
43 
44  std::ofstream myOutFile; ///< C-binary for output
45  bool myAsBinary; ///< if false output as text
46  bool myWriteZero; ///< if true also write out derivatives/labels ==0
47  /// buffer size for ints and floats
48  enum {myBufferSize = 15000}; ///< buffer size for ints and floats
49  int myBufferInt[myBufferSize]; ///< to collect labels etc.
50  float myBufferFloat[myBufferSize]; ///< to collect derivatives etc.
51  int myBufferPos; ///< position in buffer
52  bool myHasSpecial; ///< if true, special(..) already called for this record
53  /// largest label allowed: 2^31 - 1
54  enum {myMaxLabel = (0xFFFFFFFF - (1 << 31))};
55 };
56 #endif
~Mille()
Closes file.
bool myHasSpecial
if true, special(..) already called for this record largest label allowed: 2^31 ...
void mille(int NLC, const float *derLc, int NGL, const float *derGl, const int *label, float rMeas, float sigma)
Add measurement to buffer.
bool myAsBinary
if false output as text
std::ofstream myOutFile
C-binary for output.
float myBufferFloat[myBufferSize]
to collect derivatives etc.
void special(int nSpecial, const float *floatings, const int *integers)
Add special data to buffer.
void kill()
Reset buffers, i.e. kill derivatives accumulated for current set.
bool myWriteZero
if true also write out derivatives/labels ==0 buffer size for ints and floa...
Double_t sigma[NCHANNELS]
Definition: st_tw_resols.C:37
void end()
Write buffer (set of derivatives with same local parameters) to file.
int myBufferInt[myBufferSize]
to collect labels etc.
Class to write C binary file.
int myBufferPos
position in buffer
void newSet()
Initialize for new set of locals, e.g. new track.
bool checkBufferSize(int nLocal, int nGlobal)
Enough space for next nLocal + nGlobal derivatives incl. measurement?
Mille(const char *outFileName, bool asBinary=true, bool writeZero=false)
Opens outFileName (by default as binary file).