-
Notifications
You must be signed in to change notification settings - Fork 1
Parameter Conatainer
LKParameterContainer
class is parameter container for lilak project.
It is just a list of parameters (name
value
comment
) with methods those are useful to handle parameters.
Easiest to way of using parameter container is giving input parameter file. One can print out parameters using Print()
method. Getters are used to get parameters out of parameter container. T
auto par = new LKParameterContainer("parameter_file_name");
par -> Print();
int index = par -> GetParInt("index");
double value = par -> GetParDouble("value");
TString input = par -> GetParString("input");
Parameter file is list of header
name
value
comment
header
is optional and it does not have to be used in general. There are three headers that can be used #
*
and @
.
-
#
: The whole line comment. -
*
:*
makes the parameter a temporary parameter. Temporary parameter can be used as usual. But the parameter will not be copied whenLKRun
is trying to copy the parameter container from input file to ouput file. -
@
:@
header makes conditional parameter. If@
header is set, the container will look for registerd parameters withname
orvalue
that has the same value of inputgroup
. If any is found, the parameter will be registered. If not, the parameter will be ignored. -
<<
:<<
header tell that this is another input parameter file for the parameter container. No name is needed as it is not a parameter.
name
is name of the parameter.
-
name
should not contain any space. -
name
can includegroup
using/
ex)group/name
. Group does nothing until@
header is set.
value
is value of the parameter.
- One do not have to use
"
to define string parameter. - All parameters are stored in a form of
TString
and converted into specific type when getter is called. - Array parameter can be set by separating each element with space.
-
value
of other parameter can be referenced using{...}
. ex){other_parameter}
,{other_parameter[0]}
. -
value
can reference environment variable using e{...}. ex)e{ROOTSYS}
,e{HOME}
,e{LILAK_PATH}
-
value
can reference compiled parameter of lilak using e{...}. ex)e{lilak_version}
,e{userhost}
- Comments should start with
#
aftervalue
. Lines starting with#
are line comment.
<< /home/file/to/add.mac # this is another input parameter file
world/size 100 # mm
cage/size 50 60 70 # mm
detector/title detector of 10 silicon arrays
detector/length {dimension[2]}/2
detector/color kRed+1
# parameters defined in lilak/log/LKCompiled.h can be called using e{parameter_name}
hostuser e{lilak_hostuser}
@host.user1/par value1 # this parameter will be set because it was defined previously
@host.user3/par value2 # this parameter will not be set
@host.user3/par value3 # this parameter will not be set
*LKRun/RunName lilak 1 # this parameter will last only up to the first file.
The type of parameters are decided when Getter is called. Featured types: TString, int, double, bool, TVector3, Color_t, Width_t, Size_t.
From the example parameter file above,
-
GetParInt("world/size")
will return parameter value 100 as int type, -
GetParString("world/size")
will return parameter value 100 as TString type, -
GetParString("detector/title")
will return TString type "detector of 10 silicon arrays" -
GetParString("detector/title",0)
will return TString type "detector" -
GetParString("detector/title",2)
will return TString type "10" -
GetParDouble("detector/title",2)
will return double type 10 -
GetParDouble("detector/length")
will return double type 80 -
GetParString("detector/length")
will return TString type "70/2" -
GetParV3("cage/size")
will return TVector3(50,60,70). This method use the first 3 values of parameter values for x, y and z. -
GetParColor("color")
will return Color_t (int) type 633.
lilak
Stear
Project