Jpp  18.2.1
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::JEvtWeightFactorMupage Struct Reference

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

#include <JEvtWeightFactorMupage.hh>

Inheritance diagram for JAANET::JEvtWeightFactorMupage:

Public Types

enum  variables {
  MUON_MULTIPLICITY, MEAN_ZENITH_ANGLE, TOTAL_MUON_ENERGY, LATERAL_SPREAD,
  NUMBER_OF_VARIABLES
}
 Indices of reweighting variables for MUPAGE. More...
 

Public Member Functions

 JEvtWeightFactorMupage ()
 Default constructor. More...
 
 JEvtWeightFactorMupage (const char *name, const char *formula)
 Constructor. More...
 
double operator() (const Evt &evt) const
 Get weighting factor for given event. More...
 

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 37 of file JEvtWeightFactorMupage.hh.

Member Enumeration Documentation

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 43 of file JEvtWeightFactorMupage.hh.

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

Constructor & Destructor Documentation

JAANET::JEvtWeightFactorMupage::JEvtWeightFactorMupage ( )
inline

Default constructor.

Definition at line 57 of file JEvtWeightFactorMupage.hh.

57  :
58  TFormula()
59  {}
JAANET::JEvtWeightFactorMupage::JEvtWeightFactorMupage ( const char *  name,
const char *  formula 
)
inline

Constructor.

Parameters
namename
formulaformula

Definition at line 68 of file JEvtWeightFactorMupage.hh.

69  :
70  TFormula(name, formula)
71  {}
then echo Enter input within $TIMEOUT_S seconds echo n User name
Definition: JCookie.sh:42

Member Function Documentation

double JAANET::JEvtWeightFactorMupage::operator() ( const Evt evt) const
inline

Get weighting factor for given event.

Parameters
evtevent
Returns
weighting factor

Definition at line 80 of file JEvtWeightFactorMupage.hh.

81  {
82  using namespace std;
83  using namespace JPP;
84 
85  vector<JTrack3E> muons;
86 
87  for (vector<Trk>::const_iterator i = evt.mc_trks.cbegin(); i != evt.mc_trks.cend(); ++i) {
88  if (is_muon(*i) && is_finalstate(*i)) {
89  muons.push_back(getTrack(*i));
90  }
91  }
92 
93  if (!muons.empty()) {
94 
95  Double_t vars[NUMBER_OF_VARIABLES] = { 0.0 };
96 
97  double Etot = 0.0;
98  JVector3D dir;
99 
100  for (vector<JTrack3E>::const_iterator i = muons.begin(); i != muons.end(); ++i) {
101  Etot += i->getE();
102  dir += i->getDirection();
103  }
104 
105  const JDirection3D D(dir);
106  const JRotation3D R(D);
107 
108  for (vector<JTrack3E>::iterator i = muons.begin(); i != muons.end(); ++i) {
109  i->rotate(R);
110  }
111 
112  vector<Trk>::const_iterator iBundle = find_if(evt.mc_trks.cbegin(), evt.mc_trks.cend(),
114 
115  vars[MUON_MULTIPLICITY] = (iBundle != evt.mc_trks.cend() && iBundle->len > 0 ? iBundle->len : (double) muons.size());
116  vars[TOTAL_MUON_ENERGY] = (iBundle != evt.mc_trks.cend() ? iBundle->E : Etot);
117  vars[MEAN_ZENITH_ANGLE] = D.getDZ();
118 
119  if (this->GetNdim() > (int) LATERAL_SPREAD) {
120 
121  const JCircle2D circle = JCircle2D(muons.cbegin(), muons.cend()); // smallest enclosing circle
122 
123  vars[LATERAL_SPREAD] = circle.getRadius();
124  }
125 
126  return this->DoEval(&vars[0]);
127 
128  } else {
129 
130  THROW(JNullPointerException, "JEvtWeightFactorMupage::operator(): No muon for event " << evt.id << '.' << endl);
131  }
132  }
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Definition: JPredicate.hh:128
JTrack3E getTrack(const Trk &track)
Get track.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Number of reweighting variables; N.B. This enum value needs to be specified last! ...
bool is_finalstate(const Trk &track)
Test whether given track corresponds to a final state particle.
static const int TRK_ST_MUONBUNDLE
initial state muon bundle (mupage)
Definition: trkmembers.hh:18
int status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
Definition: Trk.hh:28
then JCookie sh JDataQuality D $DETECTOR_ID R
Definition: JDataQuality.sh:41
int id
offline event identifier
Definition: Evt.hh:22
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:49

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