#include "AliLog.h"
#include "AliMathBase.h"
+#include "AliRieman.h"
#include "AliCDBManager.h"
-#include "AliTracker.h"
+#include "AliTRDReconstructor.h"
#include "AliTRDpadPlane.h"
#include "AliTRDcluster.h"
#include "AliTRDseedV1.h"
#include "Cal/AliTRDCalROC.h"
#include "Cal/AliTRDCalDet.h"
+class AliTracker;
+
ClassImp(AliTRDseedV1)
//____________________________________________________________________
}
+//____________________________________________________________
+void AliTRDseedV1::Init(const AliRieman *rieman)
+{
+// Initialize this tracklet using the riemann fit information
+
+
+ fZref[0] = rieman->GetZat(fX0);
+ fZref[1] = rieman->GetDZat(fX0);
+ fYref[0] = rieman->GetYat(fX0);
+ fYref[1] = rieman->GetDYat(fX0);
+ if(fkReconstructor && fkReconstructor->IsHLT()){
+ fRefCov[0] = 1;
+ fRefCov[2] = 10;
+ }else{
+ fRefCov[0] = rieman->GetErrY(fX0);
+ fRefCov[2] = rieman->GetErrZ(fX0);
+ }
+ fC[0] = rieman->GetC();
+ fChi2 = rieman->GetChi2();
+}
+
+
//____________________________________________________________
Bool_t AliTRDseedV1::Init(AliTRDtrackV1 *track)
{
for(int ic=0; ic<AliTRDtrackerV1::GetNTimeBins(); ic++){
if(!(c = fClusters[ic]) && !(c = fClusters[ic+kNtb])) continue;
Float_t dx = TMath::Abs(fX0 - c->GetX());
-
+
// Filter clusters for dE/dx calculation
-
+
// 1.consider calibration effects for slice determination
Int_t slice;
- if(dx<kDriftLength){ // TODO should be replaced by c->IsInChamber()
+ if(dx<kDriftLength){ // TODO should be replaced by c->IsInChamber()
slice = Int_t(dx * nslices / kDriftLength);
} else slice = c->GetX() < fX0 ? nslices-1 : 0;
// 2. take sharing into account
Float_t w = /*c->IsShared() ? .5 :*/ 1.;
-
+
// 3. take into account large clusters TODO
//w *= c->GetNPads() > 3 ? .8 : 1.;
-
+
//CHECK !!!
fdEdx[slice] += w * GetdQdl(ic); //fdQdl[ic];
} // End of loop over clusters
//____________________________________________________________
Float_t AliTRDseedV1::GetAnodeWireOffset(Float_t zt)
{
+// Find position inside the amplification cell for reading drift velocity map
+
Float_t d = fPad[3] - zt;
if(d<0.){
AliError(Form("Fail AnodeWireOffset calculation z0[%+7.2f] zt[%+7.2f] d[%+7.2f].", fPad[3], zt, d));
}
+//____________________________________________________________________
+Float_t AliTRDseedV1::GetCharge(Bool_t useOutliers)
+{
+// Computes total charge attached to tracklet. If "useOutliers" is set clusters
+// which are not in chamber are also used (default false)
+
+ AliTRDcluster *c(NULL); Float_t qt(0.);
+ for(int ic=0; ic<kNclusters; ic++){
+ if(!(c=fClusters[ic])) continue;
+ if(c->IsInChamber() && !useOutliers) continue;
+ qt += TMath::Abs(c->GetQ());
+ }
+ return qt;
+}
+
+//____________________________________________________________________
+Bool_t AliTRDseedV1::GetEstimatedCrossPoint(Float_t &x, Float_t &z) const
+{
+// Algorithm to estimate cross point in the x-z plane for pad row cross tracklets.
+// Returns true in case of success.
+ if(!IsRowCross()) return kFALSE;
+
+ x=0.; z=0.;
+ AliTRDcluster *c(NULL);
+ // Find radial range for first row
+ Float_t x1[] = {0., 1.e3};
+ for(int ic=0; ic<kNtb; ic++){
+ if(!(c=fClusters[ic])) continue;
+ if(!c->IsInChamber()) continue;
+ if(c->GetX() <= x1[1]) x1[1] = c->GetX();
+ if(c->GetX() >= x1[0]) x1[0] = c->GetX();
+ z=c->GetZ();
+ }
+ if((x1[0] - x1[1])<1.e-5) return kFALSE;
+
+ // Find radial range for second row
+ Bool_t kZ(kFALSE);
+ Float_t x2[] = {0., 1.e3};
+ for(int ic=kNtb; ic<kNclusters; ic++){
+ if(!(c=fClusters[ic])) continue;
+ if(!c->IsInChamber()) continue;
+ if(c->GetX() <= x2[1]) x2[1] = c->GetX();
+ if(c->GetX() >= x2[0]) x2[0] = c->GetX();
+ if(!kZ){
+ z+=c->GetZ();
+ z*=0.5;
+ kZ=kTRUE;
+ }
+ }
+ if((x2[0] - x2[1])<1.e-5) return kFALSE;
+
+ // Find intersection of the 2 radial regions
+ x = 0.5*((x1[0]+x1[1] > x2[0]+x2[1]) ? (x1[1]+x2[0]) : (x1[0]+x2[1]));
+ return kTRUE;
+}
+
//____________________________________________________________________
Float_t AliTRDseedV1::GetdQdl(Int_t ic, Float_t *dl) const
{
if(fClusters[ic] && fClusters[ic]->IsInChamber()){
hasClusterInChamber = kTRUE;
dq += TMath::Abs(fClusters[ic]->GetQ());
- }else if(fClusters[ic+kNtb] && fClusters[ic+kNtb]->IsInChamber()){
+ }
+ if(fClusters[ic+kNtb] && fClusters[ic+kNtb]->IsInChamber()){
hasClusterInChamber = kTRUE;
dq += TMath::Abs(fClusters[ic+kNtb]->GetQ());
}
//____________________________________________________________________
UShort_t AliTRDseedV1::GetVolumeId() const
{
+// Returns geometry volume id by delegation
+
for(Int_t ic(0);ic<kNclusters; ic++){
if(fClusters[ic]) return fClusters[ic]->GetVolumeId();
}
}
//____________________________________________________________
-void AliTRDseedV1::SetPadPlane(AliTRDpadPlane *p)
+void AliTRDseedV1::SetPadPlane(AliTRDpadPlane * const p)
{
// Shortcut method to initialize pad geometry.
fPad[0] = p->GetLengthIPad();
}
if(!IsCalibrated()) Calibrate();
if(opt>2){
- AliWarning(Form("Option [%d] outside range [0, 2]. Using default"));
+ AliWarning(Form("Option [%d] outside range [0, 2]. Using default",opt));
opt=0;
}
// to few clusters
if (n < kClmin){
+ AliDebug(1, Form("Not enough clusters to fit. Clusters: Attached[%d] Fit[%d].", GetN(), n));
SetErrorMsg(kFitCl);
return kFALSE;
}
-
// fit XY
if(!fitterY.Eval()){
+ AliDebug(1, "Fit Y failed.");
SetErrorMsg(kFitFailedY);
return kFALSE;
}
// fit QZ
if(opt!=1 && IsRowCross()){
if(!fitterZ.Eval()) SetErrorMsg(kFitFailedZ);
- if(!HasError(kFitFailedZ) && fitterZ.GetFunctionParameter(1)!=0.){
+ if(!HasError(kFitFailedZ) && TMath::Abs(fitterZ.GetFunctionParameter(1))>1.e-10){
// TODO - one has to recalculate xy fit based on
// better knowledge of z position
// Double_t x = -fitterZ.GetFunctionParameter(0)/fitterZ.GetFunctionParameter(1);
if ( fZref[i] != inTracklet->fZref[i] ) return kFALSE;
}
- if ( fS2Y != inTracklet->fS2Y ) return kFALSE;
- if ( GetTilt() != inTracklet->GetTilt() ) return kFALSE;
- if ( GetPadLength() != inTracklet->GetPadLength() ) return kFALSE;
+ if ( TMath::Abs(fS2Y - inTracklet->fS2Y)>1.e-10 ) return kFALSE;
+ if ( TMath::Abs(GetTilt() - inTracklet->GetTilt())>1.e-10 ) return kFALSE;
+ if ( TMath::Abs(GetPadLength() - inTracklet->GetPadLength())>1.e-10 ) return kFALSE;
for (Int_t i = 0; i < kNclusters; i++){
// if ( fX[i] != inTracklet->GetX(i) ) return kFALSE;
//if ( fFreq != inTracklet->GetFreq() ) return kFALSE;
//if ( fNChange != inTracklet->GetNChange() ) return kFALSE;
- if ( fC != inTracklet->fC ) return kFALSE;
+ if ( TMath::Abs(fC[0] - inTracklet->fC[0])>1.e-10 ) return kFALSE;
//if ( fCC != inTracklet->GetCC() ) return kFALSE;
- if ( fChi2 != inTracklet->fChi2 ) return kFALSE;
+ if ( TMath::Abs(fChi2 - inTracklet->fChi2)>1.e-10 ) return kFALSE;
// if ( fChi2Z != inTracklet->GetChi2Z() ) return kFALSE;
if ( fDet != inTracklet->fDet ) return kFALSE;
- if ( fPt != inTracklet->fPt ) return kFALSE;
- if ( fdX != inTracklet->fdX ) return kFALSE;
+ if ( TMath::Abs(fPt - inTracklet->fPt)>1.e-10 ) return kFALSE;
+ if ( TMath::Abs(fdX - inTracklet->fdX)>1.e-10 ) return kFALSE;
for (Int_t iCluster = 0; iCluster < kNclusters; iCluster++){
AliTRDcluster *curCluster = fClusters[iCluster];