CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Attributes
ALIUtils Class Reference

#include <ALIUtils.h>

Public Member Functions

 ALIUtils ()
 
 ~ALIUtils ()
 

Static Public Member Functions

static double addPii (double val)
 
static ALIdouble AngleSigmaDimensionFactor ()
 
static ALIdouble AngleValueDimensionFactor ()
 
static double approxTo0 (double val)
 
static ALIdouble CalculateAngleDimensionFactorFromInt (ALIint ad)
 
static ALIdouble CalculateAngleDimensionFactorFromString (ALIstring dimstr)
 
static ALIdouble CalculateLengthDimensionFactorFromInt (ALIint ad)
 
static ALIdouble CalculateLengthDimensionFactorFromString (ALIstring dimstr)
 
static std::string changeName (const std::string &oldName, const std::string &subsstr1, const std::string &subsstr2)
 
static int checkMatrixEquations (double angleX, double angleY, double angleZ, const CLHEP::HepRotation &rot)
 
static double diff2pi (double ang1, double ang2)
 
static void dump3v (const CLHEP::Hep3Vector &vec, const std::string &msg)
 
static void dumpDimensions (std::ofstream &fout)
 
static void dumprm (const CLHEP::HepRotation &rm, const std::string &msg, std::ostream &out=std::cout)
 
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 More...
 
static bool eq2ang (double ang1, double ang2)
 
static bool getBool (const ALIstring &str)
 Convert a bool to an integer, checking that it is really a bool. More...
 
static ALIdouble getDimensionValue (const ALIstring &dim, const ALIstring &dimType)
 
static ALIbool getFirstTime ()
 
static double getFloat (const ALIstring &str)
 Convert a string to an float, checking that it is really a number. More...
 
static int getInt (const ALIstring &str)
 Convert a string to an integer, checking that it is really an integer. More...
 
static ALIdouble getMaximumDeviationDerivative ()
 
static std::vector< double > getRotationAnglesFromMatrix (const CLHEP::HepRotation &rmLocal, double origAngleX, double origAngleY, double origAngleZ)
 
static int IsNumber (const ALIstring &str)
 
static ALIdouble LengthSigmaDimensionFactor ()
 
static ALIdouble LengthValueDimensionFactor ()
 
static ALIdouble OutputAngleSigmaDimensionFactor ()
 
static ALIdouble OutputAngleValueDimensionFactor ()
 
static ALIdouble OutputLengthSigmaDimensionFactor ()
 
static ALIdouble OutputLengthValueDimensionFactor ()
 
static void set_time_now (time_t now)
 
static void SetAngleDimensionFactors ()
 
static void setDebugVerbosity (ALIint val)
 
static void setFirstTime (ALIbool val)
 
static void SetLengthDimensionFactors ()
 
static void setMaximumDeviationDerivative (ALIdouble val)
 
static void SetOutputAngleDimensionFactors ()
 
static void SetOutputLengthDimensionFactors ()
 
static void setReportVerbosity (ALIint val)
 
static ALIstring subQuotes (const ALIstring &str)
 
static time_t time_now ()
 
static ALIdouble val0 (ALIdouble val)
 

Static Public Attributes

static ALIint debug = 99
 
static ALIdouble deg = 0.017453293
 
static ALIint report = 1
 

Static Private Attributes

static ALIdouble _AngleSigmaDimensionFactor = 1.
 
static ALIdouble _AngleValueDimensionFactor = 1.
 
static ALIdouble _LengthSigmaDimensionFactor = 1.
 
static ALIdouble _LengthValueDimensionFactor = 1.
 
static ALIdouble _OutputAngleSigmaDimensionFactor = 1.
 
static ALIdouble _OutputAngleValueDimensionFactor = 1.
 
static ALIdouble _OutputLengthSigmaDimensionFactor = 1.
 
static ALIdouble _OutputLengthValueDimensionFactor = 1.
 
static time_t _time_now
 
static ALIbool firstTime = false
 
static ALIdouble maximum_deviation_derivative = 1.E-6
 

Detailed Description

Definition at line 23 of file ALIUtils.h.

Constructor & Destructor Documentation

◆ ALIUtils()

ALIUtils::ALIUtils ( )
inline

Definition at line 25 of file ALIUtils.h.

25 {};

◆ ~ALIUtils()

ALIUtils::~ALIUtils ( )
inline

Definition at line 26 of file ALIUtils.h.

26 {};

Member Function Documentation

◆ addPii()

double ALIUtils::addPii ( double  val)
static

Definition at line 751 of file ALIUtils.cc.

References M_PI, and heppy_batch::val.

Referenced by getRotationAnglesFromMatrix().

751  {
752  if (val < M_PI) {
753  val += M_PI;
754  } else {
755  val -= M_PI;
756  }
757 
758  return val;
759 }
#define M_PI

◆ AngleSigmaDimensionFactor()

static ALIdouble ALIUtils::AngleSigmaDimensionFactor ( )
inlinestatic

Definition at line 65 of file ALIUtils.h.

References _AngleSigmaDimensionFactor.

Referenced by EntryAngle::SigmaDimensionFactor().

static ALIdouble _AngleSigmaDimensionFactor
Definition: ALIUtils.h:106

◆ AngleValueDimensionFactor()

static ALIdouble ALIUtils::AngleValueDimensionFactor ( )
inlinestatic

◆ approxTo0()

double ALIUtils::approxTo0 ( double  val)
static

Definition at line 743 of file ALIUtils.cc.

References boostedTaus_cff::precision, and heppy_batch::val.

Referenced by getRotationAnglesFromMatrix().

743  {
744  double precision = 1.e-9;
745  if (fabs(val) < precision)
746  val = 0;
747  return val;
748 }

◆ CalculateAngleDimensionFactorFromInt()

ALIdouble ALIUtils::CalculateAngleDimensionFactorFromInt ( ALIint  ad)
static

Definition at line 271 of file ALIUtils.cc.

References CalculateAngleDimensionFactorFromString(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, and beamvalidation::exit().

Referenced by SetAngleDimensionFactors(), and SetOutputAngleDimensionFactors().

271  {
272  ALIdouble valsig;
273  switch (ad) {
274  case 0: //----- radians
276  break;
277  case 1: //----- miliradians
279  break;
280  case 2: //----- microradians
281  valsig = CalculateAngleDimensionFactorFromString("murad");
282  break;
283  case 3: //----- degrees
285  break;
286  case 4: //----- grads
288  break;
289  default:
290  std::cerr << "!!! UNKNOWN DIMENSION SCALING " << ad << std::endl << "VALUE MUST BE BETWEEN 0 AND 3 " << std::endl;
291  exit(1);
292  }
293 
294  // use microradinas instead of radians
295  //- valsig *= 1000000.;
296 
297  return valsig;
298 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIdouble CalculateAngleDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:218
def exit(msg="")

◆ CalculateAngleDimensionFactorFromString()

ALIdouble ALIUtils::CalculateAngleDimensionFactorFromString ( ALIstring  dimstr)
static

Definition at line 218 of file ALIUtils.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), and M_PI.

Referenced by CalculateAngleDimensionFactorFromInt(), and FittedEntriesReader::FittedEntriesReader().

218  {
219  ALIdouble valsig;
220  if (dimstr == "rad") {
221  valsig = 1.;
222  } else if (dimstr == "mrad") {
223  valsig = 1.E-3;
224  } else if (dimstr == "murad") {
225  valsig = 1.E-6;
226  } else if (dimstr == "deg") {
227  valsig = M_PI / 180.;
228  } else if (dimstr == "grad") {
229  valsig = M_PI / 200.;
230  } else {
231  std::cerr << "!!! UNKNOWN DIMENSION SCALING: " << dimstr << std::endl
232  << "VALUE MUST BE AN ANGLE DIMENSION " << std::endl;
233  exit(1);
234  }
235 
236  return valsig;
237 }
long double ALIdouble
Definition: CocoaGlobals.h:11
#define M_PI
def exit(msg="")

◆ CalculateLengthDimensionFactorFromInt()

ALIdouble ALIUtils::CalculateLengthDimensionFactorFromInt ( ALIint  ad)
static

Definition at line 242 of file ALIUtils.cc.

References CalculateLengthDimensionFactorFromString(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, and beamvalidation::exit().

Referenced by SetLengthDimensionFactors(), and SetOutputLengthDimensionFactors().

242  {
243  ALIdouble valsig;
244  switch (ad) {
245  case 0: //----- metres
247  break;
248  case 1: //----- milimetres
250  break;
251  case 2: //----- micrometres
253  break;
254  case 3: //----- centimetres
256  break;
257  default:
258  std::cerr << "!!! UNKNOWN DIMENSION SCALING " << ad << std::endl << "VALUE MUST BE BETWEEN 0 AND 3 " << std::endl;
259  exit(1);
260  }
261 
262  // use microradinas instead of radians
263  //- valsig *= 1000000.;
264 
265  return valsig;
266 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIdouble CalculateLengthDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:179
def exit(msg="")

◆ CalculateLengthDimensionFactorFromString()

ALIdouble ALIUtils::CalculateLengthDimensionFactorFromString ( ALIstring  dimstr)
static

Definition at line 179 of file ALIUtils.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, and beamvalidation::exit().

Referenced by CalculateLengthDimensionFactorFromInt(), and FittedEntriesReader::FittedEntriesReader().

179  {
180  ALIdouble valsig = 1.;
181  ALIstring internalDim = "m";
182  if (internalDim == "m") {
183  if (dimstr == "m") {
184  valsig = 1.;
185  } else if (dimstr == "mm") {
186  valsig = 1.E-3;
187  } else if (dimstr == "mum") {
188  valsig = 1.E-6;
189  } else if (dimstr == "cm") {
190  valsig = 1.E-2;
191  } else {
192  std::cerr << "!!! UNKNOWN DIMENSION SCALING " << dimstr << std::endl
193  << "VALUE MUST BE BETWEEN 0 AND 3 " << std::endl;
194  exit(1);
195  }
196  } else if (internalDim == "mm") {
197  if (dimstr == "m") {
198  valsig = 1.E3;
199  } else if (dimstr == "mm") {
200  valsig = 1.;
201  } else if (dimstr == "mum") {
202  valsig = 1.E-3;
203  } else if (dimstr == "cm") {
204  valsig = 1.E+1;
205  } else {
206  std::cerr << "!!! UNKNOWN DIMENSION SCALING: " << dimstr << std::endl
207  << "VALUE MUST BE A LENGTH DIMENSION " << std::endl;
208  exit(1);
209  }
210  }
211 
212  return valsig;
213 }
long double ALIdouble
Definition: CocoaGlobals.h:11
std::string ALIstring
Definition: CocoaGlobals.h:9
def exit(msg="")

◆ changeName()

std::string ALIUtils::changeName ( const std::string &  oldName,
const std::string &  subsstr1,
const std::string &  subsstr2 
)
static

Definition at line 535 of file ALIUtils.cc.

References mps_merge::newName, cmssw_fix_interface::oldName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by Measurement::copyMeas(), and Model::copyMeasurements().

535  {
537  int il = oldName.find(subsstr1);
538  // std::cout << " il " << il << " oldname " << oldName << " " << subsstr1 << std::endl;
539  while (il >= 0) {
540  newName = newName.substr(0, il) + subsstr2 + newName.substr(il + subsstr1.length(), newName.length());
541  // std::cout << " dnewName " << newName << " " << newName.substr( 0, il ) << " " << subsstr2 << " " << newName.substr( il+subsstr1.length(), newName.length() ) << std::endl;
542  il = oldName.find(subsstr1, il + 1);
543  }
544 
545  return newName;
546 }
string newName
Definition: mps_merge.py:86

◆ checkMatrixEquations()

int ALIUtils::checkMatrixEquations ( double  angleX,
double  angleY,
double  angleZ,
const CLHEP::HepRotation &  rot 
)
static

Definition at line 762 of file ALIUtils.cc.

References funct::cos(), eq2ang(), makeMuonMisalignmentScenario::rot, funct::sin(), fftjetcommon_cfi::sx, and fftjetcommon_cfi::sy.

Referenced by getRotationAnglesFromMatrix().

762  {
763  double sx = sin(angleX);
764  double cx = cos(angleX);
765  double sy = sin(angleY);
766  double cy = cos(angleY);
767  double sz = sin(angleZ);
768  double cz = cos(angleZ);
769 
770  double rotxx = cy * cz;
771  double rotxy = sx * sy * cz - cx * sz;
772  double rotxz = cx * sy * cz + sx * sz;
773  double rotyx = cy * sz;
774  double rotyy = sx * sy * sz + cx * cz;
775  double rotyz = cx * sy * sz - sx * cz;
776  double rotzx = -sy;
777  double rotzy = sx * cy;
778  double rotzz = cx * cy;
779 
780  int matrixElemBad = 0;
781  if (!eq2ang(rot.xx(), rotxx) || !eq2ang(rot.xy(), rotxy) || !eq2ang(rot.xz(), rotxz) || !eq2ang(rot.yx(), rotyx) ||
782  !eq2ang(rot.yy(), rotyy) || !eq2ang(rot.yz(), rotyz) || !eq2ang(rot.zx(), rotzx) || !eq2ang(rot.zy(), rotzy) ||
783  !eq2ang(rot.zz(), rotzz)) {
784  matrixElemBad++;
785  }
786 
787  return matrixElemBad;
788 }
static bool eq2ang(double ang1, double ang2)
Definition: ALIUtils.cc:725
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22

◆ diff2pi()

double ALIUtils::diff2pi ( double  ang1,
double  ang2 
)
static

Definition at line 717 of file ALIUtils.cc.

References change_name::diff, and createfilelist::int.

Referenced by eq2ang(), and getRotationAnglesFromMatrix().

717  {
718  double pii = acos(0.) * 2;
719  double diff = fabs(ang1 - ang2);
720  diff = diff - int(diff / 2. / pii) * 2 * pii;
721  return diff;
722 }

◆ dump3v()

void ALIUtils::dump3v ( const CLHEP::Hep3Vector &  vec,
const std::string &  msg 
)
static

Definition at line 58 of file ALIUtils.cc.

References gather_cfg::cout, and mps_check::msg.

Referenced by ALILine::ALILine(), ALIPlane::ALIPlane(), OptOOpticalSquare::calculateFaces(), OptOCOPS::convertPointToLocalCoordinates(), OptOSensor2D::convertPointToLocalCoordinates(), OptOPinhole::defaultBehaviour(), OptOPlateSplitter::detailedDeviatesLightRay(), OptOMirror::detailedDeviatesLightRay(), OptOCubeSplitter::detailedDeviatesLightRay(), OptOModifiedRhomboidPrism::detailedDeviatesLightRay(), OpticalObject::displaceCentreGlobOriginal(), OpticalObject::displaceCentreGlobOriginalOriginal(), OpticalObject::displaceRmGlobAroundGlobal(), OpticalObject::displaceRmGlobAroundLocal(), OpticalObject::displaceRmGlobOriginal(), OpticalObject::displaceRmGlobOriginalOriginal(), LightRay::dumpData(), OpticalObjectMgr::dumpOptOs(), OpticalObject::getDispVec(), OptOCubeSplitter::getMiddlePlate(), OpticalObject::getPlate(), OptOModifiedRhomboidPrism::getRotatedPlate(), OptOCubeSplitter::getUpperPlate(), ALILine::intersect(), LightRay::intersect(), OptOTiltmeter::makeMeasurement(), OptOSensor2D::makeMeasurement(), OptODistancemeter3dim::makeMeasurement(), OptODistancemeter::makeMeasurement(), OptOCOPS::makeMeasurement(), LightRay::reflect(), LightRay::refract(), OpticalObject::SetCentreGlobFromCentreLocal(), OpticalObject::SetCentreLocalFromEntryValues(), LightRay::shiftAndDeviateWhileTraversing(), and OptOUserDefined::userDefinedBehaviour().

58  {
59  // double phicyl = atan( vec.y()/vec.x() );
60  std::cout << msg << std::setprecision(8) << vec;
61  std::cout << std::endl;
62  // std::cout << " " << vec.theta()/deg << " " << vec.phi()/deg << " " << vec.perp() << " " << phicyl/deg << std::endl;
63  // setw(10);
64  // std::cout << msg << " x=" << std::setprecision(8) << vec.x() << " y=" << setprecision(8) <<vec.y() << " z=" << std::setprecision(8) << vec.z() << std::endl;
65  // std::setprecision(8);
66 }
tuple msg
Definition: mps_check.py:285

◆ dumpDimensions()

void ALIUtils::dumpDimensions ( std::ofstream &  fout)
static

Definition at line 308 of file ALIUtils.cc.

References _OutputAngleSigmaDimensionFactor, _OutputAngleValueDimensionFactor, _OutputLengthSigmaDimensionFactor, _OutputLengthValueDimensionFactor, EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), groupFilesInBlocks::fout, and M_PI.

Referenced by Fit::fitNextEvent(), and FittedEntriesManager::MakeHistos().

308  {
309  fout << "DIMENSIONS: lengths = ";
310  ALIstring internalDim = "m";
312  fout << "m";
313  } else if (_OutputLengthValueDimensionFactor == 1.E-3) {
314  fout << "mm";
315  } else if (_OutputLengthValueDimensionFactor == 1.E-6) {
316  fout << "mum";
317  } else if (_OutputLengthValueDimensionFactor == 1.E-2) {
318  fout << "cm";
319  } else {
320  std::cerr << " !! unknown OutputLengthValueDimensionFactor " << _OutputLengthValueDimensionFactor << std::endl;
321  exit(1);
322  }
323 
324  fout << " +- ";
326  fout << "m";
327  } else if (_OutputLengthSigmaDimensionFactor == 1.E-3) {
328  fout << "mm";
329  } else if (_OutputLengthSigmaDimensionFactor == 1.E-6) {
330  fout << "mum";
331  } else if (_OutputLengthSigmaDimensionFactor == 1.E-2) {
332  fout << "cm";
333  } else {
334  std::cerr << " !! unknown OutputLengthSigmaDimensionFactor " << _OutputLengthSigmaDimensionFactor << std::endl;
335  exit(1);
336  }
337 
338  fout << " angles = ";
340  fout << "rad";
341  } else if (_OutputAngleValueDimensionFactor == 1.E-3) {
342  fout << "mrad";
343  } else if (_OutputAngleValueDimensionFactor == 1.E-6) {
344  fout << "murad";
345  } else if (_OutputAngleValueDimensionFactor == M_PI / 180.) {
346  fout << "deg";
347  } else if (_OutputAngleValueDimensionFactor == M_PI / 200.) {
348  fout << "grad";
349  } else {
350  std::cerr << " !! unknown OutputAngleValueDimensionFactor " << _OutputAngleValueDimensionFactor << std::endl;
351  exit(1);
352  }
353 
354  fout << " +- ";
356  fout << "rad";
357  } else if (_OutputAngleSigmaDimensionFactor == 1.E-3) {
358  fout << "mrad";
359  } else if (_OutputAngleSigmaDimensionFactor == 1.E-6) {
360  fout << "murad";
361  } else if (_OutputAngleSigmaDimensionFactor == M_PI / 180.) {
362  fout << "deg";
363  } else if (_OutputAngleSigmaDimensionFactor == M_PI / 200.) {
364  fout << "grad";
365  } else {
366  std::cerr << " !! unknown OutputAngleSigmaDimensionFactor " << _OutputAngleSigmaDimensionFactor << std::endl;
367  exit(1);
368  }
369  fout << std::endl;
370 }
static ALIdouble _OutputLengthValueDimensionFactor
Definition: ALIUtils.h:107
static ALIdouble _OutputAngleSigmaDimensionFactor
Definition: ALIUtils.h:110
#define M_PI
std::string ALIstring
Definition: CocoaGlobals.h:9
static ALIdouble _OutputAngleValueDimensionFactor
Definition: ALIUtils.h:109
static ALIdouble _OutputLengthSigmaDimensionFactor
Definition: ALIUtils.h:108
def exit(msg="")

◆ dumprm()

void ALIUtils::dumprm ( const CLHEP::HepRotation &  rm,
const std::string &  msg,
std::ostream &  out = std::cout 
)
static

Definition at line 71 of file ALIUtils.cc.

References mps_check::msg, MillePedeFileConverter_cfg::out, and eostools::rm().

Referenced by OpticalObject::buildRmFromEntryValuesOriginalOriginal(), OptOCOPS::convertPointToLocalCoordinates(), OptOSensor2D::convertPointToLocalCoordinates(), OpticalObject::displaceRmGlobAroundGlobal(), OpticalObject::displaceRmGlobAroundLocal(), OpticalObject::displaceRmGlobOriginal(), OpticalObject::displaceRmGlobOriginalOriginal(), OpticalObject::getDispVec(), OptOCubeSplitter::getMiddlePlate(), OpticalObject::getPlate(), OptOModifiedRhomboidPrism::getRotatedPlate(), getRotationAnglesFromMatrix(), OpticalObject::getRotationAnglesInOptOFrame(), OptOCubeSplitter::getUpperPlate(), OptOTiltmeter::makeMeasurement(), Fit::printCentreInOptOFrame(), OpticalObject::propagateGlobalRMOriginalOriginalChangeToChildren(), OpticalObject::SetCentreGlobFromCentreLocal(), OpticalObject::setGlobalRMOriginalOriginal(), OpticalObject::SetRMGlobFromRMLocal(), OpticalObject::SetRMLocalFromEntryValues(), LightRay::startLightRay(), and EntryAngleAffAngles::valueDisplaced().

71  {
72  out << msg << " xx=" << rm.xx() << " xy=" << rm.xy() << " xz=" << rm.xz() << std::endl;
73  out << msg << " yx=" << rm.yx() << " yy=" << rm.yy() << " yz=" << rm.yz() << std::endl;
74  out << msg << " zx=" << rm.zx() << " zy=" << rm.zy() << " zz=" << rm.zz() << std::endl;
75 }
def rm(path, rec=False)
Definition: eostools.py:363
tuple msg
Definition: mps_check.py:285

◆ dumpVS()

void ALIUtils::dumpVS ( const std::vector< ALIstring > &  wl,
const std::string &  msg,
std::ostream &  outs = std::cout 
)
static

◆ eq2ang()

bool ALIUtils::eq2ang ( double  ang1,
double  ang2 
)
static

Definition at line 725 of file ALIUtils.cc.

References change_name::diff, and diff2pi().

Referenced by checkMatrixEquations(), and getRotationAnglesFromMatrix().

725  {
726  bool beq = true;
727 
728  double pii = acos(0.) * 2;
729  double diff = diff2pi(ang1, ang2);
730  if (diff > 0.00001) {
731  if (fabs(diff - 2 * pii) > 0.00001) {
732  //- std::cout << " diff " << diff << " " << ang1 << " " << ang2 << std::endl;
733  beq = false;
734  }
735  } else {
736  beq = true;
737  }
738 
739  return beq;
740 }
static double diff2pi(double ang1, double ang2)
Definition: ALIUtils.cc:717

◆ getBool()

bool ALIUtils::getBool ( const ALIstring str)
static

Convert a bool to an integer, checking that it is really a bool.

Definition at line 420 of file ALIUtils.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), str, and heppy_batch::val.

420  {
421  bool val;
422 
423  //t str = upper( str );
424  //----------- first check that it is a not number
425  if (str == "ON" || str == "TRUE") {
426  val = true;
427  } else if (str == "OFF" || str == "FALSE") {
428  val = false;
429  } else {
430  std::cerr << "!!!! EXITING: trying to get the float from a string that is not 'ON'/'OFF'/'TRUE'/'FALSE' " << str
431  << std::endl;
432  exit(1);
433  }
434 
435  return val;
436 }
#define str(s)
def exit(msg="")

◆ getDimensionValue()

ALIdouble ALIUtils::getDimensionValue ( const ALIstring dim,
const ALIstring dimType 
)
static

Definition at line 477 of file ALIUtils.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, M_PI, and relativeConstraints::value.

Referenced by EntryMgr::readEntryFromReportOut().

477  {
479  if (dimType == "Length") {
480  if (dim == "mm") {
481  value = 1.E-3;
482  } else if (dim == "cm") {
483  value = 1.E-2;
484  } else if (dim == "m") {
485  value = 1.;
486  } else if (dim == "mum") {
487  value = 1.E-6;
488  } else if (dim == "dm") {
489  value = 1.E-1;
490  } else if (dim == "nm") {
491  value = 1.E-9;
492  } else {
493  std::cerr << "!!!!FATAL ERROR: ALIUtils::GetDimensionValue. " << dim
494  << " is a dimension not supported for dimension type " << dimType << std::endl;
495  abort();
496  }
497  } else if (dimType == "Angle") {
498  if (dim == "rad") {
499  value = 1.;
500  } else if (dim == "mrad") {
501  value = 1.E-3;
502  } else if (dim == "murad") {
503  value = 1.E-6;
504  } else if (dim == "deg") {
505  value = M_PI / 180.;
506  } else if (dim == "grad") {
507  value = M_PI / 200.;
508  } else {
509  std::cerr << "!!!!FATAL ERROR: ALIUtils::GetDimensionValue. " << dim
510  << " is a dimension not supported for dimension type " << dimType << std::endl;
511  abort();
512  }
513  } else {
514  std::cerr << "!!!!FATAL ERROR: ALIUtils::GetDimensionValue. " << dimType << " is a dimension type not supported "
515  << std::endl;
516  abort();
517  }
518 
519  return value;
520 }
long double ALIdouble
Definition: CocoaGlobals.h:11
Definition: value.py:1
#define M_PI

