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, 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 (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 = -1
 
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 24 of file ALIUtils.h.

Constructor & Destructor Documentation

ALIUtils::ALIUtils ( )
inline

Definition at line 27 of file ALIUtils.h.

27 {};
ALIUtils::~ALIUtils ( )
inline

Member Function Documentation

double ALIUtils::addPii ( double  val)
static

Definition at line 787 of file ALIUtils.cc.

References M_PI, and heppy_batch::val.

Referenced by getRotationAnglesFromMatrix(), and setMaximumDeviationDerivative().

788 {
789  if( val < M_PI ) {
790  val += M_PI;
791  } else {
792  val -= M_PI;
793  }
794 
795  return val;
796 }
#define M_PI
static ALIdouble ALIUtils::AngleSigmaDimensionFactor ( )
inlinestatic

Definition at line 78 of file ALIUtils.h.

References _AngleSigmaDimensionFactor.

Referenced by EntryAngle::SigmaDimensionFactor().

78  {
static ALIdouble _AngleSigmaDimensionFactor
Definition: ALIUtils.h:124
static ALIdouble ALIUtils::AngleValueDimensionFactor ( )
inlinestatic
double ALIUtils::approxTo0 ( double  val)
static

Definition at line 778 of file ALIUtils.cc.

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

Referenced by getRotationAnglesFromMatrix(), and setMaximumDeviationDerivative().

779 {
780  double precision = 1.e-9;
781  if( fabs(val) < precision ) val = 0;
782  return val;
783 }
ALIdouble ALIUtils::CalculateAngleDimensionFactorFromInt ( ALIint  ad)
static

Definition at line 298 of file ALIUtils.cc.

References CalculateAngleDimensionFactorFromString(), MessageLogger_cfi::cerr, and cmsRelvalreport::exit.

Referenced by set_time_now(), SetAngleDimensionFactors(), and SetOutputAngleDimensionFactors().

299 {
300  ALIdouble valsig;
301  switch ( ad ) {
302  case 0: //----- radians
303  valsig = CalculateAngleDimensionFactorFromString( "rad" );
304  break;
305  case 1: //----- miliradians
306  valsig = CalculateAngleDimensionFactorFromString( "mrad" );
307  break;
308  case 2: //----- microradians
309  valsig = CalculateAngleDimensionFactorFromString( "murad" );
310  break;
311  case 3: //----- degrees
312  valsig = CalculateAngleDimensionFactorFromString( "deg" );
313  break;
314  case 4: //----- grads
315  valsig = CalculateAngleDimensionFactorFromString( "grad" );
316  break;
317  default:
318  std::cerr << "!!! UNKNOWN DIMENSION SCALING " << ad << std::endl <<
319  "VALUE MUST BE BETWEEN 0 AND 3 " << std::endl;
320  exit(1);
321  }
322 
323  // use microradinas instead of radians
324  //- valsig *= 1000000.;
325 
326  return valsig;
327 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIdouble CalculateAngleDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:237
ALIdouble ALIUtils::CalculateAngleDimensionFactorFromString ( ALIstring  dimstr)
static

Definition at line 237 of file ALIUtils.cc.

References MessageLogger_cfi::cerr, cmsRelvalreport::exit, and M_PI.

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

238 {
239  ALIdouble valsig;
240  if( dimstr == "rad" ) {
241  valsig = 1.;
242  }else
243  if( dimstr == "mrad" ) {
244  valsig = 1.E-3;
245  }else
246  if( dimstr == "murad" ) {
247  valsig = 1.E-6;
248  }else
249  if( dimstr == "deg" ) {
250  valsig = M_PI/180.;
251  }else
252  if( dimstr == "grad" ) {
253  valsig = M_PI/200.;
254  }else {
255  std::cerr << "!!! UNKNOWN DIMENSION SCALING: " << dimstr << std::endl <<
256  "VALUE MUST BE AN ANGLE DIMENSION " << std::endl;
257  exit(1);
258  }
259 
260  return valsig;
261 }
long double ALIdouble
Definition: CocoaGlobals.h:11
#define M_PI
ALIdouble ALIUtils::CalculateLengthDimensionFactorFromInt ( ALIint  ad)
static

Definition at line 266 of file ALIUtils.cc.

References CalculateLengthDimensionFactorFromString(), MessageLogger_cfi::cerr, and cmsRelvalreport::exit.

Referenced by set_time_now(), SetLengthDimensionFactors(), and SetOutputLengthDimensionFactors().

267 {
268  ALIdouble valsig;
269  switch ( ad ) {
270  case 0: //----- metres
272  break;
273  case 1: //----- milimetres
275  break;
276  case 2: //----- micrometres
278  break;
279  case 3: //----- centimetres
281  break;
282  default:
283  std::cerr << "!!! UNKNOWN DIMENSION SCALING " << ad << std::endl <<
284  "VALUE MUST BE BETWEEN 0 AND 3 " << std::endl;
285  exit(1);
286  }
287 
288  // use microradinas instead of radians
289  //- valsig *= 1000000.;
290 
291  return valsig;
292 }
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIdouble CalculateLengthDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:196
ALIdouble ALIUtils::CalculateLengthDimensionFactorFromString ( ALIstring  dimstr)
static

Definition at line 196 of file ALIUtils.cc.

References MessageLogger_cfi::cerr, and cmsRelvalreport::exit.

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

197 {
198  ALIdouble valsig = 1.;
199  ALIstring internalDim = "m";
200  if(internalDim == "m" ){
201  if( dimstr == "m" ) {
202  valsig = 1.;
203  }else if( dimstr == "mm" ) {
204  valsig = 1.E-3;
205  }else if( dimstr == "mum" ) {
206  valsig = 1.E-6;
207  }else if( dimstr == "cm" ) {
208  valsig = 1.E-2;
209  }else {
210  std::cerr << "!!! UNKNOWN DIMENSION SCALING " << dimstr << std::endl <<
211  "VALUE MUST BE BETWEEN 0 AND 3 " << std::endl;
212  exit(1);
213  }
214  }else if(internalDim == "mm" ){
215  if( dimstr == "m" ) {
216  valsig = 1.E3;
217  }else if( dimstr == "mm" ) {
218  valsig = 1.;
219  }else if( dimstr == "mum" ) {
220  valsig = 1.E-3;
221  }else if( dimstr == "cm" ) {
222  valsig = 1.E+1;
223  }else {
224  std::cerr << "!!! UNKNOWN DIMENSION SCALING: " << dimstr << std::endl <<
225  "VALUE MUST BE A LENGTH DIMENSION " << std::endl;
226  exit(1);
227  }
228  }
229 
230  return valsig;
231 }
long double ALIdouble
Definition: CocoaGlobals.h:11
std::string ALIstring
Definition: CocoaGlobals.h:9
std::string ALIUtils::changeName ( const std::string &  oldName,
const std::string &  subsstr1,
const std::string &  subsstr2 
)
static

Definition at line 573 of file ALIUtils.cc.

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

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

574 {
575 
576  std::string newName = oldName;
577  int il = oldName.find( subsstr1 );
578  // std::cout << " il " << il << " oldname " << oldName << " " << subsstr1 << std::endl;
579  while( il >= 0 ) {
580  newName = newName.substr( 0, il ) + subsstr2 + newName.substr( il+subsstr1.length(), newName.length() );
581  // std::cout << " dnewName " << newName << " " << newName.substr( 0, il ) << " " << subsstr2 << " " << newName.substr( il+subsstr1.length(), newName.length() ) << std::endl;
582  il = oldName.find( subsstr1, il+1 );
583  }
584 
585  return newName;
586 }
string newName
Definition: mps_merge.py:85
int ALIUtils::checkMatrixEquations ( double  angleX,
double  angleY,
double  angleZ,
CLHEP::HepRotation *  rot 
)
static

Definition at line 799 of file ALIUtils.cc.

References MessageLogger_cfi::cerr, funct::cos(), eq2ang(), funct::sin(), fftjetcommon_cfi::sx, and fftjetcommon_cfi::sy.

Referenced by getRotationAnglesFromMatrix(), and setMaximumDeviationDerivative().

800 {
801  //- std::cout << " cme " << angleX << " " << angleY << " " << angleZ << std::endl;
802  if( rot == nullptr ) {
803  rot = new CLHEP::HepRotation();
804  rot->rotateX( angleX );
805  rot->rotateY( angleY );
806  rot->rotateZ( angleZ );
807  }
808  double sx = sin(angleX);
809  double cx = cos(angleX);
810  double sy = sin(angleY);
811  double cy = cos(angleY);
812  double sz = sin(angleZ);
813  double cz = cos(angleZ);
814 
815  double rotxx = cy*cz;
816  double rotxy = sx*sy*cz-cx*sz;
817  double rotxz = cx*sy*cz+sx*sz;
818  double rotyx = cy*sz;
819  double rotyy = sx*sy*sz+cx*cz;
820  double rotyz = cx*sy*sz-sx*cz;
821  double rotzx = -sy;
822  double rotzy = sx*cy;
823  double rotzz = cx*cy;
824 
825  int matrixElemBad = 0;
826  if( !eq2ang( rot->xx(), rotxx ) ) {
827  std::cerr << " EQUATION for xx() IS BAD " << rot->xx() << " <> " << rotxx << std::endl;
828  matrixElemBad++;
829  }
830  if( !eq2ang( rot->xy(), rotxy ) ) {
831  std::cerr << " EQUATION for xy() IS BAD " << rot->xy() << " <> " << rotxy << std::endl;
832  matrixElemBad++;
833  }
834  if( !eq2ang( rot->xz(), rotxz ) ) {
835  std::cerr << " EQUATION for xz() IS BAD " << rot->xz() << " <> " << rotxz << std::endl;
836  matrixElemBad++;
837  }
838  if( !eq2ang( rot->yx(), rotyx ) ) {
839  std::cerr << " EQUATION for yx() IS BAD " << rot->yx() << " <> " << rotyx << std::endl;
840  matrixElemBad++;
841  }
842  if( !eq2ang( rot->yy(), rotyy ) ) {
843  std::cerr << " EQUATION for yy() IS BAD " << rot->yy() << " <> " << rotyy << std::endl;
844  matrixElemBad++;
845  }
846  if( !eq2ang( rot->yz(), rotyz ) ) {
847  std::cerr << " EQUATION for yz() IS BAD " << rot->yz() << " <> " << rotyz << std::endl;
848  matrixElemBad++;
849  }
850  if( !eq2ang( rot->zx(), rotzx ) ) {
851  std::cerr << " EQUATION for zx() IS BAD " << rot->zx() << " <> " << rotzx << std::endl;
852  matrixElemBad++;
853  }
854  if( !eq2ang( rot->zy(), rotzy ) ) {
855  std::cerr << " EQUATION for zy() IS BAD " << rot->zy() << " <> " << rotzy << std::endl;
856  matrixElemBad++;
857  }
858  if( !eq2ang( rot->zz(), rotzz ) ) {
859  std::cerr << " EQUATION for zz() IS BAD " << rot->zz() << " <> " << rotzz << std::endl;
860  matrixElemBad++;
861  }
862 
863  //- std::cout << " cme: matrixElemBad " << matrixElemBad << std::endl;
864  return matrixElemBad;
865 }
static bool eq2ang(double ang1, double ang2)
Definition: ALIUtils.cc:758
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double ALIUtils::diff2pi ( double  ang1,
double  ang2 
)
static

Definition at line 748 of file ALIUtils.cc.

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

Referenced by eq2ang(), getRotationAnglesFromMatrix(), and setMaximumDeviationDerivative().

749 {
750  double pii = acos(0.)*2;
751  double diff = fabs( ang1 - ang2 );
752  diff = diff - int(diff/2./pii) * 2 *pii;
753  return diff;
754 }
void ALIUtils::dump3v ( const CLHEP::Hep3Vector &  vec,
const std::string &  msg 
)
static

Definition at line 61 of file ALIUtils.cc.

References gather_cfg::cout.

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(), OptODistancemeter::makeMeasurement(), OptODistancemeter3dim::makeMeasurement(), OptOSensor2D::makeMeasurement(), OptOCOPS::makeMeasurement(), LightRay::reflect(), LightRay::refract(), OpticalObject::SetCentreGlobFromCentreLocal(), OpticalObject::SetCentreLocalFromEntryValues(), LightRay::shiftAndDeviateWhileTraversing(), OptOUserDefined::userDefinedBehaviour(), and ~ALIUtils().

62 {
63  // double phicyl = atan( vec.y()/vec.x() );
64  std::cout << msg << std::setprecision(8) << vec;
65  std::cout << std::endl;
66  // std::cout << " " << vec.theta()/deg << " " << vec.phi()/deg << " " << vec.perp() << " " << phicyl/deg << std::endl;
67  // setw(10);
68  // std::cout << msg << " x=" << std::setprecision(8) << vec.x() << " y=" << setprecision(8) <<vec.y() << " z=" << std::setprecision(8) << vec.z() << std::endl;
69  // std::setprecision(8);
70 
71 }
tuple msg
Definition: mps_check.py:278
void ALIUtils::dumpDimensions ( std::ofstream &  fout)
static

Definition at line 337 of file ALIUtils.cc.

References _OutputAngleSigmaDimensionFactor, _OutputAngleValueDimensionFactor, _OutputLengthSigmaDimensionFactor, _OutputLengthValueDimensionFactor, MessageLogger_cfi::cerr, cmsRelvalreport::exit, and M_PI.

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

338 {
339  fout << "DIMENSIONS: lengths = ";
340  ALIstring internalDim = "m";
342  fout << "m";
343  }else if(_OutputLengthValueDimensionFactor == 1.E-3 ) {
344  fout << "mm";
345  }else if(_OutputLengthValueDimensionFactor == 1.E-6 ) {
346  fout << "mum";
347  }else if(_OutputLengthValueDimensionFactor == 1.E-2 ) {
348  fout << "cm";
349  } else {
350  std::cerr << " !! unknown OutputLengthValueDimensionFactor " << _OutputLengthValueDimensionFactor << std::endl;
351  exit(1);
352  }
353 
354  fout << " +- ";
356  fout << "m";
357  }else if(_OutputLengthSigmaDimensionFactor == 1.E-3 ) {
358  fout << "mm";
359  }else if(_OutputLengthSigmaDimensionFactor == 1.E-6 ) {
360  fout << "mum";
361  }else if(_OutputLengthSigmaDimensionFactor == 1.E-2 ) {
362  fout << "cm";
363  } else {
364  std::cerr << " !! unknown OutputLengthSigmaDimensionFactor " << _OutputLengthSigmaDimensionFactor << std::endl;
365  exit(1);
366  }
367 
368  fout << " angles = ";
370  fout << "rad";
371  }else if(_OutputAngleValueDimensionFactor == 1.E-3 ) {
372  fout << "mrad";
373  }else if(_OutputAngleValueDimensionFactor == 1.E-6 ) {
374  fout << "murad";
375  }else if(_OutputAngleValueDimensionFactor == M_PI/180. ) {
376  fout << "deg";
377  }else if(_OutputAngleValueDimensionFactor == M_PI/200. ) {
378  fout << "grad";
379  } else {
380  std::cerr << " !! unknown OutputAngleValueDimensionFactor " << _OutputAngleValueDimensionFactor << std::endl;
381  exit(1);
382  }
383 
384  fout << " +- ";
386  fout << "rad";
387  }else if(_OutputAngleSigmaDimensionFactor == 1.E-3 ) {
388  fout << "mrad";
389  }else if(_OutputAngleSigmaDimensionFactor == 1.E-6 ) {
390  fout << "murad";
391  }else if(_OutputAngleSigmaDimensionFactor == M_PI/180. ) {
392  fout << "deg";
393  }else if(_OutputAngleSigmaDimensionFactor == M_PI/200. ) {
394  fout << "grad";
395  } else {
396  std::cerr << " !! unknown OutputAngleSigmaDimensionFactor " << _OutputAngleSigmaDimensionFactor << std::endl;
397  exit(1);
398  }
399  fout << std::endl;
400 
401 }
static ALIdouble _OutputLengthValueDimensionFactor
Definition: ALIUtils.h:125
static ALIdouble _OutputAngleSigmaDimensionFactor
Definition: ALIUtils.h:128
#define M_PI
std::string ALIstring
Definition: CocoaGlobals.h:9
static ALIdouble _OutputAngleValueDimensionFactor
Definition: ALIUtils.h:127
static ALIdouble _OutputLengthSigmaDimensionFactor
Definition: ALIUtils.h:126
void ALIUtils::dumprm ( const CLHEP::HepRotation &  rm,
const std::string &  msg,
std::ostream &  out = std::cout 
)
static
void ALIUtils::dumpVS ( const std::vector< ALIstring > &  wl,
const std::string &  msg,
std::ostream &  outs = std::cout 
)
static
bool ALIUtils::eq2ang ( double  ang1,
double  ang2 
)
static

