113 auto tracker = std::unique_ptr<TrackerGeometry>{trackerBuilder.
build(&(*geometricDet), *ptp,
topology)};
116 std::sort(dets.begin(), dets.end(), [](
const auto&
a,
const auto&
b) {
117 return a->geographicalId().rawId() <
b->geographicalId().rawId();
124 if (dets.size() != alignments->m_align.size()) {
125 throw cms::Exception(
"GeometryMismatch") <<
"Size mismatch between alignments (size=" << alignments->m_align.size()
126 <<
") and ideal geometry (size=" << dets.size() <<
")";
131 auto outlierCounter{0};
132 auto ideal = dets.cbegin();
133 const auto& ideal_end = dets.cend();
134 auto misaligned = alignments->
m_align.cbegin();
135 for (; ideal != ideal_end; ++ideal, ++misaligned) {
136 if ((*ideal)->geographicalId().rawId() != misaligned->rawId()) {
137 throw cms::Exception(
"GeometryMismatch") <<
"Order differs between Dets in alignments ideal geometry.";
141 const auto&
subDetId = (*ideal)->geographicalId().subdetId();
142 auto side =
topology->side((*ideal)->geographicalId());
149 side =
topology->tibSide((*ideal)->geographicalId());
152 side =
topology->tobSide((*ideal)->geographicalId());
165 auto x_diff = misaligned->translation().x() - (*ideal)->position().x();
166 auto y_diff = misaligned->translation().y() - (*ideal)->position().y();
167 auto z_diff = misaligned->translation().z() - (*ideal)->position().z();
169 auto xx_diff = misaligned->rotation().xx() - (*ideal)->rotation().xx();
170 auto xy_diff = misaligned->rotation().xy() - (*ideal)->rotation().xy();
171 auto xz_diff = misaligned->rotation().xz() - (*ideal)->rotation().xz();
172 auto yx_diff = misaligned->rotation().yx() - (*ideal)->rotation().yx();
173 auto yy_diff = misaligned->rotation().yy() - (*ideal)->rotation().yy();
174 auto yz_diff = misaligned->rotation().yz() - (*ideal)->rotation().yz();
175 auto zx_diff = misaligned->rotation().zx() - (*ideal)->rotation().zx();
176 auto zy_diff = misaligned->rotation().zy() - (*ideal)->rotation().zy();
177 auto zz_diff = misaligned->rotation().zz() - (*ideal)->rotation().zz();
183 <<
": delta x: " << x_diff <<
", delta y: " << y_diff <<
", delta z: " << z_diff
184 <<
", delta xx: " << xx_diff <<
", delta xy: " << xy_diff
185 <<
", delta xz: " << xz_diff <<
", delta yx: " << yx_diff
186 <<
", delta yx: " << yy_diff <<
", delta yy: " << yz_diff
187 <<
", delta zz: " << zx_diff <<
", delta zy: " << zy_diff
188 <<
", delta zz: " << zz_diff <<
"\n";
197 CLHEP::HepRep3x3{(*ideal)->rotation().xx() +
scaleFactor * xx_diff,
205 (*ideal)->rotation().zz() +
scaleFactor * zz_diff}};
207 const AlignTransform rescaledTransform{rescaledTranslation, rescaledRotation, misaligned->
rawId()};
208 rescaledAlignments.m_align.emplace_back(
std::move(rescaledTransform));
214 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
216 edm::LogInfo(
"Alignment") <<
"Writing rescaled tracker-alignment record.";
218 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)
static constexpr auto TOB
bool IsModuleBad(const uint32_t &detid) const
static constexpr auto TIB
const bool pullBadModulesToIdeal_
T const * product() const