◆ getFirstTime()

static ALIbool ALIUtils::getFirstTime ( )
inlinestatic

◆ getFloat()

double ALIUtils::getFloat ( const ALIstring str)
static

Convert a string to an float, checking that it is really a number.

Definition at line 373 of file ALIUtils.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), IsNumber(), and str.

Referenced by EntryData::fill(), DeviationSensor2D::fillData(), FittedEntriesSet::FillEntriesFromFile(), OptOSensor2D::fillExtraEntry(), FittedEntriesReader::readFittedEntriesFromFile(), ErrorCorrelationMgr::readFromReportFile(), and Model::readSystemDescription().

373  {
374  //----------- first check that it is a number
375  if (!IsNumber(str)) {
376  std::cerr << "!!!! EXITING: trying to get the float from a string that is not a number " << str << std::endl;
377  exit(1);
378  }
379 
380  return atof(str.c_str());
381 }
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:33
#define str(s)
def exit(msg="")

◆ getInt()

int ALIUtils::getInt ( const ALIstring str)
static

Convert a string to an integer, checking that it is really an integer.

Definition at line 384 of file ALIUtils.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), cuy::ii, createfilelist::int, IsNumber(), and str.

Referenced by OpticalObject::createComponentOptOs(), ErrorCorrelationMgr::readFromReportFile(), and Model::readSystemDescription().

384  {
385  //----------- first check that it is an integer
386  if (!IsNumber(str)) {
387  //----- Check that it is a number
388  std::cerr << "!!!! EXITING: trying to get the integer from a string that is not a number " << str << std::endl;
389  exit(1);
390  } else {
391  //----- Check that it is not a float, no decimal or E-n
392  bool isFloat = false;
393  int ch = str.find('.');
394  ALIuint ii = 0;
395  if (ch != -1) {
396  for (ii = ch + 1; ii < str.size(); ii++) {
397  if (str[ii] != '0')
398  isFloat = true;
399  }
400  }
401 
402  ch = str.find('E');
403  if (ch != -1)
404  ch = str.find('e');
405  if (ch != -1) {
406  if (str[ch + 1] == '-')
407  isFloat = true;
408  }
409 
410  if (isFloat) {
411  std::cerr << "!!!! EXITING: trying to get the integer from a string that is a float: " << str << std::endl;
412  std::cerr << ii << " ii " << ch << std::endl;
413  exit(1);
414  }
415  }
416  return int(atof(str.c_str()));
417 }
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:33
ii
Definition: cuy.py:589
#define str(s)
unsigned int ALIuint
Definition: CocoaGlobals.h:17
def exit(msg="")

◆ getMaximumDeviationDerivative()

static ALIdouble ALIUtils::getMaximumDeviationDerivative ( )
inlinestatic

Definition at line 89 of file ALIUtils.h.

References maximum_deviation_derivative.

Referenced by Measurement::DerivativeRespectEntry(), and Fit::getInstance().

static ALIdouble maximum_deviation_derivative
Definition: ALIUtils.h:115

◆ getRotationAnglesFromMatrix()

std::vector< double > ALIUtils::getRotationAnglesFromMatrix ( const CLHEP::HepRotation &  rmLocal,
double  origAngleX,
double  origAngleY,
double  origAngleZ 
)
static

Definition at line 549 of file ALIUtils.cc.

References addPii(), approxTo0(), EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, checkMatrixEquations(), funct::cos(), gather_cfg::cout, debug, diff2pi(), dumprm(), eq2ang(), cuy::ii, makeMuonMisalignmentScenario::rot, and funct::sin().

Referenced by OpticalObject::getRotationAnglesFromMatrix(), and CocoaAnalyzer::readXMLFile().

552  {
553  double pii = acos(0.) * 2;
554  std::vector<double> newang(3);
555  double angleX = origAngleX;
556  double angleY = origAngleY;
557  double angleZ = origAngleZ;
558 
559  if (ALIUtils::debug >= 4) {
560  std::cout << " angles as value entries: X= " << angleX << " Y= " << angleY << " Z " << angleZ << std::endl;
561  }
562 
563  //- std::cout << name () << " vdbf " << angleX << " " << angleY << " " << angleZ << std::endl;
564  double rotzx = approxTo0(rmLocal.zx());
565  double rotzy = approxTo0(rmLocal.zy());
566  double rotzz = approxTo0(rmLocal.zz());
567  double rotyx = approxTo0(rmLocal.yx());
568  double rotxx = approxTo0(rmLocal.xx());
569  if (rotzy == 0. && rotzz == 0.) {
570  //check that entry is z angle
571  newang[0] = angleX;
572  //beware of aa <==> pii - aa
573  if (eq2ang(rmLocal.zx(), -1.)) {
574  double aa = asin(rmLocal.xy());
575  if (diff2pi(angleZ, -aa + newang[0]) < diff2pi(angleZ, -pii + aa + newang[0])) {
576  newang[2] = -aa + newang[0];
577  if (ALIUtils::debug >= 5)
578  std::cout << " newang[0] = -aa + newang[0] " << std::endl;
579  } else {
580  newang[2] = -pii + aa + newang[0];
581  if (ALIUtils::debug >= 5)
582  std::cout << " newang[0] = -pii + aa + newang[0] " << newang[0] << " " << aa << " " << newang[2] << std::endl;
583  }
584  } else {
585  double aa = asin(-rmLocal.xy());
586  if (diff2pi(angleZ, aa - newang[0]) < diff2pi(angleZ, pii - aa - newang[0])) {
587  newang[2] = aa - newang[0];
588  if (ALIUtils::debug >= 5)
589  std::cout << " newang[0] = aa - newang[2] " << std::endl;
590  } else {
591  newang[2] = pii - aa - newang[0];
592  if (ALIUtils::debug >= 5)
593  std::cout << " newang[0] = pii - aa - newang[2] " << newang[0] << " " << aa << " " << newang[2] << std::endl;
594  }
595  }
596  } else {
597  newang[0] = atan(rotzy / rotzz);
598  newang[2] = atan(rotyx / rotxx);
599  }
600  if (rotzx < -1.) {
601  //- std::cerr << " rotzx too small " << rotzx << " = " << rmLocal.zx() << " " << rotzx-rmLocal.zx() << std::endl;
602  rotzx = -1.;
603  } else if (rotzx > 1.) {
604  //- std::cerr << " rotzx too big " << rotzx << " = " << rmLocal.zx() << " " << rotzx-rmLocal.zx() << std::endl;
605  rotzx = 1.;
606  }
607  newang[1] = -asin(rotzx);
608  if (ALIUtils::debug >= 5)
609  std::cout << "First calculation of angles: " << std::endl
610  << " newang[0] " << newang[0] << " " << rotzy << " " << rotzz << std::endl
611  << " newang[1] " << newang[1] << " " << rotzx << std::endl
612  << " newang[2] " << newang[2] << " " << rotyx << " " << rotxx << std::endl;
613 
614  // newang[2] = acos( rmLocal.xx() / cos( newang[1] ) );
615  //----- CHECK if the angles are OK (there are several symmetries)
616  //--- Check if the predictions with the angles obtained match the values of the rotation matrix (they may differ for exampole by a sign or more in complicated formulas)
617  double rotnewxx = cos(newang[1]) * cos(newang[2]);
618  double rotnewzz = cos(newang[0]) * cos(newang[1]);
619  double rotnewxy = sin(newang[0]) * sin(newang[1]) * cos(newang[2]) - cos(newang[0]) * sin(newang[2]);
620  double rotnewxz = cos(newang[0]) * sin(newang[1]) * cos(newang[2]) + sin(newang[0]) * sin(newang[2]);
621  double rotnewyy = sin(newang[0]) * sin(newang[1]) * sin(newang[2]) + cos(newang[0]) * cos(newang[2]);
622  double rotnewyz = cos(newang[0]) * sin(newang[1]) * sin(newang[2]) - sin(newang[0]) * cos(newang[2]);
623 
624  bool eqxx = eq2ang(rotnewxx, rmLocal.xx());
625  bool eqzz = eq2ang(rotnewzz, rmLocal.zz());
626  bool eqxy = eq2ang(rotnewxy, rmLocal.xy());
627  bool eqxz = eq2ang(rotnewxz, rmLocal.xz());
628  bool eqyy = eq2ang(rotnewyy, rmLocal.yy());
629  bool eqyz = eq2ang(rotnewyz, rmLocal.yz());
630 
631  //--- Check if one of the tree angles should be changed
632  if (ALIUtils::debug >= 5) {
633  std::cout << " pred rm.xx " << rotnewxx << " =? " << rmLocal.xx() << " pred rm.zz " << rotnewzz << " =? "
634  << rmLocal.zz() << std::endl;
635  std::cout << " eqxx " << eqxx << " eqzz " << eqzz << std::endl;
636  //- std::cout << " rotnewxx " << rotnewxx << " = " << rmLocal.xx() << " " << fabs( rotnewxx - rmLocal.xx() ) << " " <<(fabs( rotnewxx - rmLocal.xx() ) < 0.0001) << std::endl;
637  }
638 
639  if (eqxx & !eqzz) {
640  newang[0] = pii + newang[0];
641  if (ALIUtils::debug >= 5)
642  std::cout << " change newang[0] " << newang[0] << std::endl;
643  } else if (!eqxx & !eqzz) {
644  newang[1] = pii - newang[1];
645  if (ALIUtils::debug >= 5)
646  std::cout << " change newang[1] " << newang[1] << std::endl;
647  } else if (!eqxx & eqzz) {
648  newang[2] = pii + newang[2];
649  if (ALIUtils::debug >= 5)
650  std::cout << " change newang[2] " << newang[2] << std::endl;
651  }
652 
653  //--- Check if the 3 angles should be changed (previous check is invariant to the 3 changing)
654  if (ALIUtils::debug >= 5) {
655  std::cout << " pred rm.xy " << rotnewxy << " =? " << rmLocal.xy() << " pred rm.xz " << rotnewxz << " =? "
656  << rmLocal.xz() << " pred rm.yy " << rotnewyy << " =? " << rmLocal.yy() << " pred rm.yz " << rotnewyz
657  << " =? " << rmLocal.yz() << std::endl;
658  std::cout << " eqxy " << eqxy << " eqxz " << eqxz << " eqyy " << eqyy << " eqyz " << eqyz << std::endl;
659  }
660 
661  if (!eqxy || !eqxz || !eqyy || !eqyz) {
662  // check also cases where one of the above 'eq' is OK because it is = 0
663  if (ALIUtils::debug >= 5)
664  std::cout << " change the 3 newang " << std::endl;
665  newang[0] = addPii(newang[0]);
666  newang[1] = pii - newang[1];
667  newang[2] = addPii(newang[2]);
668  double rotnewxy = -sin(newang[0]) * sin(newang[1]) * cos(newang[2]) - cos(newang[0]) * sin(newang[2]);
669  double rotnewxz = -cos(newang[0]) * sin(newang[1]) * cos(newang[2]) - sin(newang[0]) * sin(newang[2]);
670  if (ALIUtils::debug >= 5)
671  std::cout << " rotnewxy " << rotnewxy << " = " << rmLocal.xy() << " rotnewxz " << rotnewxz << " = "
672  << rmLocal.xz() << std::endl;
673  }
674  if (diff2pi(angleX, newang[0]) + diff2pi(angleY, newang[1]) + diff2pi(angleZ, newang[2]) >
675  diff2pi(angleX, pii + newang[0]) + diff2pi(angleY, pii - newang[1]) + diff2pi(angleZ, pii + newang[2])) {
676  // check also cases where one of the above 'eq' is OK because it is = 0
677  if (ALIUtils::debug >= 5)
678  std::cout << " change the 3 newang " << std::endl;
679  newang[0] = addPii(newang[0]);
680  newang[1] = pii - newang[1];
681  newang[2] = addPii(newang[2]);
682  double rotnewxy = -sin(newang[0]) * sin(newang[1]) * cos(newang[2]) - cos(newang[0]) * sin(newang[2]);
683  double rotnewxz = -cos(newang[0]) * sin(newang[1]) * cos(newang[2]) - sin(newang[0]) * sin(newang[2]);
684  if (ALIUtils::debug >= 5)
685  std::cout << " rotnewxy " << rotnewxy << " = " << rmLocal.xy() << " rotnewxz " << rotnewxz << " = "
686  << rmLocal.xz() << std::endl;
687  }
688 
689  for (int ii = 0; ii < 3; ii++) {
690  newang[ii] = approxTo0(newang[ii]);
691  }
692  // double rotnewyx = cos( newang[1] ) * sin( newang[2] );
693 
694  if (checkMatrixEquations(newang[0], newang[1], newang[2], rmLocal) != 0) {
695  std::cerr << " wrong rotation matrix " << newang[0] << " " << newang[1] << " " << newang[2] << std::endl;
696  ALIUtils::dumprm(rmLocal, " matrix is ");
697  }
698  if (ALIUtils::debug >= 5) {
699  std::cout << "Final angles: newang[0] " << newang[0] << " newang[1] " << newang[1] << " newang[2] " << newang[2]
700  << std::endl;
701  CLHEP::HepRotation rot;
702  rot.rotateX(newang[0]);
703  ALIUtils::dumprm(rot, " new rot after X ");
704  rot.rotateY(newang[1]);
705  ALIUtils::dumprm(rot, " new rot after Y ");
706  rot.rotateZ(newang[2]);
707  ALIUtils::dumprm(rot, " new rot ");
708  ALIUtils::dumprm(rmLocal, " rmLocal ");
709  //- ALIUtils::dumprm( theRmGlobOriginal, " theRmGlobOriginal " );
710  }
711 
712  //- std::cout << " before return newang[0] " << newang[0] << " newang[1] " << newang[1] << " newang[2] " << newang[2] << std::endl;
713  return newang;
714 }
static double approxTo0(double val)
Definition: ALIUtils.cc:743
static double diff2pi(double ang1, double ang2)
Definition: ALIUtils.cc:717
static bool eq2ang(double ang1, double ang2)
Definition: ALIUtils.cc:725
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static void dumprm(const CLHEP::HepRotation &rm, const std::string &msg, std::ostream &out=std::cout)
Definition: ALIUtils.cc:71
static ALIint debug
Definition: ALIUtils.h:34
static double addPii(double val)
Definition: ALIUtils.cc:751
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static int checkMatrixEquations(double angleX, double angleY, double angleZ, const CLHEP::HepRotation &rot)
Definition: ALIUtils.cc:762
ii
Definition: cuy.py:589

◆ IsNumber()

int ALIUtils::IsNumber ( const ALIstring str)
static

Definition at line 33 of file ALIUtils.cc.

References cuy::ii, and str.

Referenced by Measurement::fillData(), Entry::fillFromInputFileSigma(), Entry::fillFromInputFileValue(), getFloat(), getInt(), ParameterMgr::getVal(), Model::readSystemDescription(), MeasurementDistancemeter::setConversionFactor(), MeasurementDistancemeter3dim::setConversionFactor(), MeasurementSensor2D::setConversionFactor(), MeasurementCOPS::setConversionFactor(), and MeasurementTiltmeter::setConversionFactor().

33  {
34  int isnum = 1;
35  int numE = 0;
36  for (ALIuint ii = 0; ii < str.length(); ii++) {
37  if (!isdigit(str[ii]) && str[ii] != '.' && str[ii] != '-' && str[ii] != '+') {
38  //--- check for E(xponential)
39  if (str[ii] == 'E' || str[ii] == 'e') {
40  if (numE != 0 || ii == str.length() - 1) {
41  isnum = 0;
42  break;
43  }
44  numE++;
45  } else {
46  isnum = 0;
47  break;
48  }
49  }
50  }
51 
52  return isnum;
53 }
ii
Definition: cuy.py:589
#define str(s)
unsigned int ALIuint
Definition: CocoaGlobals.h:17

◆ LengthSigmaDimensionFactor()

static ALIdouble ALIUtils::LengthSigmaDimensionFactor ( )
inlinestatic

Definition at line 63 of file ALIUtils.h.

References _LengthSigmaDimensionFactor.

Referenced by EntryLength::SigmaDimensionFactor(), and Measurement::sigmaDimensionFactor().

static ALIdouble _LengthSigmaDimensionFactor
Definition: ALIUtils.h:104

◆ LengthValueDimensionFactor()

static ALIdouble ALIUtils::LengthValueDimensionFactor ( )
inlinestatic

◆ OutputAngleSigmaDimensionFactor()

static ALIdouble ALIUtils::OutputAngleSigmaDimensionFactor ( )
inlinestatic

Definition at line 69 of file ALIUtils.h.

References _OutputAngleSigmaDimensionFactor.

Referenced by EntryAngle::OutputSigmaDimensionFactor().

static ALIdouble _OutputAngleSigmaDimensionFactor
Definition: ALIUtils.h:110

◆ OutputAngleValueDimensionFactor()

static ALIdouble ALIUtils::OutputAngleValueDimensionFactor ( )
inlinestatic

Definition at line 68 of file ALIUtils.h.

References _OutputAngleValueDimensionFactor.

Referenced by EntryAngle::OutputValueDimensionFactor().

static ALIdouble _OutputAngleValueDimensionFactor
Definition: ALIUtils.h:109

◆ OutputLengthSigmaDimensionFactor()

static ALIdouble ALIUtils::OutputLengthSigmaDimensionFactor ( )
inlinestatic

Definition at line 67 of file ALIUtils.h.

References _OutputLengthSigmaDimensionFactor.

Referenced by EntryLength::OutputSigmaDimensionFactor().

static ALIdouble _OutputLengthSigmaDimensionFactor
Definition: ALIUtils.h:108

◆ OutputLengthValueDimensionFactor()

static ALIdouble ALIUtils::OutputLengthValueDimensionFactor ( )
inlinestatic

Definition at line 66 of file ALIUtils.h.

References _OutputLengthValueDimensionFactor.

Referenced by EntryLength::OutputValueDimensionFactor().

static ALIdouble _OutputLengthValueDimensionFactor
Definition: ALIUtils.h:107

◆ set_time_now()

static void ALIUtils::set_time_now ( time_t  now)
inlinestatic

◆ SetAngleDimensionFactors()

void ALIUtils::SetAngleDimensionFactors ( )
static

Definition at line 104 of file ALIUtils.cc.

References _AngleSigmaDimensionFactor, _AngleValueDimensionFactor, CalculateAngleDimensionFactorFromInt(), gather_cfg::cout, debug, GlobalOptionMgr::getInstance(), and GlobalOptionMgr::GlobalOptions().

Referenced by Model::readSystemDescription().

104  {
105  //--------------------- if it doesn exist, GlobalOptions is 0
106  //---------- Calculate factors to convert to radians
108  ALIint ad = ALIint(gomgr->GlobalOptions()[ALIstring("angle_value_dimension")]);
110 
111  ad = ALIint(gomgr->GlobalOptions()[ALIstring("angle_error_dimension")]);
113 
114  //---------- Change factor to convert to error dimensions
115  // _AngleValueDimensionFactor /= _AngleSigmaDimensionFactor;
116  //_AngleSigmaDimensionFactor = 1;
117 
118  if (ALIUtils::debug >= 6)
119  std::cout << _AngleValueDimensionFactor << "Set Angle DimensionFactors" << _AngleSigmaDimensionFactor << std::endl;
120 }
int ALIint
Definition: CocoaGlobals.h:15
static ALIdouble _AngleValueDimensionFactor
Definition: ALIUtils.h:105
static ALIint debug
Definition: ALIUtils.h:34
static GlobalOptionMgr * getInstance()
static ALIdouble _AngleSigmaDimensionFactor
Definition: ALIUtils.h:106
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
std::string ALIstring
Definition: CocoaGlobals.h:9
static ALIdouble CalculateAngleDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:271

◆ setDebugVerbosity()

static void ALIUtils::setDebugVerbosity ( ALIint  val)
inlinestatic

Definition at line 38 of file ALIUtils.h.

References debug, and heppy_batch::val.

Referenced by CocoaAnalyzer::analyze(), and GlobalOptionMgr::setGlobalOption().

38 { debug = val; }
static ALIint debug
Definition: ALIUtils.h:34

◆ setFirstTime()

static void ALIUtils::setFirstTime ( ALIbool  val)
inlinestatic

Definition at line 88 of file ALIUtils.h.

References firstTime, and heppy_batch::val.

Referenced by Fit::PropagateErrors(), and Fit::startFit().

88 { firstTime = val; }
static ALIbool firstTime
Definition: ALIUtils.h:113

◆ SetLengthDimensionFactors()

void ALIUtils::SetLengthDimensionFactors ( )
static

Definition at line 81 of file ALIUtils.cc.

References _LengthSigmaDimensionFactor, _LengthValueDimensionFactor, CalculateLengthDimensionFactorFromInt(), gather_cfg::cout, debug, GlobalOptionMgr::getGlobalOption(), GlobalOptionMgr::getInstance(), and GlobalOptionMgr::GlobalOptions().

Referenced by Model::readSystemDescription().

81  {
82  //---------------------------------------- if it doesn exist, GlobalOptions is 0
83  //---------- Calculate factors to convert to meters
85  ALIint ad = ALIint(gomgr->getGlobalOption("length_value_dimension"));
86 
88  ad = ALIint(gomgr->GlobalOptions()[ALIstring("length_error_dimension")]);
90 
91  //---------- Change factor to convert to error dimensions
92  // _LengthValueDimensionFactor /= _LengthSigmaDimensionFactor;
93  //_LengthSigmaDimensionFactor = 1;
94 
95  if (ALIUtils::debug >= 6)
96  std::cout << _LengthValueDimensionFactor << " Set Length DimensionFactors " << _LengthSigmaDimensionFactor
97  << std::endl;
98 }
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:34
static GlobalOptionMgr * getInstance()
static ALIdouble CalculateLengthDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:242
static ALIdouble _LengthSigmaDimensionFactor
Definition: ALIUtils.h:104
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
std::string ALIstring
Definition: CocoaGlobals.h:9
ALIdouble getGlobalOption(const ALIstring &sstr)
static ALIdouble _LengthValueDimensionFactor
Definition: ALIUtils.h:103

◆ setMaximumDeviationDerivative()

static void ALIUtils::setMaximumDeviationDerivative ( ALIdouble  val)
inlinestatic

Definition at line 90 of file ALIUtils.h.

References maximum_deviation_derivative, and heppy_batch::val.

Referenced by Fit::getInstance().

static ALIdouble maximum_deviation_derivative
Definition: ALIUtils.h:115

◆ SetOutputAngleDimensionFactors()

void ALIUtils::SetOutputAngleDimensionFactors ( )
static

Definition at line 153 of file ALIUtils.cc.

References _OutputAngleSigmaDimensionFactor, _OutputAngleValueDimensionFactor, CalculateAngleDimensionFactorFromInt(), gather_cfg::cout, debug, GlobalOptionMgr::getInstance(), and GlobalOptionMgr::GlobalOptions().

Referenced by Model::readSystemDescription().

153  {
154  //--------------------- if it doesn exist, GlobalOptions is 0
155  //---------- Calculate factors to convert to radians
157  ALIint ad = ALIint(gomgr->GlobalOptions()[ALIstring("output_angle_value_dimension")]);
158  if (ad == 0)
159  ad = ALIint(gomgr->GlobalOptions()[ALIstring("angle_value_dimension")]);
161 
162  ad = ALIint(gomgr->GlobalOptions()[ALIstring("output_angle_error_dimension")]);
163  if (ad == 0)
164  ad = ALIint(gomgr->GlobalOptions()[ALIstring("angle_error_dimension")]);
166 
167  //---------- Change factor to convert to error dimensions
168  // _AngleValueDimensionFactor /= _AngleSigmaDimensionFactor;
169  //_AngleSigmaDimensionFactor = 1;
170 
171  if (ALIUtils::debug >= 9)
172  std::cout << _OutputAngleValueDimensionFactor << "Output Angle Dimension Factors"
173  << _OutputAngleSigmaDimensionFactor << std::endl;
174 }
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:34
static GlobalOptionMgr * getInstance()
static ALIdouble _OutputAngleSigmaDimensionFactor
Definition: ALIUtils.h:110
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
std::string ALIstring
Definition: CocoaGlobals.h:9
static ALIdouble _OutputAngleValueDimensionFactor
Definition: ALIUtils.h:109
static ALIdouble CalculateAngleDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:271

◆ SetOutputLengthDimensionFactors()

void ALIUtils::SetOutputLengthDimensionFactors ( )
static

Definition at line 126 of file ALIUtils.cc.

