CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Alignment/LaserAlignment/src/LASBarrelAlignmentParameterSet.cc

Go to the documentation of this file.
00001 
00002 #include "Alignment/LaserAlignment/interface/LASBarrelAlignmentParameterSet.h"
00003 
00004 
00005 
00009 LASBarrelAlignmentParameterSet::LASBarrelAlignmentParameterSet(){
00010 
00011   Init();
00012   
00013 }
00014 
00015 
00016 
00017 
00018 
00022 void LASBarrelAlignmentParameterSet::Init( void ) {
00023 
00024   // could use a single vector<vector<vector<pair<> > > >
00025   // but better split it in 6 parts
00026   for( int i = 0; i < 2; ++i ) { // twice; once for each endface
00027     tecPlusParameters.push_back ( std::vector<std::pair<double,double> >( 3 ) );
00028     tecMinusParameters.push_back( std::vector<std::pair<double,double> >( 3 ) );
00029     tibPlusParameters.push_back ( std::vector<std::pair<double,double> >( 3 ) );
00030     tibMinusParameters.push_back( std::vector<std::pair<double,double> >( 3 ) );
00031     tobPlusParameters.push_back ( std::vector<std::pair<double,double> >( 3 ) );
00032     tobMinusParameters.push_back( std::vector<std::pair<double,double> >( 3 ) );
00033   }
00034 
00035   // the beam parameters (8 beams * 2 pars) are stored in one single container
00036   for( int i = 0; i < 8; ++i ) {
00037     beamParameters.push_back( std::vector<std::pair<double,double> >( 2 ) );
00038   }
00039 
00040 }
00041 
00042 
00043 
00044 
00045 
00053 std::pair<double,double>& LASBarrelAlignmentParameterSet::GetParameter( int aSubdetector, int aDisk, int aParameter ) {
00054 
00055   if( aSubdetector < 0 || aSubdetector > 5 ) {
00056     throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetParameter] ERROR ** Illegal subdetector index: " << aSubdetector << "." << std::endl;
00057   }
00058 
00059   if( aDisk < 0 || aDisk > 1 ) {
00060     throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetParameter] ERROR ** Illegal endface index: " << aDisk << "." << std::endl;
00061   }
00062   
00063   if( aParameter < 0 || aParameter > 2 ) {
00064     throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetParameter] ERROR ** Illegal parameter index: " << aParameter << "." << std::endl;
00065   }
00066 
00067 
00068   // would use a switch here, but this creates problems..
00069   if( aSubdetector == 0 ) return tecPlusParameters.at( aDisk ).at( aParameter );
00070   else if( aSubdetector == 1 ) return tecMinusParameters.at( aDisk ).at( aParameter );
00071   else if( aSubdetector == 2 ) return tibPlusParameters.at( aDisk ).at( aParameter );
00072   else if( aSubdetector == 3 ) return tibMinusParameters.at( aDisk ).at( aParameter );
00073   else if( aSubdetector == 4 ) return tobPlusParameters.at( aDisk ).at( aParameter );
00074   else return tobMinusParameters.at( aDisk ).at( aParameter );
00075 
00076 
00077 }
00078 
00079 
00080 
00081 
00082 
00087 std::pair<double,double>& LASBarrelAlignmentParameterSet::GetBeamParameter( int aBeam, int aParameter ) {
00088   
00089   if( aBeam < 0 || aBeam > 7 ) {
00090     throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal beam index: " << aBeam << "." << std::endl;
00091   }
00092 
00093   if( aParameter < 0 || aParameter > 1 ) {
00094     throw cms::Exception( "Laser Alignment" ) << " [LASBarrelAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal beam parameter index: " << aParameter << "." << std::endl;
00095   }
00096 
00097   return beamParameters.at( aBeam ).at( aParameter );
00098 
00099 }
00100 
00101 
00102 
00103 
00104 
00108 void LASBarrelAlignmentParameterSet::Print( void ) {
00109   
00110   std::cout << std::endl << " [LASBarrelAlignmentParameterSet::Print] -- Parameter list [rad/mm]: " << std::endl;
00111 
00112   const std::string subdetNames[6] = { " TEC+  ", " TEC-  ", " TIB+  ", " TIB-  ", " TOB+  ", " TOB-  " };
00113 
00114   std::cout << " Detector parameters: " << std::endl;
00115   std::cout << " --------------------" << std::endl;
00116   std::cout << " Values:     PHI1         X1          Y1         PHI2         X2          Y2   " << std::endl;
00117   for( int subdet = 0; subdet < 6; ++subdet ) {
00118     std::cout <<subdetNames[subdet];
00119     for( int par = 0; par < 3; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetParameter( subdet, 0, par ).first;
00120     for( int par = 0; par < 3; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetParameter( subdet, 1, par ).first;
00121     std::cout << std::endl;
00122   }
00123 
00124   std::cout << " Errors:     PHI1         X1          Y1         PHI2         X2          Y2   " << std::endl;
00125   for( int subdet = 0; subdet < 6; ++subdet ) {
00126     std::cout <<subdetNames[subdet];
00127     for( int par = 0; par < 3; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetParameter( subdet, 0, par ).second;
00128     for( int par = 0; par < 3; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetParameter( subdet, 1, par ).second;
00129     std::cout << std::endl;
00130   }
00131 
00132   std::cout << std::endl;
00133   std::cout << " Beam parameters: " << std::endl;
00134   std::cout << " ----------------" << std::endl;
00135   std::cout << " Values:     PHI1        PHI2" << std::endl;
00136   for( int beam = 0; beam < 8; ++beam ) {
00137     std::cout << " beam " << beam;
00138     for( int par = 0; par < 2; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetBeamParameter( beam, par ).first;
00139     std::cout << std::endl;
00140   }
00141 
00142   std::cout << " Errors:     PHI1        PHI2" << std::endl;
00143   for( int beam = 0; beam < 8; ++beam ) {
00144     std::cout << " beam " << beam;
00145     for( int par = 0; par < 2; ++par ) std::cout << std::right << std::setw( 12 ) << std::setprecision( 6 ) << std::fixed << GetBeamParameter( beam, par ).second;
00146     std::cout << std::endl;
00147   }
00148 
00149   std::cout << " [LASBarrelAlignmentParameterSet::Print] -- End parameter list." << std::endl;
00150 
00151 }