Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:36

0001 #ifndef MILLE_H
0002 #define MILLE_H
0003 
0004 #include <fstream>
0005 
0006 /**
0007  * \class Mille
0008  *
0009  *  Class to write a C binary (cf. below) file of a given name and to fill it
0010  *  with information used as input to pede.
0011  *  Use its member functions mille(...), special(...), kill() and end() as you would
0012  *  use the fortran MILLE and its entry points MILLSP, KILLE and ENDLE.
0013  *
0014  *  For debugging purposes constructor flags enable switching to text output and/or
0015  *  to write also derivatives and lables which are ==0.
0016  *  But note that pede will not be able to read text output and has not been tested with
0017  *  derivatives/labels ==0.
0018  *
0019  *  \author    : Gero Flucke
0020  *  date       : October 2006
0021  *  $Revision: 1.2 $
0022  *  $Date: 2007/03/16 16:44:47 $
0023  *  (last update by $Author: flucke $)
0024  */
0025 
0026 class Mille {
0027 public:
0028   Mille(const char *outFileName, bool asBinary = true, bool writeZero = false);
0029   ~Mille();
0030 
0031   void mille(int NLC, const float *derLc, int NGL, const float *derGl, const int *label, float rMeas, float sigma);
0032   void special(int nSpecial, const float *floatings, const int *integers);
0033   void kill();
0034   void flushOutputFile();
0035   void resetOutputFile();
0036   void end();
0037 
0038 private:
0039   void newSet();
0040   bool checkBufferSize(int nLocal, int nGlobal);
0041 
0042   const std::ios_base::openmode fileMode_;  // file open mode of the binary
0043   const std::string fileName_;              // file name of the binary
0044   std::ofstream outFile_;                   // C-binary for output
0045   bool asBinary_;                           // if false output as text
0046   bool writeZero_;                          // if true also write out derivatives/lables ==0
0047 
0048   enum { bufferSize_ = 5000 };
0049   int bufferInt_[bufferSize_];      // to collect labels etc.
0050   float bufferFloat_[bufferSize_];  // to collect derivatives etc.
0051   int bufferPos_;
0052   bool hasSpecial_;  // if true, special(..) already called for this record
0053 
0054   enum { maxLabel_ = (0xFFFFFFFF - (1 << 31)) };  // largest label allowed: 2^31 - 1
0055 };
0056 #endif