GFluxFileConfigI.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::flux::GFluxFileConfigI
5 
6 \brief
7 
8 \author Robert Hatcher <rhatcher \at fnal.gov>
9  Fermi National Accelerator Laboratory
10 
11 \created 2015-03-17
12 
13 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
14  for the full text of the license visit http://copyright.genie-mc.org
15 */
16 //____________________________________________________________________________
17 
18 #ifndef GENIE_FLUX_GFLUXFILECONFIGI_H
19 #define GENIE_FLUX_GFLUXFILECONFIGI_H
20 
21 #include <string>
22 #include <vector>
23 #include <set>
24 
26 class TTree;
27 
28 namespace genie {
29 namespace flux {
30 
32 
33  public:
34 
36  virtual ~GFluxFileConfigI();
37 
38  //
39  // define the GFluxFileConfigI interface:
40  //
41 
42  /// first is primary method for loading root flux ntuple files and config
43  /// others are alternatives that can be overloaded but have
44  /// sensible defaults to fall back to calling the vector version
45 
46  virtual void LoadBeamSimData(const std::vector<std::string>& filenames,
47  const std::string& det_loc) = 0;
48 
49  virtual void LoadBeamSimData(const std::set<std::string>& filenames,
50  const std::string& det_loc);
51 
52  virtual void LoadBeamSimData(const std::string& filename,
53  const std::string& det_loc);
54 
55  virtual void SetXMLFileBase(std::string xmlbasename="");
56  virtual std::string GetXMLFileBase() const { return fXMLbasename; }
57 
58  /// allow caller to copy current status / ntuple entry info
59  /// in the output file by providing copies of internal info
60  ///
61  /// Assumes that branch object pointers will not change
62  /// which may require either a copy be made or, if using the class
63  /// directly for reading the branch, one must force ROOT to
64  /// not autodelete:
65  /// myns::MyClassType* fCurrMyClass = new myns::MyClassType;
66  /// myTree->SetBranchAddress("bname",&fCurMyClass);
67  /// //? TBranch* b = myTree->GetBranch("bname");
68  /// //? b->SetAutoDelete(false);
69  ///
70  /// ensure vectors are sized sufficiently (or use .push_back())
71  /// branchNames[i] = "bname"
72  /// branchClassNames[i] = "myns::MyClassType"
73  /// branchObjPointers[i] = (void**)&fCurMyClass;
74 
75  virtual void GetBranchInfo(std::vector<std::string>& branchNames,
76  std::vector<std::string>& branchClassNames,
77  std::vector<void**>& branchObjPointers);
78 
79  virtual TTree* GetMetaDataTree(); //
80 
81  /// print the current configuration
82  virtual void PrintConfig() = 0;
83 
84  /// specify list of flux neutrino species
85  virtual void SetFluxParticles(const PDGCodeList & particles);
86 
87  /// set flux neutrino initial z position (upstream of the detector)
88  /// pushed back from the normal flux window
89  virtual void SetUpstreamZ(double z0);
90 
91  /// limit cycling through input files
92  virtual void SetNumOfCycles(long int ncycle);
93 
94  protected: // visible to derived classes
95 
96  PDGCodeList * fPdgCList; ///< list of neutrino pdg-codes to generate
97  PDGCodeList * fPdgCListRej; ///< list of nu pdg-codes seen but rejected
98  std::string fXMLbasename; ///< XML file that might hold config param_sets
99  long int fNCycles; ///< # times to cycle through the ntuple(s)
100  long int fICycle; ///< current file cycle
101  ///< default 0 = infinitely
102  double fZ0; ///< configurable starting z position for
103  ///< each flux neutrino (in detector coord system)
104  };
105 
106 } // namespace flux
107 } // namespace genie
108 
109 #endif //GENIE_FLUX_GFLUXFILECONFIGI_H
virtual void LoadBeamSimData(const std::vector< std::string > &filenames, const std::string &det_loc)=0
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
std::string fXMLbasename
XML file that might hold config param_sets.
std::string string
Definition: nybbler.cc:12
virtual void PrintConfig()=0
print the current configuration
virtual void SetNumOfCycles(long int ncycle)
limit cycling through input files
string filename
Definition: train.py:213
A list of PDG codes.
Definition: PDGCodeList.h:32
virtual void SetXMLFileBase(std::string xmlbasename="")
virtual void SetUpstreamZ(double z0)
PDGCodeList * fPdgCList
list of neutrino pdg-codes to generate
long int fNCycles
times to cycle through the ntuple(s)
virtual std::string GetXMLFileBase() const
virtual void GetBranchInfo(std::vector< std::string > &branchNames, std::vector< std::string > &branchClassNames, std::vector< void ** > &branchObjPointers)
PDGCodeList * fPdgCListRej
list of nu pdg-codes seen but rejected
virtual void SetFluxParticles(const PDGCodeList &particles)
specify list of flux neutrino species