Allow downloading files from private filesystem when paths to files are built without Drupal I have set up files under private filesystem (large tree of dirs and files).
Drupal does not know anything about those files, because they are not added by file upload field, but links are manually defined as strings (in special field in content type), and put in place with ftp.

Also, path to those files are not completely contained within string, but constructed in field--field_myfiled.tpl.php (some taxonomy magic adds parts of the path, so in actual string i have only filename).

Now, adding just system/files/ before link constructed in field--field_myfiled.tpl.php returns privilege errors, so I guess i need to tell Drupal somehow to allow downloading these files. I am not sure - could I use hook_file_download in this case, and how I could implement this or simmilar function or approach to give access to those files ?

EDIT: My latest findings are that it seems that hook_file_download is triggered whenever you try to access a valid link to a file in private filesystem. No need for anything except hook_file_download here!
Here are a few modules that should help you configure the way files are served.


Storage API module. It provides advanced file storage and serving options; such as to upload or serve from a separate server, via ftp, etc. It's my favorite option. I currently use it to host all files on a separate server.
CDN module. Designed for CDN related tasks, but can be used in your case to specify an alternative file location for specific file types.
Remote Steam Wrapper module. Not sure if this will work for private files. It makes it easier to serve external files.
Media Mover module. Provides advanced file serving possibilities, i.e. get files from a FTP server, provide file tokens for authentication, get files from CCK fields, etc. It's only available in development version.


Update

If you want to do it via custom code, use field_view_value() function to pull the URL from the field. Use file_create_url to create URL for streaming. You'll also need to use hook_file_download to allow the file to be downloaded; otherwise you will get a page not found.

Update

If I understood correctly, you have a field, where you enter the file name (i.e. myFile.pdf), and you rewrote its field theme (field--field_myfield.tpl.php) to generate the full location of the file. The problem here, is that you cannot include hooks/functions within a theme. Your solution would be to construct the file location in a custom module or template.php.

Example of rewriting the field value via template.php. Replace MYTHEME with your theme name.

function MYTHEME_preprocess_field(&amp;$vars) {
  if($vars['element']['#field_name'] == 'field_myField') {
    $filePath = '/secret/location/' . $vars['items']['0']['#markup'];
    $vars['items']['0']['#markup'] = file_create_url($filePath);
    return;
  }
}


If you want to check for permissions, use hook_file_download.