This macro demonstrates how to use "glcol" option for TH3 and how to create user defined TRANSFER FUNCTION: transfer function maps bin value to voxel's opacity.
codomain is [0, 1] (1. - non-transparent, 0.5 is semitransparent, etc.) To pass transparency function into painting algorithm, you have to:
- Create TF1 object (with symbolic expression like "0.5 * (sin(x) + 1)":
...
TF1 *
tf =
new TF1(
"TransferFunction",
"0.5 * (sin(x) + 1)", -10., 10.);
...
IMPORTANT, the name of TF1 object MUST be "TransferFunction".
- Add this function into a hist's list of functions:
...
TList *
lof = hist->GetListOfFunctions();
...
It's also possible to use your own function and pass it into TF1, please read TF1 documentation to learn how.
This macro is to be compiled: TF1 is extremely slow with interpreted function as an argument.
namespace {
{
return 0.008;
return 0.015;
return 0.02;
return 0.03;
return 0.04;
return 0.05;
}
}
{
TH3F *hist =
new TH3F(
"glvoxel",
"glvoxel",
nX, -1., 1.,
nY, -1., 1.,
nZ, -1., 1.);
}
}
}
}
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TStyle * gStyle
void Draw(Option_t *option="") override
Draw this histogram with options.
TList * GetListOfFunctions() const
3-D histogram with a float per channel (see TH1 documentation)
void SetBinContent(Int_t bin, Double_t content) override
Set bin content.
void SetCanvasPreferGL(Bool_t prefer=kTRUE)
- Author
- Timur Pocheptsov
Definition in file glvox2.C.