GENIEGenerator
Loading...
Searching...
No Matches
gMaxPathLengths.cxx File Reference
Include dependency graph for gMaxPathLengths.cxx:

Go to the source code of this file.

Functions

void GetCommandLineArgs (int argc, char **argv)
void PrintSyntax (void)
int main (int argc, char **argv)

Variables

string kDefOptXMLFilename = "maxpl.xml"
string kDefOptGeomLUnits = "mm"
string kDefOptGeomDUnits = "g_cm3"
string gOptGeomFilename = ""
string gOptXMLFilename = ""
string gOptRootGeomTopVol = ""
double gOptGeomLUnits = 0
double gOptGeomDUnits = 0
int gOptNPoints = -1
int gOptNRays = -1
long int gOptRanSeed = -1

Function Documentation

◆ GetCommandLineArgs()

void GetCommandLineArgs ( int argc,
char ** argv )

Definition at line 150 of file gMaxPathLengths.cxx.

151{
152 LOG("gmxpl", pINFO) << "Parsing command line arguments";
153
154 // Common run options.
156
157 // Parse run options for this app
158
159 CmdLnArgParser parser(argc,argv);
160
161 // output XML file name
162 if( parser.OptionExists('o') ) {
163 LOG("gmxpl", pDEBUG) << "Reading output filename";
164 gOptXMLFilename = parser.ArgAsString('o');
165 } else {
166 LOG("gmxpl", pDEBUG)
167 << "Unspecified output filename - Using default";
169 } // -o
170
171 // legth & density units
172 string lunits, dunits;
173 if( parser.OptionExists('L') ) {
174 LOG("gmxpl", pDEBUG) << "Checking for input geometry length units";
175 lunits = parser.ArgAsString('L');
176 } else {
177 LOG("gmxpl", pDEBUG) << "Using default geometry length units";
179 } // -L
180 if( parser.OptionExists('D') ) {
181 LOG("gmxpl", pDEBUG) << "Checking for input geometry density units";
182 dunits = parser.ArgAsString('D');
183 } else {
184 LOG("gmxpl", pDEBUG) << "Using default geometry density units";
185 dunits = kDefOptGeomDUnits;
186 } // -D
189
190 // root geometry top volume name
191 if( parser.OptionExists('t') ) {
192 LOG("gmxpl", pDEBUG)
193 << "Reading root geometry top volume name";
194 gOptRootGeomTopVol = parser.ArgAsString('t');
195 } else {
196 LOG("gmxpl", pDEBUG)
197 << "Unspecified geometry top volume - Using default";
199 } // -o
200
201 // number of scanning points / surface
202 if( parser.OptionExists('n') ) {
203 LOG("gmxpl", pDEBUG)
204 << "Reading input number of scanning points/surface";
205 gOptNPoints = parser.ArgAsInt('n');
206 } else {
207 LOG("gmxpl", pDEBUG)
208 << "Unspecified number of points - Using driver's default";
209 } //-n
210
211 // number of scanning rays / point
212 if( parser.OptionExists('r') ) {
213 LOG("gmxpl", pDEBUG)
214 << "Reading input number of scanning rays/point";
215 gOptNRays = parser.ArgAsInt('r');
216 } else {
217 LOG("gmxpl", pDEBUG)
218 << "Unspecified number of rays - Using driver's default";
219 } //-r
220
221 // input geometry file
222 if( parser.OptionExists('f') ) {
223 LOG("gmxpl", pDEBUG)
224 << "Reading ROOT/GEANT geometry filename";
225 gOptGeomFilename = parser.ArgAsString('f');
226 } else {
227 LOG("gmxpl", pFATAL)
228 << "No geometry file was specified - Exiting";
229 PrintSyntax();
230 exit(1);
231 } //-f
232
233 // random number seed
234 if( parser.OptionExists("seed") ) {
235 LOG("gmxpl", pINFO) << "Reading random number seed";
236 gOptRanSeed = parser.ArgAsLong("seed");
237 } else {
238 LOG("gmxpl", pINFO) << "Unspecified random number seed - Using default";
239 gOptRanSeed = -1;
240 }
241
242 // print the command line arguments
243 LOG("gmxpl", pNOTICE)
244 << "\n"
245 << utils::print::PrintFramedMesg("gmxpl job inputs");
246 LOG("gmxpl", pNOTICE) << "Command line arguments";
247 LOG("gmxpl", pNOTICE) << "Input ROOT geometry : " << gOptGeomFilename;
248 LOG("gmxpl", pNOTICE) << "Output XML file : " << gOptXMLFilename;
249 LOG("gmxpl", pNOTICE) << "Geometry length units : " << gOptGeomLUnits;
250 LOG("gmxpl", pNOTICE) << "Geometry density units : " << gOptGeomDUnits;
251 LOG("gmxpl", pNOTICE) << "Scanner points/surface : " << gOptNPoints;
252 LOG("gmxpl", pNOTICE) << "Scanner rays/point : " << gOptNRays;
253 LOG("gmxpl", pNOTICE) << "Random number seed : " << gOptRanSeed;
254
255 LOG("gmxpl", pNOTICE) << "\n";
256 LOG("gmxpl", pNOTICE) << *RunOpt::Instance();
257}
#define pNOTICE
Definition Messenger.h:61
#define pINFO
Definition Messenger.h:62
#define pFATAL
Definition Messenger.h:56
#define pDEBUG
Definition Messenger.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
Command line argument parser.
void ReadFromCommandLine(int argc, char **argv)
Definition RunOpt.cxx:99
static RunOpt * Instance(void)
Definition RunOpt.cxx:54
long int gOptRanSeed
double gOptGeomLUnits
string kDefOptGeomLUnits
string kDefOptGeomDUnits
double gOptGeomDUnits
string gOptRootGeomTopVol
string lunits
string gOptGeomFilename
int gOptNPoints
string kDefOptXMLFilename
int gOptNRays
void PrintSyntax(void)
string gOptXMLFilename
string PrintFramedMesg(string mesg, unsigned int nl=1, const char f=' *')
double UnitFromString(string u)
Definition UnitUtils.cxx:18

References genie::CmdLnArgParser::ArgAsInt(), genie::CmdLnArgParser::ArgAsLong(), genie::CmdLnArgParser::ArgAsString(), gOptGeomDUnits, gOptGeomFilename, gOptGeomLUnits, gOptNPoints, gOptNRays, gOptRanSeed, gOptRootGeomTopVol, gOptXMLFilename, genie::RunOpt::Instance(), kDefOptGeomDUnits, kDefOptGeomLUnits, kDefOptXMLFilename, LOG, lunits, genie::CmdLnArgParser::OptionExists(), pDEBUG, pFATAL, pINFO, pNOTICE, genie::utils::print::PrintFramedMesg(), PrintSyntax(), genie::RunOpt::ReadFromCommandLine(), and genie::utils::units::UnitFromString().

Referenced by main().

◆ main()

int main ( int argc,
char ** argv )

Definition at line 112 of file gMaxPathLengths.cxx.

113{
114 GetCommandLineArgs(argc,argv);
115
117 utils::app_init::MesgThresholds(RunOpt::Instance()->MesgThresholdFiles());
118
119 // Create the geometry driver
120 LOG("gmxpl", pINFO)
121 << "Creating/configuring a ROOT geom. driver";
122
124 geom -> SetLengthUnits (gOptGeomLUnits);
125 geom -> SetDensityUnits (gOptGeomDUnits);
126 geom -> SetWeightWithDensity (true);
127
128 // Set the top volume name
129 geom -> SetTopVolName (gOptRootGeomTopVol);
130 geom -> SetWeightWithDensity (true);
131
132 if(gOptNPoints > 0) geom->SetScannerNPoints(gOptNPoints);
133 if(gOptNRays > 0) geom->SetScannerNRays (gOptNRays);
134
135 // Compute the maximum path lengths
136 LOG("gmxpl", pINFO)
137 << "Asking input GeomAnalyzerI for the max path-lengths";
138 const PathLengthList & plmax = geom->ComputeMaxPathLengths();
139
140 // Print & save the maximum path lengths in XML format
141 LOG("gmxpl", pINFO)
142 << "Maximum path lengths: " << plmax;
144
145 delete geom;
146
147 return 0;
148}
Object to be filled with the neutrino path-length, for all detector geometry materials,...
void SaveAsXml(string filename) const
A ROOT/GEANT4 geometry driver.
string geom
void GetCommandLineArgs(int argc, char **argv)
void RandGen(long int seed)
Definition AppInit.cxx:30
void MesgThresholds(string inpfile)
Definition AppInit.cxx:99

References geom, GetCommandLineArgs(), gOptGeomDUnits, gOptGeomFilename, gOptGeomLUnits, gOptNPoints, gOptNRays, gOptRanSeed, gOptRootGeomTopVol, gOptXMLFilename, genie::RunOpt::Instance(), LOG, genie::utils::app_init::MesgThresholds(), pINFO, genie::utils::app_init::RandGen(), and genie::PathLengthList::SaveAsXml().

◆ PrintSyntax()

void PrintSyntax ( void )

Definition at line 259 of file gMaxPathLengths.cxx.

260{
261 LOG("gmxpl", pNOTICE)
262 << "\n\n" << "Syntax:" << "\n"
263 << " gmxpl"
264 << " -f geom_file"
265 << " [-L length_units]"
266 << " [-D density_units]"
267 << " [-t top_volume_name]"
268 << " [-o output_xml_file]"
269 << " [-seed random_number_seed]"
270 << " [--message-thresholds xml_file]\n";
271
272}

References LOG, and pNOTICE.

Referenced by GetCommandLineArgs().

Variable Documentation

◆ gOptGeomDUnits

double gOptGeomDUnits = 0

Definition at line 106 of file gMaxPathLengths.cxx.

◆ gOptGeomFilename

string gOptGeomFilename = ""

Definition at line 102 of file gMaxPathLengths.cxx.

◆ gOptGeomLUnits

double gOptGeomLUnits = 0

Definition at line 105 of file gMaxPathLengths.cxx.

◆ gOptNPoints

int gOptNPoints = -1

Definition at line 107 of file gMaxPathLengths.cxx.

Referenced by GetCommandLineArgs(), and main().

◆ gOptNRays

int gOptNRays = -1

Definition at line 108 of file gMaxPathLengths.cxx.

Referenced by GetCommandLineArgs(), and main().

◆ gOptRanSeed

long int gOptRanSeed = -1

Definition at line 109 of file gMaxPathLengths.cxx.

◆ gOptRootGeomTopVol

string gOptRootGeomTopVol = ""

Definition at line 104 of file gMaxPathLengths.cxx.

◆ gOptXMLFilename

string gOptXMLFilename = ""

Definition at line 103 of file gMaxPathLengths.cxx.

Referenced by GetCommandLineArgs(), LoadSplines(), and main().

◆ kDefOptGeomDUnits

string kDefOptGeomDUnits = "g_cm3"

Definition at line 99 of file gMaxPathLengths.cxx.

◆ kDefOptGeomLUnits

string kDefOptGeomLUnits = "mm"

Definition at line 98 of file gMaxPathLengths.cxx.

◆ kDefOptXMLFilename

string kDefOptXMLFilename = "maxpl.xml"

Definition at line 97 of file gMaxPathLengths.cxx.

Referenced by GetCommandLineArgs().