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
46
47////////////////////////////////////////////////////////////////////////////////
48/// Constructor.
49
51 TEveShape(n, t),
52 fApex(),
53 fLimits(), fThetaC(10),
54 fEta(0), fPhi(0), fDEta(0), fDPhi(0), fNDiv(72)
55{
56 fColor = kGreen;
57}
58
59////////////////////////////////////////////////////////////////////////////////
60/// Compute bounding-box of the data.
61
71
72////////////////////////////////////////////////////////////////////////////////
73/// Virtual from TEveProjectable, returns TEveJetConeProjected class.
74
79
80////////////////////////////////////////////////////////////////////////////////
81/// Add jet cone.
82/// parameters are :
83/// - (eta,phi) : of the center/leading particle
84/// - cone_r : cone radius in eta-phi space
85/// - length : length of the cone
86/// - if cylinder is set and length is adapted to cylinder.
87/// - if length is given, it will be used as scalar factor
88/// - if cylinder is not set, length is used as length of the cone
89/// Return 0 on success.
90
95
96////////////////////////////////////////////////////////////////////////////////
97/// Add jet cone.
98/// parameters are :
99/// - (eta,phi) : of the center/leading particle
100/// - (reta, rphi) : radius of cone in eta-phi space
101/// - length : length of the cone
102/// - if cylinder is set and length is adapted to cylinder.
103/// - if length is given, it will be used as scalar factor
104/// - if cylinder is not set, length is used as length of the cone
105/// Returns 0 on success.
106
108{
109 using namespace TMath;
110
111 if (length != 0) fLimits.fX = length;
112
113 if (fLimits.IsZero())
114 return -1;
115
116 fEta = eta; fPhi = phi; fDEta = reta; fDPhi = rphi;
117
118 return 0;
119}
120
121////////////////////////////////////////////////////////////////////////////////
122/// Fill TEveVector with eta and phi, magnitude 1.
123
125{
126 using namespace TMath;
127
128 return TEveVector(Cos(phi) / CosH(eta), Sin(phi) / CosH(eta), TanH(eta));
129}
130
131////////////////////////////////////////////////////////////////////////////////
132/// Returns point on the base of the cone with given eta and phi.
133
135{
136 using namespace TMath;
137
138 TEveVector vec = CalcEtaPhiVec(eta, phi);
139
140 // -- Set length of the contourPoint
141 if (fLimits.fY != 0 && fLimits.fZ != 0)
142 {
143 Float_t theta = vec.Theta();
144 if (theta < fThetaC)
145 vec *= fLimits.fZ / Cos(theta);
146 else if (theta > Pi() - fThetaC)
147 vec *= fLimits.fZ / Cos(theta - Pi());
148 else
149 vec *= fLimits.fY / Sin(theta);
150
151 if (fLimits.fX != 0) vec *= fLimits.fX;
152 }
153 else
154 {
155 vec *= fLimits.fX;
156 }
157
158 return vec;
159}
160
161////////////////////////////////////////////////////////////////////////////////
162/// Returns point on the base of the cone with internal angle alpha:
163/// alpha = 0 -> max eta, alpha = pi/2 -> max phi, ...
164
166{
167 using namespace TMath;
168
169 return CalcBaseVec(fEta + fDEta * Cos(alpha), fPhi + fDPhi * Sin(alpha));
170}
171
172////////////////////////////////////////////////////////////////////////////////
173/// Returns true if the cone is in barrel / endcap transition region.
174
176{
177 using namespace TMath;
178
180 Float_t tM = CalcBaseVec(Pi()).Theta();
181
182 return (tM > fThetaC && tm < fThetaC) ||
183 (tM > Pi() - fThetaC && tm < Pi() - fThetaC);
184}
185
186/** \class TEveJetConeProjected
187\ingroup TEve
188Projection of TEveJetCone.
189*/
190
191////////////////////////////////////////////////////////////////////////////////
192/// Constructor.
193
195 TEveShape(n, t)
196{
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Destructor.
201
205
206////////////////////////////////////////////////////////////////////////////////
207/// Compute bounding-box, virtual from TAttBBox.
208
210{
211 BBoxInit();
212
213 TEveJetCone *cone = dynamic_cast<TEveJetCone*>(fProjectable);
214////////////////////////////////////////////////////////////////////////////////
215
218 v = cone->fApex; proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
219 v = cone->CalcBaseVec(0); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
220 v = cone->CalcBaseVec(TMath::PiOver2()); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
221 v = cone->CalcBaseVec(TMath::Pi()); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
222 v = cone->CalcBaseVec(TMath::Pi() + TMath::PiOver2()); proj->ProjectVector(v, fDepth); BBoxCheckPoint(v);
223}
224
225////////////////////////////////////////////////////////////////////////////////
226/// This is virtual method from base-class TEveProjected.
227
232
233////////////////////////////////////////////////////////////////////////////////
234/// This is virtual method from base-class TEveProjected.
235
241
242////////////////////////////////////////////////////////////////////////////////
243/// Re-project the jet-cone.
244
#define d(i)
Definition RSha256.hxx:102
char Text_t
General string (char)
Definition RtypesCore.h:76
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
@ kGreen
Definition Rtypes.h:67
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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:28
Float_t * fBBox
Definition TAttBBox.h:20
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
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.
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:69
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:54
constexpr Double_t Pi()
Definition TMath.h:40