25 Mille::Mille(
const char *outFileName,
bool asBinary,
bool writeZero) :
26 myOutFile(outFileName, (asBinary ? (std::ios::binary | std::ios::out) : std::ios::out)),
27 myAsBinary(asBinary), myWriteZero(writeZero), myBufferPos(-1), myHasSpecial(false)
35 std::cerr <<
"Mille::Mille: Could not open " << outFileName
36 <<
" as output file." << std::endl;
59 int NGL,
const float *derGl,
const int *label,
60 float rMeas,
float sigma)
62 if (sigma <= 0.)
return;
72 for (
int i = 0; i < NLC; ++i) {
86 for (
int i = 0; i < NGL; ++i) {
93 std::cerr <<
"Mille::mille: Invalid label " << label[i]
107 void Mille::special(
int nSpecial,
const float *floatings,
const int *integers)
109 if (nSpecial == 0)
return;
112 std::cerr <<
"Mille::special: Special values already stored for this record."
133 for (
int i = 0; i < nSpecial; ++i) {
155 myOutFile.write(reinterpret_cast<const char*>(&numWordsToWrite),
156 sizeof(numWordsToWrite));
168 for (
int i = 0; i < myBufferPos+1; ++i) {
198 std::cerr <<
"Mille::checkBufferSize: Buffer too short ("
200 <<
"\n need space for nLocal (" << nLocal<<
")"
201 <<
"/nGlobal (" << nGlobal <<
") local/global derivatives, "
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]
void end()
Write buffer (set of derivatives with same local parameters) to file.
int myBufferInt[myBufferSize]
to collect labels etc.
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).