Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
jetcone.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_eve
3/// Demonstrates usage of TEveJetCone class.
4///
5/// \image html eve_jetcone.png
6/// \macro_code
7///
8/// \author Jochen Thaeder
9
10const char *esd_geom_file_name = "http://root.cern/files/alice_ESDgeometry.root";
11
13void geomGentleTPC();
14
15void jetcone()
16{
18
19 using namespace TMath;
20
21 TRandom r(0);
22
23 // -- Set Constants
24 Int_t nCones = 10;
25 Int_t nTracks = 200;
26
27 Float_t coneRadius = 0.4;
28 Float_t length = 300.;
29
30 // -- Define palette
31 auto pal = new TEveRGBAPalette(0, 500);
32
33 // -----------------------------------------------------------------------
34 // -- Line sets
35 // -----------------------------------------------------------------------
36
37 // -- Define cone center
38 auto axis = new TEveStraightLineSet("Cone Axis");
39 axis->SetLineColor(kGreen);
40 axis->SetLineWidth(2);
41
42 auto tracksXYZ = new TEveStraightLineSet("StraightLinesXYZ");
43 tracksXYZ->SetLineColor(kRed);
44 tracksXYZ->SetLineWidth(2);
45
46 auto tracksEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhi");
47 tracksEtaPhi->SetLineColor(kYellow);
48 tracksEtaPhi->SetLineWidth(2);
49
50 auto tracksSeedEtaPhi = new TEveStraightLineSet("StraightLinesEtaPhiSeed");
51 tracksSeedEtaPhi->SetLineColor(kBlue);
52 tracksSeedEtaPhi->SetLineWidth(2);
53
54 // -----------------------------------------------------------------------
55 // -- Draw track distribution in XYZ in TPC Volume +/-250, +/-250, +/-250
56 // -----------------------------------------------------------------------
57
58 for (Int_t track = 0; track < nTracks; track++) {
59
60 Float_t trackX = r.Uniform(-250.0, 250.0);
61 Float_t trackY = r.Uniform(-250.0, 250.0);
62 Float_t trackZ = r.Uniform(-250.0, 250.0);
64
67 tracksXYZ->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ);
68 }
69
70 // -----------------------------------------------------------------------
71 // -- Draw track distribution in eta phi in TPC Volume +/-0.9, {0, 2Pi}
72 // -----------------------------------------------------------------------
73
74 for (Int_t track = 0; track < nTracks; track++) {
75
76 Float_t trackEta = r.Uniform(-0.9, 0.9);
77 Float_t trackPhi = r.Uniform(0.0, TwoPi());
78
81
83 tracksEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ);
84 else
85 tracksSeedEtaPhi->AddLine(0., 0., 0., trackEnd.fX, trackEnd.fY, trackEnd.fZ);
86 }
87
88 // -----------------------------------------------------------------------
89 // -- Draw cones
90 // -----------------------------------------------------------------------
91
92 for (Int_t iter = 0; iter < nCones; ++iter) {
93
94 // -- Get Random ( eta ,phi )
95 Float_t coneEta = r.Uniform(-0.9, 0.9);
96 Float_t conePhi = r.Uniform(0.0, TwoPi());
97
98 // -- Primary vertex as origin
99 TEveVector coneOrigin(0.0, 0.0, 0.0);
100
101 // -- Get Cone Axis - axis line 10% longer than cone height
103 coneAxis *= length * 1.1;
104
105 axis->AddLine(0., 0., 0., coneAxis.fX, coneAxis.fY, coneAxis.fZ);
106
107 // -- Draw jet cone
108 auto jetCone = new TEveJetCone("JetCone");
109 jetCone->SetPickable(kTRUE);
110 jetCone->SetCylinder(250., 250.);
111 if ((jetCone->AddCone(coneEta, conePhi, coneRadius)) != -1)
113 }
114
115 // -----------------------------------------------------------------------
116
117 // -- Add cone axis
118 gEve->AddElement(axis);
119
120 // -- Add lines
121 // gEve->AddElement(tracksXYZ);
124
125 // -- Load TPC geometry
127
129
130 return;
131}
132
133//___________________________________________________________________________
135{
136 using namespace TMath;
137
139 (Float_t)TanH((Double_t)eta));
140 return vec;
141}
142
143//__________________________________________________________________________
144void geomGentleTPC()
145{
146 // Simple geometry
148 TFile *geom = TFile::Open(esd_geom_file_name, "CACHEREAD");
149 if (!geom)
150 return;
151
152 TEveGeoShapeExtract *gse = (TEveGeoShapeExtract *)geom->Get("Gentle");
154 geom->Close();
155 delete geom;
156
158
159 TEveElement *elTRD = gsre->FindChild("TRD+TOF");
160 elTRD->SetRnrState(kFALSE);
161
162 TEveElement *elPHOS = gsre->FindChild("PHOS");
163 elPHOS->SetRnrState(kFALSE);
164
165 TEveElement *elHMPID = gsre->FindChild("HMPID");
166 elHMPID->SetRnrState(kFALSE);
167}
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
@ kRed
Definition Rtypes.h:66
@ kGreen
Definition Rtypes.h:66
@ kBlue
Definition Rtypes.h:66
@ kYellow
Definition Rtypes.h:66
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TEveManager * gEve
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
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
void AddElement(TEveElement *element, TEveElement *parent=nullptr)
Add an element.
void AddGlobalElement(TEveElement *element, TEveElement *parent=nullptr)
Add a global element, i.e.
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)
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 ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
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:4088
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:4625
This is the base class for the ROOT Random number generators.
Definition TRandom.h:27
Double_t Sqrt(Double_t x)
TMath.
Definition TMathBase.h:35
Double_t CosH(Double_t)
Returns the hyperbolic cosine of x.
Definition TMath.h:616
Double_t TanH(Double_t)
Returns the hyperbolic tangent of x.
Definition TMath.h:622
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:598
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:592
constexpr Double_t TwoPi()
Definition TMath.h:44