GammaCombo  Rev:Unversioneddirectory
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
OptParser Class Reference

#include <OptParser.h>

Public Member Functions

void bookAllOptions ()
 Book all available options, if you are lazy. More...
 
void bookFlowcontrolOptions ()
 Book options associated to the flow control. More...
 
void bookOption (TString opt)
 Book the given option. More...
 
void bookPlottingOptions ()
 Book options associated to plotting. More...
 
void bookPluginOptions ()
 Book options associated to the Plugin method and the Berger-Boos method (batch job handling, control plots). More...
 
void bookProbOptions ()
 Book options associated to the Prob method. More...
 
bool isAction (TString s)
 Check the –action argument. More...
 
bool isAsimovCombiner (int id)
 Check if a combiner with a given ID is an Asimov combiner. More...
 
bool isQuickhack (int id)
 Check the –quickhack argument. More...
 
 OptParser ()
 Organize command line options. More...
 
void parseArguments (int argc, char *argv[])
 Parse the command line for booked options. More...
 
 ~OptParser ()
 

Public Attributes

vector< TString > action
 
vector< int > asimov
 
vector< TString > asimovfile
 
bool batcheos
 
int batchstartn
 
bool cacheStartingValues
 
vector< int > cls
 
CmdLine cmd
 
vector< int > color
 
vector< int > combid
 
vector< vector< int > > combmodifications
 
bool confirmsols
 
bool controlplot
 
int coverageCorrectionID
 
int coverageCorrectionPoint
 
bool debug
 
int digits
 
bool enforcePhysRange
 
TString filenameaddition
 
TString filenamechange
 
vector< int > fillstyle
 
vector< vector< FixPar > > fixParameters
 
TString group
 
TString groupPos
 
TString hfagLabel
 
TString hfagLabelPos
 
int id
 
bool importance
 
bool info
 
bool interactive
 
bool intprob
 
vector< int > jmax
 
vector< int > jmin
 
TString jobdir
 
bool largest
 
bool latex
 
bool lightfiles
 
vector< TString > loadParamsFile
 
int nbatchjobs
 
int nBBpoints
 
int ncoveragetoys
 
int ndiv
 
int ndivy
 
bool nosyst
 
int npoints1d
 
int npoints2dx
 
int npoints2dy
 
int npointstoy
 
int nrun
 
int nsmooth
 
int ntoys
 
bool parevol
 
TString parsavefile
 
vector< int > pevid
 
vector< vector< RangePar > > physRanges
 
vector< int > plot2dcl
 
TString plotext
 
float plotgroupx
 
float plotgroupy
 
Double_t plotHFAGLabelPosX
 
Double_t plotHFAGLabelPosY
 
Double_t plotHFAGLabelScale
 
int plotid
 
bool plotlegend
 
float plotlegsizex
 
float plotlegsizey
 
TString plotlegstyle
 
float plotlegx
 
float plotlegy
 
bool plotlog
 
bool plotmagnetic
 
int plotnsigmacont
 
bool plotorigin
 
bool plotpluginonly
 
bool plotprelim
 
bool plotpulls
 
vector< int > plotsoln
 
vector< int > plotsolutions
 
bool plotunoff
 
float plotymax
 
float plotymin
 
float pluginPlotRangeMax
 
float pluginPlotRangeMin
 
bool printcor
 
float printSolX
 
float printSolY
 
bool probforce
 
bool probimprove
 
TString probScanResult
 
vector< int > qh
 
TString queue
 
vector< vector< TString > > randomizeToyVars
 
vector< TString > readfromfile
 
vector< TString > relation
 
vector< vector< TString > > removeRanges
 
bool runCLs
 
TString save
 
bool saveAtMin
 
vector< float > savenuisances1d
 
vector< float > savenuisances2dx
 
vector< float > savenuisances2dy
 
bool scanforce
 
float scanrangeMax
 
float scanrangeMin
 
float scanrangeyMax
 
float scanrangeyMin
 
bool smooth2d
 
vector< TString > title
 
TString toyFiles
 
bool usage
 
vector< TString > var
 
bool verbose
 

Private Member Functions

int convertToDigitWithCheck (TString parseMe, TString usage)
 Helper function for parseCombinerString(). More...
 
int convertToIntWithCheck (TString parseMe, TString usage)
 Helper function for parseCombinerString(). More...
 
void defineOptions ()
 Define the names of all available command line options. More...
 
bool parseAssignment (TString parseMe, TString &name, TString &value)
 Parse a variable assignment string. More...
 
bool parseAssignment (TString parseMe, TString &name, float &value)
 Parse a variable assignment string. More...
 
void parseCombinerString (TString parseMe, int &resultCmbId, vector< int > &resultAddDelPdf)
 Parse -c string (combiner ID with add/del PDF modification requests). More...
 
void parsePosition (TString parseMe, float &x, float &y, TString usage)
 Parse the position arguments, which define the position of the legend and logo in the plots. More...
 
void parsePositionAndScale (TString parseMe, Double_t &x, Double_t &y, Double_t &scale, TString usage)
 
bool parseRange (TString parseMe, float &min, float &max)
 Parse the range arguments. More...
 

Private Attributes

vector< TString > availableOptions
 
vector< TString > bookedOptions
 

Detailed Description

Definition at line 22 of file OptParser.h.

Constructor & Destructor Documentation

§ OptParser()

OptParser::OptParser ( )

Organize command line options.

The strategy is to have one object of this class present in the main program, which then gets passed down to all other objects. The command line options are made available through data members of this class. Options can be booked, either in blocks using the respective functions, or individually. Only booked options get parsed from the command line.

To add a new option,

  • add a data member
  • add its initializer to the constructor (vectors don't need initializers).
  • add its name to defineOptions()
  • add its definition and parsing to parseArguments()

Definition at line 18 of file OptParser.cpp.

§ ~OptParser()

OptParser::~OptParser ( )

Member Function Documentation

§ bookAllOptions()

void OptParser::bookAllOptions ( )

Book all available options, if you are lazy.

Definition at line 218 of file OptParser.cpp.

§ bookFlowcontrolOptions()

void OptParser::bookFlowcontrolOptions ( )

Book options associated to the flow control.

Definition at line 302 of file OptParser.cpp.

§ bookOption()

void OptParser::bookOption ( TString  opt)

Book the given option.

Checks if it is available.

Parameters
optBook this option.

Definition at line 315 of file OptParser.cpp.

§ bookPlottingOptions()

void OptParser::bookPlottingOptions ( )

Book options associated to plotting.

Definition at line 227 of file OptParser.cpp.

§ bookPluginOptions()

void OptParser::bookPluginOptions ( )

Book options associated to the Plugin method and the Berger-Boos method (batch job handling, control plots).

Definition at line 254 of file OptParser.cpp.

§ bookProbOptions()

void OptParser::bookProbOptions ( )

Book options associated to the Prob method.

Definition at line 280 of file OptParser.cpp.

§ convertToDigitWithCheck()

int OptParser::convertToDigitWithCheck ( TString  parseMe,
TString  usage 
)
private

Helper function for parseCombinerString().

Checks if a string is a digit (positive integer), if not, exits with printing the usage.

Definition at line 1350 of file OptParser.cpp.

§ convertToIntWithCheck()

int OptParser::convertToIntWithCheck ( TString  parseMe,
TString  usage 
)
private

Helper function for parseCombinerString().

Checks if a string is an integer (pos or neg), if not, exits with printing the usage.

Definition at line 1336 of file OptParser.cpp.

§ defineOptions()

void OptParser::defineOptions ( )
private

Define the names of all available command line options.

Other places of the code will check against this list.

Definition at line 118 of file OptParser.cpp.

§ isAction()

bool OptParser::isAction ( TString  s)

Check the –action argument.

Was action 's' given?

Definition at line 327 of file OptParser.cpp.

§ isAsimovCombiner()

bool OptParser::isAsimovCombiner ( int  id)

Check if a combiner with a given ID is an Asimov combiner.

The ID is the position of the -c argument on the command line.

Parameters
id- position of -c argument

Definition at line 1419 of file OptParser.cpp.

§ isQuickhack()

bool OptParser::isQuickhack ( int  id)

Check the –quickhack argument.

Was hack 'id' given?

Definition at line 335 of file OptParser.cpp.

§ parseArguments()

void OptParser::parseArguments ( int  argc,
char *  argv[] 
)

Parse the command line for booked options.

Then apply some post-processing and checks, where necessary. Save the parsed values into the datamembers. If an option was not given or not booked, it will assume the default value given here.

< can't assign directly because of TString cast

Definition at line 346 of file OptParser.cpp.

§ parseAssignment() [1/2]

bool OptParser::parseAssignment ( TString  parseMe,
TString &  name,
TString &  value 
)
private

Parse a variable assignment string.

Parameters
parseMeFormat: "foovar=3.14"
namereturn string
valuereturn value

Definition at line 1306 of file OptParser.cpp.

§ parseAssignment() [2/2]

bool OptParser::parseAssignment ( TString  parseMe,
TString &  name,
float &  value 
)
private

Parse a variable assignment string.

Parameters
parseMeFormat: "foovar=3.14"
namereturn string
valuereturn value

Definition at line 1324 of file OptParser.cpp.

§ parseCombinerString()

void OptParser::parseCombinerString ( TString  parseMe,
int &  resultCmbId,
vector< int > &  resultAddDelPdf 
)
private

Parse -c string (combiner ID with add/del PDF modification requests).

The string to parse looks sth like "combinerId:+pdfId1,-pdfId2" Examples: -c 26 -c 26:+12,+23 -c 26:+12,-3

Parameters
parseMe- the string provided to -c
resultCmbId- resulting combiner ID
resultAddDelPdf- vector of all PDF IDs, that are requested to be added or deleted to/from the combiner. If it is supposed to be added, a positive PDF ID is stored, if it is supposed to be deleted, a negative PDF ID is stored

Definition at line 1374 of file OptParser.cpp.

§ parsePosition()

void OptParser::parsePosition ( TString  parseMe,
float &  x,
float &  y,
TString  usage 
)
private

Parse the position arguments, which define the position of the legend and logo in the plots.

The position needs to be given as x:y, where x and y are floating point numbers between 0.0 and 1.0. To use the default position for either one, use "def".

Parameters
parseMe- parse this string. Example formats: 0.1:0.5, .1:.5, def:0.6, .75:def
x- return value x
y- return value y
usage- string containing some usage information which is printed when there is an error.

Definition at line 1177 of file OptParser.cpp.

§ parsePositionAndScale()

void OptParser::parsePositionAndScale ( TString  parseMe,
Double_t &  x,
Double_t &  y,
Double_t &  scale,
TString  usage 
)
private

Definition at line 1219 of file OptParser.cpp.

§ parseRange()

bool OptParser::parseRange ( TString  parseMe,
float &  min,
float &  max 
)
private

Parse the range arguments.

Parameters
parseMeFormat: "min-max", e.g. "3.28:7.34"
minreturn value
maxreturn value

Definition at line 1280 of file OptParser.cpp.

Member Data Documentation

§ action

vector<TString> OptParser::action

Definition at line 39 of file OptParser.h.

§ asimov

vector<int> OptParser::asimov

Definition at line 40 of file OptParser.h.

§ asimovfile

vector<TString> OptParser::asimovfile

Definition at line 41 of file OptParser.h.

§ availableOptions

vector<TString> OptParser::availableOptions
private

Definition at line 163 of file OptParser.h.

§ batcheos

bool OptParser::batcheos

Definition at line 77 of file OptParser.h.

§ batchstartn

int OptParser::batchstartn

Definition at line 76 of file OptParser.h.

§ bookedOptions

vector<TString> OptParser::bookedOptions
private

Definition at line 164 of file OptParser.h.

§ cacheStartingValues

bool OptParser::cacheStartingValues

Definition at line 42 of file OptParser.h.

§ cls

vector<int> OptParser::cls

Definition at line 43 of file OptParser.h.

§ cmd

CmdLine OptParser::cmd

Definition at line 151 of file OptParser.h.

§ color

vector<int> OptParser::color

Definition at line 44 of file OptParser.h.

§ combid

vector<int> OptParser::combid

Definition at line 45 of file OptParser.h.

§ combmodifications

vector<vector<int> > OptParser::combmodifications

Definition at line 46 of file OptParser.h.

§ confirmsols

bool OptParser::confirmsols

Definition at line 47 of file OptParser.h.

§ controlplot

bool OptParser::controlplot

Definition at line 48 of file OptParser.h.

§ coverageCorrectionID

int OptParser::coverageCorrectionID

Definition at line 49 of file OptParser.h.

§ coverageCorrectionPoint

int OptParser::coverageCorrectionPoint

Definition at line 50 of file OptParser.h.

§ debug

bool OptParser::debug

Definition at line 51 of file OptParser.h.

§ digits

int OptParser::digits

Definition at line 52 of file OptParser.h.

§ enforcePhysRange

bool OptParser::enforcePhysRange

Definition at line 53 of file OptParser.h.

§ filenameaddition

TString OptParser::filenameaddition

Definition at line 56 of file OptParser.h.

§ filenamechange

TString OptParser::filenamechange

Definition at line 55 of file OptParser.h.

§ fillstyle

vector<int> OptParser::fillstyle

Definition at line 54 of file OptParser.h.

§ fixParameters

vector<vector<FixPar> > OptParser::fixParameters

Definition at line 57 of file OptParser.h.

§ group

TString OptParser::group

Definition at line 61 of file OptParser.h.

§ groupPos

TString OptParser::groupPos

Definition at line 62 of file OptParser.h.

§ hfagLabel

TString OptParser::hfagLabel

Definition at line 63 of file OptParser.h.

§ hfagLabelPos

TString OptParser::hfagLabelPos

Definition at line 64 of file OptParser.h.

§ id

int OptParser::id

Definition at line 65 of file OptParser.h.

§ importance

bool OptParser::importance

Definition at line 66 of file OptParser.h.

§ info

bool OptParser::info

Definition at line 67 of file OptParser.h.

§ interactive

bool OptParser::interactive

Definition at line 68 of file OptParser.h.

§ intprob

bool OptParser::intprob

Definition at line 120 of file OptParser.h.

§ jmax

vector<int> OptParser::jmax

Definition at line 69 of file OptParser.h.

§ jmin

vector<int> OptParser::jmin

Definition at line 70 of file OptParser.h.

§ jobdir

TString OptParser::jobdir

Definition at line 71 of file OptParser.h.

§ largest

bool OptParser::largest

Definition at line 72 of file OptParser.h.

§ latex

bool OptParser::latex

Definition at line 73 of file OptParser.h.

§ lightfiles

bool OptParser::lightfiles

Definition at line 75 of file OptParser.h.

§ loadParamsFile

vector<TString> OptParser::loadParamsFile

Definition at line 74 of file OptParser.h.

§ nbatchjobs

int OptParser::nbatchjobs

Definition at line 78 of file OptParser.h.

§ nBBpoints

int OptParser::nBBpoints

Definition at line 79 of file OptParser.h.

§ ncoveragetoys

int OptParser::ncoveragetoys

Definition at line 87 of file OptParser.h.

§ ndiv

int OptParser::ndiv

Definition at line 80 of file OptParser.h.

§ ndivy

int OptParser::ndivy

Definition at line 81 of file OptParser.h.

§ nosyst

bool OptParser::nosyst

Definition at line 82 of file OptParser.h.

§ npoints1d

int OptParser::npoints1d

Definition at line 83 of file OptParser.h.

§ npoints2dx

int OptParser::npoints2dx

Definition at line 84 of file OptParser.h.

§ npoints2dy

int OptParser::npoints2dy

Definition at line 85 of file OptParser.h.

§ npointstoy

int OptParser::npointstoy

Definition at line 86 of file OptParser.h.

§ nrun

int OptParser::nrun

Definition at line 88 of file OptParser.h.

§ nsmooth

int OptParser::nsmooth

Definition at line 90 of file OptParser.h.

§ ntoys

int OptParser::ntoys

Definition at line 89 of file OptParser.h.

§ parevol

bool OptParser::parevol

Definition at line 92 of file OptParser.h.

§ parsavefile

TString OptParser::parsavefile

Definition at line 91 of file OptParser.h.

§ pevid

vector<int> OptParser::pevid

Definition at line 93 of file OptParser.h.

§ physRanges

vector<vector<RangePar> > OptParser::physRanges

Definition at line 58 of file OptParser.h.

§ plot2dcl

vector<int> OptParser::plot2dcl

Definition at line 94 of file OptParser.h.

§ plotext

TString OptParser::plotext

Definition at line 95 of file OptParser.h.

§ plotgroupx

float OptParser::plotgroupx

Definition at line 104 of file OptParser.h.

§ plotgroupy

float OptParser::plotgroupy

Definition at line 105 of file OptParser.h.

§ plotHFAGLabelPosX

Double_t OptParser::plotHFAGLabelPosX

Definition at line 106 of file OptParser.h.

§ plotHFAGLabelPosY

Double_t OptParser::plotHFAGLabelPosY

Definition at line 107 of file OptParser.h.

§ plotHFAGLabelScale

Double_t OptParser::plotHFAGLabelScale

Definition at line 108 of file OptParser.h.

§ plotid

int OptParser::plotid

Definition at line 96 of file OptParser.h.

§ plotlegend

bool OptParser::plotlegend

Definition at line 98 of file OptParser.h.

§ plotlegsizex

float OptParser::plotlegsizex

Definition at line 101 of file OptParser.h.

§ plotlegsizey

float OptParser::plotlegsizey

Definition at line 102 of file OptParser.h.

§ plotlegstyle

TString OptParser::plotlegstyle

Definition at line 103 of file OptParser.h.

§ plotlegx

float OptParser::plotlegx

Definition at line 99 of file OptParser.h.

§ plotlegy

float OptParser::plotlegy

Definition at line 100 of file OptParser.h.

§ plotlog

bool OptParser::plotlog

Definition at line 97 of file OptParser.h.

§ plotmagnetic

bool OptParser::plotmagnetic

Definition at line 109 of file OptParser.h.

§ plotnsigmacont

int OptParser::plotnsigmacont

Definition at line 110 of file OptParser.h.

§ plotorigin

bool OptParser::plotorigin

Definition at line 114 of file OptParser.h.

§ plotpluginonly

bool OptParser::plotpluginonly

Definition at line 111 of file OptParser.h.

§ plotprelim

bool OptParser::plotprelim

Definition at line 113 of file OptParser.h.

§ plotpulls

bool OptParser::plotpulls

Definition at line 112 of file OptParser.h.

§ plotsoln

vector<int> OptParser::plotsoln

Definition at line 116 of file OptParser.h.

§ plotsolutions

vector<int> OptParser::plotsolutions

Definition at line 115 of file OptParser.h.

§ plotunoff

bool OptParser::plotunoff

Definition at line 117 of file OptParser.h.

§ plotymax

float OptParser::plotymax

Definition at line 119 of file OptParser.h.

§ plotymin

float OptParser::plotymin

Definition at line 118 of file OptParser.h.

§ pluginPlotRangeMax

float OptParser::pluginPlotRangeMax

Definition at line 122 of file OptParser.h.

§ pluginPlotRangeMin

float OptParser::pluginPlotRangeMin

Definition at line 121 of file OptParser.h.

§ printcor

bool OptParser::printcor

Definition at line 126 of file OptParser.h.

§ printSolX

float OptParser::printSolX

Definition at line 127 of file OptParser.h.

§ printSolY

float OptParser::printSolY

Definition at line 128 of file OptParser.h.

§ probforce

bool OptParser::probforce

Definition at line 123 of file OptParser.h.

§ probimprove

bool OptParser::probimprove

Definition at line 124 of file OptParser.h.

§ probScanResult

TString OptParser::probScanResult

Definition at line 125 of file OptParser.h.

§ qh

vector<int> OptParser::qh

Definition at line 129 of file OptParser.h.

§ queue

TString OptParser::queue

Definition at line 130 of file OptParser.h.

§ randomizeToyVars

vector<vector<TString> > OptParser::randomizeToyVars

Definition at line 60 of file OptParser.h.

§ readfromfile

vector<TString> OptParser::readfromfile

Definition at line 131 of file OptParser.h.

§ relation

vector<TString> OptParser::relation

Definition at line 132 of file OptParser.h.

§ removeRanges

vector<vector<TString> > OptParser::removeRanges

Definition at line 59 of file OptParser.h.

§ runCLs

bool OptParser::runCLs

Definition at line 133 of file OptParser.h.

§ save

TString OptParser::save

Definition at line 134 of file OptParser.h.

§ saveAtMin

bool OptParser::saveAtMin

Definition at line 135 of file OptParser.h.

§ savenuisances1d

vector<float> OptParser::savenuisances1d

Definition at line 136 of file OptParser.h.

§ savenuisances2dx

vector<float> OptParser::savenuisances2dx

Definition at line 137 of file OptParser.h.

§ savenuisances2dy

vector<float> OptParser::savenuisances2dy

Definition at line 138 of file OptParser.h.

§ scanforce

bool OptParser::scanforce

Definition at line 139 of file OptParser.h.

§ scanrangeMax

float OptParser::scanrangeMax

Definition at line 141 of file OptParser.h.

§ scanrangeMin

float OptParser::scanrangeMin

Definition at line 140 of file OptParser.h.

§ scanrangeyMax

float OptParser::scanrangeyMax

Definition at line 143 of file OptParser.h.

§ scanrangeyMin

float OptParser::scanrangeyMin

Definition at line 142 of file OptParser.h.

§ smooth2d

bool OptParser::smooth2d

Definition at line 144 of file OptParser.h.

§ title

vector<TString> OptParser::title

Definition at line 145 of file OptParser.h.

§ toyFiles

TString OptParser::toyFiles

Definition at line 146 of file OptParser.h.

§ usage

bool OptParser::usage

Definition at line 147 of file OptParser.h.

§ var

vector<TString> OptParser::var

Definition at line 148 of file OptParser.h.

§ verbose

bool OptParser::verbose

Definition at line 149 of file OptParser.h.


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