dkmeta.h
Go to the documentation of this file.
1 /**
2  * \class bsim::DkMeta
3  * \file dkmeta.h
4  *
5  * \brief A class that defines the "DkMeta" object used as the
6  * branch for a TTree for the output of meta-data from
7  * neutrino flux simulations such as g4numi, g4numi_flugg, etc.
8  * This tree has one entry of this type for the file. Kept
9  * as a tree so files can be chained.
10  *
11  * \author (last to touch it) $Author: rhatcher $
12  *
13  * \version $Revision: 1.3 $
14  *
15  * \date $Date: 2012-11-21 04:44:50 $
16  *
17  * Contact: rhatcher@fnal.gov
18  *
19  * $Id: dkmeta.h,v 1.3 2012-11-21 04:44:50 rhatcher Exp $
20  *
21  * Notes tagged with "DKMETA" are questions that should be answered
22  */
23 
24 #ifndef BSIM_DKMETA_H
25 #define BSIM_DKMETA_H
26 
27 #include "TROOT.h"
28 #include "TObject.h"
29 
30 #include <vector>
31 #include <string>
32 
33 #define DKMETAVER 6 // KEEP THIS UP-TO-DATE! increment for each change
34 
35 namespace bsim {
36  /**
37  * All the data members are public as these classes are used as
38  * generalized structs. As they will be branches of a TTree no
39  * specialized naming indicators signifying that they are member data
40  * of a class will be used, nor will any fancy capitalization schemes.
41  *
42  * All classes must implement a clear() method that resets their values
43  * to an identifiably invalid state or clears any vectors. Additionally
44  * classes should provide a AsString() method for formatting themselves
45  * for use output.
46  */
47 
48  ///---------------------------------------------------------------------------
49  /**
50  *============================================================================
51  * Specified location where energy and weight will be evaluated
52  * Assume to be in beam coordinate system w/ units of cm
53  */
54  class Location
55  {
56  public:
57  Double_t x; ///< x position of location
58  Double_t y; ///< y position of location
59  Double_t z; ///< z position of location
60  std::string name; ///< identifying name
61 
62  public:
63  Location();
64  Location(double x, double y, double z, std::string name);
65  virtual ~Location();
66  void clear(const std::string &opt = ""); ///< reset everything
67  std::string AsString(const std::string& opt = "") const;
68 
69  private:
70  ClassDef(bsim::Location,DKMETAVER)
71  }; // end-of-class bsim::Location
72 
73  ///---------------------------------------------------------------------------
74  /**
75  *============================================================================
76  * Metadata for the flux file
77  */
78  class DkMeta
79  {
80  public:
81 
82  /**
83  *============================================================================
84  * General information
85  */
86  Int_t job; ///< identifying job # (keep files distinct)
87  Double_t pots; ///< protons-on-target
88 
89  /**
90  * DKMETA:
91  * formatted strings are most flexible ...
92  * but not necessarily convenient to use
93  * ??? Should parts of these be standardized ???
94  */
95  std::string beamsim; ///< e.g. "flugg" or "g4numi/<tag>"
96  std::string physics; ///< e.g. "fluka08", "g4.9.3p01"
97  std::string physcuts; ///< tracking cuts e.g. "threshold=0.1GeV"
98  std::string tgtcfg; ///< target config e.g. "minos/epoch3/-10cm"
99  std::string horncfg; ///< horn config e.g. "FHC/185A/LE/h1xoff=1mm"
100  std::string dkvolcfg; ///< decay vol config e.g. "helium" or "vacuum"
101 
102  /**
103  *============================================================================
104  * Beam Info:
105  */
106  Double_t beam0x; ///< x of beam center at start
107  Double_t beam0y; ///< y of beam center at start
108  Double_t beam0z; ///< z of beam start
109  Double_t beamhwidth; ///< horizontal width of beam
110  Double_t beamvwidth; ///< vertical width of beam
111  Double_t beamdxdz; ///< beam slope dx/dz
112  Double_t beamdydz; ///< beam slope dy/dz
113 
114  /**
115  *============================================================================
116  * Detector Position Info:
117  * Values are in beam coordinate system w/ units of "cm"
118  */
119  std::vector<bsim::Location> location; ///< locations
120 
121  /**
122  *============================================================================
123  * Special Info:
124  * Document extensibility enhancements
125  */
126  std::vector<std::string> vintnames; ///< names of elements for user defined vector of integers
127  std::vector<std::string> vdblnames; ///< names of elements for user defined vector of doubles
128 
129  public:
130  /**
131  * Public methods for constructing/destruction and resetting the data
132  */
133  DkMeta();
134  virtual ~DkMeta();
135  void clear(const std::string &opt = ""); ///< reset everything
136  std::string AsString(const std::string& opt = "") const; ///< output as a string
137 
138  private:
139  ClassDef(bsim::DkMeta,DKMETAVER)
140 
141  }; // end-of-class bsim::DkMeta
142 
143 } // end-of-namespace "bsim"
144 
145 // not part of namespace bsim
146 std::ostream& operator<<(std::ostream& os, const bsim::DkMeta& dkmeta);
147 std::ostream& operator<<(std::ostream& os, const bsim::Location& location);
148 
149 #endif // BSIM_DKMETA_H
std::vector< bsim::Location > location
locations
Definition: dkmeta.h:119
std::string name
identifying name
Definition: dkmeta.h:60
std::vector< std::string > vintnames
names of elements for user defined vector of integers
Definition: dkmeta.h:126
#define location
void clear(const std::string &opt="")
reset everything
Double_t beamvwidth
vertical width of beam
Definition: dkmeta.h:110
Double_t beamhwidth
horizontal width of beam
Definition: dkmeta.h:109
std::string physcuts
tracking cuts e.g. "threshold=0.1GeV"
Definition: dkmeta.h:97
bsim namespace for beam simulation classes and functions
Definition: GDk2NuFlux.h:59
std::string dkvolcfg
decay vol config e.g. "helium" or "vacuum"
Definition: dkmeta.h:100
bsim::DkMeta * dkmeta
Double_t beamdydz
beam slope dy/dz
Definition: dkmeta.h:112
Int_t job
identifying job # (keep files distinct)
Definition: dkmeta.h:86
Double_t x
x position of location
Definition: dkmeta.h:57
Double_t beam0y
y of beam center at start
Definition: dkmeta.h:107
Double_t pots
protons-on-target
Definition: dkmeta.h:87
std::string tgtcfg
target config e.g. "minos/epoch3/-10cm"
Definition: dkmeta.h:98
std::vector< std::string > vdblnames
names of elements for user defined vector of doubles
Definition: dkmeta.h:127
std::string physics
e.g. "fluka08", "g4.9.3p01"
Definition: dkmeta.h:96
std::string beamsim
e.g. "flugg" or "g4numi/<tag>"
Definition: dkmeta.h:95
Double_t beam0z
z of beam start
Definition: dkmeta.h:108
Double_t z
z position of location
Definition: dkmeta.h:59
std::ostream & operator<<(std::ostream &os, const bsim::DkMeta &dkmeta)
std::string horncfg
horn config e.g. "FHC/185A/LE/h1xoff=1mm"
Definition: dkmeta.h:99
Double_t y
y position of location
Definition: dkmeta.h:58
Double_t beam0x
x of beam center at start
Definition: dkmeta.h:106
std::string AsString(const std::string &opt="") const
#define DKMETAVER
Definition: dkmeta.h:33
Double_t beamdxdz
beam slope dx/dz
Definition: dkmeta.h:111
virtual ~Location()
enum BeamMode string