Jpp  debug
the software that should make you happy
JEvtWeightFactorGSeaGen.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JEVTWEIGHTFACTORGSEAGEN__
2 #define __JAANET__JEVTWEIGHTFACTORGSEAGEN__
3 
5 
8 
9 #include "JLang/JClonable.hh"
10 #include "JLang/JException.hh"
11 
13 
14 
15 /**
16  * \author bjung
17  */
18 
19 namespace JAANET {}
20 namespace JPP { using namespace JAANET; }
21 
22 namespace JAANET {
23 
24  using JLANG::JClonable;
25 
26 
27  /**
28  * Implementation of reweighting factor for simulated neutrino interactions according to a specifiable ROOT TFormula.
29  *
30  * Note: The ROOT TFormula may assume any number of parameters, but should be restricted to\n
31  * the physical variables listed among `JEvtWeightFactorGSeaGen::variables`.\n
32  * These variables may be specified within the ROOT TFormula as 'x[<index>]',\n
33  * where <index> corresponds to the index of the desired physical variable within `JEvtWeightFactorGSeaGen::variables`.
34  */
36  public JClonable<JEvtWeightFactorTFormula, JEvtWeightFactorGSeaGen>
37  {
38  public:
39 
40  /**
41  * Indices of reweighting variables for GSeaGen.
42  */
43  enum variables {
44  COSTH, //!< Cosine zenith angle
45  INITIAL_STATE_ENERGY, //!< Initial state energy
46  NEUTRINO_ENERGY, //!< Initial state neutrino energy
47  FINAL_STATE_ENERGY, //!< Final state energy
48  LEADING_LEPTON_ENERGY, //!< Final state leading lepton energy
49  BJORKEN_X, //!< Björken-x (= fractional momentum carried by the struck nucleon)
50  INELASTICITY, //!< Inelasticity (= Björken-y)
51  INTERACTION_TYPE, //!< Interaction channel type
52  CURRENT_TYPE, //!< Weak current type (CC or NC)
53  XSEC, //!< Exclusive total cross-section of the interaction
54  XSEC_MEAN, //!< Average interaction cross-section per nucleon along neutrino path [m2]
55  XSEC_DIFFERENTIAL, //!< Differential cross-section of the interaction
56  XSEC_WATER, //!< Inclusive cross-section in water
57  INT_LENGTH_WATER, //!< Interaction length in pure water
58  COLUMN_DEPTH, //!< Column density [m.w.e]
59  P_EARTH, //!< Earth transmission probability
60  P_SCALE, //!< GENIE ineraction probability scale
61  TARGET_A, //!< Number of nucleons in the target
62  TARGET_Z, //!< Number of protons in the target
63 
64  NUMBER_OF_VARIABLES //!< Number of reweighting variables; \n
65  //!< N.B.\ This enum value needs to be specified last!
66  };
67 
68 
69  /**
70  * Default constructor.
71  */
73  {}
74 
75 
76  /**
77  * Check whether this formula is valid.
78  *
79  * \return true if valid; else false
80  */
81  bool is_valid() const override final
82  {
83  const int N = getFormula().GetNpar();
84 
85  return N >= 0 && N <= (int) NUMBER_OF_VARIABLES;
86  }
87 
88 
89  /**
90  * Get weighting factor for given event.
91  *
92  * \param evt event
93  * \return weighting factor
94  */
95  double getFactor(const Evt& evt) const override final
96  {
97  using namespace std;
98  using namespace JPP;
99 
100  Double_t vars[NUMBER_OF_VARIABLES] = { 0.0 };
101 
102  const Trk& neutrino = get_neutrino (evt);
103  const Trk& leading_lepton = get_leading_lepton(evt);
104 
105  vars[COSTH] = neutrino.dir.z;
106  vars[INITIAL_STATE_ENERGY] = getE0(evt);
107  vars[NEUTRINO_ENERGY] = neutrino.E;
108  vars[FINAL_STATE_ENERGY] = getE1(evt);
109  vars[LEADING_LEPTON_ENERGY] = leading_lepton.E;
110  vars[BJORKEN_X] = evt.w2list[W2LIST_GSEAGEN_BX];
111  vars[INELASTICITY] = evt.w2list[W2LIST_GSEAGEN_BY];
112  vars[INTERACTION_TYPE] = evt.w2list[W2LIST_GSEAGEN_ICHAN];
113  vars[CURRENT_TYPE] = evt.w2list[W2LIST_GSEAGEN_CC];
114  vars[XSEC] = evt.w2list[W2LIST_GSEAGEN_XSEC];
115  vars[XSEC_MEAN] = evt.w2list[W2LIST_GSEAGEN_XSEC_MEAN];
116  vars[XSEC_DIFFERENTIAL] = evt.w2list[W2LIST_GSEAGEN_DXSEC];
117  vars[XSEC_WATER] = evt.w2list[W2LIST_GSEAGEN_WATERXSEC];
119  vars[COLUMN_DEPTH] = evt.w2list[W2LIST_GSEAGEN_COLUMN_DEPTH];
120  vars[P_EARTH] = evt.w2list[W2LIST_GSEAGEN_P_EARTH];
121  vars[P_SCALE] = evt.w2list[W2LIST_GSEAGEN_P_SCALE];
122  vars[TARGET_A] = evt.w2list[W2LIST_GSEAGEN_TARGETA];
123  vars[TARGET_Z] = evt.w2list[W2LIST_GSEAGEN_TARGETZ];
124 
125  return getFormula().EvalPar(&vars[0]);
126  }
127  };
128 }
129 
130 #endif
Exceptions.
Implementation of reweighting factor for simulated neutrino interactions according to a specifiable R...
JEvtWeightFactorGSeaGen()
Default constructor.
double getFactor(const Evt &evt) const override final
Get weighting factor for given event.
variables
Indices of reweighting variables for GSeaGen.
@ TARGET_A
Number of nucleons in the target.
@ BJORKEN_X
Björken-x (= fractional momentum carried by the struck nucleon)
@ INELASTICITY
Inelasticity (= Björken-y)
@ XSEC_MEAN
Average interaction cross-section per nucleon along neutrino path [m2].
@ XSEC
Exclusive total cross-section of the interaction.
@ INITIAL_STATE_ENERGY
Initial state energy.
@ P_EARTH
Earth transmission probability.
@ INT_LENGTH_WATER
Interaction length in pure water.
@ NUMBER_OF_VARIABLES
Number of reweighting variables; N.B. This enum value needs to be specified last!
@ INTERACTION_TYPE
Interaction channel type.
@ TARGET_Z
Number of protons in the target.
@ LEADING_LEPTON_ENERGY
Final state leading lepton energy.
@ NEUTRINO_ENERGY
Initial state neutrino energy.
@ XSEC_DIFFERENTIAL
Differential cross-section of the interaction.
@ P_SCALE
GENIE ineraction probability scale.
@ CURRENT_TYPE
Weak current type (CC or NC)
@ XSEC_WATER
Inclusive cross-section in water.
bool is_valid() const override final
Check whether this formula is valid.
Extensions to Evt data format.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
const Trk & get_leading_lepton(const Evt &event)
Auxiliary function to retrieve the leading lepton of a neutrino interaction.
double getE1(const Evt &evt)
Get final state energy of a neutrino interaction.
double getE0(const Evt &evt)
Get initial state energy of a neutrino interaction.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:21
Template class for object cloning.
Definition: JClonable.hh:59
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:15
Vec dir
track direction
Definition: Trk.hh:18
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:20
double z
Definition: Vec.hh:14
static const int W2LIST_GSEAGEN_COLUMN_DEPTH
Line integrated column density through the Earth for the neutrino direction.
static const int W2LIST_GSEAGEN_BX
Bjorken x.
static const int W2LIST_GSEAGEN_DXSEC
differential cross section of the interaction (dsigma/dxdy) extracted from genie
static const int W2LIST_GSEAGEN_WATERXSEC
inclusive xsec in water
static const int W2LIST_GSEAGEN_CC
Charged current interaction flag.
static const int W2LIST_GSEAGEN_XSEC_MEAN
Average interaction cross-section per nucleon along the neutrino path throuh the Earth (in units of m...
static const int W2LIST_GSEAGEN_XSEC
exclusive total cross section of the interaction
static const int W2LIST_GSEAGEN_TARGETZ
number of protons in the target
static const int W2LIST_GSEAGEN_P_SCALE
Interaction probability scale.
static const int W2LIST_GSEAGEN_TARGETA
number of nuclons in the target
static const int W2LIST_GSEAGEN_ICHAN
Interaction channel.
static const int W2LIST_GSEAGEN_BY
Bjorken y.
static const int W2LIST_GSEAGEN_WATER_INT_LEN
Interaction length in pure water in m.
static const int W2LIST_GSEAGEN_P_EARTH
Transmission probability in the Earth (XSEC_MEAN and COLUMN_DEPTH used to compute PEarth)