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 
13 
15 
16 #include "CLHEP/Vector/ThreeVector.h"
17 #include "CLHEP/Vector/Rotation.h"
18 #include <vector>
19 #include <time.h>
20 #include <fstream>
21 #include <iostream>
22 #include <cmath>
23 
24 class ALIUtils
25 {
26 public:
27  ALIUtils(){};
28  ~ALIUtils(){};
29 
30  static int IsNumber( const ALIstring& str);
31  static void dump3v( const CLHEP::Hep3Vector& vec, const std::string& msg);
32  static void dumprm( const CLHEP::HepRotation& rm, const std::string& msg, std::ostream& out = std::cout );
33 
34  // public static DATA MEMBERS
35  static ALIint report;
36  static ALIint debug;
37  static ALIdouble deg;
38 
39  static void setReportVerbosity( ALIint val ) {
40  report = val;
41  }
42  static void setDebugVerbosity( ALIint val ) {
43  debug = val;
44  }
45  static time_t time_now() {
46  return _time_now;
47  }
48  static void set_time_now(time_t now) {
49  _time_now = now;
50  }
52  static double getFloat( const ALIstring& str );
54  static int getInt( const ALIstring& str );
56  static bool getBool( const ALIstring& str );
58  static void dumpVS( const std::vector<ALIstring>& wl , const std::string& msg, std::ostream& outs = std::cout) ;
59 
60  //---------- Dimension factors
61  static void SetLengthDimensionFactors();
62  static void SetAngleDimensionFactors();
63  static void SetOutputLengthDimensionFactors();
64  static void SetOutputAngleDimensionFactors();
69 
70  static void dumpDimensions( std::ofstream& fout );
71 
88 
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; }; }
94 
95  static ALIstring subQuotes( const ALIstring& str );
96 
97  static ALIdouble getDimensionValue( const ALIstring& dim, const ALIstring& dimType );
98 
99  static std::string changeName( const std::string& oldName, const std::string& subsstr1, const std::string& subsstr2 );
100 
102  return firstTime;
103  }
104  static void setFirstTime( ALIbool val ){
105  firstTime = val;
106  }
111 
112  static std::vector<double> getRotationAnglesFromMatrix( CLHEP::HepRotation& rmLocal, double origAngleX, double origAngleY, double origAngleZ );
113  static double diff2pi( double ang1, double ang2 );
114  static bool eq2ang( double ang1, double ang2 );
115  static double approxTo0( double val );
116  static double addPii( double val );
117  static int checkMatrixEquations( double angleX, double angleY, double angleZ, CLHEP::HepRotation* rot);
118 
119 
120  private:
129  static time_t _time_now;
130 
132 
134 
135 };
136 
137 /*
138 template<class T>
139 ALIuint FindItemInVector( const T* item, const std::vector<T*>& item_vector )
140 {
141 
142  std::vector<T*>::const_iterator vtcite;
143  ALIuint vfound = 1;
144  for( vtcite = item_vector.begin(); vtcite != item_vector.end(); vtcite++) {
145  if( (*vtcite) == item ) {
146 
147  }
148  }
149 
150 }
151 */
152 //std::ostream& operator << (std::ostream& os, const CLHEP::HepRotation& c);
153 
154 #endif
155 
156 
static void set_time_now(time_t now)
Definition: ALIUtils.h:48
~ALIUtils()
Definition: ALIUtils.h:28
static time_t _time_now
Definition: ALIUtils.h:129
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIdouble maximum_deviation_derivative
Definition: ALIUtils.h:133
static ALIdouble _OutputLengthValueDimensionFactor
Definition: ALIUtils.h:125
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
ALIUtils()
Definition: ALIUtils.h:27
static void dumprm(const CLHEP::HepRotation &rm, const std::string &msg, std::ostream &out=std::cout)
Definition: ALIUtils.cc:77
static void SetOutputLengthDimensionFactors()
Definition: ALIUtils.cc:141
static ALIdouble getMaximumDeviationDerivative()
Definition: ALIUtils.h:107
int ALIint
Definition: CocoaGlobals.h:15
static ALIdouble _AngleValueDimensionFactor
Definition: ALIUtils.h:123
static ALIint debug
Definition: ALIUtils.h:36
static ALIdouble LengthSigmaDimensionFactor()
Definition: ALIUtils.h:74
static double addPii(double val)
Definition: ALIUtils.cc:787
static void setMaximumDeviationDerivative(ALIdouble val)
Definition: ALIUtils.h:109
static int checkMatrixEquations(double angleX, double angleY, double angleZ, CLHEP::HepRotation *rot)
Definition: ALIUtils.cc:799
static ALIbool firstTime
Definition: ALIUtils.h:131
static double getFloat(const ALIstring &str)
Convert a string to an float, checking that it is really a number.
Definition: ALIUtils.cc:404
bool ALIbool
Definition: CocoaGlobals.h:19
static bool getBool(const ALIstring &str)
Convert a bool to an integer, checking that it is really a bool.
Definition: ALIUtils.cc:453
static ALIdouble OutputAngleValueDimensionFactor()
Definition: ALIUtils.h:84
static ALIdouble val0(ALIdouble val)
Definition: ALIUtils.h:89
static ALIdouble _OutputAngleSigmaDimensionFactor
Definition: ALIUtils.h:128
static ALIdouble _AngleSigmaDimensionFactor
Definition: ALIUtils.h:124
static ALIdouble CalculateAngleDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:237
static ALIdouble CalculateLengthDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:266
static int IsNumber(const ALIstring &str)
Definition: ALIUtils.cc:34
static ALIdouble OutputAngleSigmaDimensionFactor()
Definition: ALIUtils.h:86
static void setFirstTime(ALIbool val)
Definition: ALIUtils.h:104
static ALIdouble CalculateLengthDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:196
static void SetAngleDimensionFactors()
Definition: ALIUtils.cc:116
static void SetOutputAngleDimensionFactors()
Definition: ALIUtils.cc:169
static ALIdouble deg
Definition: ALIUtils.h:37
static ALIdouble AngleSigmaDimensionFactor()
Definition: ALIUtils.h:78
static void dump3v(const CLHEP::Hep3Vector &vec, const std::string &msg)
Definition: ALIUtils.cc:61
static void SetLengthDimensionFactors()
Definition: ALIUtils.cc:91
static ALIint report
Definition: ALIUtils.h:35
static std::string changeName(const std::string &oldName, const std::string &subsstr1, const std::string &subsstr2)
Definition: ALIUtils.cc:573
static ALIdouble _LengthSigmaDimensionFactor
Definition: ALIUtils.h:122
static ALIbool getFirstTime()
Definition: ALIUtils.h:101
static void dumpVS(const std::vector< ALIstring > &wl, const std::string &msg, std::ostream &outs=std::cout)
dumps a vector of strings with a message to outs
Definition: ALIUtils.cc:501
static ALIdouble getDimensionValue(const ALIstring &dim, const ALIstring &dimType)
Definition: ALIUtils.cc:515
static ALIdouble OutputLengthValueDimensionFactor()
Definition: ALIUtils.h:80
static void setDebugVerbosity(ALIint val)
Definition: ALIUtils.h:42
static ALIdouble OutputLengthSigmaDimensionFactor()
Definition: ALIUtils.h:82
std::string ALIstring
Definition: CocoaGlobals.h:9
static ALIdouble _OutputAngleValueDimensionFactor
Definition: ALIUtils.h:127
static ALIdouble AngleValueDimensionFactor()
Definition: ALIUtils.h:76
static std::vector< double > getRotationAnglesFromMatrix(CLHEP::HepRotation &rmLocal, double origAngleX, double origAngleY, double origAngleZ)
Definition: ALIUtils.cc:591
static int getInt(const ALIstring &str)
Convert a string to an integer, checking that it is really an integer.
Definition: ALIUtils.cc:417
rm
Definition: submit.py:76
static ALIdouble _OutputLengthSigmaDimensionFactor
Definition: ALIUtils.h:126
static void setReportVerbosity(ALIint val)
Definition: ALIUtils.h:39
static void dumpDimensions(std::ofstream &fout)
Definition: ALIUtils.cc:337
static ALIstring subQuotes(const ALIstring &str)
Definition: ALIUtils.cc:472
static ALIdouble _LengthValueDimensionFactor
Definition: ALIUtils.h:121
static ALIdouble LengthValueDimensionFactor()
Definition: ALIUtils.h:72
static time_t time_now()
Definition: ALIUtils.h:45
static ALIdouble CalculateAngleDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:298