CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/Alignment/LaserAlignment/src/LASModuleProfile.cc

Go to the documentation of this file.
00001 
00002 #ifndef __LASMODULEPROFILE_C
00003 #define __LASMODULEPROFILE_C
00004 
00005 
00006 #include "Alignment/LaserAlignment/interface/LASModuleProfile.h"
00007 
00008 
00009 LASModuleProfile::LASModuleProfile() {
00013 
00014   Init();
00015 
00016 }
00017 
00018 
00019 
00020 
00021 LASModuleProfile::LASModuleProfile( double theData[512] ) {
00025 
00026   Init();
00027   for( unsigned int i = 0; i < 512; ++i ) data[i] = theData[i];
00028 
00029 }
00030 
00031 
00032 
00033 
00034 
00035 LASModuleProfile::LASModuleProfile( int theData[512] ) {
00039 
00040   Init();
00041   for( unsigned int i = 0; i < 512; ++i ) data[i] = theData[i];
00042 
00043 }
00044 
00045 
00046 
00047 
00048 
00049 void LASModuleProfile::SetData( double theData[512] ) {
00053 
00054   for( unsigned int i = 0; i < 512; ++i ) data[i] = theData[i];
00055 
00056 }
00057 
00058 
00059 
00060 
00061 
00062 void LASModuleProfile::SetData( int theData[512] ) {
00069 
00070   for( unsigned int i = 0; i < 512; ++i ) data[i] = theData[i];
00071 
00072 }
00073 
00074 
00075 
00076 
00077 // MADE INLINE
00078 // double LASModuleProfile::GetValue( unsigned int theStripNumber ) const {
00079 //   ///
00080 //   /// return an element of the data
00081 //   ///
00082 
00083 //   return( data[theStripNumber] );
00084 
00085 // }
00086 
00087 
00088 
00089 // MADE INLINE
00090 // void LASModuleProfile::SetValue( unsigned int theStripNumber, const double& theValue ) {
00091 //   ///
00092 //   ///
00093 //   ///
00094 
00095 //   data.at( theStripNumber ) = theValue;
00096 
00097 // }
00098 
00099 
00100 
00101 
00102 
00103 void LASModuleProfile::SetAllValuesTo( const double& theValue ) {
00107 
00108   for( unsigned int i = 0; i < data.size(); ++i ) data.at( i ) = theValue;
00109 
00110 }
00111 
00112 
00113 
00114 
00115 
00116 void LASModuleProfile::DumpToArray( double array[512] ) {
00120 
00121   for( unsigned int i = 0; i < 512; ++i ) {
00122     array[i] = data.at( i );
00123   }
00124 
00125 }
00126 
00127 
00128 
00129 
00130 
00131 void LASModuleProfile::Init( void ) {
00135 
00136   data.resize( 512 );
00137 
00138 }
00139 
00140 
00141 
00142 
00143 
00144 LASModuleProfile& LASModuleProfile::operator=( const LASModuleProfile& anotherProfile ) {
00148 
00149   // check for self-assignment
00150   if( this != &anotherProfile ) {
00151 
00152     for( unsigned int i = 0; i < 512; ++i ) {
00153       data.at( i ) = anotherProfile.GetValue( i );
00154     }
00155 
00156   }
00157   
00158   return *this;
00159   
00160 }
00161 
00162 
00163 
00164 
00165 
00166 LASModuleProfile LASModuleProfile::operator+( const LASModuleProfile& anotherProfile ) {
00170 
00171   double theArray[512];
00172   for( unsigned int i = 0; i < 512; ++i ) {
00173     theArray[i] = this->GetValue( i ) + anotherProfile.GetValue( i );
00174   }
00175   
00176   return( LASModuleProfile( theArray ) );
00177   
00178 }
00179 
00180 
00181 
00182 
00183 
00184 LASModuleProfile LASModuleProfile::operator-( const LASModuleProfile& anotherProfile ) {
00188 
00189   double theArray[512];
00190   for( unsigned int i = 0; i < 512; ++i ) {
00191     theArray[i] = this->GetValue( i ) - anotherProfile.GetValue( i );
00192   }
00193   
00194   return( LASModuleProfile( theArray ) );
00195 
00196 }
00197 
00198 
00199 
00200 
00201 
00202 LASModuleProfile LASModuleProfile::operator+( const double b[512] ) {
00206 
00207   double theArray[512];
00208   for( unsigned int i = 0; i < 512; ++i ) {
00209     theArray[i] = this->GetValue( i ) + b[i];
00210   }
00211   
00212   return( LASModuleProfile( theArray ) );
00213 
00214 }
00215 
00216 
00217 
00218 
00219 
00220 LASModuleProfile LASModuleProfile::operator-( const double b[512] ) {
00224 
00225   double theArray[512];
00226   for( unsigned int i = 0; i < 512; ++i ) {
00227     theArray[i] = this->GetValue( i ) - b[i];
00228   }
00229   
00230   return( LASModuleProfile( theArray ) );
00231 
00232 }
00233 
00234 
00235 
00236 
00237 
00238 LASModuleProfile& LASModuleProfile::operator+=( const LASModuleProfile& anotherProfile ) {
00242 
00243   for( unsigned int i = 0; i < 512; ++i ) {
00244     data.at( i ) += anotherProfile.GetValue( i );
00245   }
00246   
00247   return *this;
00248   
00249 }
00250 
00251 
00252 
00253 
00254 
00255 LASModuleProfile& LASModuleProfile::operator-=( const LASModuleProfile& anotherProfile ) {
00259 
00260   for( unsigned int i = 0; i < 512; ++i ) {
00261     data.at( i ) -= anotherProfile.GetValue( i );
00262   }
00263   
00264   return *this;
00265 
00266 }
00267 
00268 
00269 
00270 
00271 
00272 LASModuleProfile& LASModuleProfile::operator+=( const double b[512] ) {
00276 
00277   for( unsigned int i = 0; i < 512; ++i ) {
00278     data.at( i ) += b[i];
00279   }
00280   
00281   return *this;
00282   
00283 }
00284 
00285 
00286 
00287 
00288 
00289 LASModuleProfile& LASModuleProfile::operator-=( const double b[512] ) {
00293 
00294   for( unsigned int i = 0; i < 512; ++i ) {
00295     data.at( i ) -= b[i];
00296   }
00297   
00298   return *this;
00299 
00300 }
00301 
00302 
00303 
00304 
00305 LASModuleProfile& LASModuleProfile::operator+=( const int b[512] ) {
00310 
00311   for( unsigned int i = 0; i < 512; ++i ) {
00312     data.at( i ) += b[i];
00313   }
00314   
00315   return *this;
00316   
00317 }
00318 
00319 
00320 
00321 
00322 
00323 LASModuleProfile& LASModuleProfile::operator-=( const int b[512] ) {
00328 
00329   for( unsigned int i = 0; i < 512; ++i ) {
00330     data.at( i ) -= b[i];
00331   }
00332   
00333   return *this;
00334 
00335 }
00336 
00337 
00338 
00339 
00340 
00341 LASModuleProfile& LASModuleProfile::operator/=( const double divisor ) {
00345   
00346   for( unsigned int i = 0; i < 512; ++i ) {
00347     data.at( i ) /= divisor;
00348   }
00349   
00350   return *this;
00351 
00352 }
00353 
00354 
00355 
00356 
00357 #endif