CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/Alignment/LaserAlignment/src/LASEndcapAlignmentParameterSet.cc

Go to the documentation of this file.
00001 
00002 #include "Alignment/LaserAlignment/interface/LASEndcapAlignmentParameterSet.h"
00003 
00004 
00005 
00006 
00010 LASEndcapAlignmentParameterSet::LASEndcapAlignmentParameterSet() {
00011 
00012   Init();
00013   
00014 }
00015 
00016 
00017 
00018 
00019 
00023 void LASEndcapAlignmentParameterSet::Init( void ) {
00024 
00025   // could use a single vector<vector<vector<pair<> > > >
00026   // but better split it in 2 parts
00027 
00028   for( unsigned int disk = 0; disk < 9; ++disk ) { // nine times; once for each disk
00029     tecPlusDiskParameters.push_back ( std::vector<std::pair<double,double> >( 3 ) );
00030     tecMinusDiskParameters.push_back( std::vector<std::pair<double,double> >( 3 ) );
00031     
00032     // compiler won't let me init the pairs within push_back call..
00033     for( unsigned int par = 0; par < 3; ++par ) {
00034       tecPlusDiskParameters.at( disk ).at( par ) = std::pair<double,double>( 0., 0. );
00035       tecMinusDiskParameters.at( disk ).at( par ) = std::pair<double,double>( 0., 0. );
00036     }
00037 
00038   }
00039 
00040   // once for each parameter
00041   for( unsigned int par = 0; par < 6; ++par ) {
00042     tecPlusGlobalParameters.push_back( std::pair<double,double>( 0., 0. ) );
00043     tecMinusGlobalParameters.push_back( std::pair<double,double>( 0., 0. ) );
00044   }
00045 
00046 
00047   // beam parameters
00048   tecPlusBeamParameters.resize( 8 );
00049   tecMinusBeamParameters.resize( 8 );
00050   
00051   // now once for each beam: the 2 rings
00052   for( unsigned int beam = 0; beam < 8; ++beam ) {
00053     
00054     tecPlusBeamParameters.at( beam ).resize( 2 );
00055     tecMinusBeamParameters.at( beam ).resize( 2 );
00056     
00057     // now once for each ring: the 2 parameters
00058     for( unsigned int ring = 0; ring < 2; ++ring ) {
00059       tecPlusBeamParameters.at( beam ).at( ring ).resize( 2 );
00060       tecMinusBeamParameters.at( beam ).at( ring ).resize( 2 );
00061       
00062       // now once for each parameter: the pairs (value/error)
00063       for( unsigned int par = 0; par < 2; ++par ) {
00064         tecPlusBeamParameters.at( beam ).at( ring ).at( par ) = std::pair<double,double>( 0., 0. );
00065         tecMinusBeamParameters.at( beam ).at( ring ).at( par ) = std::pair<double,double>( 0., 0. );
00066       }
00067 
00068     }
00069       
00070   }
00071 
00072 }
00073 
00074 
00075 
00076 
00077 
00085 std::pair<double,double>& LASEndcapAlignmentParameterSet::GetDiskParameter( int aSubdetector, int aDisk, int aParameter ) {
00086 
00087   if( aSubdetector < 0 || aSubdetector > 1 ) {
00088     throw cms::Exception( "Laser Alignment" ) << " [LASEndcapAlignmentParameterSet::GetDiskParameter] ERROR ** Illegal subdetector index: " << aSubdetector << "." << std::endl;
00089   }
00090 
00091   if( aDisk < 0 || aDisk > 8 ) {
00092     throw cms::Exception( "Laser Alignment" ) << " [LASEndcapAlignmentParameterSet::GetDiskParameter] ERROR ** Illegal disk index: " << aDisk << "." << std::endl;
00093   }
00094   
00095   if( aParameter < 0 || aParameter > 2 ) {
00096     throw cms::Exception( "Laser Alignment" ) << " [LASEndcapAlignmentParameterSet::GetDiskParameter] ERROR ** Illegal parameter index: " << aParameter << "." << std::endl;
00097   }
00098 
00099 
00100   if( aSubdetector == 0 ) return tecPlusDiskParameters.at( aDisk ).at( aParameter );
00101   return tecMinusDiskParameters.at( aDisk ).at( aParameter );
00102 
00103 }
00104 
00105 
00106 
00107 
00108 
00117 std::pair<double,double>& LASEndcapAlignmentParameterSet::GetGlobalParameter( int aSubdetector, int aParameter ) {
00118   
00119   if( aSubdetector < 0 || aSubdetector > 1 ) {
00120     throw cms::Exception( "Laser Alignment" ) << " [LASEndcapAlignmentParameterSet::GetGlobalParameter] ERROR ** Illegal subdetector index: " << aSubdetector << "." << std::endl;
00121   }
00122 
00123   if( aParameter < 0 || aParameter > 5 ) {
00124     throw cms::Exception( "Laser Alignment" ) << " [LASEndcapAlignmentParameterSet::GetGlobalParameter] ERROR ** Illegal parameter index: " << aParameter << "." << std::endl;
00125   }
00126 
00127   if( aSubdetector == 0 ) return tecPlusGlobalParameters.at( aParameter );
00128   return tecMinusGlobalParameters.at( aParameter );
00129 
00130 }
00131 
00132 
00133 
00134 
00135 
00143 std::pair<double,double>& LASEndcapAlignmentParameterSet::GetBeamParameter( int aSubdetector, int aRing, int aBeam, int aParameter ) {
00144   
00145   if( aSubdetector < 0 || aSubdetector > 1 ) {
00146     throw cms::Exception( "Laser Alignment" ) << " [LASEndcapAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal subdetector index: " << aSubdetector << "." << std::endl;
00147   }
00148 
00149   if( aRing < 0 || aRing > 1 ) {
00150     throw cms::Exception( "Laser Alignment" ) << " [LASEndcapAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal ring index: " << aRing << "." << std::endl;
00151   }
00152 
00153   if( aBeam < 0 || aBeam > 7 ) {
00154     throw cms::Exception( "Laser Alignment" ) << " [LASEndcapAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal beam index: " << aBeam << "." << std::endl;
00155   }
00156 
00157   if( aParameter < 0 || aParameter > 5 ) {
00158     throw cms::Exception( "Laser Alignment" ) << " [LASEndcapAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal parameter index: " << aParameter << "." << std::endl;
00159   }
00160 
00161   if( aSubdetector == 0 ) return tecPlusBeamParameters.at( aBeam ).at( aRing ).at( aParameter );
00162   return tecMinusBeamParameters.at( aBeam ).at( aRing ).at( aParameter );
00163 
00164 }
00165 
00166 
00167 
00168 
00169 
00173 void LASEndcapAlignmentParameterSet::Print( void ) {
00174   
00175   std::cout << " [LASEndcapAlignmentParameterSet::Print] -- Listing parameters:" << std::endl;
00176   std::cout << std::endl;
00177   std::cout << "  Disk parameters:" << std::endl;
00178   std:: cout << " ----------------" << std::endl;
00179   for( int det = 0; det < 2; ++det ) {
00180     std::cout << "  " << (det==0 ? "TEC+" : "TEC-") << ":          dPHI \xb1  \bE                 dX \xb1  \bE                 dY \xb1  \bE          (rad/mm): " << std::endl;
00181     for( int disk = 0; disk < 9; ++disk ) {
00182       std::cout << "  disk " << disk << ": ";
00183       for( int par = 0; par < 3; ++par ) std::cout << std::right << std::setw( 11 ) << std::fixed << std::setprecision( 6 ) << GetDiskParameter( det, disk, par ).first 
00184                                                    << " \xb1 " << std::left << std::setw( 9 ) << std::fixed << std::setprecision( 6 ) << GetDiskParameter( det, disk, par ).second;
00185       std::cout << std::endl;
00186     }
00187   }
00188 
00189   for( int det = 0; det < 2; ++det ) {
00190     std::cout << "  " << (det==0 ? "TEC+" : "TEC-") << " global parameters in format: dPhi0\xb1 \be  dPhiT\xb1 \be  dX0\xb1 \be  dXT\xb1 \be  dY0\xb1 \be  dYT\xb1 \be (rad/mm): " << std::endl;
00191     for( int par = 0; par < 6; ++par ) std::cout << std::setw( 11 ) << std::setprecision( 6 ) << std::right << GetGlobalParameter( det, par ).first 
00192                                                  << " \xb1 " << std::setw( 9 ) << std::setprecision( 6 ) << std::left << GetGlobalParameter( det, par ).second;
00193     std::cout << std::endl;
00194   }
00195 
00196   for( int det = 0; det < 2; ++det ) {
00197     std::cout << "  " << (det==0 ? "TEC+" : "TEC-") << " beam parameters in format: dPhi1\xb1 \be dPhi2\xb1 \be (rad): " << std::endl;
00198     for( int ring = 0; ring < 2; ++ring ) {
00199       std::cout << "   ring " << (ring==0?"4":"6") << ": " << std::endl;
00200       for( int beam = 0; beam < 8; ++beam ) {
00201         std::cout << "     beam " << beam << ": ";
00202         for( int par = 0; par < 2; ++par ) std::cout << std::setw( 11 ) << std::setprecision( 6 ) << std::right << GetBeamParameter( det, ring, beam, par ).first 
00203                                                      << " \xb1 " << std::setw( 9 ) << std::setprecision( 6 ) << std::left << GetBeamParameter( det, ring, beam, par ).second;
00204         std::cout << std::endl;
00205       }
00206     }
00207   }
00208 
00209   std::cout << " [LASEndcapAlignmentParameterSet::Print] -- End of list." << std::endl << std::endl;
00210 
00211 }
00212