CRYHelper.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file CRYHelper.h
3 /// \brief Interface to the CRY cosmic ray generator
4 ///
5 /// For documentation on CRY, see: http://nuclear.llnl.gov/simulation/
6 /// and http://nuclear.llnl.gov/simulations/additional_bsd.html
7 ///
8 /// This class assumes that the user has a ROOT TGeoManager defined
9 ///
10 /// \author messier@indiana.edu
11 ////////////////////////////////////////////////////////////////////////
12 #ifndef EVGB_CRYHELPER_H
13 #define EVGB_CRYHELPER_H
14 #include <string>
15 #include <vector>
16 #include "CLHEP/Random/RandEngine.h"
17 
18 namespace simb { class MCTruth; }
19 
20 class CRYSetup;
21 class CRYGenerator;
22 class CRYParticle;
23 
24 namespace evgb {
25  /// Interface to the CRY cosmic-ray generator
26  class CRYHelper {
27  public:
28  CRYHelper();
29  explicit CRYHelper(fhicl::ParameterSet const& pset,
30  CLHEP::HepRandomEngine& engine,
31  std::string const& worldVol="vWorld");
32  ~CRYHelper();
33 
34  double Sample(simb::MCTruth& mctruth,
35  double const& surfaceY,
36  double const& detectorLength,
37  double* w,
38  double rantime=0);
39 
40  private:
41 
42  void WorldBox(double* xlo_cm,
43  double* xhi_cm,
44  double* ylo_cm,
45  double* yhi_cm,
46  double* zlo_cm,
47  double* zhi_cm) const;
48 
49  void ProjectToBoxEdge(const double xyz[],
50  const double dxyz[],
51  double &xlo, double &xhi,
52  double &ylo, double &yhi,
53  double &zlo, double &zhi,
54  double xyzout[]);
55 
56  CRYSetup* fSetup; ///< CRY configuration
57  CRYGenerator* fGen; ///< The CRY generator
58  double fSampleTime; ///< Amount of time to sample (seconds)
59  double fToffset; ///< Shift in time of particles (s)
60  double fEthresh; ///< Cut on kinetic energy (GeV)
61  std::string fWorldVolume; ///< Name of the world volume
62  std::string fLatitude; ///< Latitude of detector need space after value
63  std::string fAltitude; ///< Altitude of detector need space after value
64  std::string fSubBoxL; ///< Length of subbox (m) need space after value
65  double fBoxDelta; ///< Adjustment to the size of the world box in
66  ///< each dimension to avoid G4 rounding errors
67  bool fSingleEventMode; ///< flag to turn on producing only a single cosmic ray
68  };
69 
70  // The following stuff is for the random number gererator
71  template<class T> class RNGWrapper {
72  public:
73  static void set(T* object, double (T::*func)(void));
74  static double rng(void);
75  private:
76  static T* m_obj;
77  static double (T::*m_func)(void);
78  };// end of RNGWrapper class
79 
80  template<class T> T* RNGWrapper<T>::m_obj;
81 
82  template<class T> double (T::*RNGWrapper<T>::m_func)(void);
83 
84  template<class T> void RNGWrapper<T>::set(T* object, double (T::*func)(void)) {
85  m_obj = object; m_func = func;
86  }
87 
88  template<class T> double RNGWrapper<T>::rng(void) { return (m_obj->*m_func)(); }
89 
90 }
91 #endif // EVGB_CRYHELPER_H
92 ////////////////////////////////////////////////////////////////////////
double fSampleTime
Amount of time to sample (seconds)
Definition: CRYHelper.h:58
Interface to the CRY cosmic-ray generator.
Definition: CRYHelper.h:26
static T * m_obj
Definition: CRYHelper.h:76
CRYSetup * fSetup
CRY configuration.
Definition: CRYHelper.h:56
std::string fLatitude
Latitude of detector need space after value.
Definition: CRYHelper.h:62
CRYGenerator * fGen
The CRY generator.
Definition: CRYHelper.h:57
Definition: novas.h:112
std::string fWorldVolume
Name of the world volume.
Definition: CRYHelper.h:61
double fBoxDelta
Definition: CRYHelper.h:65
std::string fAltitude
Altitude of detector need space after value.
Definition: CRYHelper.h:63
double func(double x, double y)
bool fSingleEventMode
flag to turn on producing only a single cosmic ray
Definition: CRYHelper.h:67
This class describes a particle created in the detector Monte Carlo simulation.
std::string fSubBoxL
Length of subbox (m) need space after value.
Definition: CRYHelper.h:64
double fEthresh
Cut on kinetic energy (GeV)
Definition: CRYHelper.h:60
Physics generators for neutrinos, cosmic rays, and others.
Definition: CRYHelper.cxx:33
void ProjectToBoxEdge(const double xyz[], const double dxyz[], double xlo, double xhi, double ylo, double yhi, double zlo, double zhi, double xyzout[])
Project along a direction from a particular starting point to the edge of a box.
Definition: Geo.cxx:38
double T
Definition: Xdiff_gwt.C:5
Event generator information.
Definition: MCTruth.h:32
Float_t w
Definition: plot.C:20
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData
double fToffset
Shift in time of particles (s)
Definition: CRYHelper.h:59
enum BeamMode string