NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
NtpTools.h
Go to the documentation of this file.
1 #include <iomanip>
2 #include <iostream>
3 
4 #include "TObjString.h"
5 
6 #include "root.h"
7 
8 namespace NAIA {
9 namespace NtpTools {
10 std::pair<unsigned int, unsigned int> GetInnerNHits(TrTrackR *track);
11 
12 std::vector<std::string> ExpandTextFilelist(const std::string &txtFile);
13 std::vector<std::string> LoadInputFiles(std::vector<std::string> &inputFiles);
14 
15 template <typename T> T GetDatacardValue(TObjString *datacard, const std::string &key) {
16  double value = std::numeric_limits<double>::max();
17  TObjArray *lines = datacard->GetString().Tokenize('\n');
18  TString dummystr;
19  for (size_t il = 0; il < lines->GetEntries(); il++) {
20  dummystr = static_cast<TObjString *>(lines->At(il))->GetString();
21  if (dummystr.Contains(key + "=") && !dummystr.BeginsWith('C')) {
22  value = TString{dummystr(dummystr.Last('=') + 1, dummystr.Length())}.Atof();
23  }
24  }
25 
26  return static_cast<T>(value);
27 }
28 } // namespace NtpTools
29 } // namespace NAIA
std::pair< unsigned int, unsigned int > GetInnerNHits(TrTrackR *track)
Definition: NtpTools.cpp:7
std::vector< std::string > LoadInputFiles(std::vector< std::string > &inputFiles)
Definition: NtpTools.cpp:39
std::vector< std::string > ExpandTextFilelist(const std::string &txtFile)
Definition: NtpTools.cpp:22
T GetDatacardValue(TObjString *datacard, const std::string &key)
Definition: NtpTools.h:15