GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | Friends | List of all members
genie::BaryonResList Class Reference

Encapsulates a list of baryon resonances. More...

#include <BaryonResList.h>

Collaboration diagram for genie::BaryonResList:
Collaboration graph
[legend]

Public Member Functions

 BaryonResList ()
 
 BaryonResList (const BaryonResList &rl)
 
virtual ~BaryonResList ()
 
void DecodeFromNameList (string list, string delimiter=",")
 
unsigned int NResonances (void) const
 
string ResonanceName (unsigned int ires) const
 
Resonance_t ResonanceId (unsigned int ires) const
 
int ResonancePdgCode (unsigned int ires) const
 
bool Find (Resonance_t res) const
 
void Clear (void)
 
void Copy (const BaryonResList &rl)
 
void Print (ostream &stream) const
 
auto begin () noexcept-> typename vector< Resonance_t >::iterator
 
auto end () noexcept-> typename vector< Resonance_t >::iterator
 
auto begin () const noexcept-> typename vector< Resonance_t >::const_iterator
 
auto end () const noexcept-> typename vector< Resonance_t >::const_iterator
 
auto cbegin () const noexcept-> typename vector< Resonance_t >::const_iterator
 
auto cend () const noexcept-> typename vector< Resonance_t >::const_iterator
 

Private Attributes

vector< Resonance_t > * fResVec
 

Friends

ostream & operator<< (ostream &stream, const BaryonResList &rl)
 

Detailed Description

Encapsulates a list of baryon resonances.

Author
Costas Andreopoulos <c.andreopoulos cern.ch> University of Liverpool
Created:
May 03, 2004
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 37 of file BaryonResList.h.

Constructor & Destructor Documentation

BaryonResList::BaryonResList ( )

Definition at line 32 of file BaryonResList.cxx.

References fResVec.

33 {
34  fResVec = 0;
35 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
BaryonResList::BaryonResList ( const BaryonResList rl)

Definition at line 37 of file BaryonResList.cxx.

References Copy(), and fResVec.

38 {
39  fResVec = 0;
40  this->Copy(res_list);
41 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
void Copy(const BaryonResList &rl)
BaryonResList::~BaryonResList ( )
virtual

Definition at line 43 of file BaryonResList.cxx.

References fResVec.

44 {
45  if(fResVec) delete fResVec;
46 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67

Member Function Documentation

auto BaryonResList::begin ( ) -> typename vector<Resonance_t>::iterator
noexcept

Definition at line 155 of file BaryonResList.cxx.

References fResVec.

156 {
157  return fResVec->begin();
158 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
auto BaryonResList::begin ( ) const -> typename vector<Resonance_t>::const_iterator
noexcept

Definition at line 165 of file BaryonResList.cxx.

References fResVec.

166 {
167  return fResVec->begin();
168 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
auto BaryonResList::cbegin ( ) const -> typename vector<Resonance_t>::const_iterator
noexcept

Definition at line 175 of file BaryonResList.cxx.

References fResVec.

176 {
177  return fResVec->cbegin();
178 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
auto BaryonResList::cend ( ) const -> typename vector<Resonance_t>::const_iterator
noexcept

Definition at line 180 of file BaryonResList.cxx.

References fResVec.

181 {
182  return fResVec->cend();
183 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
void BaryonResList::Clear ( void  )
void BaryonResList::Copy ( const BaryonResList rl)

Definition at line 131 of file BaryonResList.cxx.

References fResVec, NResonances(), and ResonanceId().

Referenced by BaryonResList().

132 {
133  if(fResVec) fResVec->clear();
134 
135  unsigned int nres = res_list.NResonances();
136  if(nres==0) return;
137 
138  if(!fResVec) fResVec = new vector<Resonance_t> (nres);
139 
140  for(unsigned int ires = 0; ires < nres; ires++) {
141  (*fResVec)[ires] = res_list.ResonanceId(ires);
142  }
143 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
void BaryonResList::DecodeFromNameList ( string  list,
string  delimiter = "," 
)

Definition at line 101 of file BaryonResList.cxx.

References genie::utils::str::FilterString(), fResVec, genie::utils::res::FromString(), genie::kNoResonance, pERROR, pINFO, SLOG, and genie::utils::str::Split().

Referenced by genie::RSPPResonanceSelector::LoadConfig(), genie::ReinSehgalRESXSec::LoadConfig(), genie::ReinSehgalSPPXSec::LoadConfig(), genie::ReinSehgalRESXSecFast::LoadConfig(), genie::ReinSehgalSPPPXSec::LoadConfig(), genie::MKSPPPXSec2020::LoadConfig(), and genie::RESInteractionListGenerator::LoadConfigData().

102 {
103  //-- remove all spaces in the input string coming from the XML config file
104 
105  string list = utils::str::FilterString(" ", input_list);
106 
107  vector<string> resonances = utils::str::Split(list, delimiter);
108 
109  SLOG("BaryonResList", pINFO) << list;
110  SLOG("BaryonResList", pINFO) << resonances.size();
111 
112  if(fResVec) delete fResVec;
113  fResVec = new vector<Resonance_t> (resonances.size());
114 
115  unsigned int ires = 0;
116  vector<string>::const_iterator riter;
117  for(riter = resonances.begin(); riter != resonances.end(); ++riter) {
118 
119  Resonance_t res = utils::res::FromString( (*riter).c_str() );
120  if( res == kNoResonance ) {
121  SLOG("BaryonResList", pERROR) << "*** Unknown resonance: " << *riter;
122  } else (*fResVec)[ires++] = res;
123  }
124 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
Resonance_t FromString(const char *res)
string -&gt; resonance id
#define pERROR
Definition: Messenger.h:59
enum genie::EResonance Resonance_t
#define pINFO
Definition: Messenger.h:62
string FilterString(string filt, string input)
Definition: StringUtils.cxx:79
vector< string > Split(string input, string delim)
Definition: StringUtils.cxx:36
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
auto BaryonResList::end ( ) -> typename vector<Resonance_t>::iterator
noexcept

Definition at line 160 of file BaryonResList.cxx.

References fResVec.

161 {
162  return fResVec->end();
163 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
auto BaryonResList::end ( ) const -> typename vector<Resonance_t>::const_iterator
noexcept

Definition at line 170 of file BaryonResList.cxx.

References fResVec.

171 {
172  return fResVec->end();
173 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
bool BaryonResList::Find ( Resonance_t  res) const

Definition at line 90 of file BaryonResList.cxx.

References fResVec, pWARN, and SLOG.

Referenced by genie::ReinSehgalSPPPXSec::XSec().

91 {
92  if(!fResVec) {
93  SLOG("BaryonResList", pWARN) << "NULL resonance list!";
94  return false;
95  }
96  int n = count(fResVec->begin(), fResVec->end(), res);
97  if(n!=0) return true;
98  return false;
99 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
#define pWARN
Definition: Messenger.h:60
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
unsigned int BaryonResList::NResonances ( void  ) const

Definition at line 48 of file BaryonResList.cxx.

References fResVec, pERROR, and SLOG.

Referenced by genie::ReinSehgalRESXSecWithCache::CacheResExcitationXSec(), genie::ReinSehgalRESXSecWithCacheFast::CacheResExcitationXSec(), Copy(), genie::RESInteractionListGenerator::CreateInteractionList(), genie::ReinSehgalSPPXSec::Integrate(), ResonanceId(), ResonanceName(), genie::RSPPResonanceSelector::SelectResonance(), and genie::ReinSehgalSPPPXSec::XSecNRES().

49 {
50  if(!fResVec) {
51  SLOG("BaryonResList", pERROR) << "Null Resonance List";
52  return 0;
53  }
54  return fResVec->size();
55 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
#define pERROR
Definition: Messenger.h:59
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
void BaryonResList::Print ( ostream &  stream) const

Definition at line 145 of file BaryonResList.cxx.

References genie::utils::res::AsString(), and fResVec.

Referenced by genie::operator<<().

146 {
147  stream << "\n [-] Resonance List\n";
148 
149  vector<Resonance_t>::const_iterator riter;
150  for(riter = fResVec->begin(); riter != fResVec->end(); ++riter) {
151  stream << " |--> RES: " << utils::res::AsString(*riter) << endl;
152  }
153 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
const char * AsString(Resonance_t res)
resonance id -&gt; string
Resonance_t BaryonResList::ResonanceId ( unsigned int  ires) const

Definition at line 71 of file BaryonResList.cxx.

References fResVec, genie::kNoResonance, NResonances(), pERROR, and SLOG.

Referenced by genie::ReinSehgalRESXSecWithCache::CacheResExcitationXSec(), genie::ReinSehgalRESXSecWithCacheFast::CacheResExcitationXSec(), Copy(), genie::RESInteractionListGenerator::CreateInteractionList(), genie::ReinSehgalSPPXSec::Integrate(), genie::RSPPResonanceSelector::SelectResonance(), and genie::ReinSehgalSPPPXSec::XSecNRES().

72 {
73  if(!fResVec) {
74  SLOG("BaryonResList", pERROR) << "Null Resonance List";
75  return kNoResonance;
76  }
77  if(ires >= this->NResonances() ) {
78  SLOG("BaryonResList", pERROR) << "Resonance idx: " << ires
79  << " outside limits: [0, " << this->NResonances() << "]";
80  return kNoResonance;
81  }
82  return (*fResVec)[ires];
83 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
#define pERROR
Definition: Messenger.h:59
unsigned int NResonances(void) const
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
string BaryonResList::ResonanceName ( unsigned int  ires) const

Definition at line 57 of file BaryonResList.cxx.

References genie::utils::res::AsString(), fResVec, NResonances(), pERROR, and SLOG.

58 {
59  if(!fResVec) {
60  SLOG("BaryonResList", pERROR) << "Null Resonance List";
61  return "-";
62  }
63  if(ires >= this->NResonances() ) {
64  SLOG("BaryonResList", pERROR) << "Resonance idx: " << ires
65  << " outside limits: [0, " << this->NResonances() << "]";
66  return "-";
67  }
68  return utils::res::AsString( (*fResVec)[ires] );
69 }
vector< Resonance_t > * fResVec
Definition: BaryonResList.h:67
#define pERROR
Definition: Messenger.h:59
unsigned int NResonances(void) const
const char * AsString(Resonance_t res)
resonance id -&gt; string
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
int BaryonResList::ResonancePdgCode ( unsigned int  ires) const

Definition at line 85 of file BaryonResList.cxx.

86 {
87  return 0;
88 }

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const BaryonResList rl 
)
friend

Definition at line 25 of file BaryonResList.cxx.

26  {
27  res_list.Print(stream);
28  return stream;
29  }

Member Data Documentation

vector<Resonance_t>* genie::BaryonResList::fResVec
private

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