CMS 3D CMS Logo

LASGlobalData.cc

Go to the documentation of this file.
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   // do a range check first
00031   if( !( ( theDetector == 0 || theDetector == 1 ) &&        // TEC+ or TEC-
00032          ( theRing == 0 || theRing == 1 )         &&        // ring4 or ring6
00033          ( theBeam >= 0 && theBeam < 8 )          &&        // eight beams in a TEC
00034          ( theDisk >= 0 && theDisk < 9 )             ) ) {  // disk1..disk9
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."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
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   // do a range check first
00057   if( !( ( theDetector == 2 || theDetector == 3 ) &&        // TIB or TOB
00058          ( theBeam >= 0 && theBeam < 8 )          &&        // there are eight AT beams
00059          ( thePosition >= 0 && thePosition < 6 )     ) ) {  // z-pos -3 .. z-pos +3
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."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
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   // do a range check first
00082   if( !( ( theDetector == 0 || theDetector == 1 ) &&        // TEC+ or TEC-
00083          ( theBeam >= 0 && theBeam < 8 )          &&        // eight AT beams in a TEC
00084          ( theDisk >= 0 && theDisk < 6 )     ) ) {          // disk1...disk5 are hit by AT
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."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
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   // do a range check first
00108   if( !( ( theDetector == 0 || theDetector == 1 ) &&        // TEC+ or TEC-
00109          ( theRing == 0 || theRing == 1 )         &&        // ring4 or ring6
00110          ( theBeam >= 0 && theBeam < 8 )          &&        // eight beams in a TEC
00111          ( theDisk >= 0 && theDisk < 9 )             ) ) {  // disk1..disk9
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."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
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   // do a range check first
00135   if( !( ( theDetector == 2 || theDetector == 3 ) &&        // TIB or TOB
00136          ( theBeam >= 0 && theBeam < 8 )          &&        // there are eight AT beams
00137          ( thePosition >= 0 && thePosition < 6 )     ) ) {  // pos-3..pos+3
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."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
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   // do a range check first
00161   if( !( ( theDetector == 0 || theDetector == 1 ) &&        // TEC+ or TEC-
00162          ( theBeam >= 0 && theBeam < 8 )          &&        // eight beams in a TEC
00163          ( theDisk >= 0 && theDisk < 6 )             ) ) {  // disk1..disk5 for TEC AT
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."; // @@@ REPLACE THIS BY cms::Exception (<FWCore/Utilities/interface/Exception.h> in 1_3_6)
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 // /// element wise assignment operator
00181 // ///
00182 // template <class T>
00183 // LASGlobalData<T>& LASGlobalData<T>::operator=( LASGlobalData<T>& anotherGlobalData ) {
00184 
00185 //   // TEC copy
00186 //   for( int det = 0; det < 2; ++det ) {
00187 //     for( int ring = 0; ring < 2; ++ring ) {
00188 //       for( int beam = 0; beam < 8; ++ beam ) {
00189 //      for( int disk = 0; disk < 9; ++ disk ) {
00190 //        this->SetTECEntry( det, ring, beam, disk, anotherGlobalData.GetTECEntry( det, ring, beam, disk ) );
00191 //      }
00192 //       }
00193 //     }
00194 //   }
00195 
00196 //   // TIBTOB copy
00197 //   for( int det = 2; det < 4; ++det ) {
00198 //     for( int beam = 0; beam < 8; ++ beam ) {
00199 //       for( int pos = 0; pos < 6; ++ pos ) {
00200 //      this->SetTIBTOBEntry( det, beam, pos, anotherGlobalData.GetTIBTOBEntry( det, beam, pos ) );
00201 //       }
00202 //     }
00203 //   }
00204   
00205 //   // TEC2TEC copy
00206 //   for( int det = 2; det < 4; ++det ) {
00207 //     for( int beam = 0; beam < 8; ++ beam ) {
00208 //       for( int disk = 0; disk < 9; ++ disk ) {
00209 //      this->SetTEC2TECEntry( det, beam, disk, anotherGlobalData.GetTEC2TECEntry( det, beam, disk ) );
00210 //       }
00211 //     }
00212 //   }
00213 
00214 // }
00215 
00216 
00217 
00218 
00219 
00224 template <class T>
00225 void LASGlobalData<T>::Init( void ) {
00226 
00227   // create TEC+ subdetector "multi"-vector of T
00228   tecPlusData.resize( 2 ); // create ring4 and ring6
00229   for( unsigned int ring = 0; ring < tecPlusData.size(); ++ring ) {
00230     tecPlusData.at( ring ).resize( 8 ); // create 8 beams for each ring
00231     for( unsigned int beam = 0; beam < tecPlusData.at( ring ).size(); ++beam ) {
00232       tecPlusData.at( ring ).at( beam ).resize( 9 ); // create 9 disks for each beam
00233     }
00234   }
00235 
00236   // same for TEC-
00237   tecMinusData.resize( 2 ); // create ring4 and ring6
00238   for( unsigned int ring = 0; ring < tecMinusData.size(); ++ring ) {
00239     tecMinusData.at( ring ).resize( 8 ); // create 8 beams for each ring
00240     for( unsigned int beam = 0; beam < tecMinusData.at( ring ).size(); ++beam ) {
00241       tecMinusData.at( ring ).at( beam ).resize( 9 ); // create 9 disks for each beam
00242     }
00243   }
00244   
00245   // same for TEC+ AT
00246   tecPlusATData.resize( 8 ); // create 8 beams
00247   for( unsigned int beam = 0; beam < tecPlusATData.size(); ++beam ) {
00248     tecPlusATData.at( beam ).resize( 5 ); // five TEC disks hit by each AT beam
00249   }
00250 
00251   // same for TEC- AT
00252   tecMinusATData.resize( 8 ); // create 8 beams
00253   for( unsigned int beam = 0; beam < tecMinusATData.size(); ++beam ) {
00254     tecMinusATData.at( beam ).resize( 5 ); // five TEC disks hit by each AT beam
00255   }
00256 
00257   // same for TIB..
00258   tibData.resize( 8 ); // create 8 beams
00259   for( unsigned int beam = 0; beam < tibData.size(); ++ beam ) {
00260     tibData.at( beam ).resize( 6 ); // six TIB modules hit by each beam
00261   }
00262 
00263   // ..and for TOB
00264   tobData.resize( 8 ); // create 8 beams
00265   for( unsigned int beam = 0; beam < tobData.size(); ++ beam ) {
00266     tobData.at( beam ).resize( 6 ); // six TOB modules hit by each beam
00267   }
00268 
00269 
00270 
00271 
00272 }
00273 
00274 #endif

Generated on Tue Jun 9 17:24:09 2009 for CMSSW by  doxygen 1.5.4