star-travex
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrgOptionProcessor.h
Go to the documentation of this file.
1 #ifndef PrgOptionProcessor_h
2 #define PrgOptionProcessor_h
3 
4 #include <set>
5 #include <string>
6 
7 #include <boost/program_options/options_description.hpp>
8 #include <boost/program_options/variables_map.hpp>
9 #include <boost/program_options/parsers.hpp>
10 
11 #include "TChain.h"
12 
13 #include "travex/ProgramOptions.h"
14 
15 
16 namespace {
17  namespace po = boost::program_options;
18 }
19 
20 
24 class PrgOptionProcessor : public tvx::ProgramOptions
25 {
26 public:
27 
29  PrgOptionProcessor(int argc, char **argv, const std::string& stiTreeName="t");
31 
32  std::string PathToStiTreeFile() const { return fInFilePath; }
33  std::string PathToGeometryFile() const { return fGeomFilePath; }
34  const std::set<std::string>& GetVolumeList() const { return fVolumeList; }
35  TChain* GetStiTChain() { return fStiTChain; }
36 
37  void ProcessOptions();
38  bool MatchedVolName(const std::string & volName) const;
39 
40 protected:
41 
42  void BuildInputChains();
43  virtual void VerifyOptions();
44  virtual void AddToInputChains(std::string stiTreeRootFileName);
45 
47  std::string fGeomFilePath;
48 
50  std::string fVolumeListFile;
51 
53  std::string fVolumePattern;
54 
56  std::set<std::string> fVolumeList;
57 
59  TChain *fStiTChain;
60 };
61 
62 #endif
std::string PathToStiTreeFile() const
Processes and controls user options provided in the command line.
TChain * fStiTChain
A (chained) TTree from the input file.
virtual void AddToInputChains(std::string stiTreeRootFileName)
This private method takes a path to a valid ROOT file as input.
std::string fGeomFilePath
Full path to a ROOT file with TGeo geometry.
std::set< std::string > fVolumeList
A list of volume names to consider.
virtual void VerifyOptions()
bool MatchedVolName(const std::string &volName) const
Note that the function returns true when the internal list of regex'es formed by the user specified o...
void ProcessOptions()
Takes the standard command line arguments and parses them with the boost program_options utility...
std::string PathToGeometryFile() const
std::string fVolumeListFile
Full path to a text file with Sti/TGeo volume names.
std::string fVolumePattern
Regex pattern provided by the user in the command line.
const std::set< std::string > & GetVolumeList() const