Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JAANET::JEvtCategoryMap< JFluxHelper > Class Referencefinal

Template specialisation for a map between event categories and flux factors. More...

#include <JEvtCategoryMap.hh>

Inheritance diagram for JAANET::JEvtCategoryMap< JFluxHelper >:
std::map< JEvtCategoryHelper, JFluxHelper > JLANG::JClonable< JClonable_t, JDerived_t >

Classes

struct  JEvtCategoryMapHelper
 Auxiliary class for I/O of map of event categories and weight factors. More...
 

Public Types

typedef JEvtCategoryMap< JFluxHelperJEvtCategoryMap_t
 
typedef std::map< JEvtCategoryHelper, JFluxHelpermap_type
 
typedef map_type::iterator iterator
 
typedef map_type::const_iterator const_iterator
 
typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JEvtCategoryMap ()
 Default constructor.
 
 JEvtCategoryMap (const JOscProbHelper &oscProb)
 Constructor.
 
 JEvtCategoryMap (const JOscProbHelper &oscProb, const JEvtCategoryHelper &category, const JFluxHelper &factor)
 Constructor.
 
template<class ... Args>
 JEvtCategoryMap (const JOscProbHelper &oscProb, const JEvtCategoryHelper &category, const JFluxHelper &factor, const Args &...args)
 Constructor.
 
 JEvtCategoryMap (const JEvtCategoryHelper &category, const JFluxHelper &flux)
 Constructor.
 
template<class ... Args>
 JEvtCategoryMap (const JEvtCategoryHelper &category, const JFluxHelper &flux, const Args &...args)
 Constructor.
 
void insert (const JEvtCategoryHelper &category, const JFluxHelper &flux)
 Insert pair of an event category and a flux function.
 
template<class ... Args>
void insert (const JEvtCategoryHelper &category, const JFluxHelper &flux, const Args &...args)
 Insert pairs of event categories and flux functions.
 
double getFactor (const Evt &evt) const override final
 Get weight factor of given event.
 
bool is_valid () const override final
 Check whether this flux factor is valid.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
 Get properties of this class.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const override final
 Get properties of this class.
 
std::istream & read (std::istream &in) override final
 Read map between event categories and flux factors.
 
std::ostream & write (std::ostream &out) const override final
 Write event-weight factor to output.
 
virtual clone_type clone () const override
 Get clone of this object.
 

Public Attributes

JOscProbHelper oscProb
 oscillation probability calculator
 

Detailed Description

Template specialisation for a map between event categories and flux factors.

Input syntax as follows:

      <PDG type> [<PDG type>]...;           <flux identifier> [<flux arguments>];
      <key>=<value>[,<key>=<value>]...; <flux identifier> [<flux arguments>];

where

  • <PDG type> refers to a PDG identifier;
  • <key> to one of the data members of a data structure derived from JAANET::JEvtCategory;
  • <value> to the corresponding value; and
  • <flux identifier> to a flux identifier (c.f. JAANET::JFluxDictionary) and
  • <flux arguments> to the list of arguments of the corresponding flux factor.

Definition at line 512 of file JEvtCategoryMap.hh.

Member Typedef Documentation

◆ JEvtCategoryMap_t

Definition at line 518 of file JEvtCategoryMap.hh.

◆ map_type

◆ iterator

map_type::iterator JAANET::JEvtCategoryMap< JFluxHelper >::iterator

Definition at line 522 of file JEvtCategoryMap.hh.

◆ const_iterator

map_type::const_iterator JAANET::JEvtCategoryMap< JFluxHelper >::const_iterator

Definition at line 523 of file JEvtCategoryMap.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

◆ JEvtCategoryMap() [1/6]

JAANET::JEvtCategoryMap< JFluxHelper >::JEvtCategoryMap ( )
inline

Default constructor.

Definition at line 530 of file JEvtCategoryMap.hh.

530 :
531 map_type(),
532 oscProb()
533 {}
JOscProbHelper oscProb
oscillation probability calculator
std::map< JEvtCategoryHelper, JFluxHelper > map_type

◆ JEvtCategoryMap() [2/6]

JAANET::JEvtCategoryMap< JFluxHelper >::JEvtCategoryMap ( const JOscProbHelper & oscProb)
inline

Constructor.

Parameters
oscProboscillation probability calculator

Definition at line 541 of file JEvtCategoryMap.hh.

541 :
542 map_type(),
544 {}

◆ JEvtCategoryMap() [3/6]

JAANET::JEvtCategoryMap< JFluxHelper >::JEvtCategoryMap ( const JOscProbHelper & oscProb,
const JEvtCategoryHelper & category,
const JFluxHelper & factor )
inline

Constructor.

Parameters
oscProboscillation probability calculator
categoryevent category
factorevent-weight factor

Definition at line 554 of file JEvtCategoryMap.hh.

556 :
557 map_type(),
559 {
560 insert(category, factor);
561 }
void insert(const JEvtCategoryHelper &category, const JFluxHelper &flux)
Insert pair of an event category and a flux function.

◆ JEvtCategoryMap() [4/6]

template<class ... Args>
JAANET::JEvtCategoryMap< JFluxHelper >::JEvtCategoryMap ( const JOscProbHelper & oscProb,
const JEvtCategoryHelper & category,
const JFluxHelper & factor,
const Args &... args )
inline

Constructor.

Parameters
oscProboscillation probability calculator
categoryevent category
factorevent-weight factor
argsremaining pairs of event categories and event-weight factors

Definition at line 573 of file JEvtCategoryMap.hh.

576 :
577 map_type(),
579 {
580 insert(category, factor, args...);
581 }

◆ JEvtCategoryMap() [5/6]

