GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
genie::utils::print Namespace Reference

Simple printing utilities. More...

Functions

string P4AsString (const TLorentzVector *p)
 
string P4AsShortString (const TLorentzVector *p)
 
string X4AsString (const TLorentzVector *x)
 
string P3AsString (const TVector3 *vec)
 
string Vec3AsString (const TVector3 *vec)
 
string BoolAsString (bool b)
 
string BoolAsTFString (bool b)
 
string BoolAsIOString (bool b)
 
string BoolAsYNString (bool b)
 
void PrintBanner (void)
 
void PrintBanner (string filename, UInt_t wait_msec)
 
string PrintFramedMesg (string mesg, unsigned int nl=1, const char f='*')
 

Detailed Description

Simple printing utilities.

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

Function Documentation

string genie::utils::print::BoolAsIOString ( bool  b)

Definition at line 102 of file PrintUtils.cxx.

Referenced by genie::GEVGDriver::Print().

103 {
104  if(b) return "ON";
105  else return "OFF";
106 }
static constexpr double b
Definition: Units.h:78
string genie::utils::print::BoolAsString ( bool  b)

Definition at line 91 of file PrintUtils.cxx.

References BoolAsTFString().

Referenced by genie::XclsTag::Print().

92 {
93  return BoolAsTFString(b);
94 }
string BoolAsTFString(bool b)
Definition: PrintUtils.cxx:96
static constexpr double b
Definition: Units.h:78
string genie::utils::print::BoolAsTFString ( bool  b)

Definition at line 96 of file PrintUtils.cxx.

Referenced by BoolAsString().

97 {
98  if(b) return "true";
99  else return "false";
100 }
static constexpr double b
Definition: Units.h:78
string genie::utils::print::BoolAsYNString ( bool  b)
string genie::utils::print::P3AsString ( const TVector3 *  vec)

Definition at line 69 of file PrintUtils.cxx.

Referenced by genie::geometry::ROOTGeomAnalyzer::GenBoxRay(), genie::geometry::ROOTGeomAnalyzer::GenerateVertex(), genie::flux::GPowerLawFlux::SetDirectionCos(), and genie::flux::GMonoEnergeticFlux::SetDirectionCos().

70 {
71  ostringstream fmt;
72 
73  fmt << "(px = " << vec->X()
74  << ", py = " << vec->Y()
75  << ", pz = " << vec->Z() << ")";
76 
77  return fmt.str();
78 }
string genie::utils::print::P4AsShortString ( const TLorentzVector *  p)
string genie::utils::print::P4AsString ( const TLorentzVector *  p)

Definition at line 27 of file PrintUtils.cxx.

References genie::units::m2.

