CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FittedEntriesReader Class Reference

#include <FittedEntriesReader.h>

List of all members.

Public Member Functions

 FittedEntriesReader (const ALIstring &filename)
ALIbool readFittedEntriesFromFile ()
ALIstring substitutePointBySlash (const ALIstring &nameWithPoints) const
 ~FittedEntriesReader ()

Private Member Functions

 FittedEntriesReader ()

Private Attributes

ALIdouble theAngleDim
ALIdouble theAngleErrorDim
ALIFileIn theFile
ALIstring theFileName
ALIdouble theLengthDim
ALIdouble theLengthErrorDim

Detailed Description

Definition at line 15 of file FittedEntriesReader.h.


Constructor & Destructor Documentation

FittedEntriesReader::FittedEntriesReader ( ) [private]
FittedEntriesReader::FittedEntriesReader ( const ALIstring filename)
FittedEntriesReader::~FittedEntriesReader ( )

Member Function Documentation

ALIbool FittedEntriesReader::readFittedEntriesFromFile ( )

Definition at line 30 of file FittedEntriesReader.cc.

References ALIRmDataFromFile::constructRm(), gather_cfg::cout, ALIRmDataFromFile::dataFilled(), ALIUtils::debug, Entry::displaceOriginalOriginal(), Model::getEntryByName(), OpticalObject::getEntryRMangle(), ALIUtils::getFloat(), ALIFileIn::getWordsInLine(), Entry::name(), Entry::OptOCurrent(), ALIRmDataFromFile::rm(), ALIRmDataFromFile::setAngle(), OpticalObject::setGlobalRMOriginalOriginal(), Entry::setSigma(), substitutePointBySlash(), theAngleDim, theFile, theFileName, theLengthDim, and Entry::value().

Referenced by Fit::fitNextEvent().

{
  if( ALIUtils::debug >= 5) std::cout << " readFittedEntriesFromFile " << theFileName << std::endl;
  std::map<OpticalObject*,ALIRmDataFromFile> affAngles;

  std::vector<ALIstring> wl;
  theFile.getWordsInLine( wl );
  unsigned int siz = wl.size();
  for( size_t ii = 1; ii < siz; ii+=3 ){
    ALIstring optOentryName = substitutePointBySlash( wl[ii] );
    Entry* entry = Model::getEntryByName( optOentryName );
    if( ALIUtils::debug >= 5) std::cout << entry->name() << " readFittedEntriesFromFile " << entry->value() << " " << ALIUtils::getFloat( wl[ii+1] ) << std::endl;
    if( entry->name().substr(0,6) != "angles" ) {
      entry->displaceOriginalOriginal(entry->value() - ALIUtils::getFloat( wl[ii+1] )*theLengthDim);
    } else {
      OpticalObject* opto = entry->OptOCurrent();
      if( affAngles.find(opto) == affAngles.end() ){
        affAngles[opto] = ALIRmDataFromFile();
      }
      std::map<OpticalObject*,ALIRmDataFromFile>::iterator ite = affAngles.find(opto);
      (*ite).second.setAngle( optOentryName.substr(optOentryName.size()-1,1), ALIUtils::getFloat( wl[ii+1] )*theAngleDim );
      if( ALIUtils::debug >= 5) std::cout << " setting angle from file " << ALIUtils::getFloat( wl[ii+1] )*theAngleDim << " " << wl[ii+1] << " " << theAngleDim << std::endl;
    }
    entry->setSigma( ALIUtils::getFloat( wl[ii+2] )*theAngleDim );
    //  ar.lass6.laser.angles_X -159.7524 7.2208261 

  }

  ALIstring coordi("XYZ");
  std::map<OpticalObject*,ALIRmDataFromFile>::const_iterator ite;
  for( ite = affAngles.begin(); ite != affAngles.end(); ite++ ){
    ALIRmDataFromFile dff = (*ite).second;
    OpticalObject* opto = (*ite).first;
    for( size_t ii = 0; ii < 3; ii++ ) {
      int ifound =  dff.dataFilled().find( coordi[ii] );
      if( ALIUtils::debug >= 5) std::cout << ii << " dataFilled " << ifound << std::endl; 
      if( ifound == -1 ) { //angles not read from file are taken as the original value
        ALIdouble entval = opto->getEntryRMangle(coordi.substr(ii,1));
        dff.setAngle( coordi.substr(ii,1), entval );
      } 
    }
    dff.constructRm();
    opto->setGlobalRMOriginalOriginal( dff.rm() );
  }
    
  return true; // to avoid warning
  
}
ALIstring FittedEntriesReader::substitutePointBySlash ( const ALIstring nameWithPoints) const

Definition at line 80 of file FittedEntriesReader.cc.

References gather_cfg::cout, and ALIUtils::debug.

Referenced by readFittedEntriesFromFile().

{
  ALIstring nameWithSlash = nameWithPoints;

  size_t siz = nameWithPoints.length();

  for( size_t ii = 0; ii < siz; ii++ ){
    if( nameWithSlash[ii] == '.' ) nameWithSlash[ii] = '/'; 
  }
  nameWithSlash = "s/" + nameWithSlash;
  if( ALIUtils::debug >= 5) std::cout << " substitutePointBySlash " << nameWithSlash << " " << std::endl;


  return nameWithSlash;
}

Member Data Documentation

Definition at line 30 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

Definition at line 31 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader().

Definition at line 27 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

Definition at line 26 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

Definition at line 28 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

Definition at line 29 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader().