Naming Conventions and General Variables
Naming Conventions
ROOT classes begin with T
Examples: TLine, TTreeT 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: fTreef is “field”.
Member functions begin with a capital letter.
Example: Loop()
Constants begin with k
Examples: kInitialSize, kRedk is Germany “konstant” (= constant).
Global variables begin with g followed by a capital letter.
Example: gEnvg is “global”.
Static data members begin with fg
Example: fgTokenClientfg = f + g = “field + global”, meaning both data members and global variables.
Enumeration types begin with E
Example: EColorLevelE 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
gROOTis a global root variable.
Example:gROOT::GetListOf(), or
1 | gROOT -> GetListOfCanvases() -> FindObject("c1"); |
to find the canvas named c1.
gFileis the pointer of this opened ROOT File.gStylegSystemgDirectoryis the pointer to this current directory.gPadgRandom
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.
gEnvgGeoManager
- 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.