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

Implementation of reweighting factor for mupage events according to a specifiable ROOT TFormula. More...

#include <JEvtWeightFactorMupage.hh>

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

Public Types

enum  variables {
  MUON_MULTIPLICITY , MEAN_ZENITH_ANGLE , TOTAL_MUON_ENERGY , LATERAL_SPREAD ,
  NUMBER_OF_VARIABLES
}
 Indices of reweighting variables for MUPAGE. More...
 
typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JEvtWeightFactorMupage ()
 Default constructor.
 
bool is_valid () const override final
 Check whether this formula is valid.
 
double getFactor (const Evt &evt) const override final
 Get weighting factor for given event.
 
virtual clone_type clone () const override
 Get clone of this object.
 

Detailed Description

Implementation of reweighting factor for mupage events 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 JEvtWeightFactorMupage::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 JEvtWeightFactorMupage::variables.

Definition at line 40 of file JEvtWeightFactorMupage.hh.

Member Typedef Documentation

◆ 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.

Member Enumeration Documentation

◆ variables

Indices of reweighting variables for MUPAGE.

Enumerator
MUON_MULTIPLICITY 

Muon multiplicity

MEAN_ZENITH_ANGLE 

Average cosine of zenith angle.

TOTAL_MUON_ENERGY 

Muon bundle total energy [GeV].

LATERAL_SPREAD 

Muon bundle lateral spread [m].

NUMBER_OF_VARIABLES 

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

Definition at line 46 of file JEvtWeightFactorMupage.hh.

46 {
47 MUON_MULTIPLICITY, //!< Muon multiplicity
48 MEAN_ZENITH_ANGLE, //!< Average cosine of zenith angle
49 TOTAL_MUON_ENERGY, //!< Muon bundle total energy [GeV]
50 LATERAL_SPREAD, //!< Muon bundle lateral spread [m]
51
52 NUMBER_OF_VARIABLES //!< Number of reweighting variables; \n
53 //!< N.B.\ This enum value needs to be specified last!
54 };
@ TOTAL_MUON_ENERGY
Muon bundle total energy [GeV].
@ LATERAL_SPREAD
Muon bundle lateral spread [m].
@ MEAN_ZENITH_ANGLE
Average cosine of zenith angle.
@ NUMBER_OF_VARIABLES
Number of reweighting variables; N.B. This enum value needs to be specified last!

Constructor & Destructor Documentation

◆ JEvtWeightFactorMupage()

JAANET::JEvtWeightFactorMupage::JEvtWeightFactorMupage ( )
inline

Default constructor.

Definition at line 60 of file JEvtWeightFactorMupage.hh.

61 {}

Member Function Documentation

◆ is_valid()

bool JAANET::JEvtWeightFactorMupage::is_valid ( ) const
inlinefinaloverride

Check whether this formula is valid.

Returns
true if valid; else false

Definition at line 69 of file JEvtWeightFactorMupage.hh.

70 {
71 const int N = this->GetNdim();
72
73 return N >= 0 && N <= (int) NUMBER_OF_VARIABLES;
74 }

◆ getFactor()

double JAANET::JEvtWeightFactorMupage::getFactor ( const Evt & evt) const
inlinefinaloverride

Get weighting factor for given event.

Parameters
evtevent
Returns
weighting factor

Definition at line 83 of file JEvtWeightFactorMupage.hh.

84 {
85 using namespace std;
86 using namespace JPP;
87
88 vector<JTrack3E> muons;
89
90 for (vector<Trk>::const_iterator i = evt.mc_trks.cbegin(); i != evt.mc_trks.cend(); ++i) {
91 if (is_muon(*i) && is_finalstate(*i)) {
92 muons.push_back(getTrack(*i));
93 }
94 }
95
96 if (muons.empty()) {
97 THROW(JValueOutOfRange, "JEvtWeightFactorMupage::operator(): No muon for event " << evt.id << '.' << endl);
98 }
99
100 Double_t vars[NUMBER_OF_VARIABLES] = { 0.0 };
101
102 double Etot = 0.0;
103 JVector3D dir;
104
105 for (vector<JTrack3E>::const_iterator i = muons.begin(); i != muons.end(); ++i) {
106 Etot += i->getE();
107 dir += i->getDirection();
108 }
109
110 const JDirection3D D(dir);
111 const JRotation3D R(D);
112
113 for (vector<JTrack3E>::iterator i = muons.begin(); i != muons.end(); ++i) {
114 i->rotate(R);
115 }
116
117 vector<Trk>::const_iterator iBundle = find_if(evt.mc_trks.cbegin(), evt.mc_trks.cend(),
118 make_predicate(&Trk::status, TRK_ST_MUONBUNDLE));
119
120 vars[MUON_MULTIPLICITY] = (double) muons.size();
121 vars[TOTAL_MUON_ENERGY] = (iBundle != evt.mc_trks.cend() ? iBundle->E : Etot);
122 vars[MEAN_ZENITH_ANGLE] = D.getDZ();
123
124 if (this->GetNdim() > (int) LATERAL_SPREAD) {
125
126 const JCircle2D circle = JCircle2D(muons.cbegin(), muons.cend()); // smallest enclosing circle
127
128 vars[LATERAL_SPREAD] = circle.getRadius();
129 }
130
131 return this->EvalPar(&vars[0]);
132 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Data structure for circle in two dimensions.
Definition JCircle2D.hh:35
double getRadius() const
Get radius.
Definition JCircle2D.hh:144
Data structure for direction in three dimensions.
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
Exception for accessing a value in a collection that is outside of its range.
JTrack3E getTrack(const Trk &track)
Get track.
bool is_finalstate(const Trk &track)
Test whether given track corresponds to a final state particle.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition Evt.hh:49
int id
offline event identifier
Definition Evt.hh:22
int status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
Definition Trk.hh:28
static const int TRK_ST_MUONBUNDLE
initial state muon bundle (mupage)
Definition trkmembers.hh:18

◆ 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: