Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches

Detailed Description

Demonstrates usage of TEveJetCone class.

const char *esd_geom_file_name = "http://root.cern/files/alice_ESDgeometry.root";
TEveVector GetTEveVector(Float_t eta, Float_t phi);
void geomGentleTPC();
void jetcone()
{
using namespace TMath;
TRandom r(0);
// -- Set Constants
Int_t nCones = 10;
Int_t nTracks = 200;
Float_t coneRadius = 0.4;
Float_t length = 300.;
// -- Define palette
auto pal = new TEveRGBAPalette(0, 500);
// -----------------------------------------------------------------------
// -- Line sets
// -----------------------------------------------------------------------
// -- Define cone center
auto axis = new TEveStraightLineSet("Cone Axis");
axis->SetLineColor(kGreen);
axis->SetLineWidth(2);
auto tracksXYZ = new TEveStraightLineSet("StraightLinesXYZ");
tracksXYZ->SetLineColor(kRed);
tracksXYZ->SetLineWidth(2);
auto tracksEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhi");
tracksEtaPhi->SetLineColor(kYellow);
tracksEtaPhi->SetLineWidth(2);
auto tracksSeedEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhiSeed");
tracksSeedEtaPhi->SetLineColor(kBlue);
tracksSeedEtaPhi->SetLineWidth(2);
// -----------------------------------------------------------------------
// -- Draw track distribution in XYZ in TPC Volume +/-250, +/-250, +/-250
// -----------------------------------------------------------------------
for (Int_t track = 0; track < nTracks; track++) {
Float_t trackX = r.Uniform(-250.0, 250.0);
Float_t trackY = r.Uniform(-250.0, 250.0);
Float_t trackZ = r.Uniform(-250.0, 250.0);
Float_t trackR = Sqrt(trackX * trackX + trackY * trackY + trackZ * trackZ);
TEveVector trackDir(trackX / trackR, trackY / trackR, trackZ / trackR);
TEveVector trackEnd = trackDir * length;
tracksXYZ->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ);
}
// -----------------------------------------------------------------------
// -- Draw track distribution in eta phi in TPC Volume +/-0.9, {0, 2Pi}
// -----------------------------------------------------------------------
for (Int_t track = 0; track < nTracks; track++) {
Float_t trackEta = r.Uniform(-0.9, 0.9);
Float_t trackPhi = r.Uniform(0.0, TwoPi());
TEveVector trackDir(GetTEveVector(trackEta, trackPhi));
TEveVector trackEnd = trackDir * length;
if (trackEta > coneRadius || trackEta < -coneRadius)
tracksEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ);
else
tracksSeedEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ);
}
// -----------------------------------------------------------------------
// -- Draw cones
// -----------------------------------------------------------------------
for (Int_t iter = 0; iter < nCones; ++iter) {
// -- Get Random ( eta ,phi )
Float_t coneEta = r.Uniform(-0.9, 0.9);
Float_t conePhi = r.Uniform(0.0, TwoPi());
// -- Primary vertex as origin
TEveVector coneOrigin(0.0, 0.0, 0.0);
// -- Get Cone Axis - axis line 10% longer than cone height
TEveVector coneAxis(GetTEveVector(coneEta, conePhi));
coneAxis *= length * 1.1;
axis->AddLine(0., 0., 0., coneAxis.fX, coneAxis.fY, coneAxis.fZ);
// -- Draw jet cone
auto jetCone = new TEveJetCone("JetCone");
jetCone->SetPickable(kTRUE);
jetCone->SetCylinder(250., 250.);
if ((jetCone->AddCone(coneEta, conePhi, coneRadius)) != -1)
gEve->AddElement(jetCone);
}
// -----------------------------------------------------------------------
// -- Add cone axis
gEve->AddElement(axis);
// -- Add lines
// gEve->AddElement(tracksXYZ);
gEve->AddElement(tracksSeedEtaPhi);
gEve->AddElement(tracksEtaPhi);
// -- Load TPC geometry
geomGentleTPC();
gEve->Redraw3D(kTRUE);
return;
}
//___________________________________________________________________________
TEveVector GetTEveVector(Float_t eta, Float_t phi)
{
using namespace TMath;
return vec;
}
//__________________________________________________________________________
void geomGentleTPC()
{
// Simple geometry
TFile *geom = TFile::Open(esd_geom_file_name, "CACHEREAD");
if (!geom)
return;
TEveGeoShapeExtract *gse = (TEveGeoShapeExtract *)geom->Get("Gentle");
geom->Close();
delete geom;
gEve->AddGlobalElement(gsre);
TEveElement *elTRD = gsre->FindChild("TRD+TOF");
TEveElement *elPHOS = gsre->FindChild("PHOS");
elPHOS->SetRnrState(kFALSE);
TEveElement *elHMPID = gsre->FindChild("HMPID");
elHMPID->SetRnrState(kFALSE);
}
ROOT::R::TRInterface & r
Definition Object.C:4
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
@ kRed
Definition Rtypes.h:67
@ kGreen
Definition Rtypes.h:67
@ kBlue
Definition Rtypes.h:67
@ kYellow
Definition Rtypes.h:67
externTEveManager * gEve
TEveVectorT< Float_t > TEveVector
Definition TEveVector.h:123
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
TEveElement * FindChild(const TString &name, const TClass *cls=nullptr)
Find the first child with given name.
virtual Bool_t SetRnrState(Bool_t rnr)
Set render state of this element and of its children to the same value.
Globally positioned TGeoShape with rendering attributes and an optional list of daughter shape-extrac...
Wrapper for TGeoShape with absolute positioning and color attributes allowing display of extracted TG...
static TEveGeoShape * ImportShapeExtract(TEveGeoShapeExtract *gse, TEveElement *parent=nullptr)
Import a shape extract 'gse' under element 'parent'.
Draws a jet cone with leading particle is specified in (eta,phi) and cone radius is given.
Definition TEveJetCone.h:24
static TEveManager * Create(Bool_t map_window=kTRUE, Option_t *opt="FIV")
If global TEveManager* gEve is not set initialize it.
A generic, speed-optimised mapping from value to RGBA color supporting different wrapping and range t...
Set of straight lines with optional markers along the lines.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Definition TFile.h:130
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:3787
static Bool_t SetCacheFileDir(std::string_view cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
Definition TFile.cxx:4328
void Close(Option_t *option="") override
Close a file.
Definition TFile.cxx:981
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
TMath.
Definition TMathBase.h:35
Double_t CosH(Double_t)
Returns the hyperbolic cosine of x.
Definition TMath.h:623
Double_t TanH(Double_t)
Returns the hyperbolic tangent of x.
Definition TMath.h:629
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:605
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:599
constexpr Double_t TwoPi()
Definition TMath.h:47
BVH_ALWAYS_INLINE T length(const Vec< T, N > &v)
Definition vec.h:122
Author
Jochen Thaeder

Definition in file jetcone.C.