CMS 3D CMS Logo

FittedEntriesReader Class Reference

#include <Alignment/CocoaModel/interface/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  ) 

Definition at line 10 of file FittedEntriesReader.cc.

References ALIUtils::CalculateAngleDimensionFactorFromString(), ALIUtils::CalculateLengthDimensionFactorFromString(), ALIUtils::dumpVS(), exception, ALIFileIn::getInstance(), ALIFileIn::getWordsInLine(), theAngleDim, theAngleErrorDim, theFile, theFileName, theLengthDim, and theLengthErrorDim.

00011 {
00012   theFileName = filename;
00013   theFile = ALIFileIn::getInstance( filename );
00014   std::vector<ALIstring> wl;
00015   theFile.getWordsInLine( wl );
00016   if (wl[0] == ALIstring( "DIMENSIONS:" ) ){
00017     theLengthDim = ALIUtils::CalculateLengthDimensionFactorFromString( wl[3] );
00018     theLengthErrorDim = ALIUtils::CalculateLengthDimensionFactorFromString( wl[5] );
00019     theAngleDim = ALIUtils::CalculateAngleDimensionFactorFromString( wl[8] );
00020     theAngleErrorDim = ALIUtils::CalculateAngleDimensionFactorFromString( wl[10] );
00021   } else {
00022     ALIUtils::dumpVS( wl, "!!! FATAL ERROR FittedEntriesReader: first line is not dimensions " );
00023     std::exception();
00024   }
00025 
00026 }

FittedEntriesReader::~FittedEntriesReader (  ) 


Member Function Documentation

ALIbool FittedEntriesReader::readFittedEntriesFromFile (  ) 

Definition at line 30 of file FittedEntriesReader.cc.

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

Referenced by Fit::fitNextEvent().

00031 {
00032   if( ALIUtils::debug >= 5) std::cout << " readFittedEntriesFromFile " << theFileName << std::endl;
00033   std::map<OpticalObject*,ALIRmDataFromFile> affAngles;
00034 
00035   std::vector<ALIstring> wl;
00036   theFile.getWordsInLine( wl );
00037   uint siz = wl.size();
00038   for( size_t ii = 1; ii < siz; ii+=3 ){
00039     ALIstring optOentryName = substitutePointBySlash( wl[ii] );
00040     Entry* entry = Model::getEntryByName( optOentryName );
00041     if( ALIUtils::debug >= 5) std::cout << entry->name() << " readFittedEntriesFromFile " << entry->value() << " " << ALIUtils::getFloat( wl[ii+1] ) << std::endl;
00042     if( entry->name().substr(0,6) != "angles" ) {
00043       entry->displaceOriginalOriginal(entry->value() - ALIUtils::getFloat( wl[ii+1] )*theLengthDim);
00044     } else {
00045       OpticalObject* opto = entry->OptOCurrent();
00046       if( affAngles.find(opto) == affAngles.end() ){
00047         affAngles[opto] = ALIRmDataFromFile();
00048       }
00049       std::map<OpticalObject*,ALIRmDataFromFile>::iterator ite = affAngles.find(opto);
00050       (*ite).second.setAngle( optOentryName.substr(optOentryName.size()-1,1), ALIUtils::getFloat( wl[ii+1] )*theAngleDim );
00051       if( ALIUtils::debug >= 5) std::cout << " setting angle from file " << ALIUtils::getFloat( wl[ii+1] )*theAngleDim << " " << wl[ii+1] << " " << theAngleDim << std::endl;
00052     }
00053     entry->setSigma( ALIUtils::getFloat( wl[ii+2] )*theAngleDim );
00054     //  ar.lass6.laser.angles_X -159.7524 7.2208261 
00055 
00056   }
00057 
00058   ALIstring coordi("XYZ");
00059   std::map<OpticalObject*,ALIRmDataFromFile>::const_iterator ite;
00060   for( ite = affAngles.begin(); ite != affAngles.end(); ite++ ){
00061     ALIRmDataFromFile dff = (*ite).second;
00062     OpticalObject* opto = (*ite).first;
00063     for( size_t ii = 0; ii < 3; ii++ ) {
00064       int ifound =  dff.dataFilled().find( coordi[ii] );
00065       if( ALIUtils::debug >= 5) std::cout << ii << " dataFilled " << ifound << std::endl; 
00066       if( ifound == -1 ) { //angles not read from file are taken as the original value
00067         ALIdouble entval = opto->getEntryRMangle(coordi.substr(ii,1));
00068         dff.setAngle( coordi.substr(ii,1), entval );
00069       } 
00070     }
00071     dff.constructRm();
00072     opto->setGlobalRMOriginalOriginal( dff.rm() );
00073   }
00074     
00075 
00076 
00077   
00078 }

ALIstring FittedEntriesReader::substitutePointBySlash ( const ALIstring nameWithPoints  )  const

Definition at line 81 of file FittedEntriesReader.cc.

References GenMuonPlsPt100GeV_cfg::cout, ALIUtils::debug, lat::endl(), and siz.

Referenced by readFittedEntriesFromFile().

00082 {
00083   ALIstring nameWithSlash = nameWithPoints;
00084 
00085   size_t siz = nameWithPoints.length();
00086 
00087   for( size_t ii = 0; ii < siz; ii++ ){
00088     if( nameWithSlash[ii] == '.' ) nameWithSlash[ii] = '/'; 
00089   }
00090   nameWithSlash = "s/" + nameWithSlash;
00091   if( ALIUtils::debug >= 5) std::cout << " substitutePointBySlash " << nameWithSlash << " " << std::endl;
00092 
00093 
00094   return nameWithSlash;
00095 }


Member Data Documentation

ALIdouble FittedEntriesReader::theAngleDim [private]

Definition at line 30 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

ALIdouble FittedEntriesReader::theAngleErrorDim [private]

Definition at line 31 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader().

ALIFileIn FittedEntriesReader::theFile [private]

Definition at line 27 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

ALIstring FittedEntriesReader::theFileName [private]

Definition at line 26 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

ALIdouble FittedEntriesReader::theLengthDim [private]

Definition at line 28 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

ALIdouble FittedEntriesReader::theLengthErrorDim [private]

Definition at line 29 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:20:55 2009 for CMSSW by  doxygen 1.5.4