File indexing completed on 2024-04-06 11:56:26
0001
0002
0003 #include "Alignment/LaserAlignment/interface/LASConstants.h"
0004 #include "FWCore/Utilities/interface/Exception.h"
0005
0006
0007
0008
0009 LASConstants::LASConstants() : atRadius(0.), tecBsZPosition(0.), atZPosition(0.) {}
0010
0011
0012
0013
0014 LASConstants::LASConstants(std::vector<edm::ParameterSet> const& theConstConf) {
0015 InitContainers();
0016
0017 for (std::vector<edm::ParameterSet>::const_iterator iter = theConstConf.begin(); iter < theConstConf.end(); ++iter) {
0018 if (iter->getParameter<std::string>("PSetName") == "BeamsplitterKinks")
0019 FillBsKinks(*iter);
0020 else if (iter->getParameter<std::string>("PSetName") == "Radii")
0021 FillRadii(*iter);
0022 else if (iter->getParameter<std::string>("PSetName") == "ZPositions")
0023 FillZPositions(*iter);
0024 else {
0025 std::cerr << " [] ** WARNING: Cannot process unknown parameter set named: "
0026 << iter->getParameter<std::string>("PSetName") << "." << std::endl;
0027 }
0028 }
0029 }
0030
0031
0032
0033
0034 LASConstants::~LASConstants() {}
0035
0036
0037
0038
0039
0040
0041
0042 double LASConstants::GetEndcapBsKink(unsigned int det, unsigned int ring, unsigned int beam) const {
0043 if (!((det == 0 || det == 1) && (ring == 0 || ring == 1) && (beam < 8U))) {
0044 throw cms::Exception(" [LASConstants::GetEndcapBsKink]")
0045 << " ** ERROR: no such element: det " << det << ", ring " << ring << ", beam " << beam << "." << std::endl;
0046 }
0047
0048 return endcapBsKinks.at(det).at(ring).at(beam);
0049 }
0050
0051
0052
0053
0054 double LASConstants::GetAlignmentTubeBsKink(unsigned int beam) const {
0055 if (beam >= 8U) {
0056 throw cms::Exception(" [LASConstants::GetAlignmentTubeBsKink]")
0057 << " ** ERROR: no such beam: " << beam << "." << std::endl;
0058 }
0059
0060 return alignmentTubeBsKinks.at(beam);
0061 }
0062
0063
0064
0065
0066 double LASConstants::GetTecRadius(unsigned int ring) const {
0067 if (ring > 1U) {
0068 throw cms::Exception(" [LASConstants::GetTecRadius]") << " ** ERROR: no such ring: " << ring << "." << std::endl;
0069 }
0070
0071 return tecRadii.at(ring);
0072 }
0073
0074
0075
0076
0077 double LASConstants::GetAtRadius(void) const { return atRadius; }
0078
0079
0080
0081
0082 double LASConstants::GetTecZPosition(unsigned int det, unsigned int disk) const {
0083 if ((det > 1) || (disk > 8)) {
0084 throw cms::Exception(" [LASConstants::GetTecZPosition]")
0085 << " ** ERROR: no such element: det " << det << ", disk " << disk << "." << std::endl;
0086 }
0087
0088 if (det == 0)
0089 return tecZPositions.at(disk);
0090 else
0091 return -1. * tecZPositions.at(disk);
0092 }
0093
0094
0095
0096
0097 double LASConstants::GetTibZPosition(unsigned int pos) const {
0098 if (pos > 5) {
0099 throw cms::Exception(" [LASConstants::GetTibZPosition]")
0100 << " ** ERROR: no such position: " << pos << "." << std::endl;
0101 }
0102
0103 return tibZPositions.at(pos);
0104 }
0105
0106
0107
0108
0109 double LASConstants::GetTobZPosition(unsigned int pos) const {
0110 if (pos > 5) {
0111 throw cms::Exception(" [LASConstants::GetTobZPosition]")
0112 << " ** ERROR: no such position: " << pos << "." << std::endl;
0113 }
0114
0115 return tobZPositions.at(pos);
0116 }
0117
0118
0119
0120
0121 double LASConstants::GetTecBsZPosition(unsigned int det) const { return tecBsZPosition; }
0122
0123
0124
0125
0126 double LASConstants::GetAtBsZPosition(void) const { return atZPosition; }
0127
0128
0129
0130
0131 void LASConstants::InitContainers(void) {
0132
0133
0134 endcapBsKinks.resize(2);
0135 for (int det = 0; det < 2; ++det) {
0136 endcapBsKinks.at(det).resize(2);
0137 for (int ring = 0; ring < 2; ++ring) {
0138 endcapBsKinks.at(det).at(ring).resize(8);
0139 }
0140 }
0141
0142 alignmentTubeBsKinks.resize(8);
0143
0144
0145 tecRadii.resize(2);
0146
0147
0148 tecZPositions.resize(9);
0149 tibZPositions.resize(6);
0150 tobZPositions.resize(6);
0151 }
0152
0153
0154
0155
0156 void LASConstants::FillBsKinks(edm::ParameterSet const& theBsKinkConf) {
0157
0158 endcapBsKinks.at(0).at(0) = theBsKinkConf.getParameter<std::vector<double> >("LASTecPlusRing4BsKinks");
0159 endcapBsKinks.at(0).at(1) = theBsKinkConf.getParameter<std::vector<double> >("LASTecPlusRing6BsKinks");
0160
0161
0162 for (unsigned int ring = 0; ring < 2; ++ring) {
0163 for (unsigned int beam = 0; beam < 8; ++beam) {
0164 endcapBsKinks.at(0).at(ring).at(beam) += theBsKinkConf.getParameter<double>("TecPlusGlobalOffset");
0165 }
0166 }
0167
0168
0169 endcapBsKinks.at(1).at(0) = theBsKinkConf.getParameter<std::vector<double> >("LASTecMinusRing4BsKinks");
0170 endcapBsKinks.at(1).at(1) = theBsKinkConf.getParameter<std::vector<double> >("LASTecMinusRing6BsKinks");
0171
0172
0173 for (unsigned int ring = 0; ring < 2; ++ring) {
0174 for (unsigned int beam = 0; beam < 8; ++beam) {
0175 endcapBsKinks.at(1).at(ring).at(beam) += theBsKinkConf.getParameter<double>("TecMinusGlobalOffset");
0176 }
0177 }
0178
0179
0180 alignmentTubeBsKinks = theBsKinkConf.getParameter<std::vector<double> >("LASAlignmentTubeBsKinks");
0181 }
0182
0183
0184
0185
0186 void LASConstants::FillRadii(edm::ParameterSet const& theRadiiConf) {
0187 tecRadii = theRadiiConf.getParameter<std::vector<double> >("LASTecRadius");
0188 atRadius = theRadiiConf.getParameter<double>("LASAtRadius");
0189 }
0190
0191
0192
0193
0194 void LASConstants::FillZPositions(edm::ParameterSet const& theZPosConf) {
0195 tecZPositions = theZPosConf.getParameter<std::vector<double> >("LASTecZPositions");
0196 tibZPositions = theZPosConf.getParameter<std::vector<double> >("LASTibZPositions");
0197 tobZPositions = theZPosConf.getParameter<std::vector<double> >("LASTobZPositions");
0198 tecBsZPosition = theZPosConf.getParameter<double>("LASTecBeamSplitterZPosition");
0199 atZPosition = theZPosConf.getParameter<double>("LASAtBeamsplitterZPosition");
0200 }