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

Implementation of flux function for multiple particle types. More...

#include <JMultiParticleFlux.hh>

Inheritance diagram for JAANET::JMultiParticleFlux:
JLANG::JClonable< JClonable_t, JDerived_t > std::map< int, JFluxHelper >

Public Types

typedef std::map< int,
JFluxHelper
map_type
 
typedef JClonable< JClonable_t >
::clone_type 
clone_type
 

Public Member Functions

 JMultiParticleFlux ()
 Default constructor. More...
 
template<class... Args>
 JMultiParticleFlux (const int type, const JFlux &flux, const Args &...args)
 Constructor. More...
 
void insert (const int type, const JFlux &flux)
 Insert pair of particle code and flux function. More...
 
template<class... Args>
void insert (const int type, const JFlux &flux, const Args &...args)
 Insert pairs of particle codes and flux functions. More...
 
double getFlux (const Evt &evt) const override
 Get flux of given event. More...
 
virtual clone_type clone () const override
 Get clone of this object. More...
 

Detailed Description

Implementation of flux function for multiple particle types.

Definition at line 29 of file JMultiParticleFlux.hh.

Member Typedef Documentation

Definition at line 33 of file JMultiParticleFlux.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.

Constructor & Destructor Documentation

JAANET::JMultiParticleFlux::JMultiParticleFlux ( )
inline

Default constructor.

Definition at line 38 of file JMultiParticleFlux.hh.

38  :
39  map_type()
40  {}
std::map< int, JFluxHelper > map_type
template<class... Args>
JAANET::JMultiParticleFlux::JMultiParticleFlux ( const int  type,
const JFlux flux,
const Args &...  args 
)
inline

Constructor.

Parameters
typeparticle PDG code
fluxflux function
argsremaining pairs of PDG codes and flux functions

Definition at line 51 of file JMultiParticleFlux.hh.

54  {
55  insert(type, flux, args...);
56  }
void insert(const int type, const JFlux &flux)
Insert pair of particle code and flux function.

Member Function Documentation

void JAANET::JMultiParticleFlux::insert ( const int  type,
const JFlux flux 
)
inline

Insert pair of particle code and flux function.

Parameters
typeparticle PDG code
fluxflux function
argsremaining pairs of PDG codes and flux functions

Definition at line 66 of file JMultiParticleFlux.hh.

68  {
69  map_type::insert(std::make_pair(type, JFluxHelper(flux)));
70  }
template<class... Args>
void JAANET::JMultiParticleFlux::insert ( const int  type,
const JFlux flux,
const Args &...  args 
)
inline

Insert pairs of particle codes and flux functions.

Parameters
typeparticle PDG code
fluxflux function
argsremaining pairs of PDG codes and flux functions

Definition at line 81 of file JMultiParticleFlux.hh.

84  {
85  insert(type, flux);
86  insert(args...);
87  }
void insert(const int type, const JFlux &flux)
Insert pair of particle code and flux function.
double JAANET::JMultiParticleFlux::getFlux ( const Evt evt) const
inlineoverride

Get flux of given event.

Parameters
evtevent
Returns
flux [GeV * m^-2 * sr^-1 * s^-1]

Definition at line 96 of file JMultiParticleFlux.hh.

97  {
98  using namespace std;
99  using namespace JPP;
100 
101  vector<Trk>::const_iterator primary = find_if(evt.mc_trks.cbegin(),
102  evt.mc_trks.cend(),
104 
105  if (primary != evt.mc_trks.cend()) {
106 
107  return this->at(primary->type).getFlux(evt);
108 
109  } else if (has_neutrino(evt)) {
110 
111  const Trk& neutrino = get_neutrino(evt);
112 
113  return this->at(neutrino.type).getFlux(evt);
114 
115  } else {
116 
117  THROW(JValueOutOfRange, "JMultiParticleFlux::getFlux(): No primary track found for event " << evt.id << ".");
118  }
119  }
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
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
bool is_primary() const
Check if this is a primary particle.
Definition: Trk.hh:75
int type
MC: particle type in PDG encoding.
Definition: Trk.hh:23
int id
offline event identifier
Definition: Evt.hh:21
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Definition: Trk.hh:13
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
template<class JClonable_t, class JDerived_t = JNullType>
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

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