CMS 3D CMS Logo

Classes | Functions

/data/refman/pasoursint/CMSSW_5_2_9/src/Calibration/Tools/interface/matrixSaver.h File Reference

#include <vector>
#include <string>
#include <fstream>
#include <iostream>
#include "CLHEP/Matrix/GenMatrix.h"
#include "CLHEP/Matrix/Matrix.h"
#include "CLHEP/Matrix/Vector.h"

Go to the source code of this file.

Classes

class  matrixSaver
 save (read) CLHEP::HepMatrix to (from) text files More...

Functions

std::ostream & operator<< (std::ostream &outputFile, const CLHEP::HepGenMatrix &saveMe)
std::istream & operator>> (std::istream &input, CLHEP::HepGenMatrix &matrix)

Function Documentation

std::ostream& operator<< ( std::ostream &  outputFile,
const CLHEP::HepGenMatrix &  saveMe 
)
std::istream& operator>> ( std::istream &  input,
CLHEP::HepGenMatrix &  matrix 
)

Definition at line 111 of file matrixSaver.cc.

References LaserDQM_cfg::input.

{
  int numRow = 0 ;
  int numCol = 0 ;
  
  //PG read the matrix dimension
  input >> numRow ;
  input >> numCol ;
  
  //PG check whether the matrices have the right dimension
  assert ( numRow == matrix.num_row () ) ;
  assert ( numCol == matrix.num_col () ) ;

  //PG get the matrix elements from the file
  for (int row=0 ; row<numRow ; ++row)
    {
      for (int col=0 ; col<numCol ; ++col)
              {
                input >> matrix[row][col] ;
            assert (col*row < numRow*numCol) ;
              } 
    }   

  return input ;
}