ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsConfigurationHelper Class Reference

#include <PhysicsConfigurationHelper.h>

Collaboration diagram for PhysicsConfigurationHelper:

Public Member Functions

bool Resonant () const
bool ReggeModel () const
double ResonanceEnergy () const
double XsecMultiplier () const
double Gamma () const
double Amplitude () const
double SuppressionFactor () const
double Lifetime () const
double Mixing () const
int DoDecays () const

Static Public Member Functions

static const PhysicsConfigurationHelperInstance ()

Protected Member Functions

 PhysicsConfigurationHelper ()
 PhysicsConfigurationHelper (const PhysicsConfigurationHelper &)
PhysicsConfigurationHelperoperator= (const PhysicsConfigurationHelper &)

Private Member Functions

void ReadAndParse (const G4String &str, std::vector< G4String > &tokens, const G4String &delimiters=" ") const
void ReadInPhysicsParameters (std::map< G4String, G4double > &parameters) const

Private Attributes

bool m_resonant {false}
bool m_reggemodel {false}
double m_ek_0 {0.}
double m_gamma {0.}
double m_amplitude {0.}
double m_xsecmultiplier {1.}
double m_suppressionfactor {0.}
double m_hadronlifetime {0.}
double m_mixing {0.}
int m_doDecays {0}

Detailed Description

Definition at line 14 of file PhysicsConfigurationHelper.h.

Constructor & Destructor Documentation

◆ PhysicsConfigurationHelper() [1/2]

PhysicsConfigurationHelper::PhysicsConfigurationHelper ( )
protected

Definition at line 12 of file PhysicsConfigurationHelper.cxx.

13{
14 G4cout << "PhysicsConfigurationHelper constructor: start" << G4endl;
15
16 std::map<G4String,G4double> parameters;
17 ReadInPhysicsParameters(parameters);
18 if (parameters["Resonant"]!=0.) m_resonant=true;
19 m_ek_0 = parameters["ResonanceEnergy"]*CLHEP::GeV;
20 m_gamma = parameters["Gamma"]*CLHEP::GeV;
21 m_amplitude = parameters["Amplitude"]*CLHEP::millibarn;
22 m_xsecmultiplier = parameters["XsecMultiplier"];
23 m_suppressionfactor = parameters["ReggeSuppression"];
24 m_hadronlifetime = parameters["HadronLifeTime"];
25 m_mixing = parameters["Mixing"];
26 if (parameters["ReggeModel"]!=0.) m_reggemodel=true;
27 m_doDecays=parameters["DoDecays"];
28
29 G4cout<<"Read in physics parameters:"<<G4endl;
30 G4cout<<"Resonant = "<< m_resonant <<G4endl;
31 G4cout<<"ResonanceEnergy = "<<m_ek_0/CLHEP::GeV<<" GeV"<<G4endl;
32 G4cout<<"XsecMultiplier = "<<m_xsecmultiplier<<G4endl;
33 G4cout<<"Gamma = "<<m_gamma/CLHEP::GeV<<" GeV"<<G4endl;
34 G4cout<<"Amplitude = "<<m_amplitude/CLHEP::millibarn<<" millibarn"<<G4endl;
35 G4cout<<"ReggeSuppression = "<<100*m_suppressionfactor<<" %"<<G4endl;
36 G4cout<<"HadronLifeTime = "<<m_hadronlifetime;
37 if (m_doDecays) G4cout<<" ns"<<G4endl;
38 else G4cout<<" s"<<G4endl;
39 G4cout<<"ReggeModel = "<< m_reggemodel <<G4endl;
40 G4cout<<"Mixing = "<< m_mixing*100 <<" %"<<G4endl;
41 G4cout<<"DoDecays = "<< m_doDecays << G4endl;
42
43 if ((!m_doDecays && m_hadronlifetime>0.) ||
45 G4cout << "WARNING: Inconsistent treatment of R-Hadron properties! Lifetime of " << m_hadronlifetime
46 << " and doDecays= " << m_doDecays << G4endl;
47 }
48
49 return;
50}
void ReadInPhysicsParameters(std::map< G4String, G4double > &parameters) const

◆ PhysicsConfigurationHelper() [2/2]

PhysicsConfigurationHelper::PhysicsConfigurationHelper ( const PhysicsConfigurationHelper & )
protected

Member Function Documentation

◆ Amplitude()

double PhysicsConfigurationHelper::Amplitude ( ) const
inline

Definition at line 24 of file PhysicsConfigurationHelper.h.

24{ return m_amplitude; }

◆ DoDecays()

int PhysicsConfigurationHelper::DoDecays ( ) const
inline

Definition at line 28 of file PhysicsConfigurationHelper.h.

28{ return m_doDecays; }

◆ Gamma()

double PhysicsConfigurationHelper::Gamma ( ) const
inline

Definition at line 23 of file PhysicsConfigurationHelper.h.

23{ return m_gamma; }

◆ Instance()

const PhysicsConfigurationHelper * PhysicsConfigurationHelper::Instance ( )
static

Definition at line 53 of file PhysicsConfigurationHelper.cxx.

54{
56 return &instance;
57}
std::map< std::string, double > instance

◆ Lifetime()

double PhysicsConfigurationHelper::Lifetime ( ) const
inline

Definition at line 26 of file PhysicsConfigurationHelper.h.

26{ return (m_doDecays == 1) ? m_hadronlifetime * CLHEP::ns : m_hadronlifetime * CLHEP::s; }

◆ Mixing()

double PhysicsConfigurationHelper::Mixing ( ) const
inline

Definition at line 27 of file PhysicsConfigurationHelper.h.

27{ return m_mixing; }

◆ operator=()

PhysicsConfigurationHelper & PhysicsConfigurationHelper::operator= ( const PhysicsConfigurationHelper & )
protected

◆ ReadAndParse()

void PhysicsConfigurationHelper::ReadAndParse ( const G4String & str,
std::vector< G4String > & tokens,
const G4String & delimiters = " " ) const
private

Definition at line 88 of file PhysicsConfigurationHelper.cxx.

91{
92 // Skip delimiters at beginning.
93 G4String::size_type lastPos = str.find_first_not_of(delimiters, 0);
94 if (lastPos==G4String::npos) return;
95
96 // Find first "non-delimiter".
97 G4String::size_type pos = str.find_first_of(delimiters, lastPos);
98
99 while (G4String::npos != pos || G4String::npos != lastPos)
100 {
101 //Skipping leading / trailing whitespaces
102 G4String temp = str.substr(lastPos, pos - lastPos);
103 while(temp.c_str()[0] == ' ') temp.erase(0,1);
104 while(temp[temp.size()-1] == ' ') temp.erase(temp.size()-1,1);
105
106 // Found a token, add it to the vector.
107 tokens.push_back(std::move(temp));
108
109 // Skip delimiters. Note the "not_of"
110 lastPos = str.find_first_not_of(delimiters, pos);
111 if (lastPos==G4String::npos) continue;
112
113 // Find next "non-delimiter"
114 pos = str.find_first_of(delimiters, lastPos);
115 }
116}

◆ ReadInPhysicsParameters()

void PhysicsConfigurationHelper::ReadInPhysicsParameters ( std::map< G4String, G4double > & parameters) const
private

Definition at line 60 of file PhysicsConfigurationHelper.cxx.

61 {
62 parameters["Resonant"]=0.;
63 parameters["ResonanceEnergy"]=0.;
64 parameters["XsecMultiplier"]=1.;
65 parameters["Gamma"]=0.;
66 parameters["Amplitude"]=0.;
67 parameters["ReggeSuppression"]=0.;
68 parameters["HadronLifeTime"]=0.;
69 parameters["ReggeModel"]=0.;
70 parameters["Mixing"]=0.;
71 parameters["DoDecays"]=0;
72
73 std::ifstream physics_stream ("PhysicsConfiguration.txt");
74 G4String line;
75 char** endptr=0;
76 while (getline(physics_stream,line)) {
77 std::vector<G4String> tokens;
78 //Getting a line
79 ReadAndParse(line,tokens,"=");
80 G4String key = tokens[0];
81 G4double val = strtod(tokens[1],endptr);
83 }
84 physics_stream.close();
85 }
void ReadAndParse(const G4String &str, std::vector< G4String > &tokens, const G4String &delimiters=" ") const

◆ ReggeModel()

bool PhysicsConfigurationHelper::ReggeModel ( ) const
inline

Definition at line 20 of file PhysicsConfigurationHelper.h.

20{ return m_reggemodel; }

◆ ResonanceEnergy()

double PhysicsConfigurationHelper::ResonanceEnergy ( ) const
inline

Definition at line 21 of file PhysicsConfigurationHelper.h.

21{ return m_ek_0; }

◆ Resonant()

bool PhysicsConfigurationHelper::Resonant ( ) const
inline

Definition at line 19 of file PhysicsConfigurationHelper.h.

19{ return m_resonant; }

◆ SuppressionFactor()

double PhysicsConfigurationHelper::SuppressionFactor ( ) const
inline

Definition at line 25 of file PhysicsConfigurationHelper.h.

25{ return m_suppressionfactor; }

◆ XsecMultiplier()

double PhysicsConfigurationHelper::XsecMultiplier ( ) const
inline

Definition at line 22 of file PhysicsConfigurationHelper.h.

22{ return m_xsecmultiplier; }

Member Data Documentation

◆ m_amplitude

double PhysicsConfigurationHelper::m_amplitude {0.}
private

Definition at line 47 of file PhysicsConfigurationHelper.h.

47{0.};

◆ m_doDecays

int PhysicsConfigurationHelper::m_doDecays {0}
private

Definition at line 52 of file PhysicsConfigurationHelper.h.

52{0};

◆ m_ek_0

double PhysicsConfigurationHelper::m_ek_0 {0.}
private

Definition at line 45 of file PhysicsConfigurationHelper.h.

45{0.};

◆ m_gamma

double PhysicsConfigurationHelper::m_gamma {0.}
private

Definition at line 46 of file PhysicsConfigurationHelper.h.

46{0.};

◆ m_hadronlifetime

double PhysicsConfigurationHelper::m_hadronlifetime {0.}
private

Definition at line 50 of file PhysicsConfigurationHelper.h.

50{0.};

◆ m_mixing

double PhysicsConfigurationHelper::m_mixing {0.}
private

Definition at line 51 of file PhysicsConfigurationHelper.h.

51{0.};

◆ m_reggemodel

bool PhysicsConfigurationHelper::m_reggemodel {false}
private

Definition at line 44 of file PhysicsConfigurationHelper.h.

44{false};

◆ m_resonant

bool PhysicsConfigurationHelper::m_resonant {false}
private

Definition at line 43 of file PhysicsConfigurationHelper.h.

43{false};

◆ m_suppressionfactor

double PhysicsConfigurationHelper::m_suppressionfactor {0.}
private

Definition at line 49 of file PhysicsConfigurationHelper.h.

49{0.};

◆ m_xsecmultiplier

double PhysicsConfigurationHelper::m_xsecmultiplier {1.}
private

Definition at line 48 of file PhysicsConfigurationHelper.h.

48{1.};

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