Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Attributes | List of all members
JAANET::JWeightGSeaGen Struct Reference

Implementation of event weighing for GSeaGen data. More...

#include <JWeightGSeaGen.hh>

Inheritance diagram for JAANET::JWeightGSeaGen:
JLANG::JClonable< JClonable_t, JDerived_t >

Public Types

typedef JClonable< JClonable_t >
::clone_type 
clone_type
 

Public Member Functions

 JWeightGSeaGen ()
 Default Constructor. More...
 
 JWeightGSeaGen (const JHead &header)
 Constructor. More...
 
virtual void configure (const JHead &header) override
 Configuration. More...
 
virtual bool check (const JHead &header) const override
 Check whether header is consistent with this event weighter. More...
 
virtual double getWeight (const Evt &evt) const override
 Get weight of given event. More...
 
virtual double getWeight (const Evt &evt, const double flux) const override
 Get weight of given event. More...
 
virtual clone_type clone () const override
 Get clone of this object. More...
 

Private Attributes

double W
 

Detailed Description

Implementation of event weighing for GSeaGen data.

Definition at line 28 of file JWeightGSeaGen.hh.

Member Typedef Documentation

template<class JClonable_t, class JDerived_t = JNullType>
typedef JClonable<JClonable_t>::clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone_type
inherited

Definition at line 61 of file JClonable.hh.

Constructor & Destructor Documentation

JAANET::JWeightGSeaGen::JWeightGSeaGen ( )
inline

Default Constructor.

Definition at line 34 of file JWeightGSeaGen.hh.

34  : W(0.0)
35  {}
JAANET::JWeightGSeaGen::JWeightGSeaGen ( const JHead header)
inline

Constructor.

Parameters
headerheader

Definition at line 43 of file JWeightGSeaGen.hh.

44  {
45  configure(header);
46  }
virtual void configure(const JHead &header) override
Configuration.

Member Function Documentation

virtual void JAANET::JWeightGSeaGen::configure ( const JHead header)
inlineoverridevirtual

Configuration.

Parameters
headerheader

Definition at line 54 of file JWeightGSeaGen.hh.

55  {
56  if (check(header) && (header.tgen.numberOfSeconds > 0.0 &&
57  header.genvol.numberOfEvents > 0.0)) {
58 
59  W = 1.0 / header.genvol.numberOfEvents / header.tgen.numberOfSeconds;
60 
61  } else {
62 
63  THROW(JValueOutOfRange, "JWeightGSeaGen::configure(): Provided header is inconsistent with GSeaGen.");
64  }
65  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
virtual bool check(const JHead &header) const override
Check whether header is consistent with this event weighter.
virtual bool JAANET::JWeightGSeaGen::check ( const JHead header) const
inlineoverridevirtual

Check whether header is consistent with this event weighter.

Parameters
headerheader
Returns
true if consistent; else false

Definition at line 74 of file JWeightGSeaGen.hh.

75  {
76  return is_gseagen(header);
77  }
bool is_gseagen(const JHead &header)
Check for generator.
Definition: JHeadToolkit.hh:60
virtual double JAANET::JWeightGSeaGen::getWeight ( const Evt evt) const
inlineoverridevirtual

Get weight of given event.

Parameters
evtevent
Returns
weight [Hz]

Definition at line 86 of file JWeightGSeaGen.hh.

87  {
88  if (evt.w.size() > 2 && !(evt.w[2] < 0.0)) {
89 
90  return W * evt.w[2];
91 
92  } else {
93 
94  if (evt.w.size() < 3) {
95  THROW(JIndexOutOfRange, "JWeightGSeaGen::getWeight(): w3-weight is empty.");
96  } else {
97  THROW(JValueOutOfRange, "JWeightGSeaGen::getWeight(): w3-weight is negative.");
98  }
99  }
100  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]]=w3 (see e.g. Tag list)
Definition: Evt.hh:39
virtual double JAANET::JWeightGSeaGen::getWeight ( const Evt evt,
const double  flux 
) const
inlineoverridevirtual

Get weight of given event.

Parameters
evtevent
fluxneutrino flux [m^-2 s^-1 sr^-1 GeV^-1]
Returns
weight [Hz]

Definition at line 110 of file JWeightGSeaGen.hh.

112  {
113  if (evt.w.size() > 1 && !(evt.w[1] < 0.0 || flux < 0.0)) {
114 
115  return W * evt.w[1] * flux;
116 
117  } else {
118 
119  if (evt.w.size() < 2) {
120  THROW(JIndexOutOfRange, "JWeightGSeaGen::getWeight(): w2-weight is empty.");
121  } else {
122  THROW(JValueOutOfRange, "JWeightGSeaGen::getWeight(): w2-weight or flux is negative");
123  }
124  }
125  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]]=w3 (see e.g. Tag list)
Definition: Evt.hh:39
template<class JClonable_t, class JDerived_t = JNullType>
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

Member Data Documentation

double JAANET::JWeightGSeaGen::W
private

Definition at line 128 of file JWeightGSeaGen.hh.


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