Back to home page

Project CMSSW displayed by LXR

 
 

    


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 /// Returns one beamsplitter kink, parameters are:
0038 /// det  (0=TEC+/1=TEC-)
0039 /// ring (0=R4/1=R6)
0040 /// beam (0..7)
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))) {  // beam >= 0, since beam is unsigned
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 /// Returns beamplitter kink for alignment tube beam <beam> (0..7)
0053 ///
0054 double LASConstants::GetAlignmentTubeBsKink(unsigned int beam) const {
0055   if (beam >= 8U) {  // beam >= 0, since beam is unsigned
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) {  // ring >= 0, since ring is unsigned
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);  // tec+
0090   else
0091     return -1. * tecZPositions.at(disk);  // tec-
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   // beam splitter kinks
0133 
0134   endcapBsKinks.resize(2);  // create two dets
0135   for (int det = 0; det < 2; ++det) {
0136     endcapBsKinks.at(det).resize(2);  // create two rings per det
0137     for (int ring = 0; ring < 2; ++ring) {
0138       endcapBsKinks.at(det).at(ring).resize(8);  // 8 beams per ring
0139     }
0140   }
0141 
0142   alignmentTubeBsKinks.resize(8);  // 8 beams
0143 
0144   // radii
0145   tecRadii.resize(2);
0146 
0147   // z positions
0148   tecZPositions.resize(9);
0149   tibZPositions.resize(6);
0150   tobZPositions.resize(6);
0151 }
0152 
0153 ///
0154 /// fill the beamplitter-kink related containers
0155 ///
0156 void LASConstants::FillBsKinks(edm::ParameterSet const& theBsKinkConf) {
0157   // tec+
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   // apply global offsets
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   // tec-
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   // apply global offsets
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   // at
0180   alignmentTubeBsKinks = theBsKinkConf.getParameter<std::vector<double> >("LASAlignmentTubeBsKinks");
0181 }
0182 
0183 ///
0184 /// fill the beam radii
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 }