Reading multiple .dat files and save plots in .root

Holy smokes!
when you see a solution it’s always so easy that it’s embarassing for who was wandering in the dark.

Lemme try both and soon i’ll post the whole script that performs also a fit with two landau+a gauss. I think it could be of help since this solution was nowere to be found and solves a problem for whoever deals with Strontium as source (which decay is 90Sr->90Y->Zr so that you always have a convolution between two landau plus a gauss of noise.

Thank you a lot, i’ll back to you asap with a script trying to solve the whole issue.

EDIT:
the script you proposed looks very very intriguing but i cannot compile and the errore i’m afraid is beyond my actual kung-fu:

root [0] .x Example.C
In file included from input_line_8:1:
/myMacOSfolder/Example.C:91:20: error: no viable conversion from 'TString' to 'string' (aka
      'basic_string<char, char_traits<char>, allocator<char> >')
            string filename = fname.ReplaceAll(ext, "");
                   ^          ~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1349:5: note: 
      candidate constructor not viable: no known conversion from 'TString' to 'const std::__1::basic_string<char> &' for 1st
      argument
    basic_string(const basic_string& __str);
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1354:5: note: 
      candidate constructor not viable: no known conversion from 'TString' to 'std::__1::basic_string<char> &&' for 1st argument
    basic_string(basic_string&& __str)
    ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1364:31: note: 
      candidate constructor not viable: no known conversion from 'TString' to 'const value_type *' (aka 'const char *') for 1st
      argument
    _LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s);
                              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:1385:5: note: 
      candidate constructor not viable: no known conversion from 'TString' to 'initializer_list<value_type>'
      (aka 'initializer_list<char>') for 1st argument
    basic_string(initializer_list<value_type> __il);
    ^
/usr/local/Cellar/root6/6.08.02/include/root/TString.h:289:4: note: candidate function
   operator const char*() const { return GetPointer(); }
   ^
/usr/local/Cellar/root6/6.08.02/include/root/TString.h:290:4: note: candidate function
   operator std::string_view() const { return std::string_view(GetPointer(),Length()); }
   ^

I hope it is not somehow because i have a MacOS (10.11.6)…