-
Notifications
You must be signed in to change notification settings - Fork 225
Implement the ability to tilt the TPC envelope in sPHENIX #4308
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
Changes from all commits
d8866f9
165b1f3
e08f803
a9a5359
f28f854
d97ac63
45967b3
4d022db
275ed89
4b72c34
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 |
|---|---|---|
|
|
@@ -45,13 +45,21 @@ TpcClusterMover::TpcClusterMover() | |
| } | ||
| } | ||
|
|
||
| void TpcClusterMover::initialize_geometry(PHG4TpcGeomContainer* cellgeo) | ||
| void TpcClusterMover::initialize_geometry(PHG4TpcGeomContainer* cellgeo, ActsGeometry *tGeometry) | ||
| { | ||
| if (_verbosity > 0) | ||
| { | ||
| std::cout << "TpcClusterMover: Initializing layer radii for Tpc from cell geometry object" << std::endl; | ||
| std::cout << "TpcClusterMover: Getting ActsGeometry, and getting layer radii for Tpc from cell geometry object" << std::endl; | ||
| } | ||
|
|
||
| if(!tGeometry || !cellgeo) | ||
| { | ||
| std::cout << PHWHERE << " Failed to get ActsGeometry or TPC cell geometry, cannot continue - quit!" << std::endl; | ||
| exit(1); | ||
| } | ||
|
|
||
| _tGeometry = tGeometry; | ||
|
|
||
|
Comment on lines
+60
to
+62
Contributor
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. Enforce geometry initialization before transform calls
Proposed fix void TpcClusterMover::initialize_geometry(PHG4TpcGeomContainer* cellgeo, ActsGeometry *tGeometry)
{
+ if (!cellgeo || !tGeometry)
+ {
+ _tGeometry = nullptr;
+ if (_verbosity > 0)
+ {
+ std::cout << "TpcClusterMover::initialize_geometry missing required geometry input" << std::endl;
+ }
+ return;
+ }
+
if (_verbosity > 0)
{
std::cout << "TpcClusterMover: Initializing layer radii for Tpc from cell geometry object" << std::endl;
}
-
_tGeometry = tGeometry;
-
+
int layer = 0;
PHG4TpcGeomContainer::ConstRange layerrange = cellgeo->get_begin_end();
@@
std::vector<std::pair<TrkrDefs::cluskey, Acts::Vector3>> TpcClusterMover::processTrack(const std::vector<std::pair<TrkrDefs::cluskey, Acts::Vector3>>& global_in)
{
+ if (!_tGeometry)
+ {
+ if (_verbosity > 0)
+ {
+ std::cout << "TpcClusterMover::processTrack called before valid geometry initialization" << std::endl;
+ }
+ return global_in;
+ }
+
// Get the global positions of the TPC clusters for this track, already corrected for distortions, and move them to the surfacesAlso applies to: 87-88, 148-150 |
||
| int layer = 0; | ||
| PHG4TpcGeomContainer::ConstRange layerrange = cellgeo->get_begin_end(); | ||
| for (PHG4TpcGeomContainer::ConstIterator layeriter = layerrange.first; | ||
|
|
@@ -67,8 +75,9 @@ void TpcClusterMover::initialize_geometry(PHG4TpcGeomContainer* cellgeo) | |
| std::vector<std::pair<TrkrDefs::cluskey, Acts::Vector3>> TpcClusterMover::processTrack(const std::vector<std::pair<TrkrDefs::cluskey, Acts::Vector3>>& global_in) | ||
| { | ||
| // Get the global positions of the TPC clusters for this track, already corrected for distortions, and move them to the surfaces | ||
| // The input object contains all clusters for the track | ||
|
|
||
| // The input object contains all clusters for the track in world coordinates | ||
| // The surface radii are in envelope coordinates, we transform the positions to envelope coordinates | ||
|
|
||
| std::vector<std::pair<TrkrDefs::cluskey, Acts::Vector3>> global_moved; | ||
|
|
||
| std::vector<Acts::Vector3> tpc_global_vec; | ||
|
|
@@ -80,7 +89,8 @@ std::vector<std::pair<TrkrDefs::cluskey, Acts::Vector3>> TpcClusterMover::proces | |
| if (trkrid == TrkrDefs::tpcId) | ||
| { | ||
| tpc_cluskey_vec.push_back(ckey); | ||
| tpc_global_vec.push_back(global); | ||
| Acts::Vector3 env_global = _tGeometry->transformTpcWorldToEnvelope(global); | ||
| tpc_global_vec.push_back(env_global); | ||
| } | ||
| else | ||
| { | ||
|
|
@@ -140,9 +150,9 @@ std::vector<std::pair<TrkrDefs::cluskey, Acts::Vector3>> TpcClusterMover::proces | |
| // now move the cluster to the surface radius | ||
| // we keep the cluster key fixed, change the surface if necessary | ||
|
|
||
| Acts::Vector3 global_new(xnew, ynew, znew); | ||
|
|
||
| // add the new position and surface to the return object | ||
| Acts::Vector3 env_global_new(xnew, ynew, znew); | ||
| // now we transform back to global coordinates and add the new position and surface to the return object | ||
| Acts::Vector3 global_new = _tGeometry->transformTpcEnvelopeToWorld(env_global_new); | ||
| global_moved.emplace_back(cluskey, global_new); | ||
|
|
||
| if (_verbosity > 2) | ||
|
|
||
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.
Validate required geometry nodes before initializing
m_clusterMover.Line 120 passes
tpccellgeo/geometrywithout null checks. If either lookup fails,processTrackwill dereference a null geometry pointer and crash. Fail fast inInitRunwithABORTRUN.Suggested fix
📝 Committable suggestion