References _OutputLengthSigmaDimensionFactor, _OutputLengthValueDimensionFactor, CalculateLengthDimensionFactorFromInt(), gather_cfg::cout, debug, GlobalOptionMgr::getInstance(), and GlobalOptionMgr::GlobalOptions().

Referenced by Model::readSystemDescription().

126  {
127  //---------------------------------------- if it doesn exist, GlobalOptions is 0
128  //---------- Calculate factors to convert to meters
130  ALIint ad = ALIint(gomgr->GlobalOptions()[ALIstring("output_length_value_dimension")]);
131  if (ad == 0)
132  ad = ALIint(gomgr->GlobalOptions()[ALIstring("length_value_dimension")]);
134 
135  ad = ALIint(gomgr->GlobalOptions()[ALIstring("output_length_error_dimension")]);
136  if (ad == 0)
137  ad = ALIint(gomgr->GlobalOptions()[ALIstring("length_error_dimension")]);
139 
140  //---------- Change factor to convert to error dimensions
141  // _LengthValueDimensionFactor /= _LengthSigmaDimensionFactor;
142  //_LengthSigmaDimensionFactor = 1;
143 
144  if (ALIUtils::debug >= 6)
145  std::cout << _OutputLengthValueDimensionFactor << "Output Length Dimension Factors"
146  << _OutputLengthSigmaDimensionFactor << std::endl;
147 }
static ALIdouble _OutputLengthValueDimensionFactor
Definition: ALIUtils.h:107
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:34
static GlobalOptionMgr * getInstance()
static ALIdouble CalculateLengthDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:242
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
std::string ALIstring
Definition: CocoaGlobals.h:9
static ALIdouble _OutputLengthSigmaDimensionFactor
Definition: ALIUtils.h:108

◆ setReportVerbosity()

static void ALIUtils::setReportVerbosity ( ALIint  val)
inlinestatic

Definition at line 37 of file ALIUtils.h.

References report, and heppy_batch::val.

Referenced by GlobalOptionMgr::setGlobalOption().

37 { report = val; }
static ALIint report
Definition: ALIUtils.h:33

◆ subQuotes()

ALIstring ALIUtils::subQuotes ( const ALIstring str)
static

Definition at line 439 of file ALIUtils.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, beamvalidation::exit(), and str.

439  {
440  //---------- Take out leading and trailing '"'
441  if (str.find('"') != 0 || str.rfind('"') != str.length() - 1) {
442  std::cerr << "!!!EXITING trying to substract quotes from a word that has no quotes " << str << std::endl;
443  exit(1);
444  }
445 
446  // str = str.strip(ALIstring::both, '\"');
447  //---------- Take out leading and trallling '"'
448  ALIstring strt = str.substr(1, str.size() - 2);
449 
450  //- std::cout << " subquotes " << str << std::endl;
451  //---------- Look for leading spaces
452  while (strt[0] == ' ') {
453  strt = strt.substr(1, strt.size() - 1);
454  }
455 
456  //---------- Look for trailing spaces
457  while (strt[strt.size() - 1] == ' ') {
458  strt = strt.substr(0, strt.size() - 1);
459  }
460 
461  return strt;
462 }
std::string ALIstring
Definition: CocoaGlobals.h:9
#define str(s)
def exit(msg="")

◆ time_now()

static time_t ALIUtils::time_now ( )
inlinestatic

Definition at line 39 of file ALIUtils.h.

References _time_now.

Referenced by Fit::getFitQuality(), Fit::multiplyMatrices(), and Fit::PropagateErrors().

39 { return _time_now; }
static time_t _time_now
Definition: ALIUtils.h:111

◆ val0()

static ALIdouble ALIUtils::val0 ( ALIdouble  val)
inlinestatic

Definition at line 71 of file ALIUtils.h.

References heppy_batch::val.

71  {
72  //-std::cout << val << " val " << ( (val <= 1.E-9) ? 0. : val) << std::endl;
73  // return (abs(val) <= 1.E-9) ? 0. : val; }
74  if (std::fabs(val) <= 1.E-9) {
75  return 0.;
76  } else {
77  return val;
78  };
79  }

Member Data Documentation

◆ _AngleSigmaDimensionFactor

ALIdouble ALIUtils::_AngleSigmaDimensionFactor = 1.
staticprivate

Definition at line 106 of file ALIUtils.h.

Referenced by AngleSigmaDimensionFactor(), and SetAngleDimensionFactors().

◆ _AngleValueDimensionFactor

ALIdouble ALIUtils::_AngleValueDimensionFactor = 1.
staticprivate

Definition at line 105 of file ALIUtils.h.

Referenced by AngleValueDimensionFactor(), and SetAngleDimensionFactors().

◆ _LengthSigmaDimensionFactor

ALIdouble ALIUtils::_LengthSigmaDimensionFactor = 1.
staticprivate

Definition at line 104 of file ALIUtils.h.

Referenced by LengthSigmaDimensionFactor(), and SetLengthDimensionFactors().

◆ _LengthValueDimensionFactor

ALIdouble ALIUtils::_LengthValueDimensionFactor = 1.
staticprivate

Definition at line 103 of file ALIUtils.h.

Referenced by LengthValueDimensionFactor(), and SetLengthDimensionFactors().

◆ _OutputAngleSigmaDimensionFactor

ALIdouble ALIUtils::_OutputAngleSigmaDimensionFactor = 1.
staticprivate

◆ _OutputAngleValueDimensionFactor

ALIdouble ALIUtils::_OutputAngleValueDimensionFactor = 1.
staticprivate

◆ _OutputLengthSigmaDimensionFactor

ALIdouble ALIUtils::_OutputLengthSigmaDimensionFactor = 1.
staticprivate

◆ _OutputLengthValueDimensionFactor

ALIdouble ALIUtils::_OutputLengthValueDimensionFactor = 1.
staticprivate

◆ _time_now

time_t ALIUtils::_time_now
staticprivate

Definition at line 111 of file ALIUtils.h.

Referenced by set_time_now(), and time_now().

◆ debug

ALIint ALIUtils::debug = 99
static

Definition at line 34 of file ALIUtils.h.

Referenced by Measurement::addAffectingEntriesFromOptO(), Fit::addDaMatrixToEntries(), Entry::addFittedDisplacementToValue(), ParameterMgr::addParameter(), ParameterMgr::addRandomFlatParameter(), ParameterMgr::addRandomGaussParameter(), ALILine::ALILine(), ALIPlane::ALIPlane(), CocoaDBMgr::BuildAlignments(), Model::BuildMeasurementsFromOA(), CocoaDaqReaderRoot::BuildMeasurementsFromOptAlign(), CocoaDBMgr::BuildOpticalAlignments(), Measurement::buildOptOList(), OpticalObject::buildRmFromEntryValuesOriginalOriginal(), OpticalObject::buildWordList(), OptOOpticalSquare::calculateFaces(), OpticalObject::calculateLocalRotationAxisInGlobal(), Measurement::calculateOriginalSimulatedValue(), Fit::calculateSimulatedMeasurementsWithOriginalValues(), MeasurementSensor2D::calculateSimulatedValue(), MeasurementDistancemeter::calculateSimulatedValue(), MeasurementDistancemeter3dim::calculateSimulatedValue(), MeasurementCOPS::calculateSimulatedValue(), MeasurementDiffEntry::calculateSimulatedValue(), MeasurementTiltmeter::calculateSimulatedValue(), Fit::CheckIfFitPossible(), Fit::CheckIfMeasIsProportionalToAnother(), Model::CMSLinkDeleteOptOs(), CocoaDaqReaderRoot::CocoaDaqReaderRoot(), CocoaDaqReaderText::CocoaDaqReaderText(), Measurement::construct(), OpticalObject::construct(), Measurement::constructFromOA(), OpticalObject::constructFromOptAligInfo(), OptOCOPS::convertPointToLocalCoordinates(), OptOSensor2D::convertPointToLocalCoordinates(), OpticalObject::copyData(), Measurement::copyMeas(), CocoaAnalyzer::correctAllOpticalAlignments(), CocoaAnalyzer::correctOpticalAlignmentParameter(), MeasurementSensor2D::correctValueAndSigma(), MeasurementCOPS::correctValueAndSigma(), MeasurementDistancemeter::correctValueAndSigma(), MeasurementDistancemeter3dim::correctValueAndSigma(), MeasurementTiltmeter::correctValueAndSigma(), OpticalObject::createComponentOptOs(), OpticalObject::createComponentOptOsFromOptAlignInfo(), Model::createCopyComponentList(), FittedEntriesManager::createFileName(), Fit::CreateMatrices(), OpticalObject::createNewOptO(), OptOLaser::defaultBehaviour(), OptOPinhole::defaultBehaviour(), OptOXLaser::defaultBehaviour(), OptOCOPS::defaultBehaviour(), OptOSource::defaultBehaviour(), Model::deleteOptO(), Measurement::DerivativeRespectEntry(), OptOPlateSplitter::detailedDeviatesLightRay(), OptOMirror::detailedDeviatesLightRay(), OptOCubeSplitter::detailedDeviatesLightRay(), OptOModifiedRhomboidPrism::detailedDeviatesLightRay(), OptOOpticalSquare::detailedDeviatesLightRay(), OptOPlateSplitter::detailedTraversesLightRay(), OptOCubeSplitter::detailedTraversesLightRay(), OptOModifiedRhomboidPrism::detailedTraversesLightRay(), OptOOpticalSquare::detailedTraversesLightRay(), OptOMirror::detailedTraversesLightRay(), OptOSensor2D::detailedTraversesLightRay(), EntryLengthAffCentre::displace(), Entry::displace(), OpticalObject::displaceCentreGlob(), OpticalObject::displaceCentreGlobOriginal(), OpticalObject::displaceCentreGlobOriginalOriginal(), EntryLengthAffCentre::displaceOriginal(), Entry::displaceOriginal(), EntryAngleAffAngles::displaceOriginalOriginal(), EntryLengthAffCentre::displaceOriginalOriginal(), Entry::displaceOriginalOriginal(), OpticalObject::displaceRmGlobAroundGlobal(), OpticalObject::displaceRmGlobAroundLocal(), OpticalObject::displaceRmGlobOriginal(), OpticalObject::displaceRmGlobOriginalOriginal(), util.rrapi.RRApi::dprint(), rrapi.RRApi::dprint(), Measurement::DumpBadOrderOptOs(), CocoaDBMgr::DumpCocoaResults(), FittedEntriesManager::dumpEntriesSubstraction(), Fit::dumpEntryAfterFit(), Fit::dumpEntryCorrelations(), Fit::dumpFittedValues(), MatrixMeschach::EliminateColumns(), MatrixMeschach::EliminateLines(), Entry::Entry(), OptOCubeSplitter::fastDeviatesLightRay(), OptOOpticalSquare::fastDeviatesLightRay(), OptOModifiedRhomboidPrism::fastDeviatesLightRay(), OptOPlateSplitter::fastDeviatesLightRay(), OptOMirror::fastDeviatesLightRay(), OptOModifiedRhomboidPrism::fastTraversesLightRay(), OptOOpticalSquare::fastTraversesLightRay(), OptOCubeSplitter::fastTraversesLightRay(), OptOSensor2D::fastTraversesLightRay(), OptOPlateSplitter::fastTraversesLightRay(), OptOCOPS::fastTraversesLightRay(), OptOMirror::fastTraversesLightRay(), EntryData::fill(), Entry::fill(), Model::fillCopyComponentList(), Measurement::fillData(), FittedEntriesSet::FillEntriesAveragingSets(), OptOSensor2D::fillExtraEntry(), OpticalObject::fillExtraEntry(), Entry::fillFromInputFileQuality(), Entry::fillFromInputFileSigma(), Entry::fillFromInputFileValue(), Entry::fillFromReportOutFileValue(), Fit::FillMatricesWithCalibratedParameters(), Fit::FillMatricesWithMeasurements(), EntryMgr::findEntryByLongName(), OpticalObject::findExtraEntryValue(), Fit::fitNextEvent(), Fit::fitParameters(), FittedEntry::FittedEntry(), pkg.AbstractPkg::generate(), rrapi.RRApi::get(), util.rrapi.RRApi::get(), pkg.AbstractPkg::get_kwds(), CocoaDBMgr::GetAlignInfoErrorFromOptO(), CocoaDBMgr::GetAlignInfoFromOptO(), Model::getComponentOptOs(), OpticalObject::getCoordinateFromOptAlignParam(), FittedEntriesManager::GetDifferentBetweenLasers(), OpticalObject::getDispVec(), Model::getEntryByName(), Fit::getEntryValue(), Fit::getFitQuality(), GlobalOptionMgr::getGlobalOption(), GlobalOptionMgr::getGlobalOptionValue(), Fit::getInstance(), OptOCOPS::getMeasFromInters(), OptOCubeSplitter::getMiddlePlate(), Model::getOptOByName(), OpticalObject::getPlate(), OptOModifiedRhomboidPrism::getRotatedPlate(), getRotationAnglesFromMatrix(), OpticalObject::getRotationAnglesFromMatrix(), OpticalObject::getRotationAnglesInOptOFrame(), Fit::GetSChi2(), OptOCubeSplitter::getUpperPlate(), ALILine::intersect(), LightRay::intersect(), MatrixMeschach::inverse(), LightRay::LightRay(), runTauIdMVA.TauIDEmbedder::loadMVA_WPs_run2_2017(), FittedEntriesManager::MakeHistos(), OptOTiltmeter::makeMeasurement(), OptODistancemeter3dim::makeMeasurement(), OptOSensor2D::makeMeasurement(), OptODistancemeter::makeMeasurement(), OptOCOPS::makeMeasurement(), Fit::multiplyMatrices(), Model::nextOptOToCopy(), operator+(), MatrixMeschach::operator=(), OpticalObject::OpticalObject(), Measurement::postConstruct(), Fit::printCentreInOptOFrame(), Fit::PrintChi2(), Fit::PropagateErrors(), CocoaAnalyzer::readCalibrationDB(), OpticalObject::readCoordinates(), EntryMgr::readEntryFromReportOut(), CocoaDaqReaderRoot::ReadEvent(), DeviationsFromFileSensor2D::readFile(), FittedEntriesReader::readFittedEntriesFromFile(), ErrorCorrelationMgr::readFromReportFile(), Model::readMeasurementsFromFile(), CocoaDaqReaderText::ReadNextEvent(), Model::readSystemDescription(), CocoaAnalyzer::readXMLFile(), Fit::redoMatrices(), LightRay::reflect(), LightRay::refract(), OpticalObject::rotateItAroundGlobal(), CocoaAnalyzer::runCocoa(), runTauIdMVA.TauIDEmbedder::runTauID(), SetAngleDimensionFactors(), OpticalObject::SetCentreGlobFromCentreLocal(), OpticalObject::SetCentreLocalFromEntryValues(), MatrixMeschach::SetCorrelation(), Fit::setCorrelationsInWMatrix(), setDebugVerbosity(), Fit::setFittableEntries(), GlobalOptionMgr::setGlobalOption(), OpticalObject::setGlobalRMOriginalOriginal(), SetLengthDimensionFactors(), FittedEntriesSet::SetOptOEntries(), OpticalObject::setOriginalEntryValues(), SetOutputAngleDimensionFactors(), SetOutputLengthDimensionFactors(), OpticalObject::SetRMGlobFromRMLocal(), OpticalObject::SetRMLocalFromEntryValues(), Model::SetValueDisplacementsFromReportOut(), LightRay::shiftAndDeviateWhileTraversing(), Fit::startFit(), LightRay::startLightRay(), crabFunctions.CrabController::submit(), Measurement::Substitute2p(), FittedEntriesReader::substitutePointBySlash(), Fit::substractLastDisplacementToEntries(), OpticalObject::transformCylindrical2Cartesian(), OptOUserDefined::userDefinedBehaviour(), EntryAngleAffAngles::valueDisplaced(), EntryLengthAffCentre::valueDisplaced(), Entry::valueDisplaced(), pkg.AbstractPkg::write(), and Fit::WriteVisualisationFiles().

◆ deg

ALIdouble ALIUtils::deg = 0.017453293
static

Definition at line 35 of file ALIUtils.h.

Referenced by OptOModifiedRhomboidPrism::getRotatedPlate().

◆ firstTime

ALIbool ALIUtils::firstTime = false
staticprivate

Definition at line 113 of file ALIUtils.h.

Referenced by getFirstTime(), and setFirstTime().

◆ maximum_deviation_derivative

ALIdouble ALIUtils::maximum_deviation_derivative = 1.E-6
staticprivate

Definition at line 115 of file ALIUtils.h.

Referenced by getMaximumDeviationDerivative(), and setMaximumDeviationDerivative().

◆ report

ALIint ALIUtils::report = 1
static