64 #include "CLHEP/Vector/RotationInterfaces.h"
78 static std::vector<GeomDetEnumerators::SubDetector>
98 std::vector<GeomDetEnumerators::SubDetector>
subDets_;
106 skipSubDetectors_(toSubDetectors(iConfig.getUntrackedParameter<std::vector<std::
string> >(
"skipSubDetectors"))),
107 alignToGlobalTag_(iConfig.getUntrackedParameter<bool>(
"alignToGlobalTag")),
108 createReferenceRcd_(iConfig.getUntrackedParameter<bool>(
"createReferenceRcd")),
132 std::sort(dets.begin(), dets.end(),
133 [](
const auto&
a,
const auto&
b) {
134 return a->geographicalId().rawId() <
b->geographicalId().rawId();});
197 std::vector<GeomDetEnumerators::SubDetector>
200 std::vector<GeomDetEnumerators::SubDetector>
result;
201 for (
const auto& sub: subs) result.emplace_back(
toSubDetector(sub));
216 std::unique_ptr<TrackerGeometry>
227 const auto*
const tTopo = tTopoHandle.
product();
231 return std::unique_ptr<TrackerGeometry> {
232 trackerBuilder.
build(&(*geometricDet), *ptp, tTopo )};
254 CLHEP::HepRep3x3(
rot.xx(),
rot.xy(),
rot.xz(),
257 const auto& eulerAngles = rotation.eulerAngles();
259 <<
"============================================================\n"
260 <<
"subdetector: " << subDetector <<
"\n"
261 <<
"detId: " << detId <<
"\n"
262 <<
"------------------------------------------------------------\n"
263 <<
" x: " << pos.x() <<
"\n"
264 <<
" y: " << pos.y() <<
"\n"
265 <<
" z: " << pos.z() <<
"\n"
266 <<
" phi: " << eulerAngles.phi() <<
"\n"
267 <<
" theta: " << eulerAngles.theta() <<
"\n"
268 <<
" psi: " << eulerAngles.psi() <<
"\n"
269 <<
"============================================================\n";
282 LogDebug(
"Alignment") <<
"Aligning to global tag\n";
291 if (alignments->m_align.size() != alignmentErrors->m_alignError.size())
293 <<
"Size mismatch between alignments (size=" << alignments->m_align.size()
294 <<
") and alignment errors (size=" << alignmentErrors->m_alignError.size()
297 std::vector<uint32_t> commonIDs;
298 auto itAlignErr = alignmentErrors->m_alignError.cbegin();
299 for (
auto itAlign = alignments->m_align.cbegin();
300 itAlign != alignments->m_align.cend();
301 ++itAlign, ++itAlignErr) {
302 const auto id = itAlign->rawId();
305 if (
id != itAlignErr->rawId())
307 <<
"DetId mismatch between alignments (rawId=" <<
id
308 <<
") and alignment errors (rawId=" << itAlignErr->rawId() <<
")";
318 <<
"DetId mismatch between alignments (rawId="
320 <<
") and alignment errors (rawId="
324 <<
"============================================================\n"
333 <<
"============================================================\n";
336 commonIDs.push_back(
id);
338 <<
"============================================================\n"
347 <<
"============================================================\n";
357 for (
const auto&
id: commonIDs) {
359 auto item = std::find_if(surfaceDeformations->items().cbegin(),
360 surfaceDeformations->items().cend(),
361 [&id](
const auto&
i) {
return i.m_rawId == id; });
362 if (item == surfaceDeformations->items().cend())
continue;
366 const auto beginEndPair = surfaceDeformations->parameters(
index);
367 std::vector<align::Scalar> params(beginEndPair.first, beginEndPair.second);
369 item->m_parametrizationType,
382 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
386 <<
"Writing ideal tracker-alignment records.";
398 desc.
setComment(
"Creates ideal TrackerAlignmentRcd and TrackerAlignmentErrorExtendedRcd "
399 "from the loaded tracker geometry. "
400 "PoolDBOutputService must be set up for these records.");
402 desc.
addUntracked<std::vector<std::string> >(
"skipSubDetectors",
403 std::vector<std::string>{});
405 descriptions.
add(
"createIdealTkAlRecords", desc);
std::unique_ptr< TrackerGeometry > retrieveGeometry(const edm::EventSetup &)
const TimeTypeSpecs timeTypeSpecs[]
std::vector< uint32_t > rawIDs_
void addAlignmentInfo(const GeomDet &)
static std::string toString(const GeomDetEnumerators::SubDetector &)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
AlignmentErrorsExtended alignmentErrors_
AlignmentSurfaceDeformations alignmentSurfaceDeformations_
std::vector< GeomDetEnumerators::SubDetector > subDets_
const Surface::RotationType & rotation() const
The rotation defining the local R.F.
#define DEFINE_FWK_MODULE(type)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
void clear()
Clear vector without having to look into internals:
const bool createReferenceRcd_
CreateIdealTkAlRecords(const edm::ParameterSet &)
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
static std::vector< GeomDetEnumerators::SubDetector > toSubDetectors(const std::vector< std::string > &subs)
void alignToGT(const edm::EventSetup &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< AlignTransform > m_align
const std::vector< GeomDetEnumerators::SubDetector > skipSubDetectors_
uint32_t rawId() const
get the raw id
void setComment(std::string const &value)
const Surface::PositionType & position() const
The position (origin of the R.F.)
DetId geographicalId() const
The label of this GeomDet.
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
~CreateIdealTkAlRecords()
void clearAlignmentInfos()
static GeomDetEnumerators::SubDetector toSubDetector(const std::string &sub)
std::vector< AlignTransformErrorExtended > m_alignError
T const * product() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const bool alignToGlobalTag_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual SubDetector subDetector() const
Which subdetector.
void clear()
Clear vector without having to look into internals: