BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
ZHelix Class Reference

#include <ZHelix.h>

+ Inheritance diagram for ZHelix:

Public Member Functions

 ZHelix ()
 
 ZHelix (Double_t Azim, Double_t QovR, Double_t QxDh, Double_t refx, Double_t refy, Double_t refz, Double_t TDip, Double_t phii, Double_t phio, Float_t Chi2, Int_t NDoF, EZHelixRangeType RangeType=kBesHelixPhi, Double_t RangeMin=0, Double_t RangeMax=2 *TMath::Pi())
 
virtual ~ZHelix ()
 
void Phi2XYZ (Double_t phi, Double_t &x, Double_t &y, Double_t &z)
 
void Phi2ZR (Double_t phi, Double_t &z, Double_t &r)
 
void SetRange (EZHelixRangeType RangeType, Double_t RangeMin, Double_t RangeMax)
 
void SetTrackType (TrackType tt)
 
virtual void SetPoints (Option_t *option="3D")
 
Double_t X2Phi (Double_t x)
 
Double_t Y2Phi (Double_t y)
 
Double_t Z2Phi (Double_t z)
 
Double_t R2Phi (Double_t r)
 
Double_t Phi2S (Double_t phi)
 
virtual void Print (Option_t *option="") const
 
virtual void Draw (Option_t *option="3D")
 
virtual void Paint (Option_t *option="3D")
 
virtual Int_t SetNextPoint (Double_t x, Double_t y, Double_t z)
 
virtual void SetPoint (Int_t point, Double_t x, Double_t y, Double_t z)
 
virtual void Delete (Option_t *option)
 
virtual void DrawClass ()
 
virtual void DrawClone (Option_t *option)
 
virtual void SetDrawOption (Option_t *option)
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 

Protected Attributes

TrackType fTrackType
 
Double_t fAzim
 
Double_t fQovR
 
Double_t fQxDh
 
Double_t fTDip
 
Double_t fRefX
 
Double_t fRefY
 
Double_t fRefZ
 
Double_t fRange [2]
 
EZHelixRangeType fRType
 
Float_t fChi2
 
Int_t fNDoF
 
Double_t fSinAzim
 
Double_t fCosAzim
 
Int_t fRSign
 
Double_t fPhiI
 sign of radius
 
Double_t fPhiO
 
Bool_t fEnable
 

Detailed Description

Definition at line 42 of file ZHelix.h.

Constructor & Destructor Documentation

◆ ZHelix() [1/2]

ZHelix::ZHelix ( )

◆ ZHelix() [2/2]

ZHelix::ZHelix ( Double_t Azim,
Double_t QovR,
Double_t QxDh,
Double_t refx,
Double_t refy,
Double_t refz,
Double_t TDip,
Double_t phii,
Double_t phio,
Float_t Chi2,
Int_t NDoF,
EZHelixRangeType RangeType = kBesHelixPhi,
Double_t RangeMin = 0,
Double_t RangeMax = 2*TMath::Pi() )

Definition at line 52 of file ZHelix.cxx.

58 :
59 TPolyLine3D() {
60 //
61 // ZHelix normal constructor
62 if ( gDebug ) cout << "ZHelix normal ctor called" << endl;
63
64 fAzim = Azim;
65 fSinAzim = TMath::Sin(Azim);
66 fCosAzim = TMath::Cos(Azim);
67 fQovR = QovR;
68 fQxDh = QxDh;
69 fRefX = refx;
70 fRefY = refy;
71 fRefZ = refz;
72 fTDip = TDip;
73 fPhiI = phii;
74 fPhiO = phio;
75 fChi2 = Chi2;
76 fNDoF = NDoF;
77 fRType = RangeType;
78 fEnable = kTRUE;
79
80 fRSign = 0;
81 // fSegment = 1.;
82 SetRange(RangeType, RangeMin, RangeMax);
83}
Double_t fRefZ
Definition ZHelix.h:52
void SetRange(EZHelixRangeType RangeType, Double_t RangeMin, Double_t RangeMax)
Definition ZHelix.cxx:97
Double_t fTDip
Definition ZHelix.h:49
Double_t fSinAzim
Definition ZHelix.h:57
Double_t fQxDh
Definition ZHelix.h:48
Double_t fPhiI
sign of radius
Definition ZHelix.h:61
Double_t fRefX
Definition ZHelix.h:50
Double_t fCosAzim
Definition ZHelix.h:58
Int_t fRSign
Definition ZHelix.h:60
Float_t fChi2
Definition ZHelix.h:55
Double_t fAzim
Definition ZHelix.h:46
Double_t fRefY
Definition ZHelix.h:51
Double_t fPhiO
Definition ZHelix.h:62
Bool_t fEnable
Definition ZHelix.h:63
Int_t fNDoF
Definition ZHelix.h:56
Double_t fQovR
Definition ZHelix.h:47
EZHelixRangeType fRType
Definition ZHelix.h:54

◆ ~ZHelix()

ZHelix::~ZHelix ( )
virtual

Definition at line 87 of file ZHelix.cxx.

87 {
88 //
89 // ZHelix standard destructor
90 if ( gDebug ) {
91 cout << "ZHelix dtor called" << endl;
92 }
93}

Member Function Documentation

◆ Delete()

virtual void ZHelix::Delete ( Option_t * option)
inlinevirtual

Definition at line 97 of file ZHelix.h.

97{ TObject::Delete(option); }

◆ Draw()

void ZHelix::Draw ( Option_t * option = "3D")
virtual

Definition at line 367 of file ZHelix.cxx.

367 {
368 //
369 // Draw this helix with its current attributes.
370 AppendPad(option);
371}

◆ DrawClass()

virtual void ZHelix::DrawClass ( )
inlinevirtual

Definition at line 98 of file ZHelix.h.

98{ TObject::DrawClass(); }

◆ DrawClone()

virtual void ZHelix::DrawClone ( Option_t * option)
inlinevirtual

Definition at line 99 of file ZHelix.h.

99{ TObject::DrawClone(option); }

◆ ExecuteEvent()

virtual void ZHelix::ExecuteEvent ( Int_t event,
Int_t px,
Int_t py )
inlinevirtual

Definition at line 101 of file ZHelix.h.

101{;}

◆ Paint()

void ZHelix::Paint ( Option_t * option = "3D")
virtual

Definition at line 375 of file ZHelix.cxx.

375 {
376 //
377 // Draw this helix with its current attributes
378 TString opt = option;
379 opt.ToUpper();
380
381 if ( ( (fRange[1] < fRange[0]) || (fRange[1] > fRange[0]) ) && fEnable ) {
382 SetPoints(option);
383 TPolyLine3D::Paint("SAME");
384 }
385}
Double_t fRange[2]
Definition ZHelix.h:53
virtual void SetPoints(Option_t *option="3D")
Definition ZHelix.cxx:127

◆ Phi2S()

Double_t ZHelix::Phi2S ( Double_t phi)

Definition at line 389 of file ZHelix.cxx.

389 {
390 //
391 // calculates pathlength for phi
392
393 return -(phi-fAzim)/fQovR;
394
395}

◆ Phi2XYZ()

void ZHelix::Phi2XYZ ( Double_t phi,
Double_t & x,
Double_t & y,
Double_t & z )

Definition at line 246 of file ZHelix.cxx.

246 {
247 //
248 // Calculate XYZ for a given azimuth
249 x = fRefX - TMath::Sin(phi) / fQovR + fSinAzim * (1/fQovR + fQxDh);
250 y = fRefY + TMath::Cos(phi) / fQovR - fCosAzim * (1/fQovR + fQxDh);
251 z = fRefZ + (fAzim - phi) * fTDip / fQovR;
252}
Double_t x[10]
double y[1000]

Referenced by Phi2ZR(), R2Phi(), and SetPoints().

◆ Phi2ZR()

void ZHelix::Phi2ZR ( Double_t phi,
Double_t & z,
Double_t & r )

