00001 00002 00003 #include "Alignment/LaserAlignment/interface/LASConstants.h" 00004 #include "FWCore/Utilities/interface/Exception.h" 00005 00009 LASConstants::LASConstants() : 00010 atRadius(0.), tecBsZPosition(0.), atZPosition(0.) 00011 { 00012 } 00013 00014 00015 00016 00017 00021 LASConstants::LASConstants( std::vector<edm::ParameterSet> const& theConstConf ) { 00022 00023 InitContainers(); 00024 00025 for( std::vector<edm::ParameterSet>::const_iterator iter = theConstConf.begin(); iter < theConstConf.end(); ++iter ) { 00026 00027 if( iter->getParameter<std::string>( "PSetName" ) == "BeamsplitterKinks" ) FillBsKinks( *iter ); 00028 else if( iter->getParameter<std::string>( "PSetName" ) == "Radii" ) FillRadii( *iter ); 00029 else if( iter->getParameter<std::string>( "PSetName" ) == "ZPositions" ) FillZPositions( *iter ); 00030 else { 00031 std::cerr << " [] ** WARNING: Cannot process unknown parameter set named: " << iter->getParameter<std::string>( "PSetName" ) << "." << std::endl; 00032 } 00033 00034 } 00035 00036 } 00037 00038 00039 00040 00041 00045 LASConstants::~LASConstants() { 00046 } 00047 00048 00049 00050 00051 00058 double LASConstants::GetEndcapBsKink( unsigned int det, unsigned int ring , unsigned int beam ) const { 00059 00060 if( ! ( ( det == 0 || det == 1 ) && ( ring == 0 || ring == 1 ) && ( beam < 8U ) ) ) { // beam >= 0, since beam is unsigned 00061 throw cms::Exception( " [LASConstants::GetEndcapBsKink]" ) << " ** ERROR: no such element: det " << det << ", ring " << ring << ", beam " << beam << "." << std::endl; 00062 } 00063 00064 return endcapBsKinks.at( det ).at( ring ).at( beam ); 00065 00066 } 00067 00068 00069 00070 00071 00075 double LASConstants::GetAlignmentTubeBsKink( unsigned int beam ) const { 00076 00077 if( beam >= 8U ) { // beam >= 0, since beam is unsigned 00078 throw cms::Exception( " [LASConstants::GetAlignmentTubeBsKink]" ) << " ** ERROR: no such beam: " << beam << "." << std::endl; 00079 } 00080 00081 return alignmentTubeBsKinks.at( beam ); 00082 00083 } 00084 00085 00086 00087 00088 00092 double LASConstants::GetTecRadius( unsigned int ring ) const { 00093 00094 if( ring > 1U ) { // ring >= 0, since ring is unsigned 00095 throw cms::Exception( " [LASConstants::GetTecRadius]" ) << " ** ERROR: no such ring: " << ring << "." << std::endl; 00096 } 00097 00098 return tecRadii.at( ring ); 00099 00100 } 00101 00102 00103 00104 00105 00109 double LASConstants::GetAtRadius( void ) const { 00110 00111 return atRadius; 00112 00113 } 00114 00115 00116 00117 00118 00122 double LASConstants::GetTecZPosition( unsigned int det, unsigned int disk ) const { 00123 00124 if( ( det > 1 ) || ( disk > 8 ) ) { 00125 throw cms::Exception( " [LASConstants::GetTecZPosition]" ) << " ** ERROR: no such element: det " << det << ", disk " << disk << "." << std::endl; 00126 } 00127 00128 if( det == 0 ) return tecZPositions.at( disk ); // tec+ 00129 else return -1. * tecZPositions.at( disk ); // tec- 00130 00131 } 00132 00133 00134 00135 00136 00140 double LASConstants::GetTibZPosition( unsigned int pos ) const { 00141 00142 if( pos > 5 ) { 00143 throw cms::Exception( " [LASConstants::GetTibZPosition]" ) << " ** ERROR: no such position: " << pos << "." << std::endl; 00144 } 00145 00146 return tibZPositions.at( pos ); 00147 00148 } 00149 00150 00151 00152 00153 00157 double LASConstants::GetTobZPosition( unsigned int pos ) const { 00158 00159 if( pos > 5 ) { 00160 throw cms::Exception( " [LASConstants::GetTobZPosition]" ) << " ** ERROR: no such position: " << pos << "." << std::endl; 00161 } 00162 00163 return tobZPositions.at( pos ); 00164 00165 } 00166 00167 00168 00169 00170 00174 double LASConstants::GetTecBsZPosition( unsigned int det ) const { 00175 00176 return tecBsZPosition; 00177 00178 } 00179 00180 00181 00182 00183 00187 double LASConstants::GetAtBsZPosition( void ) const { 00188 00189 return atZPosition; 00190 00191 } 00192 00193 00194 00195 00196 00200 void LASConstants::InitContainers( void ) { 00201 00202 // beam splitter kinks 00203 00204 endcapBsKinks.resize( 2 ); // create two dets 00205 for( int det = 0; det < 2; ++det ) { 00206 endcapBsKinks.at( det ).resize( 2 ); // create two rings per det 00207 for( int ring = 0; ring < 2; ++ring ) { 00208 endcapBsKinks.at( det ).at( ring ).resize( 8 ); // 8 beams per ring 00209 } 00210 } 00211 00212 alignmentTubeBsKinks.resize( 8 ); // 8 beams 00213 00214 00215 // radii 00216 tecRadii.resize( 2 ); 00217 00218 // z positions 00219 tecZPositions.resize( 9 ); 00220 tibZPositions.resize( 6 ); 00221 tobZPositions.resize( 6 ); 00222 00223 } 00224 00225 00226 00227 00228 00232 void LASConstants::FillBsKinks( edm::ParameterSet const& theBsKinkConf ) { 00233 00234 // tec+ 00235 endcapBsKinks.at( 0 ).at( 0 ) = theBsKinkConf.getParameter<std::vector<double> >( "LASTecPlusRing4BsKinks" ); 00236 endcapBsKinks.at( 0 ).at( 1 ) = theBsKinkConf.getParameter<std::vector<double> >( "LASTecPlusRing6BsKinks" ); 00237 00238 // apply global offsets 00239 for( unsigned int ring = 0; ring < 2; ++ring ) { 00240 for( unsigned int beam = 0; beam < 8; ++beam ) { 00241 endcapBsKinks.at( 0 ).at( ring ).at( beam ) += theBsKinkConf.getParameter<double>( "TecPlusGlobalOffset" ); 00242 } 00243 } 00244 00245 // tec- 00246 endcapBsKinks.at( 1 ).at( 0 ) = theBsKinkConf.getParameter<std::vector<double> >( "LASTecMinusRing4BsKinks" ); 00247 endcapBsKinks.at( 1 ).at( 1 ) = theBsKinkConf.getParameter<std::vector<double> >( "LASTecMinusRing6BsKinks" ); 00248 00249 // apply global offsets 00250 for( unsigned int ring = 0; ring < 2; ++ring ) { 00251 for( unsigned int beam = 0; beam < 8; ++beam ) { 00252 endcapBsKinks.at( 1 ).at( ring ).at( beam ) += theBsKinkConf.getParameter<double>( "TecMinusGlobalOffset" ); 00253 } 00254 } 00255 00256 // at 00257 alignmentTubeBsKinks = theBsKinkConf.getParameter<std::vector<double> >( "LASAlignmentTubeBsKinks" ); 00258 00259 } 00260 00261 00262 00263 00264 00268 void LASConstants::FillRadii( edm::ParameterSet const& theRadiiConf ) { 00269 00270 tecRadii = theRadiiConf.getParameter<std::vector<double> >( "LASTecRadius" ); 00271 atRadius = theRadiiConf.getParameter<double>( "LASAtRadius" ); 00272 00273 } 00274 00275 00276 00277 00278 00282 void LASConstants::FillZPositions( edm::ParameterSet const& theZPosConf ) { 00283 00284 tecZPositions = theZPosConf.getParameter<std::vector<double> >( "LASTecZPositions" ); 00285 tibZPositions = theZPosConf.getParameter<std::vector<double> >( "LASTibZPositions" ); 00286 tobZPositions = theZPosConf.getParameter<std::vector<double> >( "LASTobZPositions" ); 00287 tecBsZPosition = theZPosConf.getParameter<double>( "LASTecBeamSplitterZPosition" ); 00288 atZPosition = theZPosConf.getParameter<double>( "LASAtBeamsplitterZPosition" ); 00289 00290 }