CMS 3D CMS Logo

AlignPCLThresholds.cc
Go to the documentation of this file.
5 #include <iostream>
6 #include <iomanip> // std::setw
7 
8 //****************************************************************************//
10  m_thresholds[AlignableId] = Threshold;
11 }
12 
13 //****************************************************************************//
15  m_nrecords = Nrecords;
17 }
18 
19 //****************************************************************************//
20 void AlignPCLThresholds::setNRecords(const int &Nrecords) { m_nrecords = Nrecords; }
21 
22 //****************************************************************************//
24  threshold_map::const_iterator it = m_thresholds.find(AlignableId);
25 
26  if (it != m_thresholds.end()) {
27  return it->second;
28  } else {
29  throw cms::Exception("AlignPCLThresholds") << "No Thresholds defined for Alignable id " << AlignableId << "\n";
30  }
31 }
32 
33 //****************************************************************************//
35  return m_thresholds[AlignableId];
36 }
37 
38 float AlignPCLThresholds::getSigCut(const std::string &AlignableId, const coordType &type) const {
40  switch (type) {
41  case X:
42  return a.getSigXcut();
43  case Y:
44  return a.getSigYcut();
45  case Z:
46  return a.getSigZcut();
47  case theta_X:
48  return a.getSigThetaXcut();
49  case theta_Y:
50  return a.getSigThetaYcut();
51  case theta_Z:
52  return a.getSigThetaZcut();
53  default:
54  throw cms::Exception("AlignPCLThresholds")
55  << "Requested significance threshold for undefined coordinate" << type << "\n";
56  }
57 }
58 
59 //****************************************************************************//
60 // overloaded method
61 //****************************************************************************//
62 std::array<float, 6> AlignPCLThresholds::getSigCut(const std::string &AlignableId) const {
64  return {
65  {a.getSigXcut(), a.getSigYcut(), a.getSigZcut(), a.getSigThetaXcut(), a.getSigThetaYcut(), a.getSigThetaZcut()}};
66 }
67 
68 float AlignPCLThresholds::getCut(const std::string &AlignableId, const coordType &type) const {
70  switch (type) {
71  case X:
72  return a.getXcut();
73  case Y:
74  return a.getYcut();
75  case Z:
76  return a.getZcut();
77  case theta_X:
78  return a.getThetaXcut();
79  case theta_Y:
80  return a.getThetaYcut();
81  case theta_Z:
82  return a.getThetaZcut();
83  default:
84  throw cms::Exception("AlignPCLThresholds")
85  << "Requested significance threshold for undefined coordinate" << type << "\n";
86  }
87 }
88 
89 //****************************************************************************//
90 // overloaded method
91 //****************************************************************************//
92 std::array<float, 6> AlignPCLThresholds::getCut(const std::string &AlignableId) const {
94  return {{a.getXcut(), a.getYcut(), a.getZcut(), a.getThetaXcut(), a.getThetaYcut(), a.getThetaZcut()}};
95 }
96 
97 //****************************************************************************//
98 float AlignPCLThresholds::getMaxMoveCut(const std::string &AlignableId, const coordType &type) const {
100  switch (type) {
101  case X:
102  return a.getMaxMoveXcut();
103  case Y:
104  return a.getMaxMoveYcut();
105  case Z:
106  return a.getMaxMoveZcut();
107  case theta_X:
108  return a.getMaxMoveThetaXcut();
109  case theta_Y:
110  return a.getMaxMoveThetaYcut();
111  case theta_Z:
112  return a.getMaxMoveThetaZcut();
113  default:
114  throw cms::Exception("AlignPCLThresholds")
115  << "Requested significance threshold for undefined coordinate" << type << "\n";
116  }
117 }
118 
119 //****************************************************************************//
120 // overloaded method
121 //****************************************************************************//
122 std::array<float, 6> AlignPCLThresholds::getMaxMoveCut(const std::string &AlignableId) const {
124  return {{a.getMaxMoveXcut(),
125  a.getMaxMoveYcut(),
126  a.getMaxMoveZcut(),
127  a.getMaxMoveThetaXcut(),
128  a.getMaxMoveThetaYcut(),
129  a.getMaxMoveThetaZcut()}};
130 }
131 
132 //****************************************************************************//
133 float AlignPCLThresholds::getMaxErrorCut(const std::string &AlignableId, const coordType &type) const {
135  switch (type) {
136  case X:
137  return a.getErrorXcut();
138  case Y:
139  return a.getErrorYcut();
140  case Z:
141  return a.getErrorZcut();
142  case theta_X:
143  return a.getErrorThetaXcut();
144  case theta_Y:
145  return a.getErrorThetaYcut();
146  case theta_Z:
147  return a.getErrorThetaZcut();
148  default:
149  throw cms::Exception("AlignPCLThresholds")
150  << "Requested significance threshold for undefined coordinate" << type << "\n";
151  }
152 }
153 
154 //****************************************************************************//
155 // overloaded method
156 //****************************************************************************//
157 std::array<float, 6> AlignPCLThresholds::getMaxErrorCut(const std::string &AlignableId) const {
159  return {{a.getErrorXcut(),
160  a.getErrorYcut(),
161  a.getErrorZcut(),
162  a.getErrorThetaXcut(),
163  a.getErrorThetaYcut(),
164  a.getErrorThetaZcut()}};
165 }
166 
167 //****************************************************************************//
168 std::array<float, 4> AlignPCLThresholds::getExtraDOFCutsForAlignable(const std::string &AlignableId,
169  const unsigned int i) const {
171  return a.getExtraDOFCuts(i);
172 }
173 
174 //****************************************************************************//
176  const unsigned int i) const {
178  return a.getExtraDOFLabel(i);
179 }
180 
181 //****************************************************************************//
183  edm::LogVerbatim("AlignPCLThresholds") << "AlignPCLThresholds::printAll()";
184  edm::LogVerbatim("AlignPCLThresholds") << " ========================================================================="
185  "==========================================";
186  edm::LogVerbatim("AlignPCLThresholds") << "N records cut: " << this->getNrecords();
187  for (auto it = m_thresholds.begin(); it != m_thresholds.end(); ++it) {
188  edm::LogVerbatim("AlignPCLThresholds") << " ======================================================================="
189  "============================================";
190  edm::LogVerbatim("AlignPCLThresholds")
191  << "key : " << it->first << " \n"
192  << "- Xcut : " << std::setw(4) << (it->second).getXcut() << std::setw(5) << " um"
193  << "| sigXcut : " << std::setw(4) << (it->second).getSigXcut() << std::setw(1) << " "
194  << "| maxMoveXcut : " << std::setw(4) << (it->second).getMaxMoveXcut() << std::setw(5) << " um"
195  << "| ErrorXcut : " << std::setw(4) << (it->second).getErrorXcut() << std::setw(5) << " um\n"
196 
197  << "- thetaXcut : " << std::setw(4) << (it->second).getThetaXcut() << std::setw(5) << " urad"
198  << "| sigThetaXcut : " << std::setw(4) << (it->second).getSigThetaXcut() << std::setw(1) << " "
199  << "| maxMoveThetaXcut : " << std::setw(4) << (it->second).getMaxMoveThetaXcut() << std::setw(5) << " urad"
200  << "| ErrorThetaXcut : " << std::setw(4) << (it->second).getErrorThetaXcut() << std::setw(5) << " urad\n"
201 
202  << "- Ycut : " << std::setw(4) << (it->second).getYcut() << std::setw(5) << " um"
203  << "| sigYcut : " << std::setw(4) << (it->second).getSigXcut() << std::setw(1) << " "
204  << "| maxMoveYcut : " << std::setw(4) << (it->second).getMaxMoveYcut() << std::setw(5) << " um"
205  << "| ErrorYcut : " << std::setw(4) << (it->second).getErrorYcut() << std::setw(5) << " um\n"
206 
207  << "- thetaYcut : " << std::setw(4) << (it->second).getThetaYcut() << std::setw(5) << " urad"
208  << "| sigThetaYcut : " << std::setw(4) << (it->second).getSigThetaYcut() << std::setw(1) << " "
209  << "| maxMoveThetaYcut : " << std::setw(4) << (it->second).getMaxMoveThetaYcut() << std::setw(5) << " urad"
210  << "| ErrorThetaYcut : " << std::setw(4) << (it->second).getErrorThetaYcut() << std::setw(5) << " urad\n"
211 
212  << "- Zcut : " << std::setw(4) << (it->second).getZcut() << std::setw(5) << " um"
213  << "| sigZcut : " << std::setw(4) << (it->second).getSigZcut() << std::setw(1) << " "
214  << "| maxMoveZcut : " << std::setw(4) << (it->second).getMaxMoveZcut() << std::setw(5) << " um"
215  << "| ErrorZcut : " << std::setw(4) << (it->second).getErrorZcut() << std::setw(5) << " um\n"
216 
217  << "- thetaZcut : " << std::setw(4) << (it->second).getThetaZcut() << std::setw(5) << " urad"
218  << "| sigThetaZcut : " << std::setw(4) << (it->second).getSigThetaZcut() << std::setw(1) << " "
219  << "| maxMoveThetaZcut : " << std::setw(4) << (it->second).getMaxMoveThetaZcut() << std::setw(5) << " urad"
220  << "| ErrorThetaZcut : " << std::setw(4) << (it->second).getErrorThetaZcut() << std::setw(5) << " urad";
221 
222  if ((it->second).hasExtraDOF()) {
223  for (unsigned int j = 0; j < (it->second).extraDOFSize(); j++) {
224  std::array<float, 4> extraDOFCuts = getExtraDOFCutsForAlignable(it->first, j);
225 
226  edm::LogVerbatim("AlignPCLThresholds")
227  << "Extra DOF " << j << " with label: " << getExtraDOFLabelForAlignable(it->first, j);
228  edm::LogVerbatim("AlignPCLThresholds")
229  << "- cut : " << std::setw(4) << extraDOFCuts.at(0) << std::setw(5) << " "
230  << "| sigCut : " << std::setw(4) << extraDOFCuts.at(1) << std::setw(1) << " "
231  << "| maxMoveCut : " << std::setw(4) << extraDOFCuts.at(2) << std::setw(5) << " "
232  << "| maxErrorCut : " << std::setw(4) << extraDOFCuts.at(3) << std::setw(5) << " ";
233  }
234  }
235  }
236 }
237 
238 //****************************************************************************//
239 std::vector<std::string> AlignPCLThresholds::getAlignableList() const {
240  std::vector<std::string> alignables_;
241  alignables_.reserve(m_thresholds.size());
242 
243  for (auto it = m_thresholds.begin(); it != m_thresholds.end(); ++it) {
244  alignables_.push_back(it->first);
245  }
246  return alignables_;
247 }
Log< level::Info, true > LogVerbatim
void setAlignPCLThreshold(const std::string &AlignableId, const AlignPCLThreshold &Threshold)
std::string getExtraDOFLabelForAlignable(const std::string &AlignableId, const unsigned int i) const
std::map< std::string, AlignPCLThreshold > threshold_map
float getSigCut(const std::string &AlignableId, const coordType &type) const
float getCut(const std::string &AlignableId, const coordType &type) const
float getMaxMoveCut(const std::string &AlignableId, const coordType &type) const
const int & getNrecords() const
std::array< float, 4 > getExtraDOFCutsForAlignable(const std::string &AlignableId, const unsigned int i) const
float getMaxErrorCut(const std::string &AlignableId, const coordType &type) const
void setNRecords(const int &Nrecords)
threshold_map m_thresholds
void setAlignPCLThresholds(const int &Nrecords, const threshold_map &Thresholds)
double a
Definition: hdecay.h:121
std::vector< std::string > getAlignableList() const
AlignPCLThreshold getAlignPCLThreshold(const std::string &AlignableId) const