Definition at line 758 of file ALIUtils.cc.

References diffTreeTool::diff, and diff2pi().

Referenced by checkMatrixEquations(), getRotationAnglesFromMatrix(), and setMaximumDeviationDerivative().

759 {
760  bool beq = true;
761 
762  double pii = acos(0.)*2;
763  double diff = diff2pi( ang1, ang2 );
764  if( diff > 0.00001 ) {
765  if( fabs( diff - 2*pii ) > 0.00001 ) {
766  //- std::cout << " diff " << diff << " " << ang1 << " " << ang2 << std::endl;
767  beq = false;
768  }
769  } else {
770  beq = true;
771  }
772 
773  return beq;
774 }
static double diff2pi(double ang1, double ang2)
Definition: ALIUtils.cc:748
bool ALIUtils::getBool ( const ALIstring str)
static

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

Definition at line 453 of file ALIUtils.cc.

References MessageLogger_cfi::cerr, cmsRelvalreport::exit, and heppy_batch::val.

Referenced by set_time_now().

454 {
455  bool val;
456 
457  //t str = upper( str );
458  //----------- first check that it is a not number
459  if( str == "ON" || str == "TRUE" ) {
460  val = true;
461  } else if( str == "OFF" || str == "FALSE" ) {
462  val = false;
463  } else {
464  std::cerr << "!!!! EXITING: trying to get the float from a string that is not 'ON'/'OFF'/'TRUE'/'FALSE' " << str << std::endl;
465  exit(1);
466  }
467 
468  return val;
469 }
#define str(s)
ALIdouble ALIUtils::getDimensionValue ( const ALIstring dim,
const ALIstring dimType 
)
static

Definition at line 515 of file ALIUtils.cc.

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

Referenced by EntryMgr::readEntryFromReportOut(), and val0().

516 {
518  if( dimType == "Length" ) {
519  if( dim == "mm" ) {
520  value = 1.E-3;
521  }else if( dim == "cm" ) {
522  value = 1.E-2;
523  }else if( dim == "m" ) {
524  value = 1.;
525  }else if( dim == "mum" ) {
526  value = 1.E-6;
527  }else if( dim == "dm" ) {
528  value = 1.E-1;
529  }else if( dim == "nm" ) {
530  value = 1.E-9;
531  }else {
532  std::cerr << "!!!!FATAL ERROR: ALIUtils::GetDimensionValue. " << dim << " is a dimension not supported for dimension type " << dimType << std::endl;
533  abort();
534  }
535  } else if( dimType == "Angle" ) {
536  if( dim == "rad" ) {
537  value = 1.;
538  }else if( dim == "mrad" ) {
539  value = 1.E-3;
540  }else if( dim == "murad" ) {
541  value = 1.E-6;
542  }else if( dim == "deg" ) {
543  value = M_PI/180.;
544  }else if( dim == "grad" ) {
545  value = M_PI/200.;
546  }else {
547  std::cerr << "!!!!FATAL ERROR: ALIUtils::GetDimensionValue. " << dim << " is a dimension not supported for dimension type " << dimType << std::endl;
548  abort();
549  }
550  }else {
551  std::cerr << "!!!!FATAL ERROR: ALIUtils::GetDimensionValue. " << dimType << " is a dimension type not supported " << std::endl;
552  abort();
553  }
554 
555  return value;
556 
557 }
long double ALIdouble
Definition: CocoaGlobals.h:11
#define M_PI
static ALIbool ALIUtils::getFirstTime ( )
inlinestatic
double ALIUtils::getFloat ( const ALIstring str)
static

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

