File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 1212// -------------------------------------------------------------------------------------
1313
1414ChargedParticle::TrajectoryData ChargedParticle::GetTrajectoryData (CherenkovRadiator* radiator, RadiatorHistory* history) const {
15- // Try new API first, fall back to deprecated API for backwards compatibility
16- if (history->GetLocations ().empty () && !radiator->GetLocations ().empty ()) {
17- // Using deprecated API (backwards compatibility mode)
15+ bool history_has_data = !history->GetLocations ().empty ();
16+ bool radiator_has_data = !radiator->GetLocations ().empty ();
17+
18+ // Both APIs populated indicates accidental misuse
19+ if (history_has_data && radiator_has_data) {
20+ throw std::runtime_error (" Both RadiatorHistory and CherenkovRadiator have trajectory data" );
21+ }
22+
23+ // Prefer new thread-safe API, fall back to deprecated API for backwards compatibility
24+ if (history_has_data) {
25+ return {history->GetTrajectoryBinCount (), history->GetLocations ()};
26+ } else if (radiator_has_data) {
1827 return {radiator->GetTrajectoryBinCount (), radiator->GetLocations ()};
1928 } else {
20- // Using new thread-safe API
21- return {history-> GetTrajectoryBinCount (), history-> GetLocations () };
29+ static const std::vector<std::pair<TVector3, TVector3>> empty_locations;
30+ return {0 , empty_locations };
2231 }
2332}
2433
You can’t perform that action at this time.
0 commit comments