EMPHATICSoft / emphaticsoft

Base repository for art-based code
Apache License 2.0
1 stars 0 forks source link

Bugfix/lackey32 caf filename #159

Closed lackey32 closed 10 months ago

lackey32 commented 10 months ago

Finds second to last dot in filename so we keep the entire beginning but drop .artdaq.root (or whatever else the end may be) in favor of .caf.root. This could cause some confusion if people run over files that don't end with .<type>.root.

The alternative option is the first commit, which just replaces the find line with const size_t dotpos = fCAFFilename.find_last_of('.',fCAFFilename.length()-6); but that assumes the end of the file will always be the same number of characters as .root. I would hope the name always ends in .root, but are we positive it will?

I'm honestly not sure which one is safer / will cause less confusion. I think I'm leaning towards the single line version right now, but that might change in 5 minutes.

lackey32 commented 10 months ago

Chatted with Gavin a bit and went with the one-liner with a comment above it indicating the expected format for fCAFFilename. I'd be surprised if people tried running this over files that didn't end with '.root' anyways, but you never know.