Definition at line 404 of file ALIUtils.cc.

References MessageLogger_cfi::cerr, cmsRelvalreport::exit, and IsNumber().

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

405 {
406  //----------- first check that it is a number
407  if(!IsNumber(str) ) {
408  std::cerr << "!!!! EXITING: trying to get the float from a string that is not a number " << str << std::endl;
409  exit(1);
410  }
411 
412  return atof( str.c_str() );
413 }
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:34
#define str(s)
int ALIUtils::getInt ( const ALIstring str)
static

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

Definition at line 417 of file ALIUtils.cc.

References MessageLogger_cfi::cerr, cmsRelvalreport::exit, cuy::ii, createfilelist::int, and IsNumber().

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

418 {
419  //----------- first check that it is an integer
420  if(!IsNumber(str) ) {
421  //----- Check that it is a number
422  std::cerr << "!!!! EXITING: trying to get the integer from a string that is not a number " << str << std::endl;
423  exit(1);
424  } else {
425  //----- Check that it is not a float, no decimal or E-n
426  bool isFloat = false;
427  int ch = str.find('.');
428  ALIuint ii = 0;
429  if(ch != -1 ) {
430  for( ii = ch+1; ii < str.size(); ii++) {
431  if( str[ii] != '0' ) isFloat = true;
432  }
433  }
434 
435  ch = str.find('E');
436  if(ch != -1 ) ch = str.find('e');
437  if(ch != -1 ) {
438  if(str[ch+1] == '-') isFloat = true;
439  }
440 
441  if(isFloat) {
442  std::cerr << "!!!! EXITING: trying to get the integer from a string that is a float: " << str << std::endl;
443  std::cerr << ii << " ii " << ch <<std::endl;
444  exit(1);
445  }
446  }
447  return int( atof( str.c_str() ) );
448 }
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:34
ii
Definition: cuy.py:590
#define str(s)
unsigned int ALIuint
Definition: CocoaGlobals.h:17
static ALIdouble ALIUtils::getMaximumDeviationDerivative ( )
inlinestatic

Definition at line 107 of file ALIUtils.h.

References maximum_deviation_derivative.

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

