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::JWeightKM3BUU Struct Reference

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

#include <JWeightKM3BUU.hh>

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

Public Types

typedef JClonable< JClonable_t >
::clone_type 
clone_type
 

Public Member Functions

 JWeightKM3BUU ()
 Default constructor. More...
 
 JWeightKM3BUU (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 KM3BUU data.

Definition at line 28 of file JWeightKM3BUU.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::JWeightKM3BUU::JWeightKM3BUU ( )
inline

Default constructor.

Definition at line 34 of file JWeightKM3BUU.hh.

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

Constructor.

Parameters
headerheader

Definition at line 43 of file JWeightKM3BUU.hh.

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

Member Function Documentation

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

Configuration.

Parameters
headerheader
Returns
true if okay; else false

Definition at line 55 of file JWeightKM3BUU.hh.

56  {
57  if (check(header) && (header.tgen.numberOfSeconds > 0.0 &&
58  header.genvol.numberOfEvents > 0.0)) {
59 
60  W = 1.0 / header.genvol.numberOfEvents / header.tgen.numberOfSeconds;
61 
62  } else {
63 
64  THROW(JValueOutOfRange, "JWeightKM3BUU::configure(): Provided header is inconsistent with KM3BUU.");
65  }
66  }
#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::JWeightKM3BUU::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 75 of file JWeightKM3BUU.hh.

76  {
77  return is_km3buu(header);
78  }
bool is_km3buu(const JHead &header)
Check for generator.
virtual double JAANET::JWeightKM3BUU::getWeight ( const Evt evt) const
inlineoverridevirtual

Get weight of given event.

Parameters
evtevent
Returns
weight [Hz]

Definition at line 87 of file JWeightKM3BUU.hh.

88  {
89  if (evt.w.size() > 2 && evt.w[2] > 0.0) {
90 
91  return W * evt.w[2];
92 
93  } else {
94 
95  if (evt.w.size() < 3) {
96  THROW(JIndexOutOfRange, "JWeightKM3BUU::getWeight(): w3-weight is empty.");
97  } else {
98  THROW(JValueOutOfRange, "JWeightKM3BUU::getWeight(): w3-weight is negative.");
99  }
100  }
101  }
#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::JWeightKM3BUU::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 111 of file JWeightKM3BUU.hh.

113  {
114  if (evt.w.size() > 1 && !(evt.w[1] < 0.0 || flux < 0.0)) {
115 
116  return W * evt.w[1] * flux;
117 
118  } else {
119 
120  if (evt.w.size() < 2) {
121  THROW(JIndexOutOfRange, "JWeightKM3BUU::getWeight(): w2-weight is empty.");
122  } else {
123  THROW(JValueOutOfRange, "JWeightKM3BUU::getWeight(): w2-weight or flux is negative.");
124  }
125  }
126  }
#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::JWeightKM3BUU::W
private

Definition at line 129 of file JWeightKM3BUU.hh.


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