Hello hps-java,

I am trying to get the track state for a GBL track at the calorimeter face. I get the GBL tracks as normal:

List<Track> tracks = null;
if(event.hasCollection(Track.class, "GBLTracks")) {
tracks = event.get(Track.class, "GBLTracks");
} else {
tracks = new ArrayList<Track>(0);

I then attempt to get a track state:

for(Track track : tracks) {
double[] p = track.getTrackStates().get(TrackState.AtCalorimeter).getMomentum();
System.out.printf("p = <%5.3f, %5.3f, %5.3f%n", p[0], p[1], p[2]);

However, I get this error:

java.lang.IndexOutOfBoundsException: Index 4 out-of-bounds for length 3

It seems that the track does not have the track state for the calorimeter stored. Am I doing something wrong?



Use REPLY-ALL to reply to list

To unsubscribe from the HPS-SOFTWARE list, click the following link: