CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
23 class ALIUtils
24 {
25 public:
26  ALIUtils(){};
27  ~ALIUtils(){};
28 
29  static int IsNumber( const ALIstring& str);
30  static void dump3v( const CLHEP::Hep3Vector& vec, const std::string& msg);
31  static void dumprm( const CLHEP::HepRotation& rm, const std::string& msg, std::ostream& out = std::cout );
32 
33  // public static DATA MEMBERS
34  static ALIint report;
35  static ALIint debug;
36  static ALIdouble deg;
37 
38  static void setReportVerbosity( ALIint val ) {
39  report = val;
40  }
41  static void setDebugVerbosity( ALIint val ) {
42  debug = val;
43  }
44  static time_t time_now() {
45  return _time_now;
46  }
47  static void set_time_now(time_t now) {
48  _time_now = now;
49  }
51  static double getFloat( const ALIstring& str );
53  static int getInt( const ALIstring& str );
55  static bool getBool( const ALIstring& str );
57  static void dumpVS( const std::vector<ALIstring>& wl , const std::string& msg, std::ostream& outs = std::cout) ;
58 
59  //---------- Dimension factors
60  static void SetLengthDimensionFactors();
61  static void SetAngleDimensionFactors();
62  static void SetOutputLengthDimensionFactors();
63  static void SetOutputAngleDimensionFactors();
68 
69  static void dumpDimensions( std::ofstream& fout );
70 
87 
88  static ALIdouble val0( ALIdouble val ) {
89  //-std::cout << val << " val " << ( (val <= 1.E-9) ? 0. : val) << std::endl;
90 // return (abs(val) <= 1.E-9) ? 0. : val; }
91  if( fabs(val) <= 1.E-9) { return 0.;
92  }else { return val; }; }
93 
94  static ALIstring subQuotes( const ALIstring& str );
95 
96  static ALIdouble getDimensionValue( const ALIstring& dim, const ALIstring& dimType );
97 
98  static std::string changeName( const std::string& oldName, const std::string& subsstr1, const std::string& subsstr2 );
99 
101  return firstTime;
102  }
103  static void setFirstTime( ALIbool val ){
104  firstTime = val;
105  }
110 
111  static std::vector<double> getRotationAnglesFromMatrix( CLHEP::HepRotation& rmLocal, double origAngleX, double origAngleY, double origAngleZ );
112  static double diff2pi( double ang1, double ang2 );
113  static bool eq2ang( double ang1, double ang2 );
114  static double approxTo0( double val );
115  static double addPii( double val );
116  static int checkMatrixEquations( double angleX, double angleY, double angleZ, CLHEP::HepRotation* rot);
117 
118 
119  private:
128  static time_t _time_now;
129 
131 
133 
134 };
135 
136 /*
137 template<class T>
138 ALIuint FindItemInVector( const T* item, const std::vector<T*>& item_vector )
139 {
140 
141  std::vector<T*>::const_iterator vtcite;
142  ALIuint vfound = 1;
143  for( vtcite = item_vector.begin(); vtcite != item_vector.end(); vtcite++) {
144  if( (*vtcite) == item ) {
145 
146  }
147  }
148 
149 }
150 */
151 //std::ostream& operator << (std::ostream& os, const CLHEP::HepRotation& c);
152 
153 #endif
154 
155 
static void set_time_now(time_t now)
Definition: ALIUtils.h:47
~ALIUtils()
Definition: ALIUtils.h:27
static time_t _time_now
Definition: ALIUtils.h:128
long double ALIdouble
Definition: CocoaGlobals.h:11
static ALIdouble maximum_deviation_derivative
Definition: ALIUtils.h:132
static ALIdouble _OutputLengthValueDimensionFactor
Definition: ALIUtils.h:124
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:26
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:106
int ALIint
Definition: CocoaGlobals.h:15
static ALIdouble _AngleValueDimensionFactor
Definition: ALIUtils.h:122
static ALIint debug
Definition: ALIUtils.h:35
static ALIdouble LengthSigmaDimensionFactor()
Definition: ALIUtils.h:73
static double addPii(double val)
Definition: ALIUtils.cc:787
static void setMaximumDeviationDerivative(ALIdouble val)
Definition: ALIUtils.h:108
static int checkMatrixEquations(double angleX, double angleY, double angleZ, CLHEP::HepRotation *rot)
Definition: ALIUtils.cc:799
static ALIbool firstTime
Definition: ALIUtils.h:130
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:83
static ALIdouble val0(ALIdouble val)
Definition: ALIUtils.h:88
static ALIdouble _OutputAngleSigmaDimensionFactor
Definition: ALIUtils.h:127
static ALIdouble _AngleSigmaDimensionFactor
Definition: ALIUtils.h:123
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:85
string rm
Definition: submit.py:76
static void setFirstTime(ALIbool val)
Definition: ALIUtils.h:103
static ALIdouble CalculateLengthDimensionFactorFromString(ALIstring dimstr)
Definition: ALIUtils.cc:196
static void SetAngleDimensionFactors()
Definition: ALIUtils.cc:116
static void SetOutputAngleDimensionFactors()
Definition: ALIUtils.cc:169
tuple out
Definition: dbtoconf.py:99
static ALIdouble deg
Definition: ALIUtils.h:36
static ALIdouble AngleSigmaDimensionFactor()
Definition: ALIUtils.h:77
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:34
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:121
static ALIbool getFirstTime()
Definition: ALIUtils.h:100
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:79
static void setDebugVerbosity(ALIint val)
Definition: ALIUtils.h:41
static ALIdouble OutputLengthSigmaDimensionFactor()
Definition: ALIUtils.h:81
std::string ALIstring
Definition: CocoaGlobals.h:9
static ALIdouble _OutputAngleValueDimensionFactor
Definition: ALIUtils.h:126
static ALIdouble AngleValueDimensionFactor()
Definition: ALIUtils.h:75
tuple cout
Definition: gather_cfg.py:121
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
static ALIdouble _OutputLengthSigmaDimensionFactor
Definition: ALIUtils.h:125
static void setReportVerbosity(ALIint val)
Definition: ALIUtils.h:38
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:120
static ALIdouble LengthValueDimensionFactor()
Definition: ALIUtils.h:71
static time_t time_now()
Definition: ALIUtils.h:44
static ALIdouble CalculateAngleDimensionFactorFromInt(ALIint ad)
Definition: ALIUtils.cc:298