Logo ROOT   6.16/01
Reference Guide
projection_prescale.C File Reference

Detailed Description

Demonstrates usage pre-scaling for automatic 2D projections.

const char* esd_geom_file_name =
"http://root.cern.ch/files/alice_ESDgeometry.root";
{
auto pev = gEve->SpawnNewViewer("Projections");
// camera
auto s = gEve->SpawnNewScene("Projected Geom");
pev->AddScene(s);
auto pgv = pev->GetGLViewer();
pgv->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
TGLOrthoCamera& cam = (TGLOrthoCamera&) pgv->CurrentCamera();
cam.SetZoomMinMax(0.2, 20);
// projections
auto mng = new TEveProjectionManager();
{
mng->SetProjection(TEveProjection::kPT_RPhi);
auto p = mng->GetProjection();
p->AddPreScaleEntry(0, 0, 4); // r scale 4 from 0
p->AddPreScaleEntry(0, 45, 1); // r scale 1 from 45
p->AddPreScaleEntry(0, 310, 0.5);
p->SetUsePreScale(kTRUE);
}
{
mng->SetProjection(TEveProjection::kPT_RhoZ);
auto p = mng->GetProjection();
// Increase silicon tracker
p->AddPreScaleEntry(0, 0, 4); // rho scale 4 from 0
p->AddPreScaleEntry(1, 0, 4); // z scale 4 from 0
// Normal for TPC
p->AddPreScaleEntry(0, 45, 1); // rho scale 1 from 45
p->AddPreScaleEntry(1, 110, 1); // z scale 1 from 110
// Reduce the rest
p->AddPreScaleEntry(0, 310, 0.5);
p->AddPreScaleEntry(1, 250, 0.5);
p->SetUsePreScale(kTRUE);
}
mng->SetProjection(TEveProjection::kPT_RPhi);
s->AddElement(mng);
auto axes = new TEveProjectionAxes(mng);
s->AddElement(axes);
// Simple geometry
auto geom = TFile::Open(esd_geom_file_name, "CACHEREAD");
if (!geom)
return;
auto gse = (TEveGeoShapeExtract*) geom->Get("Gentle");
auto gsre = TEveGeoShape::ImportShapeExtract(gse, 0);
geom->Close();
delete geom;
mng->ImportElements(gsre);
auto line = new TEveLine;
line->SetMainColor(kGreen);
for (Int_t i=0; i<160; ++i)
line->SetNextPoint(120*sin(0.2*i), 120*cos(0.2*i), 80-i);
mng->ImportElements(line);
line->SetRnrSelf(kFALSE);
//-------------------------------------------------------------------------
// Scaled 3D "projection"
//-------------------------------------------------------------------------
auto sev = gEve->SpawnNewViewer("Scaled 3D");
auto sp = smng->GetProjection();
sp->SetUsePreScale(kTRUE);
sp->AddPreScaleEntry(2, 0, 1);
sp->AddPreScaleEntry(2, 100, 0.2);
auto ss = gEve->SpawnNewScene("Scaled Geom");
sev->AddScene(ss);
ss->AddElement(smng);
smng->ImportElements(gsre);
//-------------------------------------------------------------------------
}
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
const Bool_t kTRUE
Definition: RtypesCore.h:87
@ kGreen
Definition: Rtypes.h:63
R__EXTERN TEveManager * gEve
Definition: TEveManager.h:243
double cos(double)
double sin(double)
virtual void AddElement(TEveElement *el)
Add el to the list of children.
Globally positioned TGeoShape with rendering attributes and an optional list of daughter shape-extrac...
static TEveGeoShape * ImportShapeExtract(TEveGeoShapeExtract *gse, TEveElement *parent=0)
Import a shape extract 'gse' under element 'parent'.
An arbitrary polyline with fixed line and marker attributes.
Definition: TEveLine.h:26
void AddElement(TEveElement *element, TEveElement *parent=0)
Add an element.
void AddGlobalElement(TEveElement *element, TEveElement *parent=0)
Add a global element, i.e.
TEveBrowser * GetBrowser() const
Definition: TEveManager.h:137
TGListTreeItem * AddToListTree(TEveElement *re, Bool_t open, TGListTree *lt=0)
TEveViewer * SpawnNewViewer(const char *name, const char *title="", Bool_t embed=kTRUE)
Create a new GL viewer.
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
void Redraw3D(Bool_t resetCameras=kFALSE, Bool_t dropLogicals=kFALSE)
Definition: TEveManager.h:168
TEveScene * SpawnNewScene(const char *name, const char *title="")
Create a new scene.
Axes for non-linear projections.
Manager class for steering of projections and managing projected objects.
static Bool_t SetCacheFileDir(ROOT::Internal::TStringView cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Definition: TFile.h:316
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3975
Orthographic projection camera.
void SetZoomMinMax(Double_t min, Double_t max)
@ kCameraOrthoXOY
Definition: TGLViewer.h:64
virtual Bool_t SetTab(Int_t tabIndex, Bool_t emit=kTRUE)
Brings the composite frame with the index tabIndex to the front and generate the following event if t...
Definition: TGTab.cxx:507
TGTab * GetTabRight() const
Definition: TRootBrowser.h:141
TLine * line
void projection_prescale(std::string type="RhPhi")
static constexpr double s
Author
Matevz Tadel

Definition in file projection_prescale.C.