Skip to content
Snippets Groups Projects
Commit 854aa094 authored by FU Chengdong's avatar FU Chengdong
Browse files

add protection not exist TrackState

parent f273997a
No related branches found
No related tags found
No related merge requests found
...@@ -28,22 +28,29 @@ inline edm4hep::TrackState getTrackStateAt(edm4hep::ConstTrack track, int locati ...@@ -28,22 +28,29 @@ inline edm4hep::TrackState getTrackStateAt(edm4hep::ConstTrack track, int locati
} }
inline std::array<float,15> getCovMatrix(const edm4hep::ConstTrack &track) { inline std::array<float,15> getCovMatrix(const edm4hep::ConstTrack &track) {
return track.getTrackStates(0).covMatrix; if(track.trackStates_size()>0) return track.getTrackStates(0).covMatrix;
std::array<float,15> dummy{};
return dummy;
} }
inline float getTanLambda(const edm4hep::ConstTrack &track) { inline float getTanLambda(const edm4hep::ConstTrack &track) {
return track.getTrackStates(0).tanLambda; if(track.trackStates_size()>0) return track.getTrackStates(0).tanLambda;
return 0;
} }
inline float getOmega(const edm4hep::ConstTrack &track) { inline float getOmega(const edm4hep::ConstTrack &track) {
return track.getTrackStates(0).omega; if(track.trackStates_size()>0) return track.getTrackStates(0).omega;
return 0;
} }
inline float getD0(const edm4hep::ConstTrack &track) { inline float getD0(const edm4hep::ConstTrack &track) {
return track.getTrackStates(0).D0; if(track.trackStates_size()>0) return track.getTrackStates(0).D0;
return 0;
} }
inline float getZ0(const edm4hep::ConstTrack &track) { inline float getZ0(const edm4hep::ConstTrack &track) {
return track.getTrackStates(0).Z0; if(track.trackStates_size()>0) return track.getTrackStates(0).Z0;
return 0;
} }
inline float getPhi(const edm4hep::ConstTrack &track) { inline float getPhi(const edm4hep::ConstTrack &track) {
return track.getTrackStates(0).phi; if(track.trackStates_size()>0) return track.getTrackStates(0).phi;
return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment