00001
00002 #ifndef __LASGLOBALDATA_C
00003 #define __LASGLOBALDATA_C
00004
00005 #include "Alignment/LaserAlignment/src/LASGlobalData.h"
00006
00007
00008
00009
00010 template <class T>
00011 LASGlobalData<T>::LASGlobalData() {
00015
00016 Init();
00017
00018 }
00019
00020
00021
00022
00027 template <class T>
00028 T& LASGlobalData<T>::GetTECEntry( int theDetector, int theRing, int theBeam, int theDisk ) {
00029
00030
00031 if( !( ( theDetector == 0 || theDetector == 1 ) &&
00032 ( theRing == 0 || theRing == 1 ) &&
00033 ( theBeam >= 0 && theBeam < 8 ) &&
00034 ( theDisk >= 0 && theDisk < 9 ) ) ) {
00035 std::cerr << " [LASGlobalData::GetTECEntry] ** ERROR: illegal input coordinates:" << std::endl;
00036 std::cerr << " detector " << theDetector << ", ring " << theRing << ", beam " << theBeam << ", disk " << theDisk << "." << std::endl;
00037 throw " Bailing out.";
00038 }
00039 else {
00040 if( theDetector == 0 ) return( tecPlusData.at( theRing ).at( theBeam ).at( theDisk ) );
00041 else return( tecMinusData.at( theRing ).at( theBeam ).at( theDisk ) );
00042 }
00043
00044 }
00045
00046
00047
00048
00053 template <class T>
00054 T& LASGlobalData<T>::GetTIBTOBEntry( int theDetector, int theBeam, int thePosition ) {
00055
00056
00057 if( !( ( theDetector == 2 || theDetector == 3 ) &&
00058 ( theBeam >= 0 && theBeam < 8 ) &&
00059 ( thePosition >= 0 && thePosition < 6 ) ) ) {
00060 std::cerr << " [LASGlobalData::GetTIBTOBEntry] ** ERROR: illegal coordinates:" << std::endl;
00061 std::cerr << " detector " << theDetector << ", beam " << theBeam << ", position " << thePosition << "." << std::endl;
00062 throw " Bailing out.";
00063 }
00064 else {
00065 if( theDetector == 2 ) return( tibData.at( theBeam ).at( thePosition ) );
00066 else return( tobData.at( theBeam ).at( thePosition ) );
00067 }
00068
00069 }
00070
00071
00072
00073
00078 template <class T>
00079 T& LASGlobalData<T>::GetTEC2TECEntry( int theDetector, int theBeam, int theDisk ) {
00080
00081
00082 if( !( ( theDetector == 0 || theDetector == 1 ) &&
00083 ( theBeam >= 0 && theBeam < 8 ) &&
00084 ( theDisk >= 0 && theDisk < 6 ) ) ) {
00085 std::cerr << " [LASGlobalData::GetTEC2TECEntry] ** ERROR: illegal coordinates:" << std::endl;
00086 std::cerr << " detector " << theDetector << ", beam " << theBeam << ", disk " << theDisk << "." << std::endl;
00087 throw " Bailing out.";
00088 }
00089 else {
00090 if( theDetector == 0 ) return( tecPlusATData.at( theBeam ).at( theDisk ) );
00091 else return( tecMinusATData.at( theBeam ).at( theDisk ) );
00092 }
00093
00094 }
00095
00096
00097
00098
00099
00104 template <class T>
00105 void LASGlobalData<T>::SetTECEntry( int theDetector, int theRing, int theBeam, int theDisk, T theEntry ) {
00106
00107
00108 if( !( ( theDetector == 0 || theDetector == 1 ) &&
00109 ( theRing == 0 || theRing == 1 ) &&
00110 ( theBeam >= 0 && theBeam < 8 ) &&
00111 ( theDisk >= 0 && theDisk < 9 ) ) ) {
00112 std::cerr << " [LASGlobalData::SetTECEntry] ** ERROR: illegal coordinates:" << std::endl;
00113 std::cerr << " detector " << theDetector << ", ring " << theRing << ", beam " << theBeam << ", disk " << theDisk << "." << std::endl;
00114 throw " Bailing out.";
00115 }
00116 else {
00117 if( theDetector == 0 ) tecPlusData.at( theRing ).at( theBeam ).at( theDisk ) = theEntry;
00118 else tecMinusData.at( theRing ).at( theBeam ).at( theDisk ) = theEntry;
00119 }
00120
00121 }
00122
00123
00124
00125
00126
00131 template <class T>
00132 void LASGlobalData<T>::SetTIBTOBEntry( int theDetector, int theBeam, int thePosition, T theEntry ) {
00133
00134
00135 if( !( ( theDetector == 2 || theDetector == 3 ) &&
00136 ( theBeam >= 0 && theBeam < 8 ) &&
00137 ( thePosition >= 0 && thePosition < 6 ) ) ) {
00138 std::cerr << " [LASGlobalData::SetTIBTOBEntry] ** ERROR: illegal coordinates:" << std::endl;
00139 std::cerr << " detector " << theDetector << ", beam " << theBeam << ", position " << thePosition << "." << std::endl;
00140 throw " Bailing out.";
00141 }
00142 else {
00143 if( theDetector == 2 ) tibData.at( theBeam ).at( thePosition ) = theEntry;
00144 else tobData.at( theBeam ).at( thePosition ) = theEntry;
00145 }
00146
00147 }
00148
00149
00150
00151
00152
00157 template <class T>
00158 void LASGlobalData<T>::SetTEC2TECEntry( int theDetector, int theBeam, int theDisk, T theEntry ) {
00159
00160
00161 if( !( ( theDetector == 0 || theDetector == 1 ) &&
00162 ( theBeam >= 0 && theBeam < 8 ) &&
00163 ( theDisk >= 0 && theDisk < 6 ) ) ) {
00164 std::cerr << " [LASGlobalData::SetTEC2TECEntry] ** ERROR: illegal coordinates:" << std::endl;
00165 std::cerr << " detector " << theDetector << ", beam " << theBeam << ", disk " << theDisk << "." << std::endl;
00166 throw " Bailing out.";
00167 }
00168 else {
00169 if( theDetector == 0 ) tecPlusATData.at( theBeam ).at( theDisk ) = theEntry;
00170 else tecMinusATData.at( theBeam ).at( theDisk ) = theEntry;
00171 }
00172
00173 }
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00224 template <class T>
00225 void LASGlobalData<T>::Init( void ) {
00226
00227
00228 tecPlusData.resize( 2 );
00229 for( unsigned int ring = 0; ring < tecPlusData.size(); ++ring ) {
00230 tecPlusData.at( ring ).resize( 8 );
00231 for( unsigned int beam = 0; beam < tecPlusData.at( ring ).size(); ++beam ) {
00232 tecPlusData.at( ring ).at( beam ).resize( 9 );
00233 }
00234 }
00235
00236
00237 tecMinusData.resize( 2 );
00238 for( unsigned int ring = 0; ring < tecMinusData.size(); ++ring ) {
00239 tecMinusData.at( ring ).resize( 8 );
00240 for( unsigned int beam = 0; beam < tecMinusData.at( ring ).size(); ++beam ) {
00241 tecMinusData.at( ring ).at( beam ).resize( 9 );
00242 }
00243 }
00244
00245
00246 tecPlusATData.resize( 8 );
00247 for( unsigned int beam = 0; beam < tecPlusATData.size(); ++beam ) {
00248 tecPlusATData.at( beam ).resize( 5 );
00249 }
00250
00251
00252 tecMinusATData.resize( 8 );
00253 for( unsigned int beam = 0; beam < tecMinusATData.size(); ++beam ) {
00254 tecMinusATData.at( beam ).resize( 5 );
00255 }
00256
00257
00258 tibData.resize( 8 );
00259 for( unsigned int beam = 0; beam < tibData.size(); ++ beam ) {
00260 tibData.at( beam ).resize( 6 );
00261 }
00262
00263
00264 tobData.resize( 8 );
00265 for( unsigned int beam = 0; beam < tobData.size(); ++ beam ) {
00266 tobData.at( beam ).resize( 6 );
00267 }
00268
00269
00270
00271
00272 }
00273
00274 #endif