Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Friends | List of all members
JAANET::JEvtWeightFactorGSeaGen Struct Reference

Implementation of reweighting factor for simulated neutrino interactions according to a specifiable ROOT TFormula. More...

#include <JEvtWeightFactorGSeaGen.hh>

Inheritance diagram for JAANET::JEvtWeightFactorGSeaGen:
JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >

Public Types

enum  variables {
  COSTH, ENERGY, BJORKEN_X, INELASTICITY,
  INTERACTION_TYPE, CURRENT_TYPE, XSEC, XSEC_MEAN,
  XSEC_DIFFERENTIAL, XSEC_WATER, INT_LENGTH_WATER, COLUMN_DEPTH,
  P_EARTH, P_SCALE, TARGET_A, TARGET_Z,
  NUMBER_OF_VARIABLES
}
 Indices of reweighting variables for GSeaGen. More...
 
typedef JEvtWeightFactorHelper
< JEvtWeightFactor_t > 
JEvtWeightFactorHelper_t
 
typedef std::shared_ptr
< JEvtWeightFactor_t > 
pointer_type
 

Public Member Functions

 JEvtWeightFactorGSeaGen ()
 Default constructor. More...
 
 JEvtWeightFactorGSeaGen (const JFlux &flux, const char *name, const char *formula)
 Constructor. More...
 
double operator() (const Evt &evt) const
 Get weighting factor for given event. More...
 
void configure (const JEvtWeightFactor_t &factor)
 Configure event-weight factor. More...
 
JEvtWeightFactor_t & getEvtWeightFactor () const
 Get reference to event-weight factor. More...
 
double getFactor (const Evt &evt) const
 Get weight-factor of given event. More...
 

Friends

std::istream & operator>> (std::istream &in, JEvtWeightFactorGSeaGen &object)
 Stream input. More...
 
std::ostream & operator<< (std::ostream &out, const JEvtWeightFactorGSeaGen &object)
 Stream output. More...
 

Detailed Description

Implementation of reweighting factor for simulated neutrino interactions according to a specifiable ROOT TFormula.

Note: The ROOT TFormula may assume any number of parameters, but should be restricted to
the physical variables listed among JEvtWeightFactorGSeaGen::variables.
These variables may be specified within the ROOT TFormula as 'x[<index>]',
where <index> corresponds to the index of the desired physical variable within JEvtWeightFactorGSeaGen::variables.

Definition at line 38 of file JEvtWeightFactorGSeaGen.hh.

Member Typedef Documentation

template<class JEvtWeightFactor_t>
typedef JEvtWeightFactorHelper<JEvtWeightFactor_t> JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::JEvtWeightFactorHelper_t
inherited

Definition at line 32 of file JEvtWeightFactorHelper.hh.

template<class JEvtWeightFactor_t>
typedef std::shared_ptr<JEvtWeightFactor_t> JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::pointer_type
inherited

Definition at line 33 of file JEvtWeightFactorHelper.hh.

Member Enumeration Documentation

Indices of reweighting variables for GSeaGen.

Enumerator
COSTH 

Cosine zenith angle.

ENERGY 

Initial state energy.

BJORKEN_X 

Björken-x (= fractional momentum carried by the struck nucleon)

INELASTICITY 

Inelasticity (= Björken-y)

INTERACTION_TYPE 

Interaction channel type.

CURRENT_TYPE 

Weak current type (CC or NC)

XSEC 

Exclusive total cross-section of the interaction.

XSEC_MEAN 

Average interaction cross-section per nucleon along neutrino path [m2].

XSEC_DIFFERENTIAL 

Differential cross-section of the interaction.

XSEC_WATER 

Inclusive cross-section in water.

INT_LENGTH_WATER 

Interaction length in pure water.

COLUMN_DEPTH 

Column density [m.w.e].

P_EARTH 

Earth transmission probability.

P_SCALE 

GENIE ineraction probability scale.

TARGET_A 

Number of nucleons in the target.

TARGET_Z 

Number of protons in the target.

NUMBER_OF_VARIABLES 

Number of reweighting variables;
N.B. This enum value needs to be specified last!

Definition at line 45 of file JEvtWeightFactorGSeaGen.hh.