JAANET::JEvtCategoryMap< JFluxHelper >::JEvtCategoryMap ( const JEvtCategoryHelper & category,
const JFluxHelper & flux )
inline

Constructor.

Parameters
categoryevent category
fluxflux function

Definition at line 590 of file JEvtCategoryMap.hh.

591 :
592 map_type(),
593 oscProb()
594 {
595 insert(category, flux);
596 }

◆ JEvtCategoryMap() [6/6]

template<class ... Args>
JAANET::JEvtCategoryMap< JFluxHelper >::JEvtCategoryMap ( const JEvtCategoryHelper & category,
const JFluxHelper & flux,
const Args &... args )
inline

Constructor.

Parameters
categoryevent category
fluxflux function
argsremaining pairs of event categories and flux functions

Definition at line 608 of file JEvtCategoryMap.hh.

610 :
611 map_type()
612 {
613 insert(category, flux, args...);
614 }

Member Function Documentation

◆ insert() [1/2]

void JAANET::JEvtCategoryMap< JFluxHelper >::insert ( const JEvtCategoryHelper & category,
const JFluxHelper & flux )
inline

Insert pair of an event category and a flux function.

Parameters
categoryevent category
fluxflux function

Definition at line 623 of file JEvtCategoryMap.hh.

625 {
626 map_type::insert(std::make_pair(category, flux));
627 }

◆ insert() [2/2]

template<class ... Args>
void JAANET::JEvtCategoryMap< JFluxHelper >::insert ( const JEvtCategoryHelper & category,
const JFluxHelper & flux,
const Args &... args )
inline

Insert pairs of event categories and flux functions.

Parameters
categoryevent category
fluxflux function
argsremaining pairs of event categories and flux functions

Definition at line 638 of file JEvtCategoryMap.hh.

641 {
642 insert(category, flux);
643 insert(args...);
644 }

◆ getFactor()

double JAANET::JEvtCategoryMap< JFluxHelper >::getFactor ( const Evt & evt) const
inlinefinaloverride

Get weight factor of given event.

Parameters
evtevent
Returns
weight-factor for given event

Definition at line 653 of file JEvtCategoryMap.hh.

654 {
655 using namespace JPP;
656
657 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
658 if (i->first.match(evt)) {
659 return i->second.getFactor(evt);
660 }
661 }
662
663 THROW(JValueOutOfRange, "JEvtCategoryMap<JFluxHelper>::getFactor(): No flux factor for given event.");
664 }
#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).

◆ is_valid()

bool JAANET::JEvtCategoryMap< JFluxHelper >::is_valid ( ) const
inlinefinaloverride

Check whether this flux factor is valid.

Returns
true if valid; else false

Definition at line 672 of file JEvtCategoryMap.hh.

673 {
674 for (typename map_type::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
675 if (!(i->second.is_valid())) { return false; }
676 }
677
678 return true;
679 }

◆ getProperties() [1/2]

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 687 of file JEvtCategoryMap.hh.

688 {
689 return JEvtCategoryMapHelper(*this, eqpars);
690 }

◆ getProperties() [2/2]

JProperties JAANET::JEvtCategoryMap< JFluxHelper >::getProperties ( const JEquationParameters & eqpars = JEvtWeightFactor::getEquationParameters()) const
inlinefinaloverride

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 698 of file JEvtCategoryMap.hh.

699 {
700 return JEvtCategoryMapHelper(*this, eqpars);
701 }

◆ read()

std::istream & JAANET::JEvtCategoryMap< JFluxHelper >::read ( std::istream & in)
inlinefinaloverride

Read map between event categories and flux factors.

Parameters
ininput stream
Returns
input stream

Definition at line 710 of file JEvtCategoryMap.hh.

711 {
712 using namespace std;
713 using namespace JPP;
714
715 static const JFluxDictionary dictionary(oscProb);
716
717 JStringStream is(in);
718
719 if (getFileStatus(is.str().c_str())) {
720 is.load();
721 }
722
723 for (JToken<';'> token1, token2; is >> token1 >> token2; ) {
724
725 istringstream iss1(token1); // Read event categories
726
727 JEvtCategorySet categories;
728
729 iss1 >> categories;
730
731 istringstream iss2(token2); // Read event-weight factors
732
733 int fluxID = 0;
734
735 if (iss2 >> fluxID) {
736
737 JFluxHelper helper(dictionary.at(fluxID).getFlux());
738
739 JFlux& flux = helper.getFlux();
740
741 iss2 >> flux;
742
743 if (!fail(iss2)) {
744 for (JEvtCategorySet::const_iterator i = categories.cbegin(); i != categories.cend(); ++i) {
745 this->insert(*i, helper);
746 }
747 }
748 }
749 }
750
751 return in;
752 }
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
Wrapper class around string.
Definition JToken.hh:26
bool fail(std::istream &in)
Check for stream state.
Definition JParser.hh:98
Container for a set of event categories.
Helper class for flux function.
Neutrino flux.
Definition JHead.hh:906

◆ write()

std::ostream & JAANET::JEvtCategoryMap< JFluxHelper >::write ( std::ostream & out) const
inlinefinaloverride

Write event-weight factor to output.

Parameters
outoutput stream
Returns
output stream

Definition at line 761 of file JEvtCategoryMap.hh.

762 {
763 return out << getProperties(JEquationParameters("=", "\n", "./", "#"));
764 }
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
Get properties of this class.
Simple data structure to support I/O of equations (see class JLANG::JEquation).

◆ clone()

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

Member Data Documentation

◆ oscProb

oscillation probability calculator

Definition at line 767 of file JEvtCategoryMap.hh.


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