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 <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

May 06, 2004

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

Function Documentation

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

Definition at line 109 of file PrintUtils.cxx.

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

110 {
111  if(b) return "ON";
112  else return "OFF";
113 }
const hit & b
Definition: hits.cxx:21
string genie::utils::print::BoolAsString ( bool  b)

Definition at line 98 of file PrintUtils.cxx.

References BoolAsTFString().

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

99 {
100  return BoolAsTFString(b);
101 }
string BoolAsTFString(bool b)
Definition: PrintUtils.cxx:103
const hit & b
Definition: hits.cxx:21
string genie::utils::print::BoolAsTFString ( bool  b)

Definition at line 103 of file PrintUtils.cxx.

Referenced by BoolAsString().

104 {
105  if(b) return "true";
106  else return "false";
107 }
const hit & b
Definition: hits.cxx:21
string genie::utils::print::BoolAsYNString ( bool  b)
string genie::utils::print::P3AsString ( const TVector3 *  vec)

Definition at line 76 of file PrintUtils.cxx.

References PandAna.Demos.pi0_spectra::fmt.

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

77 {
78  ostringstream fmt;
79 
80  fmt << "(px = " << vec->X()
81  << ", py = " << vec->Y()
82  << ", pz = " << vec->Z() << ")";
83 
84  return fmt.str();
85 }
Eigen::VectorXd vec
string genie::utils::print::P4AsShortString ( const TLorentzVector *  p)
string genie::utils::print::P4AsString ( const TLorentzVector *  p)

Definition at line 34 of file PrintUtils.cxx.

References PandAna.Demos.pi0_spectra::fmt, Munits::m2, and ana::Sqrt().

Referenced by genie::HadronicSystemGenerator::AddFinalHadronicSyst(), genie::RSPPHadronicSystemGenerator::AddResonanceDecayProducts(), genie::COHHadronicSystemGenerator::CalculateHadronicSystem_ReinSehgal(), genie::KNOHadronization::DecayMethod2(), genie::MECGenerator::DecayNucleonCluster(), genie::NucleonDecayPrimaryVtxGenerator::GenerateDecayProducts(), genie::NNBarOscPrimaryVtxGenerator::GenerateDecayProducts(), genie::GMCJDriver::GenerateEvent1Try(), genie::GMCJDriver::GenerateFluxNeutrino(), genie::HadronicSystemGenerator::Hadronic4pLAB(), genie::CharmHadronization::Hadronize(), genie::HadronicSystemGenerator::MomentumTransferLAB(), genie::KNOHadronization::PhaseSpaceDecay(), genie::utils::intranuke::PhaseSpaceDecay(), genie::utils::intranuke2018::PhaseSpaceDecay(), genie::Target::Print(), genie::PrimaryLeptonGenerator::ProcessEventRecord(), genie::OutgoingDarkGenerator::ProcessEventRecord(), and genie::BaryonResonanceDecayer::SelectDecayChannel().

35 {
36  ostringstream fmt;
37 
38  fmt << "(E = " << p->Energy()
39  << ", px = " << p->Px()
40  << ", py = " << p->Py()
41  << ", pz = " << p->Pz() << ")";
42 
43  double m2 = p->Mag2();
44  if(m2>0.) fmt << " / M = " << TMath::Sqrt(m2);
45  else fmt << " / M^2 = " << m2;
46 
47  fmt << " / P = " << p->P();
48 
49  return fmt.str();
50 }
const char * p
Definition: xmltok.h:285
static constexpr Double_t m2
Definition: Munits.h:145
Var Sqrt(const Var &v)
Use to take sqrt of a var.
Definition: Var.cxx:324
void genie::utils::print::PrintBanner ( void  )

Definition at line 121 of file PrintUtils.cxx.

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

122 {
123 // loads & prints the GENIE banner
124 
125  string base_dir = string(gSystem->Getenv("GENIE"));
126 
127 #ifdef __GENIE_DEVEL_VERSION__
128  string warn_dev_banner =
129  base_dir +
130  string("/data/logo/warning_development_version.txt");
131  PrintBanner(warn_dev_banner, 0);
132 #endif
133 
134 #ifdef __GENIE_RELEASE_CANDIDATE__
135  string warn_rc_banner =
136  base_dir +
137  string("/data/logo/warning_release_candidate.txt");
138  PrintBanner(warn_rc_banner, 0);
139 #endif
140 
141  string main_banner =
142  base_dir +
143  string("/data/logo/genie_banner_long.txt");
144  PrintBanner(main_banner, 0);
145 }
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
void PrintBanner(void)
Definition: PrintUtils.cxx:121
void genie::utils::print::PrintBanner ( string  filename,
UInt_t  wait_msec 
)

Definition at line 147 of file PrintUtils.cxx.

References plot_validation_datamc::banner, om::cout, febshutoff_auto::end, allTimeWatchdog::endl, in, and demo0::length.

148 {
149  ifstream banner(filename.c_str(), ios::in);
150 
151  if( banner.is_open() ) {
152  banner.seekg(0, ios::end);
153 
154  int length = banner.tellg();
155  char * buffer = new char[length];
156 
157  banner.seekg(0, ios::beg);
158  banner.read(buffer, length);
159 
160  //cout << "\n\n" << buffer << "\n" << endl;
161  cout << "\n\n";
162  cout.write(buffer,length);
163  cout << "\n" << endl;
164 
165  delete [] buffer;
166 
167  gSystem->Sleep(wait_msec); // watch the banner for a while
168  }
169 }
string filename
Definition: shutoffs.py:106
::xsd::cxx::tree::buffer< char > buffer
Definition: Database.h:179
length
Definition: demo0.py:21
OStream cout
Definition: OStream.cxx:6
ifstream in
Definition: comparison.C:7
string genie::utils::print::PrintFramedMesg ( string  mesg,
unsigned int  nl = 1,
const char  f = '*' 
)

Definition at line 171 of file PrintUtils.cxx.

References MakeMiniprodValidationCuts::f, and fhicl::detail::nl().

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

173 {
174  string frame(4+mesg.size(),f);
175 
176  string framed_mesg = string("\n") +
177  frame + string("\n") +
178  string(" ") + mesg + string(" ") + string("\n") +
179  frame;
180 
181  for(unsigned il=0; il<nl; il++) { framed_mesg += string("\n"); }
182 
183  return framed_mesg;
184 }
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
std::string nl(std::size_t i=1)
string genie::utils::print::Vec3AsString ( const TVector3 *  vec)
string genie::utils::print::X4AsString ( const TLorentzVector *  x)