107  {
static ALIdouble maximum_deviation_derivative
Definition: ALIUtils.h:133
std::vector< double > ALIUtils::getRotationAnglesFromMatrix ( CLHEP::HepRotation &  rmLocal,
double  origAngleX,
double  origAngleY,
double  origAngleZ 
)
static

Definition at line 591 of file ALIUtils.cc.

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

Referenced by OpticalObject::getRotationAnglesFromMatrix(), and setMaximumDeviationDerivative().

592 {
593  double pii = acos(0.)*2;
594  std::vector<double> newang(3);
595  double angleX = origAngleX;
596  double angleY = origAngleY;
597  double angleZ = origAngleZ;
598 
599  if( ALIUtils::debug >= 4 ) {
600  std::cout << " angles as value entries: X= " << angleX << " Y= " << angleY << " Z " << angleZ << std::endl;
601  }
602 
603  //- std::cout << name () << " vdbf " << angleX << " " << angleY << " " << angleZ << std::endl;
604  double rotzx = approxTo0( rmLocal.zx() );
605  double rotzy = approxTo0( rmLocal.zy() );
606  double rotzz = approxTo0( rmLocal.zz() );
607  double rotyx = approxTo0( rmLocal.yx() );
608  double rotxx = approxTo0( rmLocal.xx() );
609  if( rotzy == 0. && rotzz == 0. ) {
610  //check that entry is z angle
611  newang[0] = angleX;
612  //beware of aa <==> pii - aa
613  if( eq2ang( rmLocal.zx(), -1. ) ) {
614  double aa = asin( rmLocal.xy() );
615  if( diff2pi( angleZ, - aa + newang[0] ) < diff2pi( angleZ, - pii + aa + newang[0] ) ) {
616  newang[2] = -aa + newang[0];
617  if( ALIUtils::debug >= 5 ) std::cout << " newang[0] = -aa + newang[0] " << std::endl;
618  } else {
619  newang[2] = -pii + aa + newang[0];
620  if( ALIUtils::debug >= 5 ) std::cout << " newang[0] = -pii + aa + newang[0] " << newang[0] << " " << aa << " " << newang[2] << std::endl;
621  }
622  } else {
623  double aa = asin( -rmLocal.xy() );
624  if( diff2pi( angleZ, aa - newang[0] ) < diff2pi( angleZ, pii - aa - newang[0] ) ) {
625  newang[2] = aa - newang[0];
626  if( ALIUtils::debug >= 5 ) std::cout << " newang[0] = aa - newang[2] " << std::endl;
627  } else {
628  newang[2] = pii - aa - newang[0];
629  if( ALIUtils::debug >= 5 ) std::cout << " newang[0] = pii - aa - newang[2] " << newang[0] << " " << aa << " " << newang[2] << std::endl;
630  }
631  }
632  } else {
633  newang[0] = atan( rotzy / rotzz );
634  newang[2] = atan( rotyx / rotxx );
635  }
636  if( rotzx < -1. ) {
637  //- std::cerr << " rotzx too small " << rotzx << " = " << rmLocal.zx() << " " << rotzx-rmLocal.zx() << std::endl;
638  rotzx = -1.;
639  } else if( rotzx > 1. ) {
640  //- std::cerr << " rotzx too big " << rotzx << " = " << rmLocal.zx() << " " << rotzx-rmLocal.zx() << std::endl;
641  rotzx = 1.;
642  }
643  newang[1] = -asin( rotzx );
644  if( ALIUtils::debug >= 5 ) std::cout << "First calculation of angles: " << std::endl
645  << " newang[0] " << newang[0] << " " << rotzy << " " << rotzz << std::endl
646  << " newang[1] " << newang[1] << " " << rotzx << std::endl
647  << " newang[2] " << newang[2] << " " << rotyx << " " << rotxx << std::endl;
648 
649  // newang[2] = acos( rmLocal.xx() / cos( newang[1] ) );
650  //----- CHECK if the angles are OK (there are several symmetries)
651  //--- 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)
652  double rotnewxx = cos( newang[1] ) * cos( newang[2] );
653  double rotnewzz = cos( newang[0] ) * cos( newang[1] );
654  double rotnewxy = sin( newang[0] ) * sin( newang[1] ) * cos( newang[2] ) - cos( newang[0] )* sin( newang[2] );
655  double rotnewxz = cos( newang[0] ) * sin( newang[1] ) * cos( newang[2] ) + sin( newang[0] )* sin( newang[2] );
656  double rotnewyy = sin( newang[0] ) * sin( newang[1] ) * sin( newang[2] ) + cos( newang[0] )* cos( newang[2] );
657  double rotnewyz = cos( newang[0] ) * sin( newang[1] ) * sin( newang[2] ) - sin( newang[0] )* cos( newang[2] );
658 
659  bool eqxx = eq2ang( rotnewxx, rmLocal.xx() );
660  bool eqzz = eq2ang( rotnewzz, rmLocal.zz() );
661  bool eqxy = eq2ang( rotnewxy, rmLocal.xy() );
662  bool eqxz = eq2ang( rotnewxz, rmLocal.xz() );
663  bool eqyy = eq2ang( rotnewyy, rmLocal.yy() );
664  bool eqyz = eq2ang( rotnewyz, rmLocal.yz() );
665 
666  //--- Check if one of the tree angles should be changed
667  if( ALIUtils::debug >= 5 ) {
668  std::cout << " pred rm.xx " << rotnewxx << " =? " << rmLocal.xx()
669  << " pred rm.zz " << rotnewzz << " =? " << rmLocal.zz()
670  << std::endl;
671  std::cout << " eqxx " << eqxx << " eqzz " << eqzz << std::endl;
672  //- std::cout << " rotnewxx " << rotnewxx << " = " << rmLocal.xx() << " " << fabs( rotnewxx - rmLocal.xx() ) << " " <<(fabs( rotnewxx - rmLocal.xx() ) < 0.0001) << std::endl;
673  }
674 
675  if( eqxx & !eqzz ) {
676  newang[0] = pii + newang[0];
677  if( ALIUtils::debug >= 5 ) std::cout << " change newang[0] " << newang[0] << std::endl;
678  } else if( !eqxx & !eqzz ) {
679  newang[1] = pii - newang[1];
680  if( ALIUtils::debug >= 5 ) std::cout << " change newang[1] " << newang[1] << std::endl;
681  } else if( !eqxx & eqzz ) {
682  newang[2] = pii + newang[2];
683  if( ALIUtils::debug >= 5 ) std::cout << " change newang[2] " << newang[2] << std::endl;
684  }
685 
686  //--- Check if the 3 angles should be changed (previous check is invariant to the 3 changing)
687  if( ALIUtils::debug >= 5 ) {
688  std::cout << " pred rm.xy " << rotnewxy << " =? " << rmLocal.xy()
689  << " pred rm.xz " << rotnewxz << " =? " << rmLocal.xz()
690  << " pred rm.yy " << rotnewyy << " =? " << rmLocal.yy()
691  << " pred rm.yz " << rotnewyz << " =? " << rmLocal.yz()
692  << std::endl;
693  std::cout << " eqxy " << eqxy << " eqxz " << eqxz << " eqyy " << eqyy << " eqyz " << eqyz << std::endl;
694  }
695 
696  if( !eqxy || !eqxz || !eqyy || !eqyz ) {
697  // check also cases where one of the above 'eq' is OK because it is = 0
698  if( ALIUtils::debug >= 5 ) std::cout << " change the 3 newang " << std::endl;
699  newang[0] = addPii( newang[0] );
700  newang[1] = pii - newang[1];
701  newang[2] = addPii( newang[2] );
702  double rotnewxy = -sin( newang[0] ) * sin( newang[1] ) * cos( newang[2] ) - cos( newang[0] )* sin( newang[2] );
703  double rotnewxz = -cos( newang[0] ) * sin( newang[1] ) * cos( newang[2] ) - sin( newang[0] )* sin( newang[2] );
704  if( ALIUtils::debug >= 5 ) std::cout << " rotnewxy " << rotnewxy << " = " << rmLocal.xy()
705  << " rotnewxz " << rotnewxz << " = " << rmLocal.xz() << std::endl;
706  }
707  if( diff2pi(angleX, newang[0] ) + diff2pi(angleY, newang[1] ) +diff2pi(angleZ, newang[2] )
708  > diff2pi(angleX, pii+newang[0] ) + diff2pi(angleY, pii-newang[1] ) + diff2pi(angleZ, pii+newang[2] ) ){
709  // check also cases where one of the above 'eq' is OK because it is = 0
710  if( ALIUtils::debug >= 5 ) std::cout << " change the 3 newang " << std::endl;
711  newang[0] = addPii( newang[0] );
712  newang[1] = pii - newang[1];
713  newang[2] = addPii( newang[2] );
714  double rotnewxy = -sin( newang[0] ) * sin( newang[1] ) * cos( newang[2] ) - cos( newang[0] )* sin( newang[2] );
715  double rotnewxz = -cos( newang[0] ) * sin( newang[1] ) * cos( newang[2] ) - sin( newang[0] )* sin( newang[2] );
716  if( ALIUtils::debug >= 5 ) std::cout << " rotnewxy " << rotnewxy << " = " << rmLocal.xy()
717  << " rotnewxz " << rotnewxz << " = " << rmLocal.xz() << std::endl;
718  }
719 
720  for (int ii=0; ii<3; ii++) {
721  newang[ii] = approxTo0( newang[ii] );
722  }
723  // double rotnewyx = cos( newang[1] ) * sin( newang[2] );
724 
725  if( checkMatrixEquations( newang[0], newang[1], newang[2], &rmLocal ) != 0 ){
726  std::cerr << " wrong rotation matrix " << newang[0] << " " << newang[1] << " " << newang[2] << std::endl;
727  ALIUtils::dumprm( rmLocal, " matrix is " );
728  }
729  if( ALIUtils::debug >= 5 ) {
730  std::cout << "Final angles: newang[0] " << newang[0] << " newang[1] " << newang[1] << " newang[2] " << newang[2] << std::endl;
731  CLHEP::HepRotation rot;
732  rot.rotateX( newang[0] );
733  ALIUtils::dumprm( rot, " new rot after X ");
734  rot.rotateY( newang[1] );
735  ALIUtils::dumprm( rot, " new rot after Y ");
736  rot.rotateZ( newang[2] );
737  ALIUtils::dumprm( rot, " new rot ");
738  ALIUtils::dumprm( rmLocal, " rmLocal " );
739  //- ALIUtils::dumprm( theRmGlobOriginal, " theRmGlobOriginal " );
740  }
741 
742  //- std::cout << " before return newang[0] " << newang[0] << " newang[1] " << newang[1] << " newang[2] " << newang[2] << std::endl;
743  return newang;
744 
745 }
static double approxTo0(double val)
Definition: ALIUtils.cc:778
static double diff2pi(double ang1, double ang2)
Definition: ALIUtils.cc:748
static bool eq2ang(double ang1, double ang2)
Definition: ALIUtils.cc:758
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:77
static ALIint debug
Definition: ALIUtils.h:36
static double addPii(double val)
Definition: ALIUtils.cc:787
static int checkMatrixEquations(double angleX, double angleY, double angleZ, CLHEP::HepRotation *rot)
Definition: ALIUtils.cc:799
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
ii
Definition: cuy.py:590
int ALIUtils::IsNumber ( const ALIstring str)
static

Definition at line 34 of file ALIUtils.cc.

References cuy::ii.

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

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

Definition at line 74 of file ALIUtils.h.

References _LengthSigmaDimensionFactor.

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

74  {
static ALIdouble _LengthSigmaDimensionFactor
Definition: ALIUtils.h:122
static ALIdouble ALIUtils::LengthValueDimensionFactor ( )
inlinestatic
static ALIdouble ALIUtils::OutputAngleSigmaDimensionFactor ( )
inlinestatic

Definition at line 86 of file ALIUtils.h.

References _OutputAngleSigmaDimensionFactor.

Referenced by EntryAngle::OutputSigmaDimensionFactor().

86  {
static ALIdouble _OutputAngleSigmaDimensionFactor
Definition: ALIUtils.h:128
static ALIdouble ALIUtils::OutputAngleValueDimensionFactor ( )
inlinestatic

Definition at line 84 of file ALIUtils.h.

References _OutputAngleValueDimensionFactor.

Referenced by EntryAngle::OutputValueDimensionFactor().

84  {
static ALIdouble _OutputAngleValueDimensionFactor
Definition: ALIUtils.h:127
static ALIdouble ALIUtils::OutputLengthSigmaDimensionFactor ( )
inlinestatic

Definition at line 82 of file ALIUtils.h.

References _OutputLengthSigmaDimensionFactor.

Referenced by EntryLength::OutputSigmaDimensionFactor().

82  {
static ALIdouble _OutputLengthSigmaDimensionFactor
Definition: ALIUtils.h:126
static ALIdouble ALIUtils::OutputLengthValueDimensionFactor ( )
inlinestatic

Definition at line 80 of file ALIUtils.h.

References _OutputLengthValueDimensionFactor.

Referenced by EntryLength::OutputValueDimensionFactor().

80  {
static ALIdouble _OutputLengthValueDimensionFactor
Definition: ALIUtils.h:125
static void ALIUtils::set_time_now ( time_t  now)
inlinestatic
void ALIUtils::SetAngleDimensionFactors ( )
static

Definition at line 116 of file ALIUtils.cc.

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

Referenced by Model::readSystemDescription(), and set_time_now().

117 {
118 //--------------------- if it doesn exist, GlobalOptions is 0
119  //---------- Calculate factors to convert to radians
121  ALIint ad = ALIint(gomgr->GlobalOptions()[ ALIstring("angle_value_dimension") ]);
123 
124  ad = ALIint(gomgr->GlobalOptions()[ ALIstring("angle_error_dimension"
125 ) ]);
127 
128  //---------- Change factor to convert to error dimensions
129  // _AngleValueDimensionFactor /= _AngleSigmaDimensionFactor;
130  //_AngleSigmaDimensionFactor = 1;
131 
132  if(ALIUtils::debug >= 6) std::cout << _AngleValueDimensionFactor << "Set Angle DimensionFactors" << _AngleSigmaDimensionFactor << std::endl;
133 
134 }
int ALIint
Definition: CocoaGlobals.h:15
static ALIdouble _AngleValueDimensionFactor
Definition: ALIUtils.h:123
static ALIint debug
Definition: ALIUtils.h:36
static GlobalOptionMgr * getInstance()
static ALIdouble _AngleSigmaDimensionFactor
Definition: ALIUtils.h:124
std::string ALIstring
Definition: CocoaGlobals.h:9
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
static ALIdouble CalculateAngleDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:298
static void ALIUtils::setDebugVerbosity ( ALIint  val)
inlinestatic

Definition at line 42 of file ALIUtils.h.

References heppy_batch::val.

Referenced by GlobalOptionMgr::setGlobalOption().

42  {
43  debug = val;
44  }
static ALIint debug
Definition: ALIUtils.h:36
static void ALIUtils::setFirstTime ( ALIbool  val)
inlinestatic

Definition at line 104 of file ALIUtils.h.

References firstTime, and heppy_batch::val.

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

104  {
105  firstTime = val;
106  }
static ALIbool firstTime
Definition: ALIUtils.h:131
void ALIUtils::SetLengthDimensionFactors ( )
static

Definition at line 91 of file ALIUtils.cc.

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

Referenced by Model::readSystemDescription(), and set_time_now().

92 {
93 //---------------------------------------- if it doesn exist, GlobalOptions is 0
94  //---------- Calculate factors to convert to meters
96  ALIint ad = ALIint(gomgr->getGlobalOption("length_value_dimension"));
97 
99  ad = ALIint(gomgr->GlobalOptions()[ ALIstring("length_error_dimension"
100 ) ]);
102 
103  //---------- Change factor to convert to error dimensions
104  // _LengthValueDimensionFactor /= _LengthSigmaDimensionFactor;
105  //_LengthSigmaDimensionFactor = 1;
106 
107  if(ALIUtils::debug >= 6) std::cout << _LengthValueDimensionFactor << " Set Length DimensionFactors " << _LengthSigmaDimensionFactor << std::endl;
108 
109 }
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:36
static GlobalOptionMgr * getInstance()
static ALIdouble CalculateLengthDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:266
static ALIdouble _LengthSigmaDimensionFactor
Definition: ALIUtils.h:122
std::string ALIstring
Definition: CocoaGlobals.h:9
ALIdouble getGlobalOption(const ALIstring &sstr)
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
static ALIdouble _LengthValueDimensionFactor
Definition: ALIUtils.h:121
static void ALIUtils::setMaximumDeviationDerivative ( ALIdouble  val)
inlinestatic
void ALIUtils::SetOutputAngleDimensionFactors ( )
static

Definition at line 169 of file ALIUtils.cc.

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

Referenced by Model::readSystemDescription(), and set_time_now().

170 {
171 //--------------------- if it doesn exist, GlobalOptions is 0
172  //---------- Calculate factors to convert to radians
174  ALIint ad = ALIint(gomgr->GlobalOptions()[ ALIstring("output_angle_value_dimension") ]);
175  if( ad == 0 ) ad = ALIint(gomgr->GlobalOptions()[ ALIstring("angle_value_dimension") ]);
177 
178 
179  ad = ALIint(gomgr->GlobalOptions()[ ALIstring("output_angle_error_dimension") ]);
180  if( ad == 0) ad = ALIint(gomgr->GlobalOptions()[ ALIstring("angle_error_dimension") ]);
182 
183  //---------- Change factor to convert to error dimensions
184  // _AngleValueDimensionFactor /= _AngleSigmaDimensionFactor;
185  //_AngleSigmaDimensionFactor = 1;
186 
187  if(ALIUtils::debug >= 9) std::cout << _OutputAngleValueDimensionFactor << "Output Angle Dimension Factors" << _OutputAngleSigmaDimensionFactor << std::endl;
188 
189 }
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:36
static GlobalOptionMgr * getInstance()
static ALIdouble _OutputAngleSigmaDimensionFactor
Definition: ALIUtils.h:128
std::string ALIstring
Definition: CocoaGlobals.h:9
static ALIdouble _OutputAngleValueDimensionFactor
Definition: ALIUtils.h:127
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
static ALIdouble CalculateAngleDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:298
void ALIUtils::SetOutputLengthDimensionFactors ( )
static

Definition at line 141 of file ALIUtils.cc.

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

Referenced by Model::readSystemDescription(), and set_time_now().

142 {
143 //---------------------------------------- if it doesn exist, GlobalOptions is 0
144  //---------- Calculate factors to convert to meters
146  ALIint ad = ALIint(gomgr->GlobalOptions()[ ALIstring("output_length_value_dimension") ]);
147  if( ad == 0 ) ad = ALIint(gomgr->GlobalOptions()[ ALIstring("length_value_dimension") ]);
149 
150  ad = ALIint(gomgr->GlobalOptions()[ ALIstring("output_length_error_dimension"
151 ) ]);
152  if( ad == 0 ) ad = ALIint(gomgr->GlobalOptions()[ ALIstring("length_error_dimension"
153 ) ]);
155 
156  //---------- Change factor to convert to error dimensions
157  // _LengthValueDimensionFactor /= _LengthSigmaDimensionFactor;
158  //_LengthSigmaDimensionFactor = 1;
159 
160  if(ALIUtils::debug >= 6) std::cout << _OutputLengthValueDimensionFactor << "Output Length Dimension Factors" << _OutputLengthSigmaDimensionFactor << std::endl;
161 
162 }
static ALIdouble _OutputLengthValueDimensionFactor
Definition: ALIUtils.h:125
int ALIint
Definition: CocoaGlobals.h:15
static ALIint debug
Definition: ALIUtils.h:36
static GlobalOptionMgr * getInstance()
static ALIdouble CalculateLengthDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:266
std::string ALIstring
Definition: CocoaGlobals.h:9
std::map< ALIstring, ALIdouble, std::less< ALIstring > > & GlobalOptions()
static ALIdouble _OutputLengthSigmaDimensionFactor
Definition: ALIUtils.h:126
static void ALIUtils::setReportVerbosity ( ALIint  val)
inlinestatic

Definition at line 39 of file ALIUtils.h.

References heppy_batch::val.

Referenced by GlobalOptionMgr::setGlobalOption().

39  {
40  report = val;
41  }
static ALIint report
Definition: ALIUtils.h:35
ALIstring ALIUtils::subQuotes ( const ALIstring str)
static

Definition at line 472 of file ALIUtils.cc.

References MessageLogger_cfi::cerr, and cmsRelvalreport::exit.

Referenced by val0().

473 {
474 
475  //---------- Take out leading and trailing '"'
476  if( str.find('"') != 0 || str.rfind('"') != str.length()-1 ) {
477  std::cerr << "!!!EXITING trying to substract quotes from a word that has no quotes " << str << std::endl;
478  exit(1);
479  }
480 
481  // str = str.strip(ALIstring::both, '\"');
482  //---------- Take out leading and trallling '"'
483  ALIstring strt = str.substr(1,str.size()-2);
484 
485  //- std::cout << " subquotes " << str << std::endl;
486  //---------- Look for leading spaces
487  while( strt[0] == ' ' ) {
488  strt = strt.substr(1,strt.size()-1);
489  }
490 
491  //---------- Look for trailing spaces
492  while( strt[strt.size()-1] == ' ' ) {
493  strt = strt.substr(0,strt.size()-1);
494  }
495 
496  return strt;
497 
498 }
std::string ALIstring
Definition: CocoaGlobals.h:9
#define str(s)
static time_t ALIUtils::time_now ( )
inlinestatic

Definition at line 45 of file ALIUtils.h.

References _time_now.

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

45  {
46  return _time_now;
47  }
static time_t _time_now
Definition: ALIUtils.h:129
static ALIdouble ALIUtils::val0 ( ALIdouble  val)
inlinestatic

Definition at line 89 of file ALIUtils.h.

References changeName(), getDimensionValue(), AlCaHLTBitMon_QueryRunRegistry::string, subQuotes(), and heppy_batch::val.

89  {
90  //-std::cout << val << " val " << ( (val <= 1.E-9) ? 0. : val) << std::endl;
91 // return (abs(val) <= 1.E-9) ? 0. : val; }
92  if( std::fabs(val) <= 1.E-9) { return 0.;
93  }else { return val; }; }

Member Data Documentation

ALIdouble ALIUtils::_AngleSigmaDimensionFactor = 1.
staticprivate

Definition at line 124 of file ALIUtils.h.

Referenced by AngleSigmaDimensionFactor(), and SetAngleDimensionFactors().

ALIdouble ALIUtils::_AngleValueDimensionFactor = 1.
staticprivate

Definition at line 123 of file ALIUtils.h.

Referenced by AngleValueDimensionFactor(), and SetAngleDimensionFactors().

ALIdouble ALIUtils::_LengthSigmaDimensionFactor = 1.
staticprivate

Definition at line 122 of file ALIUtils.h.

Referenced by LengthSigmaDimensionFactor(), and SetLengthDimensionFactors().

ALIdouble ALIUtils::_LengthValueDimensionFactor = 1.
staticprivate

Definition at line 121 of file ALIUtils.h.

Referenced by LengthValueDimensionFactor(), and SetLengthDimensionFactors().

ALIdouble ALIUtils::_OutputAngleSigmaDimensionFactor = 1.
staticprivate
ALIdouble ALIUtils::_OutputAngleValueDimensionFactor = 1.
staticprivate
ALIdouble ALIUtils::_OutputLengthSigmaDimensionFactor = 1.
staticprivate
ALIdouble ALIUtils::_OutputLengthValueDimensionFactor = 1.
staticprivate
time_t ALIUtils::_time_now
staticprivate

Definition at line 129 of file ALIUtils.h.

Referenced by set_time_now(), and time_now().

ALIint ALIUtils::debug = -1
static

Definition at line 36 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(), MeasurementDistancemeter3dim::calculateSimulatedValue(), MeasurementDistancemeter::calculateSimulatedValue(), MeasurementTiltmeter::calculateSimulatedValue(), MeasurementCOPS::calculateSimulatedValue(), MeasurementDiffEntry::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(), 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(), rrapi.RRApi::dprint(), util.rrapi.RRApi::dprint(), Measurement::DumpBadOrderOptOs(), CocoaDBMgr::DumpCocoaResults(), FittedEntriesManager::dumpEntriesSubstraction(), Fit::dumpEntryAfterFit(), Fit::dumpEntryCorrelations(), Fit::dumpFittedValues(), MatrixMeschach::EliminateColumns(), MatrixMeschach::EliminateLines(), Entry::Entry(), OptOCubeSplitter::fastDeviatesLightRay(), OptOModifiedRhomboidPrism::fastDeviatesLightRay(), OptOOpticalSquare::fastDeviatesLightRay(), OptOPlateSplitter::fastDeviatesLightRay(), OptOMirror::fastDeviatesLightRay(), OptOCubeSplitter::fastTraversesLightRay(), OptOOpticalSquare::fastTraversesLightRay(), OptOModifiedRhomboidPrism::fastTraversesLightRay(), OptOSensor2D::fastTraversesLightRay(), OptOCOPS::fastTraversesLightRay(), OptOPlateSplitter::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(), OptODistancemeter::makeMeasurement(), OptODistancemeter3dim::makeMeasurement(), OptOSensor2D::makeMeasurement(), OptOCOPS::makeMeasurement(), Fit::multiplyMatrices(), Model::nextOptOToCopy(), operator+(), MatrixMeschach::operator=(), OpticalObject::OpticalObject(), Measurement::postConstruct(), Fit::printCentreInOptOFrame(), Fit::PrintChi2(), Fit::PropagateErrors(), OpticalObject::readCoordinates(), EntryMgr::readEntryFromReportOut(), CocoaDaqReaderRoot::ReadEvent(), DeviationsFromFileSensor2D::readFile(), FittedEntriesReader::readFittedEntriesFromFile(), ErrorCorrelationMgr::readFromReportFile(), Model::readMeasurementsFromFile(), CocoaDaqReaderText::ReadNextEvent(), Model::readSystemDescription(), Fit::redoMatrices(), LightRay::reflect(), LightRay::refract(), OpticalObject::rotateItAroundGlobal(), runTauIdMVA.TauIDEmbedder::runTauID(), SetAngleDimensionFactors(), OpticalObject::SetCentreGlobFromCentreLocal(), OpticalObject::SetCentreLocalFromEntryValues(), MatrixMeschach::SetCorrelation(), Fit::setCorrelationsInWMatrix(), 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().

ALIdouble ALIUtils::deg = 0.017453293
static

Definition at line 37 of file ALIUtils.h.

Referenced by OptOModifiedRhomboidPrism::getRotatedPlate().

ALIbool ALIUtils::firstTime = false
staticprivate

Definition at line 131 of file ALIUtils.h.

Referenced by getFirstTime(), and setFirstTime().

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

Definition at line 133 of file ALIUtils.h.

Referenced by getMaximumDeviationDerivative(), and setMaximumDeviationDerivative().

ALIint ALIUtils::report = 1
static