#ifndef ROOT_TEveTrackPropagator
#define ROOT_TEveTrackPropagator
#include "TEveVSDStructs.h"
#include "TEveUtil.h"
#include "TEveElement.h"
#include "TMarker.h"
#include <vector>
class TEvePointSet;
class TEveMagField
{
protected:
Bool_t fFieldConstant;
public:
TEveMagField(): fFieldConstant(kFALSE){}
virtual ~TEveMagField(){}
virtual Bool_t IsConst() const {return fFieldConstant;};
virtual void PrintField(Float_t x, Float_t y, Float_t z) const
{
TEveVector b = GetField(x, y, z);
printf("v(%f, %f, %f) B(%f, %f, %f) \n", x, y, z, b.fX, b.fY, b.fZ);
}
virtual TEveVector GetField(const TEveVector &v) const { return GetField(v.fX, v.fY, v.fZ);}
virtual TEveVector GetField(Float_t x, Float_t y, Float_t z) const = 0;
virtual Float_t GetMaxFieldMag() const = 0;
ClassDef(TEveMagField, 0);
};
class TEveMagFieldConst : public TEveMagField
{
protected:
TEveVector fB;
public:
TEveMagFieldConst(Float_t x, Float_t y, Float_t z) : TEveMagField(), fB(x, y, z)
{ fFieldConstant = kTRUE; }
virtual ~TEveMagFieldConst() {}
using TEveMagField::GetField;
virtual TEveVector GetField(Float_t , Float_t , Float_t ) const { return fB; }
virtual Float_t GetMaxFieldMag() const { return fB.Mag(); }
ClassDef(TEveMagFieldConst, 0);
};
class TEveMagFieldDuo : public TEveMagField
{
protected:
TEveVector fBIn;
TEveVector fBOut;
Float_t fR2;
public:
TEveMagFieldDuo(Float_t r, Float_t bIn, Float_t bOut) : TEveMagField(),
fBIn(0,0,bIn), fBOut(0,0,bOut), fR2(r*r)
{
fFieldConstant = kFALSE;
}
virtual ~TEveMagFieldDuo() {}
using TEveMagField::GetField;
virtual TEveVector GetField(Float_t x, Float_t y, Float_t ) const
{ return ((x*x+y*y)<fR2) ? fBIn : fBOut; }
virtual Float_t GetMaxFieldMag() const { return TMath::Max(fBIn.Mag(), fBOut.Mag()); }
ClassDef(TEveMagFieldDuo, 0);
};
class TEveTrackPropagator : public TEveElementList,
public TEveRefBackPtr
{
friend class TEveTrackPropagatorSubEditor;
public:
struct Helix_t
{
Int_t fCharge;
Float_t fMinAng;
Float_t fDelta;
Float_t fPhi;
Bool_t fValid;
Float_t fLam;
Float_t fR;
Float_t fPhiStep;
Float_t fSin, fCos;
TEveVector fB;
TEveVector fE1, fE2, fE3;
TEveVector fPt, fPl;
Float_t fPtMag;
Float_t fPlDir;
Float_t fTStep;
Helix_t();
void UpdateHelix(const TEveVector & p, const TEveVector& b, Bool_t fullUpdate, Float_t fraction = -1);
void UpdateRG (const TEveVector & p, const TEveVector& b, Float_t bMax = -1, Float_t maxStep = -1);
void Step (const TEveVector4& v, const TEveVector& p, TEveVector4& vOut, TEveVector& pOut);
Float_t GetStep() { return fTStep * TMath::Sqrt(1 + fLam*fLam); }
Float_t GetStep2() { return fTStep * fTStep * (1 + fLam*fLam); }
};
enum EStepper_e { kHelix, kRungeKutta };
private:
TEveTrackPropagator(const TEveTrackPropagator&);
TEveTrackPropagator& operator=(const TEveTrackPropagator&);
protected:
EStepper_e fStepper;
TEveMagField* fMagFieldObj;
Float_t fMaxR;
Float_t fMaxZ;
Int_t fNMax;
Float_t fMaxOrbs;
Float_t fMaxStepRG;
Bool_t fEditPathMarks;
Bool_t fFitDaughters;
Bool_t fFitReferences;
Bool_t fFitDecay;
Bool_t fFitCluster2Ds;
Bool_t fRnrDaughters;
Bool_t fRnrReferences;
Bool_t fRnrDecay;
Bool_t fRnrCluster2Ds;
Bool_t fRnrFV;
TMarker fPMAtt;
TMarker fFVAtt;
std::vector<TEveVector4> fPoints;
TEveVector fV;
Helix_t fH;
void RebuildTracks();
void Step(TEveVector4 &v, TEveVector &p, TEveVector4 &vOut, TEveVector &pOut, Float_t fraction);
Bool_t LoopToVertex(TEveVector& v, TEveVector& p);
void LoopToBounds(TEveVector& p);
Bool_t LineToVertex (TEveVector& v);
void LineToBounds (TEveVector& p);
void OneStepRungeKutta(Double_t charge, Double_t step, Double_t* vect, Double_t* vout);
Bool_t HelixIntersectPlane(const TEveVector& p, const TEveVector& point, const TEveVector& normal,
TEveVector& itsect);
Bool_t LineIntersectPlane(const TEveVector& p, const TEveVector& point, const TEveVector& normal,
TEveVector& itsect);
Bool_t PointOverVertex(const TEveVector4& v0, const TEveVector4& v);
public:
TEveTrackPropagator(const Text_t* n="TEveTrackPropagator", const Text_t* t="",
TEveMagField* field=0);
virtual ~TEveTrackPropagator();
virtual void OnZeroRefCount();
virtual void CheckReferenceCount(const TEveException& eh="TEveElement::CheckReferenceCount ");
virtual void ElementChanged(Bool_t update_scenes=kTRUE, Bool_t redraw=kFALSE);
void InitTrack(TEveVector& v, Int_t charge);
void ResetTrack();
void GoToBounds(TEveVector& p);
Bool_t GoToVertex(TEveVector& v, TEveVector& p);
Bool_t IntersectPlane(const TEveVector& p, const TEveVector& point, const TEveVector& normal,
TEveVector& itsect);
void FillPointSet(TEvePointSet* ps) const;
void SetStepper(EStepper_e s) { fStepper = s; }
void SetMagField(Float_t bX, Float_t bY, Float_t bZ);
void SetMagField(Float_t b) { SetMagField(0.f, 0.f, b); }
void SetMagFieldObj(TEveMagField * x);
void SetMaxR(Float_t x);
void SetMaxZ(Float_t x);
void SetMaxOrbs(Float_t x);
void SetMinAng(Float_t x);
void SetDelta(Float_t x);
void SetEditPathMarks(Bool_t x) { fEditPathMarks = x; }
void SetRnrDaughters(Bool_t x);
void SetRnrReferences(Bool_t x);
void SetRnrDecay(Bool_t x);
void SetRnrCluster2Ds(Bool_t x);
void SetFitDaughters(Bool_t x);
void SetFitReferences(Bool_t x);
void SetFitDecay(Bool_t x);
void SetFitCluster2Ds(Bool_t x);
void SetRnrFV(Bool_t x) { fRnrFV = x; }
TEveVector GetMagField(Float_t x, Float_t y, Float_t z) { return fMagFieldObj->GetField(x, y, z); }
void PrintMagField(Float_t x, Float_t y, Float_t z) const;
EStepper_e GetStepper() const { return fStepper;}
Float_t GetMaxR() const { return fMaxR; }
Float_t GetMaxZ() const { return fMaxZ; }
Float_t GetMaxOrbs() const { return fMaxOrbs; }
Float_t GetMinAng() const { return fH.fMinAng; }
Float_t GetDelta() const { return fH.fDelta; }
Bool_t GetEditPathMarks() const { return fEditPathMarks; }
Bool_t GetRnrDaughters() const { return fRnrDaughters; }
Bool_t GetRnrReferences() const { return fRnrReferences; }
Bool_t GetRnrDecay() const { return fRnrDecay; }
Bool_t GetRnrCluster2Ds() const { return fRnrCluster2Ds; }
Bool_t GetFitDaughters() const { return fFitDaughters; }
Bool_t GetFitReferences() const { return fFitReferences; }
Bool_t GetFitDecay() const { return fFitDecay; }
Bool_t GetFitCluster2Ds() const { return fFitCluster2Ds; }
Bool_t GetRnrFV() const { return fRnrFV; }
TMarker& RefPMAtt() { return fPMAtt; }
TMarker& RefFVAtt() { return fFVAtt; }
static Bool_t IsOutsideBounds(const TEveVector& point, Float_t maxRsqr, Float_t maxZ);
static Float_t fgDefMagField;
static const Float_t fgkB2C;
static TEveTrackPropagator fgDefStyle;
ClassDef(TEveTrackPropagator, 0);
};
inline Bool_t TEveTrackPropagator::IsOutsideBounds(const TEveVector& point,
Float_t maxRsqr,
Float_t maxZ)
{
return TMath::Abs(point.fZ) > maxZ ||
point.fX*point.fX + point.fY*point.fY > maxRsqr;
}
inline Bool_t TEveTrackPropagator::PointOverVertex(const TEveVector4 &v0,
const TEveVector4 &v)
{
Float_t dotV = fH.fB.fX*(v0.fX-v.fX)
+ fH.fB.fY*(v0.fY-v.fY)
+ fH.fB.fZ*(v0.fZ-v.fZ);
return (fH.fPlDir > 0 && dotV < 0) || (fH.fPlDir < 0 && dotV >0);
}
#endif
Last change: Wed Dec 10 08:21:22 2008
Last generated: 2008-12-10 08:21
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.