Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JAANET::JEvtWeightMiscellaneous Struct Referencefinal

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:
JAANET::JEvtWeightFactorHelper JLANG::JClonable< JClonable_t, JDerived_t >

Public Types

typedef std::shared_ptr< JEvtWeightFactorpointer_type
 
typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JEvtWeightMiscellaneous ()
 Default constructor.
 
 JEvtWeightMiscellaneous (const JHead &header)
 Constructor.
 
 JEvtWeightMiscellaneous (const JHead &header, const JEvtWeightFactor &factor)
 Constructor.
 
const char *const getName () const override final
 Get name.
 
void configure (const JHead &header) override final
 Configuration.
 
bool check (const JHead &header) const override final
 Check whether header is consistent with this event weighter.
 
double getWeight (const Evt &evt) const override final
 Get weight of given event.
 
void configure (const pointer_type &p)
 Configure event-weight factor.
 
void configure (const JEvtWeightFactor &factor)
 Configure event-weight factor.
 
JEvtWeightFactorgetFactor () const
 Get reference to event-weight factor.
 
double getFactor (const Evt &evt) const
 Get weight-factor of given event.
 
bool is_valid () const
 Check whether this event-weight factor is valid.
 
double operator() (const Evt &evt) const
 Get weight-factor of given event.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters())
 Get properties of this class.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const
 Get properties of this class.
 
virtual clone_type clone () const override
 Get clone of this object.
 

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

◆ pointer_type

Definition at line 31 of file JEvtWeightFactorHelper.hh.

◆ clone_type

template<class JClonable_t , class JDerived_t >
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

◆ JEvtWeightMiscellaneous() [1/3]

JAANET::JEvtWeightMiscellaneous::JEvtWeightMiscellaneous ( )
inline

Default constructor.

Definition at line 43 of file JEvtWeightMiscellaneous.hh.

43 :
45 {}
JEvtWeightFactorHelper()
Default constructor.

◆ JEvtWeightMiscellaneous() [2/3]

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

Constructor.

Parameters
headerheader

Definition at line 53 of file JEvtWeightMiscellaneous.hh.

53 :
55 {
56 configure(header);
57 }
void configure(const JHead &header) override final
Configuration.

◆ JEvtWeightMiscellaneous() [3/3]

JAANET::JEvtWeightMiscellaneous::JEvtWeightMiscellaneous ( const JHead & header,
const JEvtWeightFactor & factor )
inline

Constructor.

Parameters
headerheader
factorfactor

Definition at line 66 of file JEvtWeightMiscellaneous.hh.

67 :
69 {
70 configure(header);
72 }
void configure(const pointer_type &p)
Configure event-weight factor.

Member Function Documentation

◆ getName()

const char *const JAANET::JEvtWeightMiscellaneous::getName ( ) const
inlinefinaloverride

Get name.

Returns
name

Definition at line 80 of file JEvtWeightMiscellaneous.hh.

81 {
82 return "Miscellaneous";
83 }

◆ configure() [1/3]

void JAANET::JEvtWeightMiscellaneous::configure ( const JHead & header)
inlinefinaloverride

Configuration.

Parameters
headerheader

Definition at line 91 of file JEvtWeightMiscellaneous.hh.

92 {
93 using namespace JPP;
94
95 if (check(header)) {
96
97 setNormalisation(1.0);
98
99 } else {
100
101 THROW(JValueOutOfRange, "JEvtWeightMiscellaneous::configure(): Provided header is inconsistent with a miscellaneous, merged offline file.");
102 }
103 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for accessing a value in a collection that is outside of its range.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool check(const JHead &header) const override final
Check whether header is consistent with this event weighter.

◆ check()

bool JAANET::JEvtWeightMiscellaneous::check ( const JHead & header) const
inlinefinaloverride

Check whether header is consistent with this event weighter.

Parameters
headerheader
Returns
true if consistent; else false

Definition at line 112 of file JEvtWeightMiscellaneous.hh.

113 {
114 return header.simul.empty() && !is_daq(header);
115 }
bool is_daq(const JHead &header)
Check for real data.

◆ getWeight()

double JAANET::JEvtWeightMiscellaneous::getWeight ( const Evt & evt) const
inlinefinaloverride

Get weight of given event.

Parameters
evtevent
Returns
weight [1/s]

Definition at line 124 of file JEvtWeightMiscellaneous.hh.

125 {
126 if (static_cast<const JEvtWeightFactorHelper&>(*this)) {
127
128 return getFactor(evt) * getNormalisation(evt);
129
130 } else if (evt.w.size() > WEIGHTLIST_RESCALED_EVENT_RATE) {
131
133
134 } else {
135
136 return getNormalisation(evt);
137 }
138 }
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
JEvtWeightFactor & getFactor() const
Get reference to event-weight factor.
static const int WEIGHTLIST_RESCALED_EVENT_RATE
Rescaled event rate [s-1].
Definition weightlist.hh:17

◆ configure() [2/3]

void JAANET::JEvtWeightFactorHelper::configure ( const pointer_type & p)
inlineinherited

Configure event-weight factor.

Parameters
ppointer to event-weight factor

Definition at line 68 of file JEvtWeightFactorHelper.hh.

69 {
70 static_cast<pointer_type&>(*this) = p;
71 }
std::shared_ptr< JEvtWeightFactor > pointer_type

◆ configure() [3/3]

void JAANET::JEvtWeightFactorHelper::configure ( const JEvtWeightFactor & factor)
inlineinherited

Configure event-weight factor.

Parameters
factorevent-weight factor

Definition at line 79 of file JEvtWeightFactorHelper.hh.

80 {
81 using namespace JPP;
82
83 JEvtWeightFactor* p = dynamic_cast<JEvtWeightFactor*>(factor.clone());
84
85 if (p != NULL) {
86 this->reset(p);
87 } else {
88 THROW(JNullPointerException, "JEvtWeightFactorHelper::configure(): Could not retrieve event-weight factor interface.");
89 }
90 }
Exception for null pointer operation.
void reset(T &value)
Reset value.

◆ getFactor() [1/2]

JEvtWeightFactor & JAANET::JEvtWeightFactorHelper::getFactor ( ) const
inlineinherited

Get reference to event-weight factor.

Returns
reference to event-weight factor

Definition at line 98 of file JEvtWeightFactorHelper.hh.

99 {
100 using namespace JPP;
101
102 if (static_cast<const JEvtWeightFactorHelper&>(*this)) {
103 return *(this->get());
104 } else {
105 THROW(JNullPointerException, "JEvtWeightFactorHelper::getFactor(): Event-weight factor is not set.");
106 }
107 }
Helper class for event-weight factor.

◆ getFactor() [2/2]

double JAANET::JEvtWeightFactorHelper::getFactor ( const Evt & evt) const
inlineinherited

Get weight-factor of given event.

Parameters
evtevent
Returns
event-weight factor

Definition at line 129 of file JEvtWeightFactorHelper.hh.

130 {
131 const JEvtWeightFactor& weightFactor = getFactor();
132
133 return weightFactor.getFactor(evt);
134 }

◆ is_valid()

bool JAANET::JEvtWeightFactorHelper::is_valid ( ) const
inlineinherited

Check whether this event-weight factor is valid.

Returns
true if valid; else false

Definition at line 115 of file JEvtWeightFactorHelper.hh.

116 {
117 const JEvtWeightFactorHelper& helper = static_cast<const JEvtWeightFactorHelper&>(*this);
118
119 return (helper && helper->is_valid());
120 }

◆ operator()()

double JAANET::JEvtWeightFactorHelper::operator() ( const Evt & evt) const
inlineinherited

Get weight-factor of given event.

Parameters
evtevent
Returns
event-weight factor

Definition at line 143 of file JEvtWeightFactorHelper.hh.

144 {
145 return getFactor(evt);
146 }

◆ getProperties() [1/2]

JProperties JAANET::JEvtWeightFactorHelper::getProperties ( const JEquationParameters & eqpars = JEvtWeightFactor::getEquationParameters())
inlineinherited

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 154 of file JEvtWeightFactorHelper.hh.

155 {
156 return getFactor().getProperties(eqpars);
157 }
virtual JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters())
Get properties of this class.

◆ getProperties() [2/2]

JProperties JAANET::JEvtWeightFactorHelper::getProperties ( const JEquationParameters & eqpars = JEvtWeightFactor::getEquationParameters()) const
inlineinherited

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 165 of file JEvtWeightFactorHelper.hh.

166 {
167 return getFactor().getProperties(eqpars);
168 }

◆ clone()

template<class JClonable_t , class JDerived_t >
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

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