63 #include "CLHEP/Vector/RotationInterfaces.h" 77 static std::vector<GeomDetEnumerators::SubDetector>
toSubDetectors(
const std::vector<std::string>& subs);
96 std::vector<GeomDetEnumerators::SubDetector>
subDets_;
121 std::sort(dets.begin(), dets.end(), [](
const auto&
a,
const auto&
b) {
122 return a->geographicalId().rawId() <
b->geographicalId().rawId();
125 for (
const auto& det : dets)
137 return "PixelBarrel";
139 return "PixelEndcap";
180 if (sub ==
"PixelBarrel")
182 else if (sub ==
"PixelEndcap")
184 else if (sub ==
"TIB")
186 else if (sub ==
"TOB")
188 else if (sub ==
"TID")
190 else if (sub ==
"TEC")
192 else if (sub ==
"CSC")
194 else if (sub ==
"DT")
196 else if (sub ==
"RPCBarrel")
198 else if (sub ==
"RPCEndcap")
200 else if (sub ==
"GEM")
202 else if (sub ==
"ME0")
204 else if (sub ==
"P2OTB")
206 else if (sub ==
"P2OTEC")
208 else if (sub ==
"P1PXB")
210 else if (sub ==
"P1PXEC")
212 else if (sub ==
"P2PXB")
214 else if (sub ==
"P2PXEC")
216 else if (sub ==
"invalidDet")
223 const std::vector<std::string>& subs) {
224 std::vector<GeomDetEnumerators::SubDetector>
result;
225 for (
const auto& sub : subs)
246 const auto*
const tTopo = tTopoHandle.
product();
250 return std::unique_ptr<TrackerGeometry>{trackerBuilder.
build(&(*geometricDet), *ptp, tTopo)};
268 const auto& eulerAngles = rotation.eulerAngles();
269 LogDebug(
"Alignment") <<
"============================================================\n" 270 <<
"subdetector: " << subDetector <<
"\n" 271 <<
"detId: " << detId <<
"\n" 272 <<
"------------------------------------------------------------\n" 273 <<
" x: " <<
pos.x() <<
"\n" 274 <<
" y: " <<
pos.y() <<
"\n" 275 <<
" z: " <<
pos.z() <<
"\n" 276 <<
" phi: " << eulerAngles.phi() <<
"\n" 277 <<
" theta: " << eulerAngles.theta() <<
"\n" 278 <<
" psi: " << eulerAngles.psi() <<
"\n" 279 <<
"============================================================\n";
289 LogDebug(
"Alignment") <<
"Aligning to global tag\n";
300 <<
"Size mismatch between alignments (size=" << alignments->
m_align.size()
301 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
303 std::vector<uint32_t> commonIDs;
304 auto itAlignErr = alignmentErrors->
m_alignError.cbegin();
305 for (
auto itAlign = alignments->
m_align.cbegin(); itAlign != alignments->
m_align.cend(); ++itAlign, ++itAlignErr) {
306 const auto id = itAlign->rawId();
309 if (
id != itAlignErr->rawId())
310 throw cms::Exception(
"GeometryMismatch") <<
"DetId mismatch between alignments (rawId=" <<
id 311 <<
") and alignment errors (rawId=" << itAlignErr->rawId() <<
")";
322 LogDebug(
"Alignment") <<
"============================================================\n" 331 <<
"============================================================\n";
334 commonIDs.push_back(
id);
335 LogDebug(
"Alignment") <<
"============================================================\n" 344 <<
"============================================================\n";
354 for (
const auto&
id : commonIDs) {
356 auto item = std::find_if(surfaceDeformations->
items().cbegin(),
357 surfaceDeformations->
items().cend(),
358 [&
id](
const auto&
i) {
return i.m_rawId ==
id; });
359 if (
item == surfaceDeformations->
items().cend())
365 std::vector<align::Scalar>
params(beginEndPair.first, beginEndPair.second);
375 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
378 edm::LogInfo(
"Alignment") <<
"Writing ideal tracker-alignment records.";
388 "Creates ideal TrackerAlignmentRcd and TrackerAlignmentErrorExtendedRcd " 389 "from the loaded tracker geometry. " 390 "PoolDBOutputService must be set up for these records.");
392 desc.
addUntracked<std::vector<std::string> >(
"skipSubDetectors", std::vector<std::string>{});
394 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.
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 &)
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_
void setComment(std::string const &value)
#define DEFINE_FWK_MODULE(type)
const Surface::PositionType & position() const
The position (origin of the R.F.)
DetId geographicalId() const
The label of this GeomDet.
~CreateIdealTkAlRecords() override
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
void clearAlignmentInfos()
static GeomDetEnumerators::SubDetector toSubDetector(const std::string &sub)
std::vector< AlignTransformErrorExtended > m_alignError
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const bool alignToGlobalTag_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual SubDetector subDetector() const
Which subdetector.
T const * product() const
void clear()
Clear vector without having to look into internals: