Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveJetCone.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Author: Matevz Tadel, Jochen Thaeder 2009
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TEveJetCone.h"
13#include "TEveTrans.h"
15
16#include "TMath.h"
17
18/** \class TEveJetCone
19\ingroup TEve
20Draws a jet cone with leading particle is specified in (eta,phi) and
21cone radius is given.
22
23If Apex is not set, default is (0.,0.,0.)
24In case of cylinder was set, cone is cut at the cylinder edges.
25
26Example :
27~~~ {.cpp}
28 Float_t coneEta = r.Uniform(-0.9, 0.9);
29 Float_t conePhi = r.Uniform(0.0, TwoPi() );
30 Float_t coneRadius = 0.4;
31
32 TEveJetCone* jetCone = new TEveJetCone("JetCone");
33 jetCone->SetCylinder(250, 250);
34 if (jetCone->AddCone(coneEta, conePhi, coneRadius) != -1)
35 gEve->AddElement(jetCone);
36~~~
37
38#### Implementation notes
39
40TEveVector fLimits encodes the following information:
41 - fY, fZ: barrel radius and endcap z-position;
42 if both are 0, fX encodes the spherical radius
43 - fX : scaling for length of the cone
44*/
45
47
48////////////////////////////////////////////////////////////////////////////////
49/// Constructor.
50
52 TEveShape(n, t),
53 fApex(),
54 fLimits(), fThetaC(10),
55 fEta(0), fPhi(0), fDEta(0), fDPhi(0), fNDiv(72)
56{
57 fColor = kGreen;
58}
59
60////////////////////////////////////////////////////////////////////////////////
61/// Compute bounding-box of the data.
62
64{
65 BBoxInit();
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// Virtual from TEveProjectable, returns TEveJetConeProjected class.
75
77{
79}
80
81////////////////////////////////////////////////////////////////////////////////
82/// Add jet cone.
83/// parameters are :
84/// - (eta,phi) : of the center/leading particle
85/// - cone_r : cone radius in eta-phi space
86/// - length : length of the cone
87/// - if cylinder is set and length is adapted to cylinder.
88/// - if length is given, it will be used as scalar factor
89/// - if cylinder is not set, length is used as length of the cone
90/// Return 0 on success.
91
93{
94 return AddEllipticCone(eta, phi, cone_r, cone_r, length);
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Add jet cone.
99/// parameters are :
100/// - (eta,phi) : of the center/leading particle
101/// - (reta, rphi) : radius of cone in eta-phi space
102/// - length : length of the cone
103/// - if cylinder is set and length is adapted to cylinder.
104/// - if length is given, it will be used as scalar factor
105/// - if cylinder is not set, length is used as length of the cone
106/// Returns 0 on success.
107
109{
110 using namespace TMath;
111
112 if (length != 0) fLimits.fX = length;
113
114 if (fLimits.IsZero())
115 return -1;
116
117 fEta = eta; fPhi = phi; fDEta = reta; fDPhi = rphi;
118
119 return 0;
120}
121
122////////////////////////////////////////////////////////////////////////////////
123/// Fill TEveVector with eta and phi, magnitude 1.
124
126{
127 using namespace TMath;
128
129 return TEveVector(Cos(phi) / CosH(eta), Sin(phi) / CosH(eta), TanH(eta));
130}
131
132////////////////////////////////////////////////////////////////////////////////
133/// Returns point on the base of the cone with given eta and phi.
134
136{
137 using namespace TMath;
138
139 TEveVector vec = CalcEtaPhiVec(eta, phi);
140
141 // -- Set length of the contourPoint
142 if (fLimits.fY != 0 && fLimits.fZ != 0)
143 {
144 Float_t theta = vec.Theta();
145 if (theta < fThetaC)
146 vec *= fLimits.fZ / Cos(theta);
147 else if (theta > Pi() - fThetaC)
148 vec *= fLimits.fZ / Cos(theta - Pi());
149 else
150 vec *= fLimits.fY / Sin(theta);
151
152 if (fLimits.fX != 0) vec *= fLimits.fX;
153 }
154 else
155 {
156 vec *= fLimits.fX;
157 }
158
159 return vec;
160}
161
162////////////////////////////////////////////////////////////////////////////////
163/// Returns point on the base of the cone with internal angle alpha:
164/// alpha = 0 -> max eta, alpha = pi/2 -> max phi, ...
165
167{
168 using namespace TMath;
169
170 return CalcBaseVec(fEta + fDEta * Cos(alpha), fPhi + fDPhi * Sin(alpha));
171}
172
173////////////////////////////////////////////////////////////////////////////////
174/// Returns true if the cone is in barrel / endcap transition region.
175
177{
178 using namespace TMath;
179
180 Float_t tm = CalcBaseVec(0).Theta();
181 Float_t tM = CalcBaseVec(Pi()).Theta();
182
183 return (tM > fThetaC && tm < fThetaC) ||
184 (tM > Pi() - fThetaC && tm < Pi() - fThetaC);
185}
186
187/** \class TEveJetConeProjected
188\ingroup TEve
189Projection of TEveJetCone.
190*/
191
192////////////////////////////////////////////////////////////////////////////////
193/// Constructor.
194
196 TEveShape(n, t)
197{
198}
199
200////////////////////////////////////////////////////////////////////////////////
201/// Destructor.
202
204{
205}
206
207////////////////////////////////////////////////////////////////////////////////
208/// Compute bounding-box, virtual from TAttBBox.
209
211{
212 BBoxInit();
213
214 TEveJetCone *cone = dynamic_cast<TEveJetCone*>(fProjectable);
215////////////////////////////////////////////////////////////////////////////////
216
219 v = cone->fApex; proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
220 v = cone->CalcBaseVec(0); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
224}
225
226////////////////////////////////////////////////////////////////////////////////
227/// This is virtual method from base-class TEveProjected.
228
230{
231 SetDepthCommon(d, this, fBBox);
232}
233
234////////////////////////////////////////////////////////////////////////////////
235/// This is virtual method from base-class TEveProjected.
236
238{
240 CopyVizParams(dynamic_cast<TEveElement*>(model));
241}
242
243////////////////////////////////////////////////////////////////////////////////
244/// Re-project the jet-cone.
245
247{
248}
#define d(i)
Definition RSha256.hxx:102
char Text_t
Definition RtypesCore.h:62
float Float_t
Definition RtypesCore.h:57
#define ClassImp(name)
Definition Rtypes.h:377
@ kGreen
Definition Rtypes.h:66
TEveVectorT< Float_t > TEveVector
Definition TEveVector.h:123
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
void BBoxCheckPoint(Float_t x, Float_t y, Float_t z)
Definition TAttBBox.h:69
void BBoxInit(Float_t infinity=1e6)
Dynamic Float_t[6] X(min,max), Y(min,max), Z(min,max)
Definition TAttBBox.cxx:29
Float_t * fBBox
Definition TAttBBox.h:20
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
void UpdateProjection() override
Re-project the jet-cone.
TEveJetConeProjected(const TEveJetConeProjected &)
void SetProjection(TEveProjectionManager *mng, TEveProjectable *model) override
This is virtual method from base-class TEveProjected.
void ComputeBBox() override
Compute bounding-box, virtual from TAttBBox.
void SetDepthLocal(Float_t d) override
This is virtual method from base-class TEveProjected.
~TEveJetConeProjected() override
Destructor.
static TClass * Class()
Draws a jet cone with leading particle is specified in (eta,phi) and cone radius is given.
Definition TEveJetCone.h:24
Int_t AddEllipticCone(Float_t eta, Float_t phi, Float_t reta, Float_t rphi, Float_t length=0)
Add jet cone.
TEveVector CalcEtaPhiVec(Float_t eta, Float_t phi) const
Fill TEveVector with eta and phi, magnitude 1.
TEveVector fApex
Definition TEveJetCone.h:34
Float_t fEta
Definition TEveJetCone.h:38
TEveJetCone(const TEveJetCone &)
TEveVector CalcBaseVec(Float_t eta, Float_t phi) const
Returns point on the base of the cone with given eta and phi.
void ComputeBBox() override
Compute bounding-box of the data.
Float_t fDEta
Definition TEveJetCone.h:39
Bool_t IsInTransitionRegion() const
Returns true if the cone is in barrel / endcap transition region.
TEveVector fLimits
Definition TEveJetCone.h:36
Float_t fThetaC
Definition TEveJetCone.h:37
Int_t AddCone(Float_t eta, Float_t phi, Float_t cone_r, Float_t length=0)
Add jet cone.
Float_t fPhi
Definition TEveJetCone.h:38
TClass * ProjectedClass(const TEveProjection *p) const override
Virtual from TEveProjectable, returns TEveJetConeProjected class.
Float_t fDPhi
Definition TEveJetCone.h:39
Abstract base-class for non-linear projectable objects.
TEveProjectable * fProjectable
TEveProjectionManager * GetManager() const
virtual void SetProjection(TEveProjectionManager *mng, TEveProjectable *model)
Sets projection manager and reference in the projectable object.
void SetDepthCommon(Float_t d, TEveElement *el, Float_t *bbox)
Utility function to update the z-values of the bounding-box.
Manager class for steering of projections and managing projected objects.
TEveProjection * GetProjection()
Base-class for non-linear projections.
void ProjectVector(TEveVector &v, Float_t d)
Project TEveVector.
Abstract base-class for 2D/3D shapes.
Definition TEveShape.h:26
void CopyVizParams(const TEveElement *el) override
Copy visualization parameters from element el.
Definition TEveShape.cxx:70
Bool_t IsZero() const
Definition TEveVector.h:118
TT Theta() const
Definition TEveVector.h:136
const Int_t n
Definition legend1.C:16
TMath.
Definition TMathBase.h:35
constexpr Double_t PiOver2()
Definition TMath.h:51
constexpr Double_t Pi()
Definition TMath.h:37