118 auto tracker = std::unique_ptr<TrackerGeometry> {
122 std::sort(dets.begin(), dets.end(),
123 [](
const auto&
a,
const auto&
b) {
124 return a->geographicalId().rawId() <
b->geographicalId().rawId();});
130 if (dets.size() != alignments->m_align.size()) {
132 <<
"Size mismatch between alignments (size=" << alignments->m_align.size()
133 <<
") and ideal geometry (size=" << dets.size() <<
")";
138 auto outlierCounter{0};
139 auto ideal = dets.cbegin();
140 const auto& ideal_end = dets.cend();
141 auto misaligned = alignments->
m_align.cbegin();
142 for (; ideal != ideal_end; ++ideal, ++misaligned) {
143 if ((*ideal)->geographicalId().rawId() != misaligned->rawId()) {
145 <<
"Order differs between Dets in alignments ideal geometry.";
149 const auto&
subDetId = (*ideal)->geographicalId().subdetId();
150 auto side =
topology->side((*ideal)->geographicalId());
157 side =
topology->tibSide((*ideal)->geographicalId());
160 side =
topology->tobSide((*ideal)->geographicalId());
173 auto x_diff = misaligned->translation().x() - (*ideal)->position().x();
174 auto y_diff = misaligned->translation().y() - (*ideal)->position().y();
175 auto z_diff = misaligned->translation().z() - (*ideal)->position().z();
177 auto xx_diff = misaligned->rotation().xx() - (*ideal)->rotation().xx();
178 auto xy_diff = misaligned->rotation().xy() - (*ideal)->rotation().xy();
179 auto xz_diff = misaligned->rotation().xz() - (*ideal)->rotation().xz();
180 auto yx_diff = misaligned->rotation().yx() - (*ideal)->rotation().yx();
181 auto yy_diff = misaligned->rotation().yy() - (*ideal)->rotation().yy();
182 auto yz_diff = misaligned->rotation().yz() - (*ideal)->rotation().yz();
183 auto zx_diff = misaligned->rotation().zx() - (*ideal)->rotation().zx();
184 auto zy_diff = misaligned->rotation().zy() - (*ideal)->rotation().zy();
185 auto zz_diff = misaligned->rotation().zz() - (*ideal)->rotation().zz();
188 (x_diff*x_diff + y_diff*y_diff + z_diff*z_diff)
192 << outlierCounter <<
") Outlier found in subdetector " <<
subDetId 193 <<
": delta x: " << x_diff
194 <<
", delta y: " << y_diff
195 <<
", delta z: " << z_diff
196 <<
", delta xx: " << xx_diff
197 <<
", delta xy: " << xy_diff
198 <<
", delta xz: " << xz_diff
199 <<
", delta yx: " << yx_diff
200 <<
", delta yx: " << yy_diff
201 <<
", delta yy: " << yz_diff
202 <<
", delta zz: " << zx_diff
203 <<
", delta zy: " << zy_diff
204 <<
", delta zz: " << zz_diff
231 misaligned->
rawId()};
232 rescaledAlignments.m_align.emplace_back(
std::move(rescaledTransform));
238 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
241 <<
"Writing rescaled tracker-alignment record.";
243 poolDb->
writeOne(&rescaledAlignments,
since,
"TrackerAlignmentRcd");
const TimeTypeSpecs timeTypeSpecs[]
CaloTopology const * topology(0)
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
std::vector< AlignTransform > m_align
const double outlierPullToIdealCut_
unsigned int subDetId[21]
bool IsModuleBad(const uint32_t &detid) const
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
bool IsModuleBad(const uint32_t &detid) const
const bool pullBadModulesToIdeal_
T const * product() const