Jpp  15.0.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::JEvtWeightFactorMultiParticle Struct Reference

Implementation of event-weight factor for multiple particle types. More...

#include <JEvtWeightFactorMultiParticle.hh>

Inheritance diagram for JAANET::JEvtWeightFactorMultiParticle:
JLANG::JClonable< JClonable_t, JDerived_t > std::map< int, JEvtWeightFactorHelper >

Public Types

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

Public Member Functions

 JEvtWeightFactorMultiParticle ()
 Default constructor. More...
 
template<class... Args>
 JEvtWeightFactorMultiParticle (const int type, const JEvtWeightFactor &factor, const Args &...args)
 Constructor. More...
 
void insert (const int type, const JEvtWeightFactor &factor)
 Insert pair of particle code and event-weight factor. More...
 
template<class... Args>
void insert (const int type, const JEvtWeightFactor &factor, const Args &...args)
 Insert pairs of particle codes and event-weight factors. More...
 
double getFactor (const Evt &evt) const override
 Get event-weight factor of given event. More...
 
virtual clone_type clone () const override
 Get clone of this object. More...
 

Detailed Description

Implementation of event-weight factor for multiple particle types.

Definition at line 29 of file JEvtWeightFactorMultiParticle.hh.

Member Typedef Documentation

Definition at line 33 of file JEvtWeightFactorMultiParticle.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::JEvtWeightFactorMultiParticle::JEvtWeightFactorMultiParticle ( )
inline

Default constructor.

Definition at line 38 of file JEvtWeightFactorMultiParticle.hh.

38  :
39  map_type()
40  {}
std::map< int, JEvtWeightFactorHelper > map_type
template<class... Args>
JAANET::JEvtWeightFactorMultiParticle::JEvtWeightFactorMultiParticle ( const int  type,
const JEvtWeightFactor factor,
const Args &...  args 
)
inline

Constructor.

Parameters
typeparticle PDG code
factorevent-weight factor
argsremaining pairs of PDG codes and event-weight factors

Definition at line 51 of file JEvtWeightFactorMultiParticle.hh.

54  {
55  insert(type, factor, args...);
56  }
void insert(const int type, const JEvtWeightFactor &factor)
Insert pair of particle code and event-weight factor.

Member Function Documentation

void JAANET::JEvtWeightFactorMultiParticle::insert ( const int  type,
const JEvtWeightFactor factor 
)
inline

Insert pair of particle code and event-weight factor.

Parameters
typeparticle PDG code
factorevent-weight factor

Definition at line 65 of file JEvtWeightFactorMultiParticle.hh.

67  {
68  map_type::insert(std::make_pair(type, JEvtWeightFactorHelper(factor)));
69  }
template<class... Args>
void JAANET::JEvtWeightFactorMultiParticle::insert ( const int  type,
const JEvtWeightFactor factor,
const Args &...  args 
)
inline

Insert pairs of particle codes and event-weight factors.

Parameters
typeparticle PDG code
factorevent-weight factor
argsremaining pairs of PDG codes and event-weight factors

Definition at line 80 of file JEvtWeightFactorMultiParticle.hh.

83  {
84  insert(type, factor);
85  insert(args...);
86  }
void insert(const int type, const JEvtWeightFactor &factor)
Insert pair of particle code and event-weight factor.
double JAANET::JEvtWeightFactorMultiParticle::getFactor ( const Evt evt) const
inlineoverride

Get event-weight factor of given event.

Parameters
evtevent
Returns
weight-factor for given event

Definition at line 95 of file JEvtWeightFactorMultiParticle.hh.

96  {
97  using namespace std;
98  using namespace JPP;
99 
100  vector<Trk>::const_iterator primary = find_if(evt.mc_trks.cbegin(),
101  evt.mc_trks.cend(),
103 
104  if (primary != evt.mc_trks.cend()) {
105 
106  return this->at(primary->type).getFactor(evt);
107 
108  } else if (has_neutrino(evt)) {
109 
110  const Trk& neutrino = get_neutrino(evt);
111 
112  return this->at(neutrino.type).getFactor(evt);
113 
114  } else {
115 
116  THROW(JValueOutOfRange, "JEvtWeightFactorMultiParticle::getFactor(): No primary track found for event " << evt.id << ".");
117  }
118  }
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:76
int type
MC: particle type in PDG encoding.
Definition: Trk.hh:24
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:14
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: