For = conjunction
there drifted out = introductory "there" structure
to Soapy's ears = adverbial phrase of direction (where the music drifted out to)
sweet music = subject of sentence (introduced by "there")
that caught and held him transfixed against the convolutions of the iron fence. = qualifying clause, qualifying the subject.
Hope that helps.