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

Implementation of event weighing for miscellaneous data
such as a merged offline file containing neutrinos and atmospheric muons. More...

#include <JEvtWeightMiscellaneous.hh>

Inheritance diagram for JAANET::JEvtWeightMiscellaneous:
JLANG::JClonable< JClonable_t, JDerived_t > JAANET::JEvtWeightFactorHelper< JEvtWeightFactor >

Public Types

typedef JEvtWeightFactorHelper
< JEvtWeightFactor
JEvtWeightFactorHelper_t
 
typedef JClonable< JClonable_t >
::clone_type 
clone_type
 
typedef std::shared_ptr
< JEvtWeightFactor
pointer_type
 

Public Member Functions

 JEvtWeightMiscellaneous ()
 Default constructor. More...
 
 JEvtWeightMiscellaneous (const JHead &header)
 Constructor. More...
 
 JEvtWeightMiscellaneous (const JHead &header, const JEvtWeightFactor &factor)
 Constructor. More...
 
 JEvtWeightMiscellaneous (const JEvtWeightMiscellaneous &object)
 Copy constructor. More...
 
void configure (const JHead &header) override
 Configuration. More...
 
bool check (const JHead &header) const override
 Check whether header is consistent with this event weighter. More...
 
double getWeight (const Evt &evt) const override
 Get weight of given event. More...
 
virtual clone_type clone () const override
 Get clone of this object. More...
 
void configure (const JEvtWeightFactor &factor)
 Configure event-weight factor. More...
 
JEvtWeightFactorgetEvtWeightFactor () const
 Get reference to event-weight factor. More...
 
double getFactor (const Evt &evt) const
 Get weight-factor of given event. More...
 

Detailed Description

Implementation of event weighing for miscellaneous data
such as a merged offline file containing neutrinos and atmospheric muons.


A uniform weight of 1.0 is applied to all events.

Definition at line 36 of file JEvtWeightMiscellaneous.hh.

Member Typedef Documentation

Definition at line 40 of file JEvtWeightMiscellaneous.hh.

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.

Definition at line 33 of file JEvtWeightFactorHelper.hh.

Constructor & Destructor Documentation

JAANET::JEvtWeightMiscellaneous::JEvtWeightMiscellaneous ( )
inline

Default constructor.

Definition at line 46 of file JEvtWeightMiscellaneous.hh.

JAANET::JEvtWeightMiscellaneous::JEvtWeightMiscellaneous ( const JHead header)
inline

Constructor.

Parameters
headerheader

Definition at line 56 of file JEvtWeightMiscellaneous.hh.

56  :
58  {
59  configure(header);
60  }
void configure(const JHead &header) override
Configuration.
JAANET::JEvtWeightMiscellaneous::JEvtWeightMiscellaneous ( const JHead header,
const JEvtWeightFactor factor 
)
inline

Constructor.

Parameters
headerheader
factorfactor

Definition at line 69 of file JEvtWeightMiscellaneous.hh.

70  :
72  {
73  configure(header);
75  }
void configure(const JHead &header) override
Configuration.
void configure(const JEvtWeightFactor_t &factor)
Configure event-weight factor.
JAANET::JEvtWeightMiscellaneous::JEvtWeightMiscellaneous ( const JEvtWeightMiscellaneous object)
inline

Copy constructor.

Parameters
objectoriginal object

Definition at line 83 of file JEvtWeightMiscellaneous.hh.

84  {
85  this->norm = object.norm;
86 
87  if (static_cast<const JEvtWeightFactorHelper_t&>(object)) {
88  JEvtWeightFactorHelper::configure(*(object.get()));
89  }
90  }
void configure(const JEvtWeightFactor_t &factor)
Configure event-weight factor.

Member Function Documentation

void JAANET::JEvtWeightMiscellaneous::configure ( const JHead header)
inlineoverride

Configuration.

Parameters
headerheader

Definition at line 98 of file JEvtWeightMiscellaneous.hh.

99  {
100  using namespace JPP;
101 
102  if (check(header)) {
103 
104  norm = 1.0;
105 
106  } else {
107 
108  THROW(JValueOutOfRange, "JEvtWeightMiscellaneous::configure(): Provided header is inconsistent with a miscellaneous, merged offline file.");
109  }
110  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
bool check(const JHead &header) const override
Check whether header is consistent with this event weighter.
bool JAANET::JEvtWeightMiscellaneous::check ( const JHead header) const
inlineoverride

Check whether header is consistent with this event weighter.

Parameters
headerheader
Returns
true if consistent; else false

Definition at line 119 of file JEvtWeightMiscellaneous.hh.

120  {
121  return header.simul.empty() && !is_daq(header);
122  }
bool is_daq(const JHead &header)
Check for real data.
std::vector< JAANET::simul > simul
Definition: JHead.hh:1588
double JAANET::JEvtWeightMiscellaneous::getWeight ( const Evt evt) const
inlineoverride

Get weight of given event.

Parameters
evtevent
Returns
weight [1/s]

Definition at line 131 of file JEvtWeightMiscellaneous.hh.

132  {
133  if (static_cast<const JEvtWeightFactorHelper_t&>(*this)) {
134 
135  return getFactor(evt) * getNormalisation(evt);
136 
137  } else if (evt.w.size() > WEIGHTLIST_RESCALED_EVENT_RATE) {
138 
139  return evt.w[WEIGHTLIST_RESCALED_EVENT_RATE];
140 
141  } else {
142 
143  return getNormalisation(evt);
144  }
145  }
static const int WEIGHTLIST_RESCALED_EVENT_RATE
Rescaled event rate [s-1].
Definition: weightlist.hh:17
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]=w3 (see e.g. Tag list or km3net-dataformat/definitions) ...
Definition: Evt.hh:42
double getFactor(const Evt &evt) const
Get weight-factor of given event.
template<class JClonable_t, class JDerived_t = JNullType>
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited
void JAANET::JEvtWeightFactorHelper< JEvtWeightFactor >::configure ( const JEvtWeightFactor 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
virtual clone_type clone() const override
Get clone of this object.
Definition: JClonable.hh:69
void reset(T &value)
Reset value.
JEvtWeightFactor & JAANET::JEvtWeightFactorHelper< JEvtWeightFactor >::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
double JAANET::JEvtWeightFactorHelper< JEvtWeightFactor >::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 & getEvtWeightFactor() const
Get reference to event-weight factor.

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