45  {
46  COSTH, //!< Cosine zenith angle
47  ENERGY, //!< Initial state energy
48  BJORKEN_X, //!< Björken-x (= fractional momentum carried by the struck nucleon)
49  INELASTICITY, //!< Inelasticity (= Björken-y)
50  INTERACTION_TYPE, //!< Interaction channel type
51  CURRENT_TYPE, //!< Weak current type (CC or NC)
52  XSEC, //!< Exclusive total cross-section of the interaction
53  XSEC_MEAN, //!< Average interaction cross-section per nucleon along neutrino path [m2]
54  XSEC_DIFFERENTIAL, //!< Differential cross-section of the interaction
55  XSEC_WATER, //!< Inclusive cross-section in water
56  INT_LENGTH_WATER, //!< Interaction length in pure water
57  COLUMN_DEPTH, //!< Column density [m.w.e]
58  P_EARTH, //!< Earth transmission probability
59  P_SCALE, //!< GENIE ineraction probability scale
60  TARGET_A, //!< Number of nucleons in the target
61  TARGET_Z, //!< Number of protons in the target
62  NUMBER_OF_VARIABLES //!< Number of reweighting variables; \n
63  //!< N.B.\ This enum value needs to be specified last!
64  };
GENIE ineraction probability scale.
Exclusive total cross-section of the interaction.
Average interaction cross-section per nucleon along neutrino path [m2].
Number of reweighting variables; N.B. This enum value needs to be specified last! ...
Differential cross-section of the interaction.
Björken-x (= fractional momentum carried by the struck nucleon)

Constructor & Destructor Documentation

JAANET::JEvtWeightFactorGSeaGen::JEvtWeightFactorGSeaGen ( )
inline

Default constructor.

Definition at line 70 of file JEvtWeightFactorGSeaGen.hh.

70  :
71  JFluxHelper(),
72  TFormula()
73  {}
JEvtWeightFactorHelper< JFlux > JFluxHelper
Type definition of event-weight factor helper for flux functions.
JAANET::JEvtWeightFactorGSeaGen::JEvtWeightFactorGSeaGen ( const JFlux flux,
const char *  name,
const char *  formula 
)
inline

Constructor.

Parameters
fluxflux function
namename
formulaformula

Definition at line 83 of file JEvtWeightFactorGSeaGen.hh.

85  :
86  JFluxHelper(flux),
87  TFormula(name, formula)
88  {}
JEvtWeightFactorHelper< JFlux > JFluxHelper
Type definition of event-weight factor helper for flux functions.
then fatal The output file must have the wildcard in the name
Definition: JCanberra.sh:31

Member Function Documentation

double JAANET::JEvtWeightFactorGSeaGen::operator() ( const Evt evt) const
inline

Get weighting factor for given event.

Parameters
evtevent
Returns
weighting factor

Definition at line 97 of file JEvtWeightFactorGSeaGen.hh.

98  {
99  using namespace std;
100  using namespace JPP;
101 
102  if (static_cast<const JFluxHelper&>(*this)) {
103 
104  Double_t vars[NUMBER_OF_VARIABLES] = { 0.0 };
105 
106  const Trk& neutrino = get_neutrino(evt);
107  const double flux = getFactor(evt);
108 
109  vars[COSTH] = neutrino.dir.z;
110  vars[ENERGY] = getE0(evt);
111  vars[BJORKEN_X] = evt.w2list[W2LIST_GSEAGEN_BX];
115  vars[XSEC] = evt.w2list[W2LIST_GSEAGEN_XSEC];
125 
126  return this->DoEval(&vars[0]) * flux;
127 
128  } else {
129 
130  THROW(JNullPointerException, "JEvtWeightFactorGSeaGen::operator(): Unspecified flux function.");
131  }
132  }
static const int W2LIST_GSEAGEN_BX
Bjorken x.
static const int W2LIST_GSEAGEN_P_SCALE
Interaction probability scale.
GENIE ineraction probability scale.
double z
Definition: Vec.hh:14
double getE0(const Evt &evt)
Get initial state energy of a neutrino interaction.
static const int W2LIST_GSEAGEN_XSEC
exclusive total cross section of the interaction
Vec dir
track direction
Definition: Trk.hh:18
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
static const int W2LIST_GSEAGEN_TARGETZ
number of protons in the target
Exclusive total cross-section of the interaction.
Average interaction cross-section per nucleon along neutrino path [m2].
Number of reweighting variables; N.B. This enum value needs to be specified last! ...
static const int W2LIST_GSEAGEN_TARGETA
number of nuclons in the target
Differential cross-section of the interaction.
double getFactor(const Evt &evt) const
Get weight-factor of given event.
static const int W2LIST_GSEAGEN_ICHAN
Interaction channel.
Neutrino flux.
Definition: JHead.hh:906
Björken-x (= fractional momentum carried by the struck nucleon)
static const int W2LIST_GSEAGEN_WATER_INT_LEN
Interaction length in pure water in m.
static const int W2LIST_GSEAGEN_CC
Charged current interaction flag.
static const int W2LIST_GSEAGEN_BY
Bjorken y.
static const int W2LIST_GSEAGEN_P_EARTH
Transmission probability in the Earth (XSEC_MEAN and COLUMN_DEPTH used to compute PEarth) ...
static const int W2LIST_GSEAGEN_WATERXSEC
inclusive xsec in water
static const int W2LIST_GSEAGEN_COLUMN_DEPTH
Line integrated column density through the Earth for the neutrino direction.
static const int W2LIST_GSEAGEN_DXSEC
differential cross section of the interaction (dsigma/dxdy) extracted from genie
static const int W2LIST_GSEAGEN_XSEC_MEAN
Average interaction cross-section per nucleon along the neutrino path throuh the Earth (in units of m...
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:14
std::vector< double > w2list
MC: factors that make up w[1]=w2 (see e.g. Tag list or km3net-dataformat/definitions) ...
Definition: Evt.hh:43
template<class JEvtWeightFactor_t>
void JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::configure ( const JEvtWeightFactor_t &  factor)
inlineinherited

Configure event-weight factor.

Parameters
factorevent-weight factor

Definition at line 59 of file JEvtWeightFactorHelper.hh.

60  {
61  using namespace JPP;
62 
63  JEvtWeightFactor_t* p = dynamic_cast<JEvtWeightFactor_t*>(factor.clone());
64 
65  if (p != NULL) {
66  this->reset(p);
67  } else {
68  THROW(JNullPointerException, "JEvtWeightFactorHelper::configure(): Invalid downcast to class derived from JEvtWeightFactor.");
69  }
70  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
void reset(T &value)
Reset value.
template<class JEvtWeightFactor_t>
JEvtWeightFactor_t& JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::getEvtWeightFactor ( ) const
inlineinherited

Get reference to event-weight factor.

Returns
reference to event-weight factor

Definition at line 78 of file JEvtWeightFactorHelper.hh.

79  {
80  using namespace JPP;
81 
82  if (static_cast<const JEvtWeightFactorHelper_t&>(*this)) {
83  return *(this->get());
84  } else {
85  THROW(JNullPointerException, "JEvtWeightFactorHelper::getEvtWeightFactor(): Event-weight factor is not set.");
86  }
87  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
template<class JEvtWeightFactor_t>
double JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::getFactor ( const Evt evt) const
inlineinherited

Get weight-factor of given event.

Parameters
evtevent
Returns
event-weight factor

Definition at line 96 of file JEvtWeightFactorHelper.hh.

97  {
98  const JEvtWeightFactor_t& weightFactor = getEvtWeightFactor();
99 
100  return weightFactor.getFactor(evt);
101  }
JEvtWeightFactor_t & getEvtWeightFactor() const
Get reference to event-weight factor.

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JEvtWeightFactorGSeaGen object 
)
friend

Stream input.

Parameters
ininput stream
objectgSeaGen event-weight factor
Returns
input stream

Definition at line 142 of file JEvtWeightFactorGSeaGen.hh.

144  {
145  using namespace std;
146  using namespace JPP;
147 
148  typedef JToken<';'> JToken_t;
149 
150  JToken_t formula;
151  JToken_t equation;
152 
153  in >> formula;
154 
155  object.Clear();
156  object.Compile(formula.c_str());
157 
158  for (int count = 0; count < object.GetNpar() && in >> equation; ++count) {
159 
160  const int index = getParameter(equation);
161  const double value = getValue(equation, 0);
162 
163  object.SetParameter(index, value);
164  }
165 
166  return in;
167  }
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
Definition: JScale.hh:47
int getParameter(const std::string &text)
Get parameter number from text string.
then usage $script< input file >[option] nPossible options count
Definition: JVolume1D.sh:31
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
std::ostream& operator<< ( std::ostream &  out,
const JEvtWeightFactorGSeaGen object 
)
friend

Stream output.

Parameters
outoutput stream
objectgSeaGen event-weight factor
Returns
output stream

Definition at line 177 of file JEvtWeightFactorGSeaGen.hh.

179  {
180  using namespace std;
181  using namespace JPP;
182 
183  out << object.GetExpFormula() << ';';
184 
185  for (int i = 0; i < object.GetNpar(); ++i) {
186  out << " p" << i << " = " << SCIENTIFIC(6,3) << object.GetParameter(i) << ';';
187  }
188 
189  return out;
190  }
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:486

The documentation for this struct was generated from the following file: