Naming Conventions and General Variables
Naming Conventions
ROOT classes begin with T
Examples: TLine
, TTree
T
is “Type” or “Template”, to represent classes in ROOT.
Non-class types end with _t
Example: Int_t
_t
is “type”.
Data members begin with f
Example: fTree
f
is “field”.
Member functions begin with a capital letter.
Example: Loop()
Constants begin with k
Examples: kInitialSize
, kRed
k
is Germany “konstant” (= constant).
Global variables begin with g
followed by a capital letter.
Example: gEnv
g
is “global”.
Static data members begin with fg
Example: fgTokenClient
fg
= f
+ g
= “field + global”, meaning both data members and global variables.
Enumeration types begin with E
Example: EColorLevel
E
is “Enumeration”.
Locals and parameters begin with a lower case
Example: nbytes
Is coding convention.
Getters and setters begin with Get
and Set
Examples: SetLast()
, GetFirst()
General Variables
gROOT
is a global root variable.
Example:gROOT::GetListOf()
, or
1 | gROOT -> GetListOfCanvases() -> FindObject("c1"); |
to find the canvas named c1
.
gFile
is the pointer of this opened ROOT File.gStyle
gSystem
gDirectory
is the pointer to this current directory.gPad
gRandom
gRandom
is a pointer to the current random number generator (TRandom
interface). By default, it points to a TRandom3
object. You can replace the current random number generator by deleting gRandom
and recreating with your own desired generator.
gEnv
gGeoManager
- Title: Naming Conventions and General Variables
- Author: Albert Cheung
- Created at : 2024-10-19 16:27:16
- Updated at : 2024-10-19 16:51:56
- Link: https://www.albertc9.github.io/2024/10/19/naming-conventions-and-general-variables/
- License: This work is licensed under CC BY-NC-SA 4.0.