ROOT logo
AliRoot » TRD » AliTRDseedV1

class AliTRDseedV1: public AliTRDtrackletBase


  The TRD offline tracklet

 The running horse of the TRD reconstruction. The following tasks are preformed:
   1. Clusters attachment to tracks based on prior information stored at tracklet level (see AttachClusters)
   2. Clusters position recalculation based on track information (see GetClusterXY and Fit)
   3. Cluster error parametrization recalculation (see Fit)
   4. Linear track approximation (Fit)
   5. Optimal position (including z estimate for pad row cross tracklets) and covariance matrix of the track fit inside one TRD chamber (Fit)
   6. Tilt pad correction and systematic effects (GetCovAt)
   7. dEdx calculation (CookdEdx)
   8. PID probabilities estimation (CookPID)

Authors:
Alex Bercuci <A.Bercuci@gsi.de>
Markus Fasel <M.Fasel@gsi.de>


Function Members (Methods)

public:
AliTRDseedV1(Int_t det = -1)
AliTRDseedV1(const AliTRDseedV1& ref)
virtual~AliTRDseedV1()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
Bool_tAttachClusters(AliTRDtrackingChamber *const chamber, Bool_t tilt = kFALSE, Bool_t ChgPlus = kTRUE, Int_t ev = -1)
voidBootstrap(const AliTRDReconstructor* rec)
virtual voidTObject::Browse(TBrowser* b)
voidCalibrate()
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
voidCookdEdx(Int_t nslices)
voidCookLabels()
virtual Bool_tCookPID()
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
Double_tEstimatedCrossPoint(AliTRDpadPlane* pp, Float_t bz)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
Bool_tFit(UChar_t opt = 0)
Bool_tFitRobust(AliTRDpadPlane* pp, TGeoHMatrix* mdet, Float_t bz, Int_t chg, Int_t opt = 0)
Float_tGetAnodeWireOffset(Float_t zt)
Float_tGetC(Int_t typ = 0) const
voidGetCalibParam(Float_t& exb, Float_t& vd, Float_t& t0, Float_t& s2, Float_t& dl, Float_t& dt) const
Float_tGetCharge(Bool_t useOutliers = kFALSE) const
Int_tGetChargeGaps(Float_t* sz, Float_t* pos, Int_t* ntb) const
Float_tGetChi2() const
Float_tGetChi2Phi() const
Float_tGetChi2Y() const
Float_tGetChi2Z() const
AliTRDcluster*GetClusters(Int_t i) const
voidGetCovAt(Double_t x, Double_t* cov) const
static Double_tGetCovInv(const Double_t *const c, Double_t* d)
voidGetCovRef(Double_t* cov) const
static Int_tGetCovSqrt(const Double_t *const c, Double_t* d)
voidGetCovXY(Double_t* cov) const
const Float_t*GetdEdx() const
virtual Int_tGetDetector() const
Float_tGetdQdl() const
Float_tGetdQdl(Int_t ic, Float_t* dx = NULL) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
Float_tGetdX() const
virtual Int_tGetdY() const
virtual Float_tGetdYdX() const
virtual Float_tGetdZdX() const
UChar_tGetErrorMsg() const
virtual Int_tAliTRDtrackletBase::GetHCId() const
virtual const char*TObject::GetIconName() const
Int_tGetIndexes(Int_t i) const
Int_tGetLabels(Int_t i) const
Float_tGetLocalY() const
Float_tGetLocalZ() const
Float_tGetMomentum(Float_t* err = NULL) const
Int_tGetN() const
Int_tGetN2() const
virtual const char*TObject::GetName() const
Int_tGetNShared() const
Int_tGetNUsed() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Float_tGetPadLength() const
Float_tGetPadWidth() const
virtual Double_tGetPID(Int_t is = -1) const
Int_tGetPlane() const
Float_t*GetProbability(Bool_t force = kFALSE)
Float_tGetPt() const
Float_tGetQperTB(Int_t tb) const
Float_tGetQuality(Bool_t kZcorr) const
Double_tGetS2DYDX(Float_t) const
Double_tGetS2DZDX(Float_t dzdx) const
Double_tGetS2XcrossDZDX(Double_t absdzdx) const
Float_tGetS2Y() const
Float_tGetS2Z() const
Float_tGetSigmaY() const
Float_tGetSnp() const
Int_tGetTBcross() const
Int_tGetTBoccupancy() const
Float_tGetTgl() const
Float_tGetTilt() const
virtual const char*TObject::GetTitle() const
virtual UInt_tGetTrackletWord() const
virtual UInt_tTObject::GetUniqueID() const
UShort_tGetVolumeId() const
virtual Float_tGetX() const
Float_tGetX0() const
Float_tGetXcross() const
virtual Float_tGetY() const
Double_tGetYat(Double_t x) const
virtual Int_tGetYbin() const
Float_tGetYfit(Int_t id) const
Float_tGetYref() const
Float_tGetYref(Int_t id) const
virtual Float_tGetZ() const
Double_tGetZat(Double_t x) const
virtual Int_tGetZbin() const
Float_tGetZfit(Int_t id) const
Float_tGetZref() const
Float_tGetZref(Int_t id) const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
Bool_tHasError(AliTRDseedV1::ETRDtrackletError err) const
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
Bool_tInit(const AliTRDtrackV1* track)
voidInit(const AliRieman* fit)
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tIsCalibrated() const
Bool_tIsChmbGood() const
virtual Bool_tIsEqual(const TObject* inTracklet) const
virtual Bool_tTObject::IsFolder() const
Bool_tIsKink() const
Bool_tIsOK() const
Bool_tTObject::IsOnHeap() const
Bool_tIsOwner() const
Bool_tIsPrimary() const
Bool_tIsRowCross() const
virtual Bool_tTObject::IsSortable() const
Bool_tIsStandAlone() const
Bool_tIsUsable(Int_t i) const
Bool_tTObject::IsZombie() const
virtual voidAliTRDtrackletBase::LocalToGlobal(Float_t&, Float_t&, Float_t&, Float_t&)
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
AliTRDcluster*NextCluster()
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
AliTRDseedV1&operator=(const AliTRDseedV1& ref)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
AliTRDcluster*PrevCluster()
virtual voidPrint(Option_t* o = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidReset(Option_t* opt = "")
voidTObject::ResetBit(UInt_t f)
voidResetClusterIter(Bool_t forward = kTRUE)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetC(Float_t c, Int_t typ = 0)
voidSetChi2(Float_t chi2)
voidSetChmbGood(Bool_t k = kTRUE)
voidSetCovRef(const Double_t* cov)
virtual voidSetDetector(Int_t d)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetDX(Float_t inDX)
voidSetErrorMsg(AliTRDseedV1::ETRDtrackletError err)
voidSetIndexes(Int_t i, Int_t idx)
voidSetKink(Bool_t k = kTRUE)
voidSetLabels(Int_t* lbls)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetOwner()
voidSetPadLength(Float_t l)
voidSetPadPlane(AliTRDpadPlane *const p)
voidSetPadWidth(Float_t w)
voidSetPrimary(Bool_t k = kTRUE)
voidSetPt(Double_t pt)
voidSetReconstructor(const AliTRDReconstructor* rec)
voidSetStandAlone(Bool_t st)
voidSetTilt(Float_t tilt)
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetX0(Float_t x0)
voidSetXYZ(TGeoHMatrix* mDet)
voidSetYref(Int_t i, Float_t y)
voidSetZref(Int_t i, Float_t z)
virtual voidShowMembers(TMemberInspector&)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
voidUpdate(const AliTRDtrackV1* trk)
voidUpdateUsed()
voidUseClusters()
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidCopy(TObject& ref) const
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
voidUnbiasDZDX(Bool_t rc, Float_t bz)
Double_tUnbiasY(Bool_t rc, Float_t bz)
private:
voidSetN(Int_t n)
voidSetNShared(Int_t n)
voidSetNUsed(Int_t n)
voidSwap(Int_t& n1, Int_t& n2) const
voidSwap(Double_t& d1, Double_t& d2) const

Data Members

public:
enum ETRDtrackletBuffers { kNbits
kMask
kNtb
kNclusters
kNdEdxSlices
};
enum ETRDtrackletStatus { kOwner
kRowCross
kChmbGood
kCalib
kKink
kStandAlone
kPrimary
};
enum ETRDtrackletError { kAttachClFound
kAttachRowGap
kAttachRow
kAttachMultipleCl
kAttachClAttach
kFitCl
kFitFailedY
kFitFailedZ
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
private:
Float_tfC[2]Curvature for standalone [0] rieman [1] vertex constrained
Float_tfChi2Global chi2
Char_tfClusterIdx! clusters iterator
AliTRDcluster**fClusterIter! clusters iterator
AliTRDcluster*fClusters[62]Clusters
Double_tfCov[3]covariance matrix of the tracklet in the xy plane
Short_tfDetTRD detector
Float_tfDiffLlongitudinal diffusion coefficient
Float_tfDiffTtransversal diffusion coefficient
UChar_tfErrorMsgprocessing error
Float_tfExBtg(a_L) @ tracklet location
Int_tfIndexes[62]! Indexes
Int_tfLabels[3]most frequent MC labels and total number of different labels
UInt_tfNnumber of clusters attached/used/shared
Float_tfPad[4]local pad definition : length/width/tilt/anode wire offset
Float_tfProb[5]PID probabilities
Float_tfPtPt estimate @ tracklet [GeV/c]
Double_tfRefCov[7]covariance matrix of the track in the yz plane + the rest of the diagonal elements
Float_tfS2PRFsigma^2 PRF for xd->0 and phi=a_L
Float_tfS2Yestimated radial cross point (chmb. coord.) in case of RC tracklets
Float_tfS2Zestimated resolution in the z direction
Float_tfT0time 0 @ tracklet location
Float_tfVDdrift velocity @ tracklet location
Float_tfXlocal radial offset from anode wire where tracklet position is estimated
Float_tfX0anode wire position in TrackingCoordinates (alignment included)
Float_tfYr-phi position of the tracklet in TrackingCoordinates (alignment included)
Float_tfYfit[2]Fit :: chamber local y, dy/dx
Float_tfYref[2]Reference y, dydx
Float_tfZz position of the tracklet in TrackingCoordinates (alignment included)
Float_tfZfit[2]Fit :: chamber local z, dz/dx
Float_tfZref[2]Reference z, dz/dx
Float_tfdEdx[8]dE/dx measurements for tracklet
Float_tfdXlength of time bin
const AliTRDReconstructor*fkReconstructor! local reconstructor

Class Charts

Inheritance Chart:
TObject
AliTRDtrackletBase
AliTRDseedV1

Function documentation

AliTRDseedV1(Int_t det = -1)
 Constructor

AliTRDseedV1(const AliTRDseedV1& ref)
 Copy Constructor performing a deep copy

AliTRDseedV1& operator=(const AliTRDseedV1& ref)
 Assignment Operator using the copy function

~AliTRDseedV1()
 Destructor. The RecoParam object belongs to the underlying tracker.

void Copy(TObject& ref) const
 Copy function

void Init(const AliRieman* fit)
 Initialize this tracklet using the riemann fit information
Bool_t Init(const AliTRDtrackV1* track)
 Initialize this tracklet using the track information

 Parameters:
   track - the TRD track used to initialize the tracklet

 Detailed description
 The function sets the starting point and direction of the
 tracklet according to the information from the TRD track.

 Caution
 The TRD track has to be propagated to the beginning of the
 chamber where the tracklet will be constructed

void Reset(Option_t* opt = "")
 Reset seed. If option opt="c" is given only cluster arrays are cleared.

void Update(const AliTRDtrackV1* trk)
 update tracklet reference position from the TRD track
void UpdateUsed()
 Calculate number of used clusers in the tracklet

void UseClusters()
 Use clusters

 In stand alone mode:
 Clusters which are marked as used or shared from another track are
 removed from the tracklet

 In barrel mode:
 - Clusters which are used by another track become shared
 - Clusters which are attached to a kink track become shared

void CookdEdx(Int_t nslices)
 Calculates average dE/dx for all slices and store them in the internal array fdEdx.

 Parameters:
  nslices : number of slices for which dE/dx should be calculated
 Output:
  store results in the internal array fdEdx. This can be accessed with the method
  AliTRDseedV1::GetdEdx()

 Detailed description
 Calculates average dE/dx for all slices. Depending on the PID methode
 the number of slices can be 3 (LQ) or 8(NN).
 The calculation of dQ/dl are done using the tracklet fit results (see AliTRDseedV1::GetdQdl(Int_t))

 The following effects are included in the calculation:
 1. calibration values for t0 and vdrift (using x coordinate to calculate slice)
 2. cluster sharing (optional see AliTRDrecoParam::SetClusterSharing())
 3. cluster size

void CookLabels()
 Cook 2 labels for seed

Float_t GetAnodeWireOffset(Float_t zt)
 Find position inside the amplification cell for reading drift velocity map
Float_t GetCharge(Bool_t useOutliers = kFALSE) const
 Computes total charge attached to tracklet. If "useOutliers" is set clusters
 which are not in chamber are also used (default false)
Int_t GetChargeGaps(Float_t* sz, Float_t* pos, Int_t* ntb) const
 Find number, size and position of charge gaps (consecutive missing time bins).
 Returns the number of gaps and fills their size in input array "sz" and position in array "pos"
Double_t EstimatedCrossPoint(AliTRDpadPlane* pp, Float_t bz)
 Algorithm to estimate cross point in the x-z plane for pad row cross tracklets or the z coordinate of pad row without pad row cross in the local chamber coordinates.
 Returns variance of the radial offset from anode wire in case of raw cross or 0 otherwise.
void UnbiasDZDX(Bool_t rc, Float_t bz)
 correct dzdx for the bias in z according to MC
Double_t UnbiasY(Bool_t rc, Float_t bz)
 correct y coordinate for tail cancellation. This should be fixed by considering TC as a function of q/pt.
  rc : TRUE if tracklet crosses rows
 bz : magnetic field z component
Float_t GetQperTB(Int_t tb) const
 Charge of the clusters at timebin

Float_t GetdQdl() const
 Calculate total charge / tracklet length for 1D PID

Float_t GetdQdl(Int_t ic, Float_t* dx = NULL) const
 Using the linear approximation of the track inside one TRD chamber (TRD tracklet)
 the charge per unit length can be written as:

#frac{dq}{dl} = #frac{q_{c}}{dx * #sqrt{1 + #(){#frac{dy}{dx}}^{2}_{fit} + #(){#frac{dz}{dx}}^{2}_{ref}}}
 where qc is the total charge collected in the current time bin and dx is the length
 of the time bin.
 The following correction are applied :
   - charge : pad row cross corrections
              [diffusion and TRF assymetry] TODO
   - dx     : anisochronity, track inclination - see Fit and AliTRDcluster::GetXloc()
              and AliTRDcluster::GetYloc() for the effects taken into account


 In the picture the energy loss measured on the tracklet as a function of drift time [left] and respectively
 drift length [right] for different particle species is displayed.
 Author : Alex Bercuci <A.Bercuci@gsi.de>

Float_t GetMomentum(Float_t* err = NULL) const
 Returns momentum of the track after update with the current tracklet as:

p=#frac{1}{1/p_{t}} #sqrt{1+tgl^{2}}
 and optionally the momentum error (if err is not null).
 The estimated variance of the momentum is given by:

#sigma_{p}^{2} = (#frac{dp}{dp_{t}})^{2} #sigma_{p_{t}}^{2}+(#frac{dp}{dtgl})^{2} #sigma_{tgl}^{2}+2#frac{dp}{dp_{t}}#frac{dp}{dtgl} cov(tgl,1/p_{t})
 which can be simplified to

#sigma_{p}^{2} = p^{2}p_{t}^{4}tgl^{2}#sigma_{tgl}^{2}-2p^{2}p_{t}^{3}tgl cov(tgl,1/p_{t})+p^{2}p_{t}^{2}#sigma_{1/p_{t}}^{2}

Int_t GetTBoccupancy() const
 Returns no. of TB occupied by clusters
Int_t GetTBcross() const
 Returns no. of TB occupied by 2 clusters for pad row cross tracklets
Float_t* GetProbability(Bool_t force = kFALSE)
Bool_t CookPID()
 Fill probability array for tracklet from the DB.

 Parameters

 Output
   returns pointer to the probability array and NULL if missing DB access

 Retrieve PID probabilities for e+-, mu+-, K+-, pi+- and p+- from the DB according to tracklet information:
 - estimated momentum at tracklet reference point
 - dE/dx measurements
 - tracklet length
 - TRD layer
 According to the steering settings specified in the reconstruction one of the following methods are used
 - Neural Network [default] - option "nn"
 - 2D Likelihood - option "!nn"
Float_t GetQuality(Bool_t kZcorr) const
 Returns a quality measurement of the current seed

void GetCovAt(Double_t x, Double_t* cov) const
 Computes covariance in the y-z plane at radial point x (in tracking coordinates)
 and returns the results in the preallocated array cov[3] as :
   cov[0] = Var(y)
   cov[1] = Cov(yz)
   cov[2] = Var(z)

 Details

 For the linear transformation

Y = T_{x} X^{T}
   The error propagation has the general form

C_{Y} = T_{x} C_{X} T_{x}^{T}
  We apply this formula 2 times. First to calculate the covariance of the tracklet
 at point x we consider:

T_{x} = (1 x); X=(y0 dy/dx); C_{X}=#(){#splitline{Var(y0) Cov(y0, dy/dx)}{Cov(y0, dy/dx) Var(dy/dx)}}
 and secondly to take into account the tilt angle

T_{#alpha} = #(){#splitline{cos(#alpha) __ sin(#alpha)}{-sin(#alpha) __ cos(#alpha)}}; X=(y z); C_{X}=#(){#splitline{Var(y)    0}{0   Var(z)}}

 using simple trigonometrics one can write for this last case

C_{Y}=#frac{1}{1+tg^{2}#alpha} #(){#splitline{(#sigma_{y}^{2}+tg^{2}#alpha#sigma_{z}^{2}) __ tg#alpha(#sigma_{z}^{2}-#sigma_{y}^{2})}{tg#alpha(#sigma_{z}^{2}-#sigma_{y}^{2}) __ (#sigma_{z}^{2}+tg^{2}#alpha#sigma_{y}^{2})}}
 which can be aproximated for small alphas (2 deg) with

C_{Y}=#(){#splitline{#sigma_{y}^{2} __ (#sigma_{z}^{2}-#sigma_{y}^{2})tg#alpha}{((#sigma_{z}^{2}-#sigma_{y}^{2})tg#alpha __ #sigma_{z}^{2}}}

 before applying the tilt rotation we also apply systematic uncertainties to the tracklet
 position which can be tunned from outside via the AliTRDrecoParam::SetSysCovMatrix(). They might
 account for extra misalignment/miscalibration uncertainties.

 Author :
 Alex Bercuci <A.Bercuci@gsi.de>
 Date : Jan 8th 2009

Int_t GetCovSqrt(const Double_t *const c, Double_t* d)
 Helper function to calculate the square root of the covariance matrix.
 The input matrix is stored in the vector c and the result in the vector d.
 Both arrays have to be initialized by the user with at least 3 elements. Return negative in case of failure.

 For calculating the square root of the symmetric matrix c
 the following relation is used:

C^{1/2} = VD^{1/2}V^{-1}
 with V being the matrix with the n eigenvectors as columns.
 In case C is symmetric the followings are true:
   - matrix D is diagonal with the diagonal given by the eigenvalues of C
   - V = V^{-1}

 Author A.Bercuci <A.Bercuci@gsi.de>
 Date   Mar 19 2009
Double_t GetCovInv(const Double_t *const c, Double_t* d)
 Helper function to calculate the inverse of the covariance matrix.
 The input matrix is stored in the vector c and the result in the vector d.
 Both arrays have to be initialized by the user with at least 3 elements
 The return value is the determinant or 0 in case of singularity.

 Author A.Bercuci <A.Bercuci@gsi.de>
 Date   Mar 19 2009
UShort_t GetVolumeId() const
 Returns geometry volume id by delegation
void Calibrate()
 Retrieve calibration and position parameters from OCDB.
 The following information are used
  - detector index
  - column and row position of first attached cluster. If no clusters are attached
 to the tracklet a random central chamber position (c=70, r=7) will be used.

 The following information is cached in the tracklet
   t0 (trigger delay)
   drift velocity
   PRF width
   omega*tau = tg(a_L)
   diffusion coefficients (longitudinal and transversal)

 Author :
 Alex Bercuci <A.Bercuci@gsi.de>
 Date : Jan 8th 2009

void SetOwner()
AliInfo(Form("own [%s] fOwner[%s]", own?"YES":"NO", fOwner?"YES":"NO"));
void SetPadPlane(AliTRDpadPlane *const p)
 Shortcut method to initialize pad geometry.
Bool_t AttachClusters(AliTRDtrackingChamber *const chamber, Bool_t tilt = kFALSE, Bool_t ChgPlus = kTRUE, Int_t ev = -1)
 Projective algorithm to attach clusters to seeding tracklets. The following steps are performed :
 1. Collapse x coordinate for the full detector plane
 2. truncated mean on y (r-phi) direction
 3. purge clusters
 4. truncated mean on z direction
 5. purge clusters

 Parameters
  - chamber : pointer to tracking chamber container used to search the tracklet
  - tilt    : switch for tilt correction during road building [default true]
  - chgPos  : mark same[kFALSE] and opposite[kTRUE] sign tracks with respect to Bz field sign [default true]
  - ev      : event number for debug purposes [default = -1]
 Output
  - true    : if tracklet found successfully. Failure can happend because of the following:
      -
 Detailed description

 We start up by defining the track direction in the xy plane and roads. The roads are calculated based
 on tracking information (variance in the r-phi direction) and estimated variance of the standard
 clusters (see AliTRDcluster::SetSigmaY2()) corrected for tilt (see GetCovAt()). From this the road is

r_{y} = 3*#sqrt{12*(#sigma^{2}_{Trk}(y) + #frac{#sigma^{2}_{cl}(y) + tg^{2}(#alpha_{L})#sigma^{2}_{cl}(z)}{1+tg^{2}(#alpha_{L})})}

 Author : Alexandru Bercuci <A.Bercuci@gsi.de>
 Debug  : level = 2 for calibration
          level = 3 for visualization in the track SR
          level = 4 for full visualization including digit level
void Bootstrap(const AliTRDReconstructor* rec)
   Fill in all derived information. It has to be called after recovery from file or HLT.
   The primitive data are
   - list of clusters
   - detector (as the detector will be removed from clusters)
   - position of anode wire (fX0) - temporary
   - track reference position and direction
   - momentum of the track
   - time bin length [cm]

   A.Bercuci <A.Bercuci@gsi.de> Oct 30th 2008

Bool_t Fit(UChar_t opt = 0)
 Linear fit of the clusters attached to the tracklet

 Parameters :
   - opt : switch for tilt pad correction of cluster y position. Options are
           0 no correction [default]
           1 full tilt correction [dz/dx and z0]
           2 pseudo tilt correction [dz/dx from pad-chamber geometry]

 Output :
  True if successful

 Detailed description

            Fit in the xy plane

 The fit is performed to estimate the y position of the tracklet and the track
 angle in the bending plane. The clusters are represented in the chamber coordinate
 system (with respect to the anode wire - see AliTRDtrackerV1::FollowBackProlongation()
 on how this is set). The x and y position of the cluster and also their variances
 are known from clusterizer level (see AliTRDcluster::GetXloc(), AliTRDcluster::GetYloc(),
 AliTRDcluster::GetSX() and AliTRDcluster::GetSY()).
 If gaussian approximation is used to calculate y coordinate of the cluster the position
 is recalculated taking into account the track angle. The general formula to calculate the
 error of cluster position in the gaussian approximation taking into account diffusion and track
 inclination is given for TRD by:

#sigma^{2}_{y} = #sigma^{2}_{PRF} + #frac{x#delta_{t}^{2}}{(1+tg(#alpha_{L}))^{2}} + #frac{x^{2}tg^{2}(#phi-#alpha_{L})tg^{2}(#alpha_{L})}{12}

 Since errors are calculated only in the y directions, radial errors (x direction) are mapped to y
 by projection i.e.

#sigma_{x|y} = tg(#phi) #sigma_{x}
 and also by the lorentz angle correction

            Fit in the xz plane

 The "fit" is performed to estimate the radial position (x direction) where pad row cross happens.
 If no pad row crossing the z position is taken from geometry and radial position is taken from the xy
 fit (see below).

 There are two methods to estimate the radial position of the pad row cross:
   1. leading cluster radial position : Here the lower part of the tracklet is considered and the last
 cluster registered (at radial x0) on this segment is chosen to mark the pad row crossing. The error
 of the z estimate is given by :

#sigma_{z} = tg(#theta) #Delta x_{x_{0}}/12
 The systematic errors for this estimation are generated by the following sources:
   - no charge sharing between pad rows is considered (sharp cross)
   - missing cluster at row cross (noise peak-up, under-threshold signal etc.).

   2. charge fit over the crossing point : Here the full energy deposit along the tracklet is considered
 to estimate the position of the crossing by a fit in the qx plane. The errors in the q directions are
 parameterized as s_q = q^2. The systematic errors for this estimation are generated by the following sources:
   - no general model for the qx dependence
   - physical fluctuations of the charge deposit
   - gain calibration dependence

            Estimation of the radial position of the tracklet

 For pad row cross the radial position is taken from the xz fit (see above). Otherwise it is taken as the
 interpolation point of the tracklet i.e. the point where the error in y of the fit is minimum. The error
 in the y direction of the tracklet is (see AliTRDseedV1::GetCovAt()):

#sigma_{y} = #sigma^{2}_{y_{0}} + 2xcov(y_{0}, dy/dx) + #sigma^{2}_{dy/dx}
 and thus the radial position is:

x = - cov(y_{0}, dy/dx)/#sigma^{2}_{dy/dx}

            Estimation of tracklet position error

 The error in y direction is the error of the linear fit at the radial position of the tracklet while in the z
 direction is given by the cluster error or pad row cross error. In case of no pad row cross this is given by:

#sigma_{y} = #sigma^{2}_{y_{0}} - 2cov^{2}(y_{0}, dy/dx)/#sigma^{2}_{dy/dx} + #sigma^{2}_{dy/dx}
 For pad row cross the full error is calculated at the radial position of the crossing (see above) and the error
 in z by the width of the crossing region - being a matter of parameterization.

#sigma_{z} = tg(#theta) #Delta x_{x_{0}}/12
 In case of no tilt correction (default in the barrel tracking) the tilt is taken into account by the rotation of
 the covariance matrix. See AliTRDseedV1::GetCovAt() for details.

 Author
 A.Bercuci <A.Bercuci@gsi.de>
Bool_t FitRobust(AliTRDpadPlane* pp, TGeoHMatrix* mdet, Float_t bz, Int_t chg, Int_t opt = 0)
 Linear fit of the clusters attached to the tracklet
   The fit is performed in local chamber coordinates (27.11.2013) to take into account correctly the misalignment
   Also the pad row cross is checked here and some background is removed

 Author
 A.Bercuci <A.Bercuci@gsi.de>
void SetXYZ(TGeoHMatrix* mDet)
 Apply alignment to the local position of tracklet
 A.Bercuci @ 27.11.2013
void Print(Option_t* o = "") const
 Printing the seedstatus

Bool_t IsEqual(const TObject* inTracklet) const
 Checks if current instance of the class has the same essential members
 as the given one
Float_t GetChi2Z() const
Float_t GetChi2Y() const
Float_t GetChi2Phi() const
Double_t GetPID(Int_t is = -1) const
Double_t GetS2XcrossDZDX(Double_t absdzdx) const
Double_t GetS2DZDX(Float_t dzdx) const
AliTRDcluster* NextCluster()
AliTRDcluster* PrevCluster()
void ResetClusterIter(Bool_t forward = kTRUE)
void SetCovRef(const Double_t* cov)
void SetN(Int_t n)
void SetNUsed(Int_t n)
void SetNShared(Int_t n)
void Swap(Int_t& n1, Int_t& n2) const
void Swap(Double_t& d1, Double_t& d2) const
Bool_t IsCalibrated() const
{ return TestBit(kCalib);}
Bool_t IsChmbGood() const
{ return TestBit(kChmbGood);}
Bool_t IsOwner() const
{ return TestBit(kOwner);}
Bool_t IsKink() const
{ return TestBit(kKink);}
Bool_t IsPrimary() const
{ return TestBit(kPrimary);}
Bool_t HasError(AliTRDseedV1::ETRDtrackletError err) const
{ return TESTBIT(fErrorMsg, err);}
Bool_t IsOK() const
{ return GetN() > 4 && GetNUsed() < 4;}
Bool_t IsRowCross() const
{ return TestBit(kRowCross);}
Bool_t IsUsable(Int_t i) const
{ return fClusters[i] && !fClusters[i]->IsUsed();}
Bool_t IsStandAlone() const
{ return TestBit(kStandAlone);}
Float_t GetC(Int_t typ = 0) const
{ return fC[typ]; }
Float_t GetChi2() const
{ return fChi2; }
void GetCovXY(Double_t* cov) const
{ memcpy(cov, &fCov[0], 3*sizeof(Double_t));}
void GetCovRef(Double_t* cov) const
{ memcpy(cov, &fRefCov, 7*sizeof(Double_t));}
UChar_t GetErrorMsg() const
{ return fErrorMsg;}
Float_t GetdX() const
{ return fdX;}
const Float_t* GetdEdx() const
{ return &fdEdx[0];}
Float_t GetdYdX() const
{ return fYfit[1];}
Float_t GetdZdX() const
{ return fZfit[1];}
Int_t GetdY() const
{ return Int_t(GetY()/0.014);}
Int_t GetDetector() const
{ return fDet;}
void GetCalibParam(Float_t& exb, Float_t& vd, Float_t& t0, Float_t& s2, Float_t& dl, Float_t& dt) const
AliTRDcluster* GetClusters(Int_t i) const
{ return i<0 || i>=kNclusters ? NULL: fClusters[i];}
Int_t GetIndexes(Int_t i) const
{ return i<0 || i>=kNclusters ? -1 : fIndexes[i];}
Int_t GetLabels(Int_t i) const
{ return fLabels[i];}
Float_t GetLocalZ() const
{ return fZfit[0] - fZfit[1] * fX;}
Float_t GetLocalY() const
{ return fYfit[0] - fYfit[1] * fX;}
Int_t GetN() const
{ return (Int_t)fN&kMask;}
Int_t GetN2() const
{ return GetN();}
Int_t GetNUsed() const
{ return Int_t((fN>>kNbits)&kMask);}
Int_t GetNShared() const
{ return Int_t(((fN>>kNbits)>>kNbits)&kMask);}
Float_t GetPadLength() const
{ return fPad[0];}
Float_t GetPadWidth() const
{ return fPad[1];}
Int_t GetPlane() const
Float_t GetPt() const
{ return fPt; }
Float_t GetS2Y() const
{ return fCov[0];}
Float_t GetS2Z() const
{ return fS2Z;}
Double_t GetS2DYDX(Float_t ) const
{ return fCov[2];}
Float_t GetSigmaY() const
{ return fS2Y > 0. ? TMath::Sqrt(fS2Y) : 0.2;}
Float_t GetSnp() const
{ return fYref[1]/TMath::Sqrt(1+fYref[1]*fYref[1]);}
Float_t GetTgl() const
{ return fZref[1]/TMath::Sqrt(1+fYref[1]*fYref[1]);}
Float_t GetTilt() const
{ return fPad[2];}
UInt_t GetTrackletWord() const
{ return 0;}
Float_t GetX0() const
{ return fX0;}
Float_t GetX() const
{ return fX0 - fX;}
Float_t GetXcross() const
{ return fS2Y;}
Float_t GetY() const
{ return TMath::Abs(fY)<1.e-15?GetLocalY():fY;/*fYfit[0] - fYfit[1] * fX;*/}
Double_t GetYat(Double_t x) const
{ return fY/*fit[0]*/ - fYfit[1] * (fX0-x);}
Float_t GetYfit(Int_t id) const
{ return fYfit[id];}
Float_t GetYref(Int_t id) const
{ return fYref[id];}
Float_t GetYref() const
{ return fYref[0] - fYref[1] *fX;}
Float_t GetZ() const
{ return TMath::Abs(fZ)<1.e-15?GetLocalZ():fZ;/*fZfit[0] - fZfit[1] * fX;*/}
Double_t GetZat(Double_t x) const
{ return fZ/*fit[0]*/ - fZfit[1] * (fX0-x);}
Float_t GetZfit(Int_t id) const
{ return fZfit[id];}
Float_t GetZref(Int_t id) const
{ return fZref[id];}
Float_t GetZref() const
{ return fZref[0] - fZref[1] *fX;}
Int_t GetYbin() const
{ return Int_t(GetY()/0.016);}
Int_t GetZbin() const
{ return Int_t(GetZ()/fPad[0]);}
void SetC(Float_t c, Int_t typ = 0)
{ fC[typ] = c;}
void SetChmbGood(Bool_t k = kTRUE)
void SetChi2(Float_t chi2)
{ fChi2 = chi2;}
void SetErrorMsg(AliTRDseedV1::ETRDtrackletError err)
{ SETBIT(fErrorMsg, err);}
void SetIndexes(Int_t i, Int_t idx)
{ fIndexes[i] = idx; }
void SetLabels(Int_t* lbls)
{ memcpy(fLabels, lbls, 3*sizeof(Int_t)); }
void SetKink(Bool_t k = kTRUE)
{ SetBit(kKink, k);}
void SetPrimary(Bool_t k = kTRUE)
void SetStandAlone(Bool_t st)
void SetPt(Double_t pt)
{ fPt = pt;}
void SetPadLength(Float_t l)
{ fPad[0] = l;}
void SetPadWidth(Float_t w)
{ fPad[1] = w;}
void SetTilt(Float_t tilt)
{ fPad[2] = tilt; }
void SetDetector(Int_t d)
{ fDet = d; }
void SetDX(Float_t inDX)
{ fdX = inDX;}
void SetReconstructor(const AliTRDReconstructor* rec)
void SetX0(Float_t x0)
{ fX0 = x0; }
void SetYref(Int_t i, Float_t y)
{ if(i==0||i==1) fYref[i] = y;}
void SetZref(Int_t i, Float_t z)
   void      SetUsabilityMap(Long_t um)  { fUsable = um; }
{ if(i==0||i==1) fZref[i] = z;}