I would probably search the instHeaders instead of the instances. The instHeaders point to the instances. There may be more than one instHeader for each cell name, if the cells are pcells:
instHeaders = setof( ih cvId~>instHeaders ih~>cellName == "myCell" )instList = foreach(mapcan ih instHeaders ih~>instances)
Now you can start probing the other masters for the same information.You will need to do this recursively, keeping track of the transform of the instances in each master. When you get back to the top, transform the orientations and print out your answer.
Andrew may have an example which helps do this.