CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
FittedEntriesReader Class Reference

#include <FittedEntriesReader.h>

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(), cppFunctionSkipper::exception, lut2db_cfg::filename, ALIFileIn::getInstance(), ALIFileIn::getWordsInLine(), theAngleDim, theAngleErrorDim, theFile, theFileName, theLengthDim, and theLengthErrorDim.

11 {
14  std::vector<ALIstring> wl;
15  theFile.getWordsInLine( wl );
16  if (wl[0] == ALIstring( "DIMENSIONS:" ) ){
21  } else {
22  ALIUtils::dumpVS( wl, "!!! FATAL ERROR FittedEntriesReader: first line is not dimensions " );
24  }
25 
26 }
static ALIFileIn & getInstance(const ALIstring &name)
Definition: ALIFileIn.cc:23
static ALIdouble CalculateAngleDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:237
static ALIdouble CalculateLengthDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:196
ALIint getWordsInLine(std::vector< ALIstring > &wl)
Definition: ALIFileIn.cc:83
static void dumpVS(const std::vector< ALIstring > &wl, const std::string &msg, std::ostream &outs=std::cout)
dumps a vector of strings with a message to outs
Definition: ALIUtils.cc:501
std::string ALIstring
Definition: CocoaGlobals.h:9
tuple filename
Definition: lut2db_cfg.py:20
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(), cuy::ii, Entry::name(), Entry::OptOCurrent(), ALIRmDataFromFile::rm(), ALIRmDataFromFile::setAngle(), OpticalObject::setGlobalRMOriginalOriginal(), Entry::setSigma(), substitutePointBySlash(), theAngleDim, theFile, theFileName, theLengthDim, and Entry::value().

Referenced by Fit::fitNextEvent().

31 {
32  if( ALIUtils::debug >= 5) std::cout << " readFittedEntriesFromFile " << theFileName << std::endl;
33  std::map<OpticalObject*,ALIRmDataFromFile> affAngles;
34 
35  std::vector<ALIstring> wl;
36  theFile.getWordsInLine( wl );
37  unsigned int siz = wl.size();
38  for( size_t ii = 1; ii < siz; ii+=3 ){
39  ALIstring optOentryName = substitutePointBySlash( wl[ii] );
40  Entry* entry = Model::getEntryByName( optOentryName );
41  if( ALIUtils::debug >= 5) std::cout << entry->name() << " readFittedEntriesFromFile " << entry->value() << " " << ALIUtils::getFloat( wl[ii+1] ) << std::endl;
42  if( entry->name().substr(0,6) != "angles" ) {
44  } else {
45  OpticalObject* opto = entry->OptOCurrent();
46  if( affAngles.find(opto) == affAngles.end() ){
47  affAngles[opto] = ALIRmDataFromFile();
48  }
49  std::map<OpticalObject*,ALIRmDataFromFile>::iterator ite = affAngles.find(opto);
50  (*ite).second.setAngle( optOentryName.substr(optOentryName.size()-1,1), ALIUtils::getFloat( wl[ii+1] )*theAngleDim );
51  if( ALIUtils::debug >= 5) std::cout << " setting angle from file " << ALIUtils::getFloat( wl[ii+1] )*theAngleDim << " " << wl[ii+1] << " " << theAngleDim << std::endl;
52  }
53  entry->setSigma( ALIUtils::getFloat( wl[ii+2] )*theAngleDim );
54  // ar.lass6.laser.angles_X -159.7524 7.2208261
55 
56  }
57 
58  ALIstring coordi("XYZ");
59  std::map<OpticalObject*,ALIRmDataFromFile>::const_iterator ite;
60  for( ite = affAngles.begin(); ite != affAngles.end(); ++ite ){
61  ALIRmDataFromFile dff = (*ite).second;
62  OpticalObject* opto = (*ite).first;
63  for( size_t ii = 0; ii < 3; ii++ ) {
64  int ifound = dff.dataFilled().find( coordi[ii] );
65  if( ALIUtils::debug >= 5) std::cout << ii << " dataFilled " << ifound << std::endl;
66  if( ifound == -1 ) { //angles not read from file are taken as the original value
67  ALIdouble entval = opto->getEntryRMangle(coordi.substr(ii,1));
68  dff.setAngle( coordi.substr(ii,1), entval );
69  }
70  }
71  dff.constructRm();
72  opto->setGlobalRMOriginalOriginal( dff.rm() );
73  }
74 
75  return true; // to avoid warning
76 
77 }
const double getEntryRMangle(const XYZcoor coor) const
void setGlobalRMOriginalOriginal(const CLHEP::HepRotation &rmoriori)
long double ALIdouble
Definition: CocoaGlobals.h:11
ALIstring dataFilled() const
Definition: Entry.h:18
ALIdouble value() const
Definition: Entry.h:55
ALIbool setAngle(const ALIstring &coord, const ALIdouble val)
static ALIint debug
Definition: ALIUtils.h:35
ALIstring substitutePointBySlash(const ALIstring &nameWithPoints) const
int ii
Definition: cuy.py:588
static Entry * getEntryByName(const ALIstring &opto_name, const ALIstring &entry_name)
--— Search an Entry name in the Entry* list and return a pointer to it
Definition: Model.cc:633
static double getFloat(const ALIstring &str)
Convert a string to an float, checking that it is really a number.
Definition: ALIUtils.cc:404
void setSigma(ALIdouble sig)
Definition: Entry.h:78
CLHEP::HepRotation rm() const
const ALIstring & name() const
Definition: Entry.h:52
ALIint getWordsInLine(std::vector< ALIstring > &wl)
Definition: ALIFileIn.cc:83
std::string ALIstring
Definition: CocoaGlobals.h:9
tuple cout
Definition: gather_cfg.py:145
OpticalObject * OptOCurrent() const
Definition: Entry.h:61
virtual void displaceOriginalOriginal(ALIdouble disp)
Definition: Entry.cc:292
ALIstring FittedEntriesReader::substitutePointBySlash ( const ALIstring nameWithPoints) const

Definition at line 80 of file FittedEntriesReader.cc.

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

Referenced by readFittedEntriesFromFile().

81 {
82  ALIstring nameWithSlash = nameWithPoints;
83 
84  size_t siz = nameWithPoints.length();
85 
86  for( size_t ii = 0; ii < siz; ii++ ){
87  if( nameWithSlash[ii] == '.' ) nameWithSlash[ii] = '/';
88  }
89  nameWithSlash = "s/" + nameWithSlash;
90  if( ALIUtils::debug >= 5) std::cout << " substitutePointBySlash " << nameWithSlash << " " << std::endl;
91 
92 
93  return nameWithSlash;
94 }
static ALIint debug
Definition: ALIUtils.h:35
int ii
Definition: cuy.py:588
std::string ALIstring
Definition: CocoaGlobals.h:9
tuple cout
Definition: gather_cfg.py:145

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().