|
|
Go to the documentation of this file.
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_;
103 : skipSubDetectors_(toSubDetectors(iConfig.getUntrackedParameter<
std::
vector<
std::
string> >(
"skipSubDetectors"))),
104 alignToGlobalTag_(iConfig.getUntrackedParameter<
bool>(
"alignToGlobalTag")),
105 createReferenceRcd_(iConfig.getUntrackedParameter<
bool>(
"createReferenceRcd")),
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 result.reserve(subs.size());
226 for (
const auto& sub : subs)
247 const auto*
const tTopo = tTopoHandle.
product();
251 return std::unique_ptr<TrackerGeometry>{trackerBuilder.
build(&(*geometricDet), *ptp, tTopo)};
269 const auto& eulerAngles =
rotation.eulerAngles();
270 LogDebug(
"Alignment") <<
"============================================================\n"
271 <<
"subdetector: " << subDetector <<
"\n"
272 <<
"detId: " << detId <<
"\n"
273 <<
"------------------------------------------------------------\n"
274 <<
" x: " <<
pos.x() <<
"\n"
275 <<
" y: " <<
pos.y() <<
"\n"
276 <<
" z: " <<
pos.z() <<
"\n"
277 <<
" phi: " << eulerAngles.phi() <<
"\n"
278 <<
" theta: " << eulerAngles.theta() <<
"\n"
279 <<
" psi: " << eulerAngles.psi() <<
"\n"
280 <<
"============================================================\n";
290 LogDebug(
"Alignment") <<
"Aligning to global tag\n";
301 <<
"Size mismatch between alignments (size=" << alignments->
m_align.size()
302 <<
") and alignment errors (size=" << alignmentErrors->
m_alignError.size() <<
")";
304 std::vector<uint32_t> commonIDs;
305 auto itAlignErr = alignmentErrors->
m_alignError.cbegin();
306 for (
auto itAlign = alignments->
m_align.cbegin(); itAlign != alignments->
m_align.cend(); ++itAlign, ++itAlignErr) {
307 const auto id = itAlign->rawId();
310 if (
id != itAlignErr->rawId())
311 throw cms::Exception(
"GeometryMismatch") <<
"DetId mismatch between alignments (rawId=" <<
id
312 <<
") and alignment errors (rawId=" << itAlignErr->rawId() <<
")";
323 LogDebug(
"Alignment") <<
"============================================================\n"
332 <<
"============================================================\n";
335 commonIDs.push_back(
id);
336 LogDebug(
"Alignment") <<
"============================================================\n"
345 <<
"============================================================\n";
355 for (
const auto&
id : commonIDs) {
357 auto item = std::find_if(surfaceDeformations->
items().cbegin(),
358 surfaceDeformations->
items().cend(),
359 [&
id](
const auto&
i) {
return i.m_rawId ==
id; });
360 if (
item == surfaceDeformations->
items().cend())
366 std::vector<align::Scalar>
params(beginEndPair.first, beginEndPair.second);
376 throw cms::Exception(
"NotAvailable") <<
"PoolDBOutputService not available";
379 edm::LogInfo(
"Alignment") <<
"Writing ideal tracker-alignment records.";
389 "Creates ideal TrackerAlignmentRcd and TrackerAlignmentErrorExtendedRcd "
390 "from the loaded tracker geometry. "
391 "PoolDBOutputService must be set up for these records.");
392 desc.addUntracked<
bool>(
"alignToGlobalTag",
false);
393 desc.addUntracked<std::vector<std::string> >(
"skipSubDetectors", std::vector<std::string>{});
394 desc.addUntracked<
bool>(
"createReferenceRcd",
false);
395 descriptions.
add(
"createIdealTkAlRecords",
desc);
const Surface::PositionType & position() const
The position (origin of the R.F.)
T const * product() const
void clear()
Clear vector without having to look into internals:
~CreateIdealTkAlRecords() override
static GeomDetEnumerators::SubDetector toSubDetector(const std::string &sub)
void clearAlignmentInfos()
TrackerGeometry * build(const GeometricDet *gd, const PTrackerParameters &ptp, const TrackerTopology *tTopo)
Log< level::Info, false > LogInfo
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const bool alignToGlobalTag_
const TimeTypeSpecs timeTypeSpecs[]
#define DEFINE_FWK_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector< uint32_t > rawIDs_
static std::string toString(const GeomDetEnumerators::SubDetector &)
DetId geographicalId() const
The label of this GeomDet.
std::unique_ptr< TrackerGeometry > retrieveGeometry(const edm::EventSetup &)
AlignmentErrorsExtended alignmentErrors_
std::vector< GeomDetEnumerators::SubDetector > subDets_
AlignmentSurfaceDeformations alignmentSurfaceDeformations_
void addAlignmentInfo(const GeomDet &)
void analyze(const edm::Event &, const edm::EventSetup &) override
const bool createReferenceRcd_
constexpr uint32_t rawId() const
get the raw id
void clear()
Clear vector without having to look into internals:
CreateIdealTkAlRecords(const edm::ParameterSet &)
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
static std::vector< GeomDetEnumerators::SubDetector > toSubDetectors(const std::vector< std::string > &subs)
void alignToGT(const edm::EventSetup &)
std::vector< AlignTransform > m_align
std::vector< AlignTransformErrorExtended > m_alignError
const std::vector< GeomDetEnumerators::SubDetector > skipSubDetectors_
const Surface::RotationType & rotation() const
The rotation defining the local R.F.
virtual SubDetector subDetector() const
Which subdetector.