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 <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

May 06, 2004

Copyright (c) 2003-2020, 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.

103 {
104  if(b) return "ON";
105  else return "OFF";
106 }
static bool * b
Definition: config.cpp:1043
string genie::utils::print::BoolAsString ( bool  b)

Definition at line 91 of file PrintUtils.cxx.

92 {
93  return BoolAsTFString(b);
94 }
string BoolAsTFString(bool b)
Definition: PrintUtils.cxx:96
static bool * b
Definition: config.cpp:1043
string genie::utils::print::BoolAsTFString ( bool  b)

Definition at line 96 of file PrintUtils.cxx.

97 {
98  if(b) return "true";
99  else return "false";
100 }
static bool * b
Definition: config.cpp:1043
string genie::utils::print::BoolAsYNString ( bool  b)

Definition at line 108 of file PrintUtils.cxx.

109 {
110  if(b) return "YES";
111  else return "NO";
112 }
static bool * b
Definition: config.cpp:1043
string genie::utils::print::P3AsString ( const TVector3 *  vec)

Definition at line 69 of file PrintUtils.cxx.

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)

Definition at line 45 of file PrintUtils.cxx.

46 {
47  ostringstream fmt;
48 
49  fmt << "(E = " << p->Energy()
50  << ", px = " << p->Px()
51  << ", py = " << p->Py()
52  << ", pz = " << p->Pz() << ")";
53 
54  return fmt.str();
55 }
p
Definition: test.py:223
string genie::utils::print::P4AsString ( const TLorentzVector *  p)

Definition at line 27 of file PrintUtils.cxx.

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
p
Definition: test.py:223
void genie::utils::print::PrintBanner ( void  )

Definition at line 114 of file PrintUtils.cxx.

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 }
std::string string
Definition: nybbler.cc:12
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 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
string filename
Definition: train.py:213
QTextStream & endl(QTextStream &s)
string genie::utils::print::PrintFramedMesg ( string  mesg,
unsigned int  nl = 1,
const char  f = '*' 
)

Definition at line 164 of file PrintUtils.cxx.

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 }
std::string string
Definition: nybbler.cc:12
std::string nl(std::size_t i=1)
string genie::utils::print::Vec3AsString ( const TVector3 *  vec)

Definition at line 80 of file PrintUtils.cxx.

81 {
82  ostringstream fmt;
83 
84  fmt << "(x = " << vec->X()
85  << ", y = " << vec->Y()
86  << ", z = " << vec->Z() << ")";
87 
88  return fmt.str();
89 }
string genie::utils::print::X4AsString ( const TLorentzVector *  x)

Definition at line 57 of file PrintUtils.cxx.

58 {
59  ostringstream fmt;
60 
61  fmt << "(t = " << vec4->T()
62  << ", x = " << vec4->X()
63  << ", y = " << vec4->Y()
64  << ", z = " << vec4->Z() << ")";
65 
66  return fmt.str();
67 }