65 #include "CLHEP/Vector/RotationInterfaces.h"
79 static std::vector<GeomDetEnumerators::SubDetector>
toSubDetectors(
const std::vector<std::string>& subs);
106 std::vector<GeomDetEnumerators::SubDetector>
subDets_;
120 skipSubDetectors_(toSubDetectors(iConfig.getUntrackedParameter<std::
vector<std::
string> >(
"skipSubDetectors"))),
121 alignToGlobalTag_(iConfig.getUntrackedParameter<bool>(
"alignToGlobalTag")),
122 createReferenceRcd_(iConfig.getUntrackedParameter<bool>(
"createReferenceRcd")),
137 auto dets = tracker->dets();
138 std::sort(dets.begin(), dets.end(), [](
const auto&
a,
const auto&
b) {
139 return a->geographicalId().rawId() <
b->geographicalId().rawId();
142 for (
const auto& det : dets)
154 return "PixelBarrel";
156 return "PixelEndcap";
197 if (sub ==
"PixelBarrel")
199 else if (sub ==
"PixelEndcap")
201 else if (sub ==
"TIB")
203 else if (sub ==
"TOB")
205 else if (sub ==
"TID")
207 else if (sub ==
"TEC")
209 else if (sub ==
"CSC")
211 else if (sub ==
"DT")
213 else if (sub ==
"RPCBarrel")
215 else if (sub ==
"RPCEndcap")
217 else if (sub ==
"GEM")
219 else if (sub ==
"ME0")
221 else if (sub ==
"P2OTB")
223 else if (sub ==
"P2OTEC")
225 else if (sub ==
"P1PXB")
227 else if (sub ==
"P1PXEC")
229 else if (sub ==
"P2PXB")
231 else if (sub ==
"P2PXEC")
233 else if (sub ==
"invalidDet")
240 const std::vector<std::string>& subs) {
241 std::vector<GeomDetEnumerators::SubDetector>
result;
242 result.reserve(subs.size());
243 for (
const auto& sub : subs)
263 return std::unique_ptr<TrackerGeometry>{trackerBuilder.
build(geometricDet, ptitp, ptp, tTopo)};
281 const auto& eulerAngles = rotation.eulerAngles();
282 LogDebug(
"Alignment") <<
"============================================================\n"
283 <<
"subdetector: " << subDetector <<
"\n"
284 <<
"detId: " << detId <<
"\n"
285 <<
"------------------------------------------------------------\n"
286 <<
" x: " << pos.x() <<
"\n"
287 <<
" y: " << pos.y() <<
"\n"
288 <<
" z: " << pos.z() <<
"\n"
289 <<
" phi: " << eulerAngles.phi() <<
"\n"
290 <<
" theta: " << eulerAngles.theta() <<
"\n"
291 <<
" psi: " << eulerAngles.psi() <<
"\n"
292 <<
"============================================================\n";
302 LogDebug(
"Alignment") <<
"Aligning to global tag\n";
310 <<
"Size mismatch between alignments (size=" << alignments->
m_align.size()
311 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
313 std::vector<uint32_t> commonIDs;
314 auto itAlignErr = alignmentErrors->
m_alignError.cbegin();
315 for (
auto itAlign = alignments->
m_align.cbegin(); itAlign != alignments->
m_align.cend(); ++itAlign, ++itAlignErr) {
316 const auto id = itAlign->rawId();
319 if (
id != itAlignErr->rawId())
320 throw cms::Exception(
"GeometryMismatch") <<
"DetId mismatch between alignments (rawId=" <<
id
321 <<
") and alignment errors (rawId=" << itAlignErr->rawId() <<
")";
332 LogDebug(
"Alignment") <<
"============================================================\n"
341 <<
"============================================================\n";
344 commonIDs.push_back(
id);
345 LogDebug(
"Alignment") <<
"============================================================\n"
354 <<
"============================================================\n";
364 for (
const auto&
id : commonIDs) {
366 auto item = std::find_if(surfaceDeformations->
items().cbegin(),
367 surfaceDeformations->
items().cend(),
368 [&
id](
const auto&
i) {
return i.m_rawId ==
id; });
369 if (
item == surfaceDeformations->
items().cend())
375 std::vector<align::Scalar>
params(beginEndPair.first, beginEndPair.second);
385 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
388 edm::LogInfo(
"Alignment") <<
"Writing ideal tracker-alignment records.";
398 "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", std::vector<std::string>{});
404 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 &)
const edm::ESGetToken< GeometricDet, IdealGeometryRecord > geomDetToken_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
uint16_t *__restrict__ id
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)
TrackerGeometry * build(const GeometricDet *gd, const PTrackerAdditionalParametersPerDet *ptitp, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
constexpr uint32_t rawId() const
get the raw id
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 &)
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_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
bool getData(T &iHolder) const
void setComment(std::string const &value)
const edm::ESGetToken< Alignments, TrackerAlignmentRcd > aliToken_
const Surface::PositionType & position() const
The position (origin of the R.F.)
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
DetId geographicalId() const
The label of this GeomDet.
~CreateIdealTkAlRecords() override
const edm::ESGetToken< PTrackerAdditionalParametersPerDet, PTrackerAdditionalParametersPerDetRcd > ptitpToken_
Log< level::Info, false > LogInfo
void clearAlignmentInfos()
static GeomDetEnumerators::SubDetector toSubDetector(const std::string &sub)
std::vector< AlignTransformErrorExtended > m_alignError
const edm::ESGetToken< AlignmentErrorsExtended, TrackerAlignmentErrorExtendedRcd > aliErrorToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const bool alignToGlobalTag_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::ESGetToken< AlignmentSurfaceDeformations, TrackerSurfaceDeformationRcd > aliSurfaceToken_
virtual SubDetector subDetector() const
Which subdetector.
const edm::ESGetToken< PTrackerParameters, PTrackerParametersRcd > ptpToken_
void clear()
Clear vector without having to look into internals: