CMS 3D CMS Logo

ALIUtils.h
Go to the documentation of this file.
1 // COCOA class header file
2 //Id: ALIUtils.h
3 //CAT: Model
4 //
5 // Class with some utility function
6 //
7 // History: v1.0
8 // Pedro Arce
9 
10 #ifndef CocoaUtils_HH
11 #define CocoaUtils_HH
12 
14 
15 #include "CLHEP/Vector/ThreeVector.h"
16 #include "CLHEP/Vector/Rotation.h"
17 #include <vector>
18 #include <ctime>
19 #include <fstream>
20 #include <iostream>
21 #include <cmath>
22 
23 class ALIUtils {
24 public:
25  ALIUtils(){};
26  ~ALIUtils(){};
27 
28  static int IsNumber(const ALIstring& str);
29  static void dump3v(const CLHEP::Hep3Vector& vec, const std::string& msg);
30  static void dumprm(const CLHEP::HepRotation& rm, const std::string& msg, std::ostream& out = std::cout);
31 
32  // public static DATA MEMBERS
33  static ALIint report;
34  static ALIint debug;
35  static ALIdouble deg;
36 
37  static void setReportVerbosity(ALIint val) { report = val; }
38  static void setDebugVerbosity(ALIint val) { debug = val; }
39  static time_t time_now() { return _time_now; }
40  static void set_time_now(time_t now) { _time_now = now; }
42  static double getFloat(const ALIstring& str);
44  static int getInt(const ALIstring& str);
46  static bool getBool(const ALIstring& str);
48  static void dumpVS(const std::vector<ALIstring>& wl, const std::string& msg, std::ostream& outs = std::cout);
49 
50  //---------- Dimension factors
51  static void SetLengthDimensionFactors();
52  static void SetAngleDimensionFactors();
53  static void SetOutputLengthDimensionFactors();
54  static void SetOutputAngleDimensionFactors();
59 
60  static void dumpDimensions(std::ofstream& fout);
61 
70 
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  }
80 
81  static ALIstring subQuotes(const ALIstring& str);
82 
83  static ALIdouble getDimensionValue(const ALIstring& dim, const ALIstring& dimType);
84 
85  static std::string changeName(const std::string& oldName, const std::string& subsstr1, const std::string& subsstr2);
86 
87  static ALIbool getFirstTime() { return firstTime; }
88  static void setFirstTime(ALIbool val) { firstTime = val; }
91 
92  static std::vector<double> getRotationAnglesFromMatrix(CLHEP::HepRotation& rmLocal,
93  double origAngleX,
94  double origAngleY,
95  double origAngleZ);
96  static double diff2pi(double ang1, double ang2);
97  static bool eq2ang(double ang1, double ang2);
98  static double approxTo0(double val);
99  static double addPii(double val);
100  static int checkMatrixEquations(double angleX, double angleY, double angleZ, CLHEP::HepRotation* rot);
101 
102 private:
111  static time_t _time_now;
112 
114 
116 };
117 
118 /*
119 template<class T>
120 ALIuint FindItemInVector( const T* item, const std::vector<T*>& item_vector )
121 {
122  std::vector<T*>::const_iterator vtcite;
123  ALIuint vfound = 1;
124  for( vtcite = item_vector.begin(); vtcite != item_vector.end(); vtcite++) {
125  if( (*vtcite) == item ) {
126  }
127  }
128 
129 }
130 */
131 //std::ostream& operator << (std::ostream& os, const CLHEP::HepRotation& c);
132 
133 #endif
ALIUtils::setReportVerbosity
static void setReportVerbosity(ALIint val)
Definition: ALIUtils.h:37
ALIUtils::getFloat
static double getFloat(const ALIstring &str)
Convert a string to an float, checking that it is really a number.
Definition: ALIUtils.cc:373
ALIUtils::_LengthValueDimensionFactor
static ALIdouble _LengthValueDimensionFactor
Definition: ALIUtils.h:103
ALIUtils::subQuotes
static ALIstring subQuotes(const ALIstring &str)
Definition: ALIUtils.cc:439
ALIbool
bool ALIbool
Definition: CocoaGlobals.h:19
ALIUtils::diff2pi
static double diff2pi(double ang1, double ang2)
Definition: ALIUtils.cc:717
ALIUtils::getDimensionValue
static ALIdouble getDimensionValue(const ALIstring &dim, const ALIstring &dimType)
Definition: ALIUtils.cc:477
ALIUtils::_time_now
static time_t _time_now
Definition: ALIUtils.h:111
ALIUtils
Definition: ALIUtils.h:23
ALIUtils::CalculateLengthDimensionFactorFromInt
static ALIdouble CalculateLengthDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:242
ALIUtils::getInt
static int getInt(const ALIstring &str)
Convert a string to an integer, checking that it is really an integer.
Definition: ALIUtils.cc:384
ALIUtils::_OutputLengthValueDimensionFactor
static ALIdouble _OutputLengthValueDimensionFactor
Definition: ALIUtils.h:107
LaserClient_cfi.wl
wl
Definition: LaserClient_cfi.py:46
ALIUtils::SetLengthDimensionFactors
static void SetLengthDimensionFactors()
Definition: ALIUtils.cc:81
gather_cfg.cout
cout
Definition: gather_cfg.py:144
ALIstring
std::string ALIstring
Definition: CocoaGlobals.h:9
ALIUtils::eq2ang
static bool eq2ang(double ang1, double ang2)
Definition: ALIUtils.cc:725
ALIUtils::LengthSigmaDimensionFactor
static ALIdouble LengthSigmaDimensionFactor()
Definition: ALIUtils.h:63
ALIUtils::addPii
static double addPii(double val)
Definition: ALIUtils.cc:751
ALIUtils::setMaximumDeviationDerivative
static void setMaximumDeviationDerivative(ALIdouble val)
Definition: ALIUtils.h:90
ALIUtils::set_time_now
static void set_time_now(time_t now)
Definition: ALIUtils.h:40
mps_check.msg
tuple msg
Definition: mps_check.py:285
ALIUtils::AngleSigmaDimensionFactor
static ALIdouble AngleSigmaDimensionFactor()
Definition: ALIUtils.h:65
ALIUtils::checkMatrixEquations
static int checkMatrixEquations(double angleX, double angleY, double angleZ, CLHEP::HepRotation *rot)
Definition: ALIUtils.cc:762
ALIUtils::IsNumber
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:33
ALIUtils::_LengthSigmaDimensionFactor
static ALIdouble _LengthSigmaDimensionFactor
Definition: ALIUtils.h:104
ALIUtils::_AngleSigmaDimensionFactor
static ALIdouble _AngleSigmaDimensionFactor
Definition: ALIUtils.h:106
fileCollector.now
now
Definition: fileCollector.py:207
ALIUtils::dumpDimensions
static void dumpDimensions(std::ofstream &fout)
Definition: ALIUtils.cc:308
ALIUtils::ALIUtils
ALIUtils()
Definition: ALIUtils.h:25
ALIUtils::approxTo0
static double approxTo0(double val)
Definition: ALIUtils.cc:743
ALIUtils::getFirstTime
static ALIbool getFirstTime()
Definition: ALIUtils.h:87
ALIUtils::debug
static ALIint debug
Definition: ALIUtils.h:34
str
#define str(s)
Definition: TestProcessor.cc:48
ALIUtils::OutputLengthSigmaDimensionFactor
static ALIdouble OutputLengthSigmaDimensionFactor()
Definition: ALIUtils.h:67
ALIUtils::setFirstTime
static void setFirstTime(ALIbool val)
Definition: ALIUtils.h:88
ALIUtils::_AngleValueDimensionFactor
static ALIdouble _AngleValueDimensionFactor
Definition: ALIUtils.h:105
submit.rm
rm
Definition: submit.py:77
ALIUtils::~ALIUtils
~ALIUtils()
Definition: ALIUtils.h:26
ALIUtils::OutputAngleValueDimensionFactor
static ALIdouble OutputAngleValueDimensionFactor()
Definition: ALIUtils.h:68
ALIUtils::val0
static ALIdouble val0(ALIdouble val)
Definition: ALIUtils.h:71
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ALIUtils::OutputAngleSigmaDimensionFactor
static ALIdouble OutputAngleSigmaDimensionFactor()
Definition: ALIUtils.h:69
ALIUtils::dumprm
static void dumprm(const CLHEP::HepRotation &rm, const std::string &msg, std::ostream &out=std::cout)
Definition: ALIUtils.cc:71
ALIUtils::SetAngleDimensionFactors
static void SetAngleDimensionFactors()
Definition: ALIUtils.cc:104
ALIUtils::_OutputLengthSigmaDimensionFactor
static ALIdouble _OutputLengthSigmaDimensionFactor
Definition: ALIUtils.h:108
ALIdouble
long double ALIdouble
Definition: CocoaGlobals.h:11
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
ALIUtils::SetOutputAngleDimensionFactors
static void SetOutputAngleDimensionFactors()
Definition: ALIUtils.cc:153
ALIUtils::getRotationAnglesFromMatrix
static std::vector< double > getRotationAnglesFromMatrix(CLHEP::HepRotation &rmLocal, double origAngleX, double origAngleY, double origAngleZ)
Definition: ALIUtils.cc:549
ALIUtils::CalculateAngleDimensionFactorFromInt
static ALIdouble CalculateAngleDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:271
ALIUtils::firstTime
static ALIbool firstTime
Definition: ALIUtils.h:113
ALIUtils::dumpVS
static void dumpVS(const std::vector< ALIstring > &wl, const std::string &msg, std::ostream &outs=std::cout)
dumps a vector of strings with a message to outs
Definition: ALIUtils.cc:465
heppy_batch.val
val
Definition: heppy_batch.py:351
ALIUtils::SetOutputLengthDimensionFactors
static void SetOutputLengthDimensionFactors()
Definition: ALIUtils.cc:126
ALIUtils::dump3v
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:58
ALIUtils::getMaximumDeviationDerivative
static ALIdouble getMaximumDeviationDerivative()
Definition: ALIUtils.h:89
ALIUtils::report
static ALIint report
Definition: ALIUtils.h:33
ALIUtils::AngleValueDimensionFactor
static ALIdouble AngleValueDimensionFactor()
Definition: ALIUtils.h:64
ALIUtils::CalculateLengthDimensionFactorFromString
static ALIdouble CalculateLengthDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:179
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
ALIint
int ALIint
Definition: CocoaGlobals.h:15
ALIUtils::setDebugVerbosity
static void setDebugVerbosity(ALIint val)
Definition: ALIUtils.h:38
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ALIUtils::_OutputAngleValueDimensionFactor
static ALIdouble _OutputAngleValueDimensionFactor
Definition: ALIUtils.h:109
ALIUtils::LengthValueDimensionFactor
static ALIdouble LengthValueDimensionFactor()
Definition: ALIUtils.h:62
CocoaGlobals.h
ALIUtils::time_now
static time_t time_now()
Definition: ALIUtils.h:39
ALIUtils::changeName
static std::string changeName(const std::string &oldName, const std::string &subsstr1, const std::string &subsstr2)
Definition: ALIUtils.cc:535
ALIUtils::getBool
static bool getBool(const ALIstring &str)
Convert a bool to an integer, checking that it is really a bool.
Definition: ALIUtils.cc:420
ALIUtils::_OutputAngleSigmaDimensionFactor
static ALIdouble _OutputAngleSigmaDimensionFactor
Definition: ALIUtils.h:110
ALIUtils::CalculateAngleDimensionFactorFromString
static ALIdouble CalculateAngleDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:218
ALIUtils::deg
static ALIdouble deg
Definition: ALIUtils.h:35
ALIUtils::maximum_deviation_derivative
static ALIdouble maximum_deviation_derivative
Definition: ALIUtils.h:115
ALIUtils::OutputLengthValueDimensionFactor
static ALIdouble OutputLengthValueDimensionFactor()
Definition: ALIUtils.h:66