Definition at line 256 of file ZHelix.cxx.

256 {
257 //
258 // Calculate ZR for a given azimuth
259 Double_t x, y;
260 Phi2XYZ(phi, x, y, z);
261 r = TMath::Sqrt(TMath::Power(x,2) + TMath::Power(y,2));
262}
void Phi2XYZ(Double_t phi, Double_t &x, Double_t &y, Double_t &z)
Definition ZHelix.cxx:246

Referenced by SetPoints().

◆ Print()

void ZHelix::Print ( Option_t * option = "") const
virtual

Definition at line 342 of file ZHelix.cxx.

342 {
343 //
344 // Dump the helix attributes
345 TString opt = option;
346 opt.ToUpper();
347
348 cout << endl
349 << "Parameters of helix " << this->GetName() << ":" << endl
350 << "Azimuth = " << fAzim << endl
351 << "Q/R = " << fQovR << endl
352 << "Q*D_h = " << fQxDh << endl
353 << "Z_h = " << fRefZ << endl
354 << "cot(Dip) = " << fTDip << endl
355 << "PhiI = " << fPhiI << endl
356 << "PhiO = " << fPhiO << endl
357 << "Chi2 = " << fChi2 << endl
358 << "D.o.F. = " << fNDoF << endl
359 << "RangeType = " << fRType << endl
360 << "Range: " << fRange[0] << " -> " << fRange[1] << endl;
361 if ( opt.Contains("ALL") ) TPolyLine3D::Print("ALL");
362 cout << endl;
363}

◆ R2Phi()

Double_t ZHelix::R2Phi ( Double_t r)

Definition at line 296 of file ZHelix.cxx.

296 {
297 //
298 // Convert r to phi
299 Double_t k = 1/fQovR + fQxDh;
300 Double_t my_value = fQovR/(2*k) * (-TMath::Power(r,2) + 1/TMath::Power(fQovR,2) + TMath::Power(k,2));
301 // check if my_value is ouside acos validity range
302 if ( (my_value < -1) || (my_value > 1 ) )
303 return 999999999;
304 Double_t my_phi = TMath::ACos(my_value);
305
306 Double_t phi1 = fAzim - my_phi;
307 Double_t phi2 = fAzim + my_phi;
308
309 Double_t x1 = 0;
310 Double_t y1 = 0;
311 Double_t z1 = 0;
312 Double_t x2 = 0;
313 Double_t y2 = 0;
314 Double_t z2 = 0;
315 Double_t phi = 0;;
316 this->Phi2XYZ(phi1,x1,y1,z1);
317 this->Phi2XYZ(phi2,x2,y2,z2);
318
319
320 // check if phi1 would result in a z value with the correct sign corrsponding
321 // to fTDip
322 if ( TMath::Sign(1.,fTDip) == TMath::Sign(1.,(z1-fRefZ)) ) {
323 // check if phi2 would result in a z value with the correct sign corrsponding
324 // to fTDip
325 if ( TMath::Sign(1.,fTDip) == TMath::Sign(1.,(z2-fRefZ)) ) {
326 // take phi with smallest resulting z difference to fRefZ (Zh)
327 if ( TMath::Abs(z1-fRefZ) <= TMath::Abs(z2-fRefZ) )
328 phi = phi1;
329 else
330 phi = phi2;
331 } else
332 phi = phi1;
333 } else {
334 phi = phi2;
335 }
336
337 return phi;
338}
Double_t phi2
Double_t phi1

Referenced by SetRange().

◆ SetDrawOption()

virtual void ZHelix::SetDrawOption ( Option_t * option)
inlinevirtual

Definition at line 100 of file ZHelix.h.

100{ TObject::SetDrawOption(option); }

◆ SetNextPoint()

virtual Int_t ZHelix::SetNextPoint ( Double_t x,
Double_t y,
Double_t z )
inlinevirtual

Definition at line 91 of file ZHelix.h.

91 {
92 return TPolyLine3D::SetNextPoint(x, y, z);
93 }

◆ SetPoint()

virtual void ZHelix::SetPoint ( Int_t point,
Double_t x,
Double_t y,
Double_t z )
inlinevirtual

Definition at line 94 of file ZHelix.h.

94 {
95 TPolyLine3D::SetPoint(point, x, y, z);
96 }

Referenced by SetPoints().

◆ SetPoints()

void ZHelix::SetPoints ( Option_t * option = "3D")
virtual

Definition at line 127 of file ZHelix.cxx.

127 {
128 //
129 // Set PolyLine3D points
130 TString opt = option;
131 opt.ToUpper();
132
133 // Get view
134 BesView *view = dynamic_cast<BesView*>(gPad->GetView());
135
136 // check with which sign the segmnents have to added to fRange[0]
137 Int_t sign = 0;
138 if ( fQovR >= 0 )
139 sign = -1;
140 else
141 sign = +1;
142
143 // calculate distance between ranges in rad
144 Double_t degrad = TMath::Pi() / 180.0;
145 Double_t segment = 1. * degrad; // 1 degree segments
146 Double_t df = 0;
147 if ( sign == +1 ) {
148 if ( fRange[1] > fRange[0] )
149 df = fRange[1]-fRange[0];
150 else
151 df = 2*TMath::Pi() + fRange[1]-fRange[0];
152 } else {
153 if ( fRange[1] < fRange[0] )
154 df = fRange[1]-fRange[0];
155 else
156 df = 2*TMath::Pi() - fRange[1]+fRange[0];
157 }
158 // number of segments with degree distance
159 Int_t nSeg = Int_t(TMath::Abs(df) / segment) + 1;
160
161 // solve problem with nseg = 1 , means df too small compared to
162 // segment -> new segment
163 if ( nSeg < 2 ) {
164 segment = 0.01 * degrad;
165 nSeg = Int_t(TMath::Abs(df) / segment) + 1;
166 }
167 // if ( nSeg < 10 ) nSeg = 10;
168
169 // newly calculation of segment
170 segment = TMath::Abs(df) / nSeg;
171
172 Double_t phi, x, y, z, r;
173 TPolyLine3D::SetPolyLine(nSeg+1);
174
175 if ( opt.Contains("3D") ) {
176 // 3D view
177 for ( Int_t i = 0; i <= nSeg; i++ ) {
178 phi = fRange[0] + segment * i * sign;
179 Phi2XYZ(phi, x, y, z);
180 TPolyLine3D::SetPoint(i, x, y, z);
181 }
182 } else if ( opt.Contains("XY") ) {
183 // XY view
184 for ( Int_t i = 0; i <= nSeg; i++ ) {
185 phi = fRange[0] + segment * i * sign;
186 Phi2XYZ(phi, x, y, z);
187 TPolyLine3D::SetPoint(i, x, y, 0);
188 }
189 } else if ( opt.Contains("ZR") ) {
190 // ZR view
191
192 // The track is drawn either in the upper or lower region of
193 // the ZR view depending on how many of its segements lay in
194 // each region. If these numbers are unbalanced, the starting
195 // point of the track is taken as criterium
196 Int_t isgn = 0;
197 for ( Int_t i = 0; i <= nSeg; i++ ) {
198
199 // Get ZR coordinates
200 phi = fRange[0] + segment * i * sign;
201 Phi2ZR(phi, z, r);
202
203 // Set point
204 TPolyLine3D::SetPoint(i, z, r, 0);
205
206 // Get sign for R coordinate
207 isgn += view->GetRSign(phi);
208 if ( i == 0 ) fRSign = view->GetRSign(phi);
209 }
210 if ( isgn != 0 ) fRSign = TMath::Sign(1, isgn);
211
212 // The vertex fitted tracks need to be displaced otherwise they are
213 // are not drawn to emanate from the vertex.
214
215 Float_t z, r, rref, rdisp;
216
217 rref = TMath::Sqrt((fRefX*fRefX)+(fRefY*fRefY));
218
219 if ( (fTrackType != kVctpar) || (fTrackType != kVcparsec) || (fTrackType != kZttrprm) || (fTrackType != kZttrsec) ) {
220
221 // Set R sign for each point
222 for ( Int_t i = 0; i <= nSeg; i++ ) {
223 z = GetP()[i*3];
224 r = GetP()[i*3+1];
225 SetPoint(i, z, r*fRSign, 0);
226 }
227
228 } else {
229
230 for ( Int_t i = 0; i <= nSeg; i++ ) {
231 z = GetP()[i*3];
232 r = GetP()[i*3+1];
233 rdisp = r*fRSign;
234 if (fRSign < 0) rdisp += 2*rref;
235 SetPoint(i, z, rdisp, 0);
236 }
237
238 }
239
240 }
241
242}
@ kVcparsec
Definition ZHelix.h:34
@ kVctpar
Definition ZHelix.h:33
@ kZttrsec
Definition ZHelix.h:38
@ kZttrprm
Definition ZHelix.h:37
virtual Int_t GetRSign(Float_t Phi)
Definition BesView.cxx:621
void Phi2ZR(Double_t phi, Double_t &z, Double_t &r)
Definition ZHelix.cxx:256
TrackType fTrackType
Definition ZHelix.h:45
virtual void SetPoint(Int_t point, Double_t x, Double_t y, Double_t z)
Definition ZHelix.h:94

Referenced by Paint().

◆ SetRange()

void ZHelix::SetRange ( EZHelixRangeType RangeType,
Double_t RangeMin,
Double_t RangeMax )

Definition at line 97 of file ZHelix.cxx.

98 {
99 //
100 // Set range for drawing
101 switch (RangeType) {
102 case kBesHelixPhi:
103 fRange[0] = RangeMin;
104 fRange[1] = RangeMax;
105 break;
106 case kBesHelixX:
107 fRange[0] = X2Phi(RangeMin);
108 fRange[1] = X2Phi(RangeMax);
109 break;
110 case kBesHelixY:
111 fRange[0] = Y2Phi(RangeMin);
112 fRange[1] = Y2Phi(RangeMax);
113 break;
114 case kBesHelixZ:
115 fRange[0] = Z2Phi(RangeMin);
116 fRange[1] = Z2Phi(RangeMax);
117 break;
118 case kBesHelixR:
119 fRange[0] = R2Phi(RangeMin);
120 fRange[1] = R2Phi(RangeMax);
121 break;
122 }
123}
@ kBesHelixY
Definition ZHelix.h:23
@ kBesHelixR
Definition ZHelix.h:25
@ kBesHelixX
Definition ZHelix.h:22
@ kBesHelixZ
Definition ZHelix.h:24
@ kBesHelixPhi
Definition ZHelix.h:21
Double_t R2Phi(Double_t r)
Definition ZHelix.cxx:296
Double_t Y2Phi(Double_t y)
Definition ZHelix.cxx:276
Double_t X2Phi(Double_t x)
Definition ZHelix.cxx:266
Double_t Z2Phi(Double_t z)
Definition ZHelix.cxx:286

Referenced by ZHelix().

◆ SetTrackType()

void ZHelix::SetTrackType ( TrackType tt)
inline

Definition at line 79 of file ZHelix.h.

79{fTrackType = tt;};

◆ X2Phi()

Double_t ZHelix::X2Phi ( Double_t x)

Definition at line 266 of file ZHelix.cxx.

266 {
267 //
268 // Convert x to phi
269 Double_t phi = TMath::ASin(fQovR * (fSinAzim*(1/fQovR + fQxDh) - x + fRefX));
270
271 return phi;
272}

Referenced by SetRange().

◆ Y2Phi()

Double_t ZHelix::Y2Phi ( Double_t y)

Definition at line 276 of file ZHelix.cxx.

276 {
277 //
278 // Convert y to phi
279 Double_t phi = TMath::ACos(fQovR * (fCosAzim*(1/fQovR + fQxDh) + y - fRefY));
280
281 return phi;
282}

Referenced by SetRange().

◆ Z2Phi()

Double_t ZHelix::Z2Phi ( Double_t z)

Definition at line 286 of file ZHelix.cxx.

286 {
287 //
288 // Convert z to phi
289 Double_t phi = fAzim - fQovR * (z - fRefZ) / fTDip;
290
291 return phi;
292}

Referenced by SetRange().

Member Data Documentation

◆ fAzim

Double_t ZHelix::fAzim
protected

Definition at line 46 of file ZHelix.h.

Referenced by Phi2S(), Phi2XYZ(), Print(), R2Phi(), Z2Phi(), and ZHelix().

◆ fChi2

Float_t ZHelix::fChi2
protected

Definition at line 55 of file ZHelix.h.

Referenced by Print(), and ZHelix().

◆ fCosAzim

Double_t ZHelix::fCosAzim
protected

Definition at line 58 of file ZHelix.h.

Referenced by Phi2XYZ(), Y2Phi(), and ZHelix().

◆ fEnable

Bool_t ZHelix::fEnable
protected

Definition at line 63 of file ZHelix.h.

Referenced by Paint(), and ZHelix().

◆ fNDoF

Int_t ZHelix::fNDoF
protected

Definition at line 56 of file ZHelix.h.

Referenced by Print(), and ZHelix().

◆ fPhiI

Double_t ZHelix::fPhiI
protected

sign of radius

Definition at line 61 of file ZHelix.h.

Referenced by Print(), and ZHelix().

◆ fPhiO

Double_t ZHelix::fPhiO
protected

Definition at line 62 of file ZHelix.h.

Referenced by Print(), and ZHelix().

◆ fQovR

Double_t ZHelix::fQovR
protected

Definition at line 47 of file ZHelix.h.

Referenced by Phi2S(), Phi2XYZ(), Print(), R2Phi(), SetPoints(), X2Phi(), Y2Phi(), Z2Phi(), and ZHelix().

◆ fQxDh

Double_t ZHelix::fQxDh
protected

Definition at line 48 of file ZHelix.h.

Referenced by Phi2XYZ(), Print(), R2Phi(), X2Phi(), Y2Phi(), and ZHelix().

◆ fRange

Double_t ZHelix::fRange[2]
protected

Definition at line 53 of file ZHelix.h.

Referenced by Paint(), Print(), SetPoints(), and SetRange().

◆ fRefX

Double_t ZHelix::fRefX
protected

Definition at line 50 of file ZHelix.h.

Referenced by Phi2XYZ(), SetPoints(), X2Phi(), and ZHelix().

◆ fRefY

Double_t ZHelix::fRefY
protected

Definition at line 51 of file ZHelix.h.

Referenced by Phi2XYZ(), SetPoints(), Y2Phi(), and ZHelix().

◆ fRefZ

Double_t ZHelix::fRefZ
protected

Definition at line 52 of file ZHelix.h.

Referenced by Phi2XYZ(), Print(), R2Phi(), Z2Phi(), and ZHelix().

◆ fRSign

Int_t ZHelix::fRSign
protected

Definition at line 60 of file ZHelix.h.

Referenced by SetPoints(), and ZHelix().

◆ fRType

EZHelixRangeType ZHelix::fRType
protected

Definition at line 54 of file ZHelix.h.

Referenced by Print(), and ZHelix().

◆ fSinAzim

Double_t ZHelix::fSinAzim
protected

Definition at line 57 of file ZHelix.h.

Referenced by Phi2XYZ(), X2Phi(), and ZHelix().

◆ fTDip

Double_t ZHelix::fTDip
protected

Definition at line 49 of file ZHelix.h.

Referenced by Phi2XYZ(), Print(), R2Phi(), Z2Phi(), and ZHelix().

◆ fTrackType

TrackType ZHelix::fTrackType
protected

Definition at line 45 of file ZHelix.h.

Referenced by SetPoints(), and SetTrackType().


The documentation for this class was generated from the following files: