Public Member Functions | Private Attributes | Friends | List of all members
genie::PDGCodeList Class Reference

A list of PDG codes. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+2.6-2.12-e17-debug/GENIE-Generator/src/Framework/ParticleData/PDGCodeList.h"

Inheritance diagram for genie::PDGCodeList:

Public Member Functions

 PDGCodeList (bool allowdup=false)
 
 PDGCodeList (size_type n, bool allowdup=false)
 
 PDGCodeList (const PDGCodeList &list)
 
 ~PDGCodeList ()
 
void push_back (int pdg_code)
 
void insert (iterator pos, size_type n, const int &x)
 
bool CheckPDGCode (int pdg_code) const
 PDG code checks used by PDGCodeList. More...
 
bool ExistsInPDGLibrary (int pdg_code) const
 
bool ExistsInPDGCodeList (int pdg_code) const
 
void Copy (const PDGCodeList &list)
 copy / print More...
 
void Print (ostream &stream) const
 
bool DuplEntriesAllowed (void) const
 check state More...
 
PDGCodeListoperator= (const PDGCodeList &list)
 overloaded operators More...
 

Private Attributes

bool fAllowDuplicateEntries
 allow duplicate entries in the list? More...
 

Friends

ostream & operator<< (ostream &stream, const PDGCodeList &list)
 

Detailed Description

A list of PDG codes.

Author
Costas Andreopoulos <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

May 13, 2005

Copyright (c) 2003-2019, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 33 of file PDGCodeList.h.

Constructor & Destructor Documentation

PDGCodeList::PDGCodeList ( bool  allowdup = false)

Definition at line 44 of file PDGCodeList.cxx.

References fAllowDuplicateEntries.

44  :
45 vector<int>()
46 {
47  fAllowDuplicateEntries = allowdup;
48 }
bool fAllowDuplicateEntries
allow duplicate entries in the list?
Definition: PDGCodeList.h:65
PDGCodeList::PDGCodeList ( size_type  n,
bool  allowdup = false 
)

Definition at line 50 of file PDGCodeList.cxx.

References fAllowDuplicateEntries.

50  :
51 vector<int>(n)
52 {
53  fAllowDuplicateEntries = allowdup;
54 }
bool fAllowDuplicateEntries
allow duplicate entries in the list?
Definition: PDGCodeList.h:65
PDGCodeList::PDGCodeList ( const PDGCodeList list)

Definition at line 56 of file PDGCodeList.cxx.

References Copy().

56  :
57 vector<int>()
58 {
59  this->Copy(list);
60 }
void Copy(const PDGCodeList &list)
copy / print
PDGCodeList::~PDGCodeList ( )

Definition at line 62 of file PDGCodeList.cxx.

63 {
64 
65 }

Member Function Documentation

bool PDGCodeList::CheckPDGCode ( int  pdg_code) const

PDG code checks used by PDGCodeList.

Definition at line 80 of file PDGCodeList.cxx.

References APDHVSetting::added, ExistsInPDGCodeList(), ExistsInPDGLibrary(), fAllowDuplicateEntries, LOG, pDEBUG, and pERROR.

Referenced by insert(), and push_back().

81 {
82 // check whether the PDG code can be inserted
83 
84  bool exists = this->ExistsInPDGLibrary(pdg_code);
85  if(!exists) {
86  LOG("PDG", pERROR)
87  << "Can't add non-existent particle [pdgc = " << pdg_code << "]";
88  return false;
89  }
90 
92  bool added = this->ExistsInPDGCodeList(pdg_code);
93  if(added) {
94  LOG("PDG", pDEBUG)
95  << "Particle [pdgc = " << pdg_code << "] was already added";
96  return false;
97  }
98  }
99  return true;
100 }
#define pERROR
Definition: Messenger.h:60
bool ExistsInPDGCodeList(int pdg_code) const
bool fAllowDuplicateEntries
allow duplicate entries in the list?
Definition: PDGCodeList.h:65
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
bool ExistsInPDGLibrary(int pdg_code) const
#define pDEBUG
Definition: Messenger.h:64
void PDGCodeList::Copy ( const PDGCodeList list)

copy / print

Definition at line 154 of file PDGCodeList.cxx.

References clear, fAllowDuplicateEntries, and push_back().

Referenced by operator=(), PDGCodeList(), genie::flux::GJPARCNuFlux::SetFluxParticles(), and genie::flux::GFluxFileConfigI::SetFluxParticles().

155 {
156  this->clear();
157 
158  PDGCodeList::const_iterator iter;
159  for(iter = list.begin(); iter != list.end(); ++iter) {
160  int code = *iter;
161  this->push_back(code);
162  }
163 
165 }
vector< vector< double > > clear
bool fAllowDuplicateEntries
allow duplicate entries in the list?
Definition: PDGCodeList.h:65
Definition: inftrees.h:24
void push_back(int pdg_code)
Definition: PDGCodeList.cxx:67
bool genie::PDGCodeList::DuplEntriesAllowed ( void  ) const
inline

check state

Definition at line 57 of file PDGCodeList.h.

References fAllowDuplicateEntries, operator<<, and operator=().

57 { return fAllowDuplicateEntries; }
bool fAllowDuplicateEntries
allow duplicate entries in the list?
Definition: PDGCodeList.h:65
bool PDGCodeList::ExistsInPDGCodeList ( int  pdg_code) const

Definition at line 112 of file PDGCodeList.cxx.

References febshutoff_auto::end.

Referenced by CheckDecayerConsistency(), CheckPDGCode(), genie::flux::GJPARCNuFlux::GenerateNext_weighted(), genie::flux::GDk2NuFlux::GenerateNext_weighted(), genie::flux::GSimpleNtpFlux::GenerateNext_weighted(), genie::geometry::ROOTGeomAnalyzer::GetWeight(), and genie::Decayer::IsUnstable().

113 {
114 // check whether the PDG code already exists in the list
115 
116  PDGCodeList::const_iterator bci = this->begin();
117  PDGCodeList::const_iterator eci = this->end();
118 
119  if(find(bci,eci,pdg_code) != eci) return true;
120 
121  return false;
122 /*
123  int n = count(this->begin(), this->end(), pdg_code);
124  if(n!=0) return true;
125  return false;
126 */
127 }
bool PDGCodeList::ExistsInPDGLibrary ( int  pdg_code) const

Definition at line 102 of file PDGCodeList.cxx.

References genie::PDGLibrary::Find(), and genie::PDGLibrary::Instance().

Referenced by CheckPDGCode().

103 {
104 // check whether the PDG code is a valid one (exists in PDGLibrary)
105 
106  PDGLibrary * pdglib = PDGLibrary::Instance();
107  TParticlePDG * particle = pdglib->Find(pdg_code);
108  if(!particle) return false;
109  return true;
110 }
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:43
Singleton class to load & serve a TDatabasePDG.
Definition: PDGLibrary.h:30
TParticlePDG * Find(int pdgc)
Definition: PDGLibrary.cxx:61
void PDGCodeList::insert ( iterator  pos,
size_type  n,
const int x 
)

Definition at line 72 of file PDGCodeList.cxx.

References CheckPDGCode().

73 {
74  if(this->CheckPDGCode(pdg_code)) {
75  if(n>1) n = 1;
76  vector<int>::insert(pos,n,pdg_code);
77  }
78 }
bool CheckPDGCode(int pdg_code) const
PDG code checks used by PDGCodeList.
Definition: PDGCodeList.cxx:80
PDGCodeList & PDGCodeList::operator= ( const PDGCodeList list)

overloaded operators

Definition at line 167 of file PDGCodeList.cxx.

References Copy().

Referenced by DuplEntriesAllowed().

168 {
169  this->Copy(list);
170  return (*this);
171 }
void Copy(const PDGCodeList &list)
copy / print
void PDGCodeList::Print ( ostream &  stream) const

Definition at line 129 of file PDGCodeList.cxx.

References febshutoff_auto::end, allTimeWatchdog::endl, genie::PDGLibrary::Find(), genie::PDGLibrary::Instance(), nc, and gen_flatrecord::size.

Referenced by genie::operator<<().

130 {
131  stream << "\n[-]" << endl;
132 
133  PDGLibrary * pdglib = PDGLibrary::Instance();
134 
135  PDGCodeList::const_iterator iter;
136  size_t nc = this->size();
137 
138  for(iter = this->begin(); iter != this->end(); ++iter) {
139  int pdg_code = *iter;
140  TParticlePDG * p = pdglib->Find(pdg_code);
141 
142  if(!p) {
143  stream << " |---o ** ERR: no particle with PDG code: " << pdg_code;
144  } else {
145  string name = p->GetName();
146  stream << " |---o "
147  << setfill(' ') << setw(15) << name
148  << " (PDG code = " << pdg_code << ")";
149  }
150  if( (--nc) > 0) stream << endl;
151  }
152 }
const XML_Char * name
Definition: expat.h:151
const char * p
Definition: xmltok.h:285
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:43
Singleton class to load & serve a TDatabasePDG.
Definition: PDGLibrary.h:30
TParticlePDG * Find(int pdgc)
Definition: PDGLibrary.cxx:61
enum BeamMode nc
void PDGCodeList::push_back ( int  pdg_code)

override the vector<int> insertion methods to explicitly check for PDG code validity and that no PDG code is listed more than once

Definition at line 67 of file PDGCodeList.cxx.

References CheckPDGCode(), and push_back().

Referenced by genie::flux::GCylindTH1Flux::AddEnergySpectrum(), genie::supernova::GSNovaModel::AddGenerator(), genie::geometry::ROOTGeomAnalyzer::BuildListOfTargetNuclei(), CheckDecayerConsistency(), Configure(), Copy(), genie::utils::nnbar_osc::DecayProductList(), genie::utils::intranuke::Equilibrium(), genie::utils::intranuke2018::Equilibrium(), genie::flux::GFluxBlender::FluxParticles(), genie::KNOHadronization::GenerateHadronCodes(), genie::flux::GDk2NuFlux::GenerateNext_weighted(), genie::flux::GSimpleNtpFlux::GenerateNext_weighted(), GetCommandLineArgs(), GetNeutrinoCodes(), GetPDGCodeListFromString(), GetTargetCodes(), genie::CharmHadronization::Hadronize(), genie::HAIntranuke::Inelastic(), genie::HAIntranuke2018::Inelastic(), genie::geometry::PointGeomAnalyzer::Initialize(), genie::flux::GMonoEnergeticFlux::Initialize(), genie::Decayer::LoadConfig(), main(), genie::MECGenerator::NucleonClusterConstituents(), ParseFluxFileConfig(), genie::utils::intranuke::PreEquilibrium(), genie::utils::intranuke2018::PreEquilibrium(), genie::flux::GSimpleNtpFlux::ProcessMeta(), genie::PythiaHadronization::SelectParticles(), genie::flux::GJPARCNuFlux::SetDefaults(), genie::flux::GDk2NuFlux::SetDefaults(), genie::flux::GNuMIFlux::SetDefaults(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().

68 {
69  if(this->CheckPDGCode(pdg_code)) vector<int>::push_back(pdg_code);
70 }
base_types push_back(int_type())
bool CheckPDGCode(int pdg_code) const
PDG code checks used by PDGCodeList.
Definition: PDGCodeList.cxx:80

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const PDGCodeList list 
)
friend

Definition at line 37 of file PDGCodeList.cxx.

Referenced by DuplEntriesAllowed().

38  {
39  list.Print(stream);
40  return stream;
41  }
void Print(ostream &stream) const

Member Data Documentation

bool genie::PDGCodeList::fAllowDuplicateEntries
private

allow duplicate entries in the list?

Definition at line 65 of file PDGCodeList.h.

Referenced by CheckPDGCode(), Copy(), DuplEntriesAllowed(), and PDGCodeList().


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