-
Notifications
You must be signed in to change notification settings - Fork 2
Move LSTGeometry repo into ESProducer and standalone binary #203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
e36c573
9c72348
0219a91
7bac52c
01e5f7d
6f5baf4
e30647c
0c561d4
83f4f2e
2477131
5577697
048ec2b
650726e
f61cbbf
1a336eb
54eca66
5a5f071
8c9cef1
52c7348
e1d8e33
7e14f20
d0ad743
7d92925
7db81b4
3d144d8
a996ea4
a4770b6
539e085
b5fb2de
317653f
76dca60
6c74ad9
d4dc0dc
057098a
ed163cf
4bb1bad
84102a5
14afa6a
d2682a7
ffe91ba
6f64b0f
2ababce
76ba095
d609f43
dcf51e9
d860ac2
1df1a68
1ea88fa
5d2a0e6
0517793
6fb0015
9d306ca
3d78e81
6697a68
a67a690
df1995c
1fba827
17744c5
e2944b7
a5d5f4a
777cad3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |||||||||
| #include "RecoTracker/LSTCore/interface/EndcapGeometryDevHostCollection.h" | ||||||||||
| #include "RecoTracker/LSTCore/interface/ModulesHostCollection.h" | ||||||||||
| #include "RecoTracker/LSTCore/interface/PixelMap.h" | ||||||||||
| #include "RecoTracker/LSTCore/interface/LSTGeometry/LSTGeometry.h" | ||||||||||
|
|
||||||||||
| #include "HeterogeneousCore/AlpakaInterface/interface/CopyToDevice.h" | ||||||||||
|
|
||||||||||
|
|
@@ -41,6 +42,7 @@ namespace lst { | |||||||||
| }; | ||||||||||
|
|
||||||||||
| std::unique_ptr<LSTESData<alpaka_common::DevHost>> loadAndFillESHost(std::string& ptCutLabel); | ||||||||||
| std::unique_ptr<LSTESData<alpaka_common::DevHost>> loadAndFillESHost(lstgeometry::LSTGeometry const& lstg); | ||||||||||
|
Comment on lines
44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps rename; now that we have multiple payloads just having a generic method name is unclear. Also,
Suggested change
|
||||||||||
|
|
||||||||||
| } // namespace lst | ||||||||||
|
|
||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,15 @@ | ||||||
| #ifndef RecoTracker_LSTCore_interface_LSTGeometry_Centroid_h | ||||||
| #define RecoTracker_LSTCore_interface_LSTGeometry_Centroid_h | ||||||
|
|
||||||
| namespace lstgeometry { | ||||||
|
|
||||||
| struct Centroid { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
not sure if it's even better to be |
||||||
| unsigned int moduleType; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this be |
||||||
| double x; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I doubt we need doubles here |
||||||
| double y; | ||||||
| double z; | ||||||
| }; | ||||||
|
|
||||||
| } // namespace lstgeometry | ||||||
|
|
||||||
| #endif | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,80 @@ | ||||||
| #ifndef RecoTracker_LSTCore_interface_LSTGeometry_CentroidMethods_h | ||||||
| #define RecoTracker_LSTCore_interface_LSTGeometry_CentroidMethods_h | ||||||
|
|
||||||
| #include <stdexcept> | ||||||
| #include <unordered_map> | ||||||
|
|
||||||
| #include "Common.h" | ||||||
| #include "RecoTracker/LSTCore/interface/LSTGeometry/Module.h" | ||||||
| #include "RecoTracker/LSTCore/interface/LSTGeometry/Centroid.h" | ||||||
| #include "RecoTracker/LSTCore/interface/LSTGeometry/SensorInfo.h" | ||||||
|
|
||||||
| namespace lstgeometry { | ||||||
|
|
||||||
| unsigned int extractBits(unsigned int value, unsigned int start, unsigned int end) { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can all of this be member methods of |
||||||
| unsigned int mask = (1 << (end - start + 1)) - 1; | ||||||
| return (value >> start) & mask; | ||||||
| } | ||||||
|
|
||||||
| unsigned int firstDigit(unsigned int n) { | ||||||
| while (n >= 10) { | ||||||
| n /= 10; | ||||||
| } | ||||||
| return n; | ||||||
| } | ||||||
|
|
||||||
| // TODO: refactor to use Module class better | ||||||
| int parseModuleType(unsigned int detId) { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| // Check if the first digit of detId is '3' for inner tracker | ||||||
| if (firstDigit(detId) == 3) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is accidental; some phase-1 strip/OT also starts with 3. assuming we only get the tracker, just check that subdet is 1,2 or |
||||||
| return -1; | ||||||
|
|
||||||
| unsigned int subdet = extractBits(detId, 25, 27); | ||||||
| unsigned int layer = subdet == Module::SubDet::Barrel ? extractBits(detId, 20, 22) : extractBits(detId, 18, 20); | ||||||
| unsigned int ring = subdet == Module::SubDet::Endcap ? extractBits(detId, 12, 15) : 0; | ||||||
|
Comment on lines
+32
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think eventually all of this should be replaced by parsing done on the CMSSW side so that we actually read moduleType from file instead of parsing the detid |
||||||
|
|
||||||
| bool is_even_det_id = detId % 2 == 0; | ||||||
| if (subdet == Module::SubDet::Barrel) { | ||||||
| if (layer <= 3) | ||||||
| return is_even_det_id ? Module::ModuleType::PSS : Module::ModuleType::PSP; | ||||||
| else | ||||||
| return Module::ModuleType::TwoS; | ||||||
| } else if (subdet == Module::SubDet::Endcap) { | ||||||
| if (layer <= 2) | ||||||
| return is_even_det_id && ring <= 10 ? Module::ModuleType::PSS | ||||||
| : (ring <= 10 ? Module::ModuleType::PSP : Module::ModuleType::TwoS); | ||||||
| else | ||||||
| return is_even_det_id && ring <= 7 ? Module::ModuleType::PSS | ||||||
| : (ring <= 7 ? Module::ModuleType::PSP : Module::ModuleType::TwoS); | ||||||
| } else { | ||||||
| throw std::runtime_error("Invalid subdetector type"); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| std::unordered_map<unsigned int, Centroid> computeCentroids( | ||||||
| std::unordered_map<unsigned int, SensorInfo> const& sensors) { | ||||||
| std::unordered_map<unsigned int, Centroid> centroids; | ||||||
| for (auto const& [detId, sensor] : sensors) { | ||||||
| int moduleType = parseModuleType(detId); | ||||||
|
|
||||||
| // Remove sensors from inner tracker | ||||||
| if (moduleType == -1) { | ||||||
| continue; | ||||||
| } | ||||||
|
|
||||||
| // Convert from mm to cm | ||||||
| double z = sensor.sensorCenterZ_cm; | ||||||
| double rho = sensor.sensorCenterRho_cm; | ||||||
| double phi = sensor.phi_rad; | ||||||
| double x = rho * cos(phi); | ||||||
| double y = rho * sin(phi); | ||||||
|
|
||||||
| Centroid centroid{static_cast<unsigned int>(moduleType), x, y, z}; | ||||||
| centroids[detId] = centroid; | ||||||
| } | ||||||
| return centroids; | ||||||
| } | ||||||
|
|
||||||
| } // namespace lstgeometry | ||||||
|
|
||||||
| #endif | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #ifndef RecoTracker_LSTCore_interface_LSTGeometry_Common_h | ||
| #define RecoTracker_LSTCore_interface_LSTGeometry_Common_h | ||
|
|
||
| #include <Eigen/Dense> | ||
| #include <limits> | ||
|
|
||
| namespace lstgeometry { | ||
|
|
||
| using MatrixD3x3 = Eigen::Matrix<double, 3, 3, Eigen::RowMajor>; | ||
| using MatrixD4x2 = Eigen::Matrix<double, 4, 2, Eigen::RowMajor>; | ||
| using MatrixD4x3 = Eigen::Matrix<double, 4, 3, Eigen::RowMajor>; | ||
| using MatrixD8x3 = Eigen::Matrix<double, 8, 3, Eigen::RowMajor>; | ||
| using MatrixDNx2 = Eigen::Matrix<double, Eigen::Dynamic, 2, Eigen::RowMajor>; | ||
| using MatrixDNx3 = Eigen::Matrix<double, Eigen::Dynamic, 3, Eigen::RowMajor>; | ||
| using RowVectorD2 = Eigen::Matrix<double, 1, 2>; | ||
| using ColVectorD3 = Eigen::Matrix<double, 3, 1>; | ||
| using RowVectorD3 = Eigen::Matrix<double, 1, 3>; | ||
|
|
||
| // TODO: These should be moved to ../Common.h | ||
| constexpr double k2Rinv1GeVf = 0.00299792458; | ||
| constexpr double kB = 3.8112; | ||
|
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. k2Rinv1GeVf here is just c; cf in RecoTracker/LSTCore/interface/alpaka/Common.h |
||
|
|
||
| // For pixel maps | ||
| constexpr unsigned int kNEta = 25; | ||
| constexpr unsigned int kNPhi = 72; | ||
| constexpr unsigned int kNZ = 25; | ||
| constexpr std::array<double, 2> kPtBounds = {{2.0, 10'000.0}}; | ||
|
|
||
| // This is defined as a constant in case the legacy value (123456789) needs to be used | ||
| double kDefaultSlope = std::numeric_limits<double>::infinity(); | ||
|
|
||
| double degToRad(double degrees) { return degrees * (std::numbers::pi_v<double> / 180); } | ||
|
|
||
| double phi_mpi_pi(double phi) { | ||
| while (phi >= std::numbers::pi_v<double>) | ||
| phi -= 2 * std::numbers::pi_v<double>; | ||
| while (phi < -std::numbers::pi_v<double>) | ||
| phi += 2 * std::numbers::pi_v<double>; | ||
| return phi; | ||
| } | ||
|
|
||
| double roundAngle(double angle, double tol = 1e-3) { | ||
| const double pi = std::numbers::pi_v<double>; | ||
| if (std::fabs(angle) < tol) { | ||
| return 0.0; | ||
| } else if (std::fabs(angle - pi / 2) < tol) { | ||
| return pi / 2; | ||
| } else if (std::fabs(angle + pi / 2) < tol) { | ||
| return -pi / 2; | ||
| } else if (std::fabs(angle - pi) < tol || std::fabs(angle + pi) < tol) { | ||
| return -pi; | ||
| } | ||
| return angle; | ||
| } | ||
|
|
||
| double roundCoordinate(double coord, double tol = 1e-3) { | ||
| if (std::fabs(coord) < tol) { | ||
| return 0.0; | ||
| } | ||
| return coord; | ||
| } | ||
|
|
||
| } // namespace lstgeometry | ||
|
|
||
| #endif | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should still have a possibility to have multiple payloads in the same job with different thresholds.