+
+
+
+
+
+
+void AliTPCseed::GetError(AliTPCclusterMI* cluster, AliExternalTrackParam * param,
+ Double_t& erry, Double_t &errz)
+{
+ //
+ // Get cluster error at given position
+ //
+ AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam();
+ Double_t tany,tanz;
+ Double_t snp1=param->GetSnp();
+ tany=snp1/TMath::Sqrt((1.-snp1)*(1.+snp1));
+ //
+ Double_t tgl1=param->GetTgl();
+ tanz=tgl1/TMath::Sqrt((1.-snp1)*(1.+snp1));
+ //
+ Int_t padSize = 0; // short pads
+ if (cluster->GetDetector() >= 36) {
+ padSize = 1; // medium pads
+ if (cluster->GetRow() > 63) padSize = 2; // long pads
+ }
+
+ erry = clusterParam->GetError0Par( 0, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tany) );
+ errz = clusterParam->GetError0Par( 1, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tanz) );
+}
+
+
+void AliTPCseed::GetShape(AliTPCclusterMI* cluster, AliExternalTrackParam * param,
+ Double_t& rmsy, Double_t &rmsz)
+{
+ //
+ // Get cluster error at given position
+ //
+ AliTPCClusterParam *clusterParam = AliTPCcalibDB::Instance()->GetClusterParam();
+ Double_t tany,tanz;
+ Double_t snp1=param->GetSnp();
+ tany=snp1/TMath::Sqrt((1.-snp1)*(1.+snp1));
+ //
+ Double_t tgl1=param->GetTgl();
+ tanz=tgl1/TMath::Sqrt((1.-snp1)*(1.+snp1));
+ //
+ Int_t padSize = 0; // short pads
+ if (cluster->GetDetector() >= 36) {
+ padSize = 1; // medium pads
+ if (cluster->GetRow() > 63) padSize = 2; // long pads
+ }
+
+ rmsy = clusterParam->GetRMSQ( 0, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tany), TMath::Abs(cluster->GetMax()) );
+ rmsz = clusterParam->GetRMSQ( 1, padSize, (250.0 - TMath::Abs(cluster->GetZ())), TMath::Abs(tanz) ,TMath::Abs(cluster->GetMax()));
+}
+
+
+
+Double_t AliTPCseed::GetQCorrGeom(Float_t ty, Float_t tz){
+ //Geoetrical
+ //ty - tangent in local y direction
+ //tz - tangent
+ //
+ Float_t norm=TMath::Sqrt(1+ty*ty+tz*tz);
+ return norm;
+}
+
+Double_t AliTPCseed::GetQCorrShape(Int_t ipad, Int_t type,Float_t z, Float_t ty, Float_t tz, Float_t /*q*/, Float_t /*thr*/){
+ //
+ // Q normalization
+ //
+ // return value = Q Normalization factor
+ // Normalization - 1 - shape factor part for full drift
+ // 1 - electron attachment for 0 drift
+
+ // Input parameters:
+ //
+ // ipad - 0 short pad
+ // 1 medium pad
+ // 2 long pad
+ //
+ // type - 0 qmax
+ // - 1 qtot
+ //
+ //z - z position (-250,250 cm)
+ //ty - tangent in local y direction
+ //tz - tangent
+ //
+
+ AliTPCClusterParam * paramCl = AliTPCcalibDB::Instance()->GetClusterParam();
+ AliTPCParam * paramTPC = AliTPCcalibDB::Instance()->GetParameters();
+
+ if (!paramCl) return 1;
+ //
+ Double_t dr = 250.-TMath::Abs(z);
+ Double_t sy = paramCl->GetRMS0( 0,ipad, dr, TMath::Abs(ty));
+ Double_t sy0= paramCl->GetRMS0(0,ipad, 250, 0);
+ Double_t sz = paramCl->GetRMS0( 1,ipad, dr, TMath::Abs(tz));
+ Double_t sz0= paramCl->GetRMS0(1,ipad, 250, 0);
+
+ Double_t sfactorMax = TMath::Sqrt(sy0*sz0/(sy*sz));
+
+
+ Double_t dt = 1000000*(dr/paramTPC->GetDriftV()); //time in microsecond
+ Double_t attProb = TMath::Exp(-paramTPC->GetAttCoef()*paramTPC->GetOxyCont()*dt);
+ //
+ //
+ if (type==0) return sfactorMax*attProb;
+
+ return attProb;
+
+
+}
+
+
+//_______________________________________________________________________
+Float_t AliTPCseed::GetTPCClustInfo(Int_t nNeighbours, Int_t type, Int_t row0, Int_t row1)
+{
+ //
+ // TPC cluster information
+ // type 0: get fraction of found/findable clusters with neighbourhood definition
+ // 1: found clusters
+ // 2: findable (number of clusters above and below threshold)
+ //
+ // definition of findable clusters:
+ // a cluster is defined as findable if there is another cluster
+ // within +- nNeighbours pad rows. The idea is to overcome threshold
+ // effects with a very simple algorithm.
+ //
+
+ const Float_t kClusterShapeCut = 1.5; // IMPPRTANT TO DO: move value to AliTPCRecoParam
+ const Float_t ktany = TMath::Tan(TMath::DegToRad()*10);
+ const Float_t kedgey =3.;
+
+ Float_t ncl = 0;
+ Float_t nclBelowThr = 0; // counts number of clusters below threshold
+
+ for (Int_t irow=row0; irow<row1; irow++){
+ AliTPCclusterMI* cluster = GetClusterPointer(irow);
+
+ if (!cluster && irow > 1 && irow < 157) {
+ Bool_t isClBefore = kFALSE;
+ Bool_t isClAfter = kFALSE;
+ for(Int_t ithres = 1; ithres <= nNeighbours; ithres++) {
+ AliTPCclusterMI * clusterBefore = GetClusterPointer(irow - ithres);
+ if (clusterBefore) isClBefore = kTRUE;
+ AliTPCclusterMI * clusterAfter = GetClusterPointer(irow + ithres);
+ if (clusterAfter) isClAfter = kTRUE;
+ }
+ if (isClBefore && isClAfter) nclBelowThr++;
+ }
+ if (!cluster) continue;
+ //
+ //
+ if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster
+ //
+ AliTPCTrackerPoint * point = GetTrackPoint(irow);
+ if (point==0) continue;
+ Float_t rsigmay = TMath::Sqrt(point->GetSigmaY());
+ if (rsigmay > kClusterShapeCut) continue;
+ //
+ if (cluster->IsUsed(11)) continue; // remove shared clusters for PbPb
+ ncl++;
+ }
+
+ if(ncl<10)
+ return 0;
+ if(type==0)
+ if(nclBelowThr+ncl>0)
+ return ncl/(nclBelowThr+ncl);
+ if(type==1)
+ return ncl;
+ if(type==2)
+ return ncl+nclBelowThr;
+ return 0;
+}
+//_______________________________________________________________________
+Int_t AliTPCseed::GetNumberOfClustersIndices() {
+ Int_t ncls = 0;
+ for (int i=0; i < 160; i++) {
+ if ((fIndex[i] & 0x8000) == 0)
+ ncls++;
+ }
+ return ncls;
+}
+
+//_______________________________________________________________________
+void AliTPCseed::Clear(Option_t*)
+{
+ // formally seed may allocate memory for clusters (althought this should not happen for
+ // the seeds in the pool). Hence we need this method for fwd. compatibility
+ if (fClusterOwner) for (int i=160;i--;) {delete fClusterPointer[i]; fClusterPointer[i] = 0;}
+}
+
+TObject* AliTPCseed::Clone(const char* newname) const
+{
+ // temporary override TObject::Clone to avoid crashes in reco
+ AliTPCseed* src = (AliTPCseed*)this;
+ AliTPCseed* dst = new AliTPCseed(*src,fClusterOwner);
+ return dst;
+}