Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:26

0001 
0002 #ifndef __LASMODULEPROFILE_C
0003 #define __LASMODULEPROFILE_C
0004 
0005 #include "Alignment/LaserAlignment/interface/LASModuleProfile.h"
0006 
0007 LASModuleProfile::LASModuleProfile() {
0008   ///
0009   /// def constructor
0010   ///
0011 
0012   Init();
0013 }
0014 
0015 LASModuleProfile::LASModuleProfile(double theData[512]) {
0016   ///
0017   /// construct and fill the data storage
0018   ///
0019 
0020   Init();
0021   for (unsigned int i = 0; i < 512; ++i)
0022     data[i] = theData[i];
0023 }
0024 
0025 LASModuleProfile::LASModuleProfile(int theData[512]) {
0026   ///
0027   /// construct and fill the data storage
0028   ///
0029 
0030   Init();
0031   for (unsigned int i = 0; i < 512; ++i)
0032     data[i] = theData[i];
0033 }
0034 
0035 void LASModuleProfile::SetData(double theData[512]) {
0036   ///
0037   /// fill the data storage
0038   ///
0039 
0040   for (unsigned int i = 0; i < 512; ++i)
0041     data[i] = theData[i];
0042 }
0043 
0044 void LASModuleProfile::SetData(int theData[512]) {
0045   ///
0046   /// fill the data storage
0047   ///
0048   /// temporary workaround
0049   /// as long as data is provided in int arrays
0050   ///
0051 
0052   for (unsigned int i = 0; i < 512; ++i)
0053     data[i] = theData[i];
0054 }
0055 
0056 // MADE INLINE
0057 // double LASModuleProfile::GetValue( unsigned int theStripNumber ) const {
0058 //   ///
0059 //   /// return an element of the data
0060 //   ///
0061 
0062 //   return( data[theStripNumber] );
0063 
0064 // }
0065 
0066 // MADE INLINE
0067 // void LASModuleProfile::SetValue( unsigned int theStripNumber, const double& theValue ) {
0068 //   ///
0069 //   ///
0070 //   ///
0071 
0072 //   data.at( theStripNumber ) = theValue;
0073 
0074 // }
0075 
0076 void LASModuleProfile::SetAllValuesTo(const double& theValue) {
0077   ///
0078   ///
0079   ///
0080 
0081   for (unsigned int i = 0; i < data.size(); ++i)
0082     data.at(i) = theValue;
0083 }
0084 
0085 void LASModuleProfile::DumpToArray(double array[512]) {
0086   ///
0087   /// fill array
0088   ///
0089 
0090   for (unsigned int i = 0; i < 512; ++i) {
0091     array[i] = data.at(i);
0092   }
0093 }
0094 
0095 void LASModuleProfile::Init(void) {
0096   ///
0097   /// everything needed for initialization
0098   ///
0099 
0100   data.resize(512);
0101 }
0102 
0103 LASModuleProfile LASModuleProfile::operator+(const LASModuleProfile& anotherProfile) {
0104   ///
0105   ///
0106   ///
0107 
0108   double theArray[512];
0109   for (unsigned int i = 0; i < 512; ++i) {
0110     theArray[i] = this->GetValue(i) + anotherProfile.GetValue(i);
0111   }
0112 
0113   return (LASModuleProfile(theArray));
0114 }
0115 
0116 LASModuleProfile LASModuleProfile::operator-(const LASModuleProfile& anotherProfile) {
0117   ///
0118   ///
0119   ///
0120 
0121   double theArray[512];
0122   for (unsigned int i = 0; i < 512; ++i) {
0123     theArray[i] = this->GetValue(i) - anotherProfile.GetValue(i);
0124   }
0125 
0126   return (LASModuleProfile(theArray));
0127 }
0128 
0129 LASModuleProfile LASModuleProfile::operator+(const double b[512]) {
0130   ///
0131   /// add a double[512]
0132   ///
0133 
0134   double theArray[512];
0135   for (unsigned int i = 0; i < 512; ++i) {
0136     theArray[i] = this->GetValue(i) + b[i];
0137   }
0138 
0139   return (LASModuleProfile(theArray));
0140 }
0141 
0142 LASModuleProfile LASModuleProfile::operator-(const double b[512]) {
0143   ///
0144   /// subtract a double[512]
0145   ///
0146 
0147   double theArray[512];
0148   for (unsigned int i = 0; i < 512; ++i) {
0149     theArray[i] = this->GetValue(i) - b[i];
0150   }
0151 
0152   return (LASModuleProfile(theArray));
0153 }
0154 
0155 LASModuleProfile& LASModuleProfile::operator+=(const LASModuleProfile& anotherProfile) {
0156   ///
0157   ///
0158   ///
0159 
0160   for (unsigned int i = 0; i < 512; ++i) {
0161     data.at(i) += anotherProfile.GetValue(i);
0162   }
0163 
0164   return *this;
0165 }
0166 
0167 LASModuleProfile& LASModuleProfile::operator-=(const LASModuleProfile& anotherProfile) {
0168   ///
0169   ///
0170   ///
0171 
0172   for (unsigned int i = 0; i < 512; ++i) {
0173     data.at(i) -= anotherProfile.GetValue(i);
0174   }
0175 
0176   return *this;
0177 }
0178 
0179 LASModuleProfile& LASModuleProfile::operator+=(const double b[512]) {
0180   ///
0181   ///
0182   ///
0183 
0184   for (unsigned int i = 0; i < 512; ++i) {
0185     data.at(i) += b[i];
0186   }
0187 
0188   return *this;
0189 }
0190 
0191 LASModuleProfile& LASModuleProfile::operator-=(const double b[512]) {
0192   ///
0193   ///
0194   ///
0195 
0196   for (unsigned int i = 0; i < 512; ++i) {
0197     data.at(i) -= b[i];
0198   }
0199 
0200   return *this;
0201 }
0202 
0203 LASModuleProfile& LASModuleProfile::operator+=(const int b[512]) {
0204   ///
0205   /// temporary workaround
0206   /// as long as data is provided in int arrays
0207   ///
0208 
0209   for (unsigned int i = 0; i < 512; ++i) {
0210     data.at(i) += b[i];
0211   }
0212 
0213   return *this;
0214 }
0215 
0216 LASModuleProfile& LASModuleProfile::operator-=(const int b[512]) {
0217   ///
0218   /// temporary workaround
0219   /// as long as data is provided in int arrays
0220   ///
0221 
0222   for (unsigned int i = 0; i < 512; ++i) {
0223     data.at(i) -= b[i];
0224   }
0225 
0226   return *this;
0227 }
0228 
0229 LASModuleProfile& LASModuleProfile::operator/=(const double divisor) {
0230   ///
0231   /// handle with care!!
0232   ///
0233 
0234   for (unsigned int i = 0; i < 512; ++i) {
0235     data.at(i) /= divisor;
0236   }
0237 
0238   return *this;
0239 }
0240 
0241 #endif