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