Referenced by genie::HadronicSystemGenerator::AddFinalHadronicSyst(), genie::CEvNSEventGenerator::AddFinalStateNeutrino(), genie::CEvNSEventGenerator::AddRecoilNucleus(), genie::COHDNuEventGenerator::AddRecoilNucleus(), genie::RSPPHadronicSystemGenerator::AddResonanceDecayProducts(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_ReinSehgal(), genie::DarkSectorDecayer::Decay(), genie::AGKYLowW2019::DecayMethod2(), genie::MECGenerator::DecayNucleonCluster(), genie::NucleonDecayPrimaryVtxGenerator::GenerateDecayProducts(), genie::NNBarOscPrimaryVtxGenerator::GenerateDecayProducts(), genie::hnl::Decayer::GenerateDecayProducts(), genie::GMCJDriver::GenerateEvent1Try(), genie::GMCJDriver::GenerateFluxNeutrino(), GenerateOriginMomentum(), genie::HadronicSystemGenerator::Hadronic4pLAB(), genie::AGCharm2019::Hadronize(), genie::hnl::FluxCreator::HNLEnergy(), main(), genie::hnl::FluxCreator::MakeTupleFluxEntry(), genie::HadronicSystemGenerator::MomentumTransferLAB(), genie::hnl::operator<<(), genie::AGKYLowW2019::PhaseSpaceDecay(), genie::utils::intranuke::PhaseSpaceDecay(), genie::utils::intranuke2018::PhaseSpaceDecay(), genie::Target::Print(), genie::PrimaryLeptonGenerator::ProcessEventRecord(), genie::OutgoingDarkGenerator::ProcessEventRecord(), genie::BaryonResonanceDecayer::SelectDecayChannel(), and TestDecay().

28 {
29  ostringstream fmt;
30 
31  fmt << "(E = " << p->Energy()
32  << ", px = " << p->Px()
33  << ", py = " << p->Py()
34  << ", pz = " << p->Pz() << ")";
35 
36  double m2 = p->Mag2();
37  if(m2>0.) fmt << " / M = " << TMath::Sqrt(m2);
38  else fmt << " / M^2 = " << m2;
39 
40  fmt << " / P = " << p->P();
41 
42  return fmt.str();
43 }
static constexpr double m2
Definition: Units.h:72
void genie::utils::print::PrintBanner ( void  )

Definition at line 114 of file PrintUtils.cxx.

Referenced by genie::Messenger::Instance().

115 {
116 // loads & prints the GENIE banner
117 
118  string base_dir = string(gSystem->Getenv("GENIE"));
119 
120 #ifdef __GENIE_DEVEL_VERSION__
121  string warn_dev_banner =
122  base_dir +
123  string("/data/logo/warning_development_version.txt");
124  PrintBanner(warn_dev_banner, 0);
125 #endif
126 
127 #ifdef __GENIE_RELEASE_CANDIDATE__
128  string warn_rc_banner =
129  base_dir +
130  string("/data/logo/warning_release_candidate.txt");
131  PrintBanner(warn_rc_banner, 0);
132 #endif
133 
134  string main_banner =
135  base_dir +
136  string("/data/logo/genie_banner_long.txt");
137  PrintBanner(main_banner, 0);
138 }
void PrintBanner(void)
Definition: PrintUtils.cxx:114
void genie::utils::print::PrintBanner ( string  filename,
UInt_t  wait_msec 
)

Definition at line 140 of file PrintUtils.cxx.

141 {
142  ifstream banner(filename.c_str(), ios::in);
143 
144  if( banner.is_open() ) {
145  banner.seekg(0, ios::end);
146 
147  int length = banner.tellg();
148  char * buffer = new char[length];
149 
150  banner.seekg(0, ios::beg);
151  banner.read(buffer, length);
152 
153  //cout << "\n\n" << buffer << "\n" << endl;
154  cout << "\n\n";
155  cout.write(buffer,length);
156  cout << "\n" << endl;
157 
158  delete [] buffer;
159 
160  gSystem->Sleep(wait_msec); // watch the banner for a while
161  }
162 }
string genie::utils::print::PrintFramedMesg ( string  mesg,
unsigned int  nl = 1,
const char  f = '*' 
)

Definition at line 164 of file PrintUtils.cxx.

Referenced by genie::EventGeneratorListAssembler::AssembleGeneratorList(), genie::GEVGDriver::BuildInteractionGeneratorMap(), genie::GEVGDriver::Configure(), genie::GMCJDriver::Configure(), genie::GEVGDriver::GenerateEvent(), GetCommandLineArgs(), genie::EventGenerator::ProcessEventRecord(), and genie::PhysInteractionSelector::SelectInteraction().

166 {
167  string frame(4+mesg.size(),f);
168 
169  string framed_mesg = string("\n") +
170  frame + string("\n") +
171  string(" ") + mesg + string(" ") + string("\n") +
172  frame;
173 
174  for(unsigned il=0; il<nl; il++) { framed_mesg += string("\n"); }
175 
176  return framed_mesg;
177 }
string genie::utils::print::Vec3AsString ( const TVector3 *  vec)
string genie::utils::print::X4AsString ( const TLorentzVector *  x)