Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Mille Class Reference

Class to write C binary file. More...

#include <Mille.h>

Public Member Functions

 Mille (const char *outFileName, bool asBinary=true, bool writeZero=false)
 Opens outFileName (by default as binary file). More...
 
 ~Mille ()
 Closes file. More...
 
void mille (int NLC, const float *derLc, int NGL, const float *derGl, const int *label, float rMeas, float sigma)
 Add measurement to buffer. More...
 
void special (int nSpecial, const float *floatings, const int *integers)
 Add special data to buffer. More...
 
void kill ()
 Reset buffers, i.e. kill derivatives accumulated for current set. More...
 
void end ()
 Write buffer (set of derivatives with same local parameters) to file. More...
 
 Mille (const char *outFileName, bool asBinary=true, bool writeZero=false)
 
 ~Mille ()
 
void mille (int NLC, const float *derLc, int NGL, const float *derGl, const int *label, float rMeas, float sigma)
 
void special (int nSpecial, const float *floatings, const int *integers)
 
void kill ()
 
void end ()
 

Private Types

enum  { myBufferSize = 15000 }
 
enum  { myMaxLabel = (0xFFFFFFFF - (1 << 31)) }
 
enum  { myBufferSize = 15000 }
 
enum  { myMaxLabel = (0xFFFFFFFF - (1 << 31)) }
 

Private Member Functions

void newSet ()
 Initialize for new set of locals, e.g. new track. More...
 
bool checkBufferSize (int nLocal, int nGlobal)
 Enough space for next nLocal + nGlobal derivatives incl. measurement? More...
 
void newSet ()
 
bool checkBufferSize (int nLocal, int nGlobal)
 

Private Attributes

std::ofstream myOutFile
 C-binary for output. More...
 
bool myAsBinary
 if false output as text More...
 
bool myWriteZero
 
                         if true also write out derivatives/labels ==0

buffer size for ints and floats More...

 
int myBufferInt [myBufferSize]
 to collect labels etc. More...
 
float myBufferFloat [myBufferSize]
 to collect derivatives etc. More...
 
int myBufferPos
 position in buffer More...
 
bool myHasSpecial
 
                    if true, special(..) already called for this record

largest label allowed: 2^31 - 1 More...

 

Detailed Description

Class to write C binary file.

Class to write a C binary (cf. below) file of a given name and to fill it with information used as input to pede. Use its member functions mille(), special(), kill() and end() as you would use the fortran MILLE and its entry points MILLSP, KILLE and ENDLE.

For debugging purposes constructor flags enable switching to text output and/or to write also derivatives and labels which are ==0. But note that pede will not be able to read text output and has not been tested with derivatives/labels ==0.

Author
: Gero Flucke date : October 2006
Revision:
1.3
Date:
2007/04/16 17:47:38

(last update by

Author:
flucke

)

Definition at line 28 of file MilleFieldOff/Mille.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
myBufferSize 

Definition at line 48 of file MilleFieldOff/Mille.h.

anonymous enum
private
Enumerator
myMaxLabel 

Definition at line 54 of file MilleFieldOff/Mille.h.

anonymous enum
private
Enumerator
myBufferSize 

Definition at line 48 of file MilleFieldOn/Mille.h.

anonymous enum
private
Enumerator
myMaxLabel 

Definition at line 54 of file MilleFieldOn/Mille.h.

Constructor & Destructor Documentation

Mille::Mille ( const char *  outFileName,
bool  asBinary = true,
bool  writeZero = false 
)

Opens outFileName (by default as binary file).

Parameters
[in]outFileNamefile name
[in]asBinaryflag for binary
[in]writeZeroflag for keeping of zeros

Definition at line 25 of file MilleFieldOff/Mille.cc.

References myBufferFloat, myBufferInt, and myOutFile.

Mille::~Mille ( )

Closes file.

Definition at line 42 of file MilleFieldOff/Mille.cc.

References myOutFile.

Mille::Mille ( const char *  outFileName,
bool  asBinary = true,
bool  writeZero = false 
)
Mille::~Mille ( )

Member Function Documentation

bool Mille::checkBufferSize ( int  nLocal,
int  nGlobal 
)
private

Enough space for next nLocal + nGlobal derivatives incl. measurement?

Parameters
[in]nLocalnumber of local derivatives
[in]nGlobalnumber of global derivatives
Returns
true if sufficient space available (else false)

Definition at line 194 of file MilleFieldOff/Mille.cc.

References myBufferInt, myBufferPos, and myBufferSize.

Referenced by mille(), and special().

bool Mille::checkBufferSize ( int  nLocal,
int  nGlobal 
)
private
void Mille::end ( )
void Mille::end ( )

Write buffer (set of derivatives with same local parameters) to file.

Definition at line 149 of file MilleFieldOff/Mille.cc.

References myAsBinary, myBufferFloat, myBufferInt, myBufferPos, and myOutFile.

void Mille::kill ( )
void Mille::kill ( )

Reset buffers, i.e. kill derivatives accumulated for current set.

Definition at line 142 of file MilleFieldOff/Mille.cc.

References myBufferPos.

void Mille::mille ( int  NLC,
const float *  derLc,
int  NGL,
const float *  derGl,
const int *  label,
float  rMeas,
float  sigma 
)
void Mille::mille ( int  NLC,
const float *  derLc,
int  NGL,
const float *  derGl,
const int *  label,
float  rMeas,
float  sigma 
)

Add measurement to buffer.

Parameters
[in]NLCnumber of local derivatives
[in]derLclocal derivatives
[in]NGLnumber of global derivatives
[in]derGlglobal derivatives
[in]labelglobal labels
[in]rMeasmeasurement (residuum)
[in]sigmaerror

Definition at line 58 of file MilleFieldOff/Mille.cc.

References checkBufferSize(), myBufferFloat, myBufferInt, myBufferPos, myMaxLabel, myWriteZero, newSet(), and sigma.

void Mille::newSet ( )
private
void Mille::newSet ( )
private

Initialize for new set of locals, e.g. new track.

Definition at line 179 of file MilleFieldOff/Mille.cc.

References myBufferFloat, myBufferInt, myBufferPos, and myHasSpecial.

Referenced by mille(), and special().

void Mille::special ( int  nSpecial,
const float *  floatings,
const int *  integers 
)
void Mille::special ( int  nSpecial,
const float *  floatings,
const int *  integers 
)

Add special data to buffer.

Parameters
[in]nSpecialnumber of floats/ints
[in]floatingsfloats
[in]integersints

Definition at line 107 of file MilleFieldOff/Mille.cc.

References checkBufferSize(), myBufferFloat, myBufferInt, myBufferPos, myHasSpecial, and newSet().

Member Data Documentation

bool Mille::myAsBinary
private

if false output as text

Definition at line 45 of file MilleFieldOff/Mille.h.

Referenced by end().

float Mille::myBufferFloat
private

to collect derivatives etc.

Definition at line 50 of file MilleFieldOff/Mille.h.

Referenced by end(), Mille(), mille(), newSet(), and special().

int Mille::myBufferInt
private

to collect labels etc.

Definition at line 49 of file MilleFieldOff/Mille.h.

Referenced by checkBufferSize(), end(), Mille(), mille(), newSet(), and special().

int Mille::myBufferPos
private

position in buffer

Definition at line 51 of file MilleFieldOff/Mille.h.

Referenced by checkBufferSize(), end(), kill(), mille(), newSet(), and special().

bool Mille::myHasSpecial
private

                    if true, special(..) already called for this record

largest label allowed: 2^31 - 1

Definition at line 52 of file MilleFieldOff/Mille.h.

Referenced by newSet(), and special().

std::ofstream Mille::myOutFile
private

C-binary for output.

Definition at line 44 of file MilleFieldOff/Mille.h.

Referenced by end(), Mille(), and ~Mille().

bool Mille::myWriteZero
private

                         if true also write out derivatives/labels ==0

buffer size for ints and floats

Definition at line 46 of file MilleFieldOff/Mille.h.

Referenced by mille().


The documentation for this class was generated from the following files: