Where are the Tracks, and therefore the TrackExtras, coming from? If from a file than you need a different file. Else, you have to check if the ```edm::RefToBase<reco::TrackExtra>``` is valid and only try to create a new one if it is.