CMS 3D CMS Logo

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 14 of file FittedEntriesReader.h.

Constructor & Destructor Documentation

◆ FittedEntriesReader() [1/2]

FittedEntriesReader::FittedEntriesReader ( )
private

◆ FittedEntriesReader() [2/2]

FittedEntriesReader::FittedEntriesReader ( const ALIstring filename)

◆ ~FittedEntriesReader()

FittedEntriesReader::~FittedEntriesReader ( )

Member Function Documentation

◆ readFittedEntriesFromFile()

ALIbool FittedEntriesReader::readFittedEntriesFromFile ( )

Definition at line 26 of file FittedEntriesReader.cc.

26  {
27  if (ALIUtils::debug >= 5)
28  std::cout << " readFittedEntriesFromFile " << theFileName << std::endl;
29  std::map<OpticalObject*, ALIRmDataFromFile> affAngles;
30 
31  std::vector<ALIstring> wl;
33  unsigned int siz = wl.size();
34  for (size_t ii = 1; ii < siz; ii += 3) {
35  ALIstring optOentryName = substitutePointBySlash(wl[ii]);
36  Entry* entry = Model::getEntryByName(optOentryName);
37  if (ALIUtils::debug >= 5)
38  std::cout << entry->name() << " readFittedEntriesFromFile " << entry->value() << " "
39  << ALIUtils::getFloat(wl[ii + 1]) << std::endl;
40  if (entry->name().substr(0, 6) != "angles") {
41  entry->displaceOriginalOriginal(entry->value() - ALIUtils::getFloat(wl[ii + 1]) * theLengthDim);
42  } else {
43  OpticalObject* opto = entry->OptOCurrent();
44  if (affAngles.find(opto) == affAngles.end()) {
45  affAngles[opto] = ALIRmDataFromFile();
46  }
47  std::map<OpticalObject*, ALIRmDataFromFile>::iterator ite = affAngles.find(opto);
48  (*ite).second.setAngle(optOentryName.substr(optOentryName.size() - 1, 1),
50  if (ALIUtils::debug >= 5)
51  std::cout << " setting angle from file " << ALIUtils::getFloat(wl[ii + 1]) * theAngleDim << " " << wl[ii + 1]
52  << " " << theAngleDim << std::endl;
53  }
54  entry->setSigma(ALIUtils::getFloat(wl[ii + 2]) * theAngleDim);
55  // ar.lass6.laser.angles_X -159.7524 7.2208261
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)
66  std::cout << ii << " dataFilled " << ifound << std::endl;
67  if (ifound == -1) { //angles not read from file are taken as the original value
68  ALIdouble entval = opto->getEntryRMangle(coordi.substr(ii, 1));
69  dff.setAngle(coordi.substr(ii, 1), entval);
70  }
71  }
72  dff.constructRm();
73  opto->setGlobalRMOriginalOriginal(dff.rm());
74  }
75 
76  return true; // to avoid warning
77 }

References ALIRmDataFromFile::constructRm(), gather_cfg::cout, ALIRmDataFromFile::dataFilled(), ALIUtils::debug, mps_splice::entry, Model::getEntryByName(), OpticalObject::getEntryRMangle(), ALIUtils::getFloat(), ALIFileIn::getWordsInLine(), cuy::ii, ALIRmDataFromFile::rm(), ALIRmDataFromFile::setAngle(), OpticalObject::setGlobalRMOriginalOriginal(), substitutePointBySlash(), theAngleDim, theFile, theFileName, theLengthDim, and LaserClient_cfi::wl.

Referenced by Fit::fitNextEvent().

◆ substitutePointBySlash()

ALIstring FittedEntriesReader::substitutePointBySlash ( const ALIstring nameWithPoints) const

Definition at line 80 of file FittedEntriesReader.cc.

80  {
81  ALIstring nameWithSlash = nameWithPoints;
82 
83  size_t siz = nameWithPoints.length();
84 
85  for (size_t ii = 0; ii < siz; ii++) {
86  if (nameWithSlash[ii] == '.')
87  nameWithSlash[ii] = '/';
88  }
89  nameWithSlash = "s/" + nameWithSlash;
90  if (ALIUtils::debug >= 5)
91  std::cout << " substitutePointBySlash " << nameWithSlash << " " << std::endl;
92 
93  return nameWithSlash;
94 }

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

Referenced by readFittedEntriesFromFile().

Member Data Documentation

◆ theAngleDim

ALIdouble FittedEntriesReader::theAngleDim
private

Definition at line 29 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

◆ theAngleErrorDim

ALIdouble FittedEntriesReader::theAngleErrorDim
private

Definition at line 30 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader().

◆ theFile

ALIFileIn FittedEntriesReader::theFile
private

Definition at line 26 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

◆ theFileName

ALIstring FittedEntriesReader::theFileName
private

Definition at line 25 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

◆ theLengthDim

ALIdouble FittedEntriesReader::theLengthDim
private

Definition at line 27 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader(), and readFittedEntriesFromFile().

◆ theLengthErrorDim

ALIdouble FittedEntriesReader::theLengthErrorDim
private

Definition at line 28 of file FittedEntriesReader.h.

Referenced by FittedEntriesReader().

ALIUtils::getFloat
static double getFloat(const ALIstring &str)
Convert a string to an float, checking that it is really a number.
Definition: ALIUtils.cc:373
LaserClient_cfi.wl
wl
Definition: LaserClient_cfi.py:46
OpticalObject::getEntryRMangle
const double getEntryRMangle(const XYZcoor coor) const
Definition: OpticalObject.cc:1977
mps_splice.entry
entry
Definition: mps_splice.py:68
ALIRmDataFromFile
Definition: ALIRmDataFromFile.h:15
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Model::getEntryByName
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:623
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
FittedEntriesReader::theLengthDim
ALIdouble theLengthDim
Definition: FittedEntriesReader.h:27
OpticalObject
Definition: OpticalObject.h:35
ALIRmDataFromFile::constructRm
void constructRm()
Definition: ALIRmDataFromFile.cc:51
FittedEntriesReader::theAngleErrorDim
ALIdouble theAngleErrorDim
Definition: FittedEntriesReader.h:30
ALIRmDataFromFile::rm
CLHEP::HepRotation rm() const
Definition: ALIRmDataFromFile.h:31
FittedEntriesReader::substitutePointBySlash
ALIstring substitutePointBySlash(const ALIstring &nameWithPoints) const
Definition: FittedEntriesReader.cc:80
ALIRmDataFromFile::setAngle
ALIbool setAngle(const ALIstring &coord, const ALIdouble val)
Definition: ALIRmDataFromFile.cc:14
ALIUtils::debug
static ALIint debug
Definition: ALIUtils.h:34
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
ALIRmDataFromFile::dataFilled
ALIstring dataFilled() const
Definition: ALIRmDataFromFile.h:32
ALIFileIn::getInstance
static ALIFileIn & getInstance(const ALIstring &name)
Definition: ALIFileIn.cc:22
FittedEntriesReader::theLengthErrorDim
ALIdouble theLengthErrorDim
Definition: FittedEntriesReader.h:28
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
FittedEntriesReader::theFile
ALIFileIn theFile
Definition: FittedEntriesReader.h:26
Entry
Definition: Entry.h:18
FittedEntriesReader::theFileName
ALIstring theFileName
Definition: FittedEntriesReader.h:25
ALIUtils::dumpVS
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:465
FittedEntriesReader::theAngleDim
ALIdouble theAngleDim
Definition: FittedEntriesReader.h:29
ALIUtils::CalculateLengthDimensionFactorFromString
static ALIdouble CalculateLengthDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:179
ALIFileIn::getWordsInLine
ALIint getWordsInLine(std::vector< ALIstring > &wl)
Definition: ALIFileIn.cc:74
OpticalObject::setGlobalRMOriginalOriginal
void setGlobalRMOriginalOriginal(const CLHEP::HepRotation &rmoriori)
Definition: OpticalObject.cc:616
cuy.ii
ii
Definition: cuy.py:590
ALIUtils::CalculateAngleDimensionFactorFromString
static ALIdouble CalculateAngleDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:218