CMS 3D CMS Logo

LASBarrelAlignmentParameterSet.cc
Go to the documentation of this file.
1 
3 
8 
13  // could use a single vector<vector<vector<pair<> > > >
14  // but better split it in 6 parts
15  for (int i = 0; i < 2; ++i) { // twice; once for each endface
16  tecPlusParameters.push_back(std::vector<std::pair<double, double> >(3));
17  tecMinusParameters.push_back(std::vector<std::pair<double, double> >(3));
18  tibPlusParameters.push_back(std::vector<std::pair<double, double> >(3));
19  tibMinusParameters.push_back(std::vector<std::pair<double, double> >(3));
20  tobPlusParameters.push_back(std::vector<std::pair<double, double> >(3));
21  tobMinusParameters.push_back(std::vector<std::pair<double, double> >(3));
22  }
23 
24  // the beam parameters (8 beams * 2 pars) are stored in one single container
25  for (int i = 0; i < 8; ++i) {
26  beamParameters.push_back(std::vector<std::pair<double, double> >(2));
27  }
28 }
29 
37 std::pair<double, double>& LASBarrelAlignmentParameterSet::GetParameter(int aSubdetector, int aDisk, int aParameter) {
38  if (aSubdetector < 0 || aSubdetector > 5) {
39  throw cms::Exception("Laser Alignment")
40  << " [LASBarrelAlignmentParameterSet::GetParameter] ERROR ** Illegal subdetector index: " << aSubdetector << "."
41  << std::endl;
42  }
43 
44  if (aDisk < 0 || aDisk > 1) {
45  throw cms::Exception("Laser Alignment")
46  << " [LASBarrelAlignmentParameterSet::GetParameter] ERROR ** Illegal endface index: " << aDisk << "."
47  << std::endl;
48  }
49 
50  if (aParameter < 0 || aParameter > 2) {
51  throw cms::Exception("Laser Alignment")
52  << " [LASBarrelAlignmentParameterSet::GetParameter] ERROR ** Illegal parameter index: " << aParameter << "."
53  << std::endl;
54  }
55 
56  // would use a switch here, but this creates problems..
57  if (aSubdetector == 0)
58  return tecPlusParameters.at(aDisk).at(aParameter);
59  else if (aSubdetector == 1)
60  return tecMinusParameters.at(aDisk).at(aParameter);
61  else if (aSubdetector == 2)
62  return tibPlusParameters.at(aDisk).at(aParameter);
63  else if (aSubdetector == 3)
64  return tibMinusParameters.at(aDisk).at(aParameter);
65  else if (aSubdetector == 4)
66  return tobPlusParameters.at(aDisk).at(aParameter);
67  else
68  return tobMinusParameters.at(aDisk).at(aParameter);
69 }
70 
75 std::pair<double, double>& LASBarrelAlignmentParameterSet::GetBeamParameter(int aBeam, int aParameter) {
76  if (aBeam < 0 || aBeam > 7) {
77  throw cms::Exception("Laser Alignment")
78  << " [LASBarrelAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal beam index: " << aBeam << "."
79  << std::endl;
80  }
81 
82  if (aParameter < 0 || aParameter > 1) {
83  throw cms::Exception("Laser Alignment")
84  << " [LASBarrelAlignmentParameterSet::GetBeamParameter] ERROR ** Illegal beam parameter index: " << aParameter
85  << "." << std::endl;
86  }
87 
88  return beamParameters.at(aBeam).at(aParameter);
89 }
90 
95  std::cout << std::endl << " [LASBarrelAlignmentParameterSet::Print] -- Parameter list [rad/mm]: " << std::endl;
96 
97  const std::string subdetNames[6] = {" TEC+ ", " TEC- ", " TIB+ ", " TIB- ", " TOB+ ", " TOB- "};
98 
99  std::cout << " Detector parameters: " << std::endl;
100  std::cout << " --------------------" << std::endl;
101  std::cout << " Values: PHI1 X1 Y1 PHI2 X2 Y2 " << std::endl;
102  for (int subdet = 0; subdet < 6; ++subdet) {
103  std::cout << subdetNames[subdet];
104  for (int par = 0; par < 3; ++par)
105  std::cout << std::right << std::setw(12) << std::setprecision(6) << std::fixed
106  << GetParameter(subdet, 0, par).first;
107  for (int par = 0; par < 3; ++par)
108  std::cout << std::right << std::setw(12) << std::setprecision(6) << std::fixed
109  << GetParameter(subdet, 1, par).first;
110  std::cout << std::endl;
111  }
112 
113  std::cout << " Errors: PHI1 X1 Y1 PHI2 X2 Y2 " << std::endl;
114  for (int subdet = 0; subdet < 6; ++subdet) {
115  std::cout << subdetNames[subdet];
116  for (int par = 0; par < 3; ++par)
117  std::cout << std::right << std::setw(12) << std::setprecision(6) << std::fixed
118  << GetParameter(subdet, 0, par).second;
119  for (int par = 0; par < 3; ++par)
120  std::cout << std::right << std::setw(12) << std::setprecision(6) << std::fixed
121  << GetParameter(subdet, 1, par).second;
122  std::cout << std::endl;
123  }
124 
125  std::cout << std::endl;
126  std::cout << " Beam parameters: " << std::endl;
127  std::cout << " ----------------" << std::endl;
128  std::cout << " Values: PHI1 PHI2" << std::endl;
129  for (int beam = 0; beam < 8; ++beam) {
130  std::cout << " beam " << beam;
131  for (int par = 0; par < 2; ++par)
132  std::cout << std::right << std::setw(12) << std::setprecision(6) << std::fixed
133  << GetBeamParameter(beam, par).first;
134  std::cout << std::endl;
135  }
136 
137  std::cout << " Errors: PHI1 PHI2" << std::endl;
138  for (int beam = 0; beam < 8; ++beam) {
139  std::cout << " beam " << beam;
140  for (int par = 0; par < 2; ++par)
141  std::cout << std::right << std::setw(12) << std::setprecision(6) << std::fixed
142  << GetBeamParameter(beam, par).second;
143  std::cout << std::endl;
144  }
145 
146  std::cout << " [LASBarrelAlignmentParameterSet::Print] -- End parameter list." << std::endl;
147 }
std::pair< double, double > & GetParameter(int aSubdetector, int aDisk, int aParameter)
std::vector< std::vector< std::pair< double, double > > > beamParameters
std::vector< std::vector< std::pair< double, double > > > tobPlusParameters
std::vector< std::vector< std::pair< double, double > > > tecMinusParameters
std::vector< std::vector< std::pair< double, double > > > tibPlusParameters
std::vector< std::vector< std::pair< double, double > > > tecPlusParameters
std::pair< double, double > & GetBeamParameter(int aBeam, int aParameter)
std::vector< std::vector< std::pair< double, double > > > tobMinusParameters
std::vector< std::vector< std::pair< double, double > > > tibMinusParameters
static const char * subdetNames[]