How to set hero image for root and children in a structure
Something like this should do the trick (obviously, change navStructureHandle and entriesFieldHandle to real values):

{# Get the related nav entry for the current entry being viewed #}
{% set navEntry = craft.entries.section('navStructureHandle').relatedTo({
    targetElement: entry,
    field: 'entriesFieldHandle'
}).first() %}

{# Get the root (top level parent) structure entry for the nav entry #}
{% set rootEntry = navEntry ? craft.entries.ancestorOf(navEntry).level(1).first() : null %}

{# If a root entry was found, print out the title #}
{% if rootEntry %}
    &lt;span class="nav-header-title"&gt;{{ rootEntry.title }}&lt;/span&gt;
{% endif %}


With the above, rootEntry will be null if the current entry doesn't have a related nav structure entry, or if a top level parent can't be found for the nav entry (i.e. the nav entry is top level).

I wouldn't worry too much about the performance with the above, but if you do feel it's too complex for printing a header, you could consider using the Preparse plugin instead. Preparse basically lets you create a custom field containing Twig code that will be parsed whenever the entry is saved. This basically lets you "cache" the result of costly Twig operations to a plain text, custom field on an actual entry.

Using Preparse, you could add a field called navHeaderTitle to your child entries (i.e. not the nav section). The field should contain the Twig code above, in addition to actually printing out the rootEntry title if a root entry is found (note that it's a good idea to wrap the whole thing in a {% spaceless %} tag pair):

{% spaceless %} 
    {% set navEntry = craft.entries.section('navStructureHandle').relatedTo({
    targetElement: entry,
    field: 'entriesFieldHandle'
}).first() %}
    {% set rootEntry = navEntry ? craft.entries.ancestorOf(navEntry).level(1).first() : null %}
    {{ rootEntry ? rootEntry.title }}
{% endspaceless %}


Then, you could simply do something like this in your template:

{# No need to pull any entries; just test for the `navHeaderTitle` field #}
{% if entry.navHeaderTitle %}
    &lt;span class="nav-header-title"&gt;{{ entry.navHeaderTitle }}&lt;/span&gt;
{% endif %}


Of course, the caveat with the Preparse approach is that if you ever change your root entry's title, you'll have to re-save all your child entries in order to re-parse the Twig and update the entries' navHeaderTitle value.

A good compromise could be to use Preparse, but echo out the root entry ID instead of the title – then you could do this in your template:

{% set rootEntry = entry.navHeaderEntryId ? craft.entries.id(entry.navHeaderEntryId).first() : null %}
{% if rootEntry %}
    &lt;span class="nav-header-title"&gt;{{ rootEntry.title }}&lt;/span&gt;
{% endif %}