1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ////////////////////////////////////////////////////////////////////////////
20 // The TRD track seed //
23 // Alex Bercuci <A.Bercuci@gsi.de> //
24 // Markus Fasel <M.Fasel@gsi.de> //
26 ////////////////////////////////////////////////////////////////////////////
29 #include "TLinearFitter.h"
32 #include "AliMathBase.h"
34 #include "AliTRDseedV1.h"
35 #include "AliTRDcluster.h"
36 #include "AliTRDtrack.h"
37 #include "AliTRDcalibDB.h"
38 #include "AliTRDstackLayer.h"
39 #include "AliTRDrecoParam.h"
40 #include "AliTRDgeometry.h"
41 #include "Cal/AliTRDCalPID.h"
45 ClassImp(AliTRDseedV1)
47 //____________________________________________________________________
48 AliTRDseedV1::AliTRDseedV1(Int_t layer, AliTRDrecoParam *p)
58 for(int islice=0; islice < knSlices; islice++) fdEdx[islice] = 0.;
59 for(int itb=0; itb < knTimebins; itb++){
63 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) fProb[ispec] = -1.;
66 //____________________________________________________________________
67 AliTRDseedV1::AliTRDseedV1(const AliTRDseedV1 &ref)
68 :AliTRDseed((AliTRDseed&)ref)
72 ,fRecoParam(ref.fRecoParam)
75 // Copy Constructor performing a deep copy
79 if(ref.fOwner) SetOwner();
80 for(int islice=0; islice < knSlices; islice++) fdEdx[islice] = ref.fdEdx[islice];
81 for(int itb=0; itb < knTimebins; itb++){
82 fdQdl[itb] = ref.fdQdl[itb];
83 fdQ[itb] = ref.fdQ[itb];
85 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) fProb[ispec] = ref.fProb[ispec];
89 //____________________________________________________________________
90 AliTRDseedV1& AliTRDseedV1::operator=(const AliTRDseedV1 &ref)
93 // Assignment Operator using the copy function
104 //____________________________________________________________________
105 AliTRDseedV1::~AliTRDseedV1()
108 // Destructor. The RecoParam object belongs to the underlying tracker.
111 //AliInfo(Form("fOwner[%s]", fOwner?"YES":"NO"));
114 for(int itb=0; itb<knTimebins; itb++){
115 if(!fClusters[itb]) continue;
116 //AliInfo(Form("deleting c %p @ %d", fClusters[itb], itb));
117 delete fClusters[itb];
118 fClusters[itb] = 0x0;
122 //____________________________________________________________________
123 void AliTRDseedV1::Copy(TObject &ref) const
130 AliTRDseedV1 &target = (AliTRDseedV1 &)ref;
132 target.fPlane = fPlane;
134 target.fRecoParam = fRecoParam;
136 for(int islice=0; islice < knSlices; islice++) target.fdEdx[islice] = fdEdx[islice];
137 for(int itb=0; itb < knTimebins; itb++){
138 target.fdQdl[itb] = fdQdl[itb];
139 target.fdQ[itb] = fdQ[itb];
141 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) target.fProb[ispec] = fProb[ispec];
143 AliTRDseed::Copy(target);
147 //____________________________________________________________
148 void AliTRDseedV1::Init(AliTRDtrack *track)
150 // Initialize this tracklet using the track information
153 // track - the TRD track used to initialize the tracklet
155 // Detailed description
156 // The function sets the starting point and direction of the
157 // tracklet according to the information from the TRD track.
160 // The TRD track has to be propagated to the beginning of the
161 // chamber where the tracklet will be constructed
165 track->GetProlongation(fX0, y, z);
167 fYref[1] = track->GetSnp() < 0. ? track->GetTgl() : -track->GetTgl();
170 // tilting pad correction !!
171 fZref[1] = 0.; // TMath::Tan(track->Theta());
173 //printf("Tracklet ref x[%7.3f] y[%7.3f] z[%7.3f], snp[%f] tgl[%f]\n", fX0, fYref[0], fZref[0], track->GetSnp(), track->GetTgl());
176 //____________________________________________________________________
177 Double_t* AliTRDseedV1::GetProbability()
179 // Fill probability array for tracklet from the DB.
184 // returns pointer to the probability array and 0x0 if missing DB access
186 // Detailed description
189 // retrive calibration db
190 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
192 AliError("No access to calibration data");
196 // Retrieve the CDB container class with the parametric detector response
197 const AliTRDCalPID *pd = calibration->GetPIDObject(fRecoParam->GetPIDMethod());
199 AliError("No access to AliTRDCalPID object");
203 // calculate tracklet length TO DO
204 Float_t length = (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick());
205 /// TMath::Sqrt((1.0 - fSnp[iPlane]*fSnp[iPlane]) / (1.0 + fTgl[iPlane]*fTgl[iPlane]));
208 CookdEdx(fRecoParam->GetNdEdxSlices());
210 // Sets the a priori probabilities
211 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
212 fProb[ispec] = pd->GetProbability(ispec, fMom, &fdEdx[0], length, fPlane);
218 //____________________________________________________________________
219 void AliTRDseedV1::CookdEdx(Int_t nslices)
221 // Calculates average dE/dx for all slices and store them in the internal array fdEdx.
224 // nslices : number of slices for which dE/dx should be calculated
227 // Detailed description
228 // Calculates average dE/dx for all slices. Depending on the PID methode
229 // the number of slices can be 3 (LQ) or 8(NN). The calculation is based
230 // on previously calculated quantities dQ/dl of each cluster. The
231 // following effects are included in the calculation:
232 // 1. calibration values for t0 and vdrift
233 // 2. cluster sharing (optional see AliTRDrecoParam::SetClusterSharing())
236 Int_t nclusters[knSlices];
237 for(int i=0; i<knSlices; i++){
242 AliTRDcluster *cluster = 0x0;
243 for(int ic=0; ic<fgTimeBins; ic++){
244 if(!(cluster = fClusters[ic])) continue;
245 Int_t tb = cluster->GetLocalTimeBin();
247 // consider calibration effects
248 if(tb < fTimeBin0 || tb >= fTimeBin0+fTimeBinsRange) continue;
250 // consider cluster sharing ... TO DO
251 //if(fRecoParam->GetClusterSharing() && cluster->GetSharing()) continue;
253 Int_t slice = (tb-fTimeBin0)*nslices/fTimeBinsRange;
254 fdEdx[slice] += fdQdl[ic];
256 } // End of loop over clusters
258 // calculate mean charge per slice
259 for(int is=0; is<nslices; is++) if(nclusters[is]) fdEdx[is] /= nclusters[is];
262 //____________________________________________________________________
263 Float_t AliTRDseedV1::GetQuality(Bool_t kZcorr) const
266 // Returns a quality measurement of the current seed
269 Float_t zcorr = kZcorr ? fTilt * (fZProb - fZref[0]) : 0.;
270 return .5 * (18.0 - fN2)
271 + 10.* TMath::Abs(fYfit[1] - fYref[1])
272 + 5.* TMath::Abs(fYfit[0] - fYref[0] + zcorr)
273 + 2. * TMath::Abs(fMeanz - fZref[0]) / fPadLength;
276 //____________________________________________________________________
277 void AliTRDseedV1::GetCovAt(Double_t /*x*/, Double_t *cov) const
279 // Computes covariance in the y-z plane at radial point x
281 const Float_t k0= .2; // to be checked in FindClusters
282 Double_t sy20 = k0*TMath::Tan(fYfit[1]); sy20 *= sy20;
284 Double_t sy2 = fSigmaY2*fSigmaY2 + sy20;
285 Double_t sz2 = fPadLength/12.;
287 //printf("Yfit[1] %f sy20 %f SigmaY2 %f\n", fYfit[1], sy20, fSigmaY2);
290 cov[1] = fTilt*(sy2-sz2);
294 //____________________________________________________________________
295 void AliTRDseedV1::SetdQdl(Double_t length)
297 for(int ic=0; ic<fgTimeBins; ic++) fdQdl[ic] = fdQ[ic] *length;
300 //____________________________________________________________________
301 void AliTRDseedV1::SetOwner(Bool_t own)
303 //AliInfo(Form("own [%s] fOwner[%s]", own?"YES":"NO", fOwner?"YES":"NO"));
306 for(int ic=0; ic<knTimebins; ic++){
307 if(!fClusters[ic]) continue;
308 fClusters[ic] = new AliTRDcluster(*fClusters[ic]);
313 for(int ic=0; ic<knTimebins; ic++){
314 if(!fClusters[ic]) continue;
315 delete fClusters[ic];
316 //fClusters[ic] = tracker->GetClusters(index) TODO
323 //____________________________________________________________________
324 Bool_t AliTRDseedV1::AttachClustersIter(AliTRDstackLayer *layer
330 // Iterative process to register clusters to the seed.
331 // In iteration 0 we try only one pad-row and if quality not
332 // sufficient we try 2 pad-rows (about 5% of tracks cross 2 pad-rows)
336 AliError("Seed can not be used without a valid RecoParam.");
340 //AliInfo(Form("TimeBins = %d TimeBinsRange = %d", fgTimeBins, fTimeBinsRange));
343 Double_t kroady = fRecoParam->GetRoad1y();
344 Double_t kroadz = fPadLength * .5 + 1.;
346 // initialize configuration parameters
347 Float_t zcorr = kZcorr ? fTilt * (fZProb - fZref[0]) : 0.;
348 Int_t niter = kZcorr ? 1 : 2;
353 for (Int_t iter = 0; iter < niter; iter++) {
354 //AliInfo(Form("iter = %i", iter));
356 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
357 // define searching configuration
358 Double_t dxlayer = layer[iTime].GetX() - fX0;
361 //Try 2 pad-rows in second iteration
363 zexp = fZref[0] + fZref[1] * dxlayer - zcorr;
364 if (zexp > c->GetZ()) zexp = c->GetZ() + fPadLength*0.5;
365 if (zexp < c->GetZ()) zexp = c->GetZ() - fPadLength*0.5;
367 } else zexp = fZref[0];
368 yexp = fYref[0] + fYref[1] * dxlayer - zcorr;
370 // printf("xexp = %3.3f ,yexp = %3.3f, zexp = %3.3f\n",layer[iTime].GetX(),yexp,zexp);
371 // printf("layer[%i].GetNClusters() = %i\n", iTime, layer[iTime].GetNClusters());
372 Int_t index = layer[iTime].SearchNearestCluster(yexp, zexp, kroady, kroadz);
374 // printf("%d[%d] x[%7.3f | %7.3f] y[%7.3f] z[%7.3f]\n", iTime, layer[iTime].GetNClusters(), dxlayer, layer[iTime].GetX(), yexp, zexp);
375 // for(Int_t iclk = 0; iclk < layer[iTime].GetNClusters(); iclk++){
376 // AliTRDcluster *testcl = layer[iTime].GetCluster(iclk);
377 // printf("Cluster %i: %d x = %7.3f, y = %7.3f, z = %7.3f\n", iclk, testcl->GetLocalTimeBin(), testcl->GetX(), testcl->GetY(), testcl->GetZ());
379 // printf("Index = %i\n",index);
381 if (index < 0) continue;
384 AliTRDcluster *cl = (AliTRDcluster*) layer[iTime].GetCluster(index);
386 //printf("Cluster %i(0x%x): x = %3.3f, y = %3.3f, z = %3.3f\n", index, cl, cl->GetX(), cl->GetY(), cl->GetZ());
388 Int_t globalIndex = layer[iTime].GetGlobalIndex(index);
389 fIndexes[iTime] = globalIndex;
390 fClusters[iTime] = cl;
392 fY[iTime] = cl->GetY();
393 fZ[iTime] = cl->GetZ();
394 fdQ[iTime] = cl->GetQ()/layer[iTime].GetdX();
401 // Int_t nclusters = 0;
402 // Float_t fD[iter] = 0.;
403 // for(int ic=0; ic<fgTimeBins+1; ic++){
404 // AliTRDcluster *ci = fClusters[ic];
406 // for(int jc=ic+1; jc<fgTimeBins+1; jc++){
407 // AliTRDcluster *cj = fClusters[jc];
409 // fD[iter] += TMath::Sqrt((ci->GetY()-cj->GetY())*(ci->GetY()-cj->GetY())+
410 // (ci->GetZ()-cj->GetZ())*(ci->GetZ()-cj->GetZ()));
414 // if(nclusters) fD[iter] /= float(nclusters);
417 AliTRDseed::Update();
420 tquality = GetQuality(kZcorr);
421 if(tquality < quality) break;
422 else quality = tquality;
426 if (!IsOK()) return kFALSE;
433 //____________________________________________________________________
434 Bool_t AliTRDseedV1::AttachClusters(AliTRDstackLayer *layer
438 // Projective algorithm to attach clusters to seeding tracklets
444 // Detailed description
445 // 1. Collapse x coordinate for the full detector plane
446 // 2. truncated mean on y (r-phi) direction
448 // 4. truncated mean on z direction
454 AliError("Seed can not be used without a valid RecoParam.");
458 const Int_t kClusterCandidates = 2 * knTimebins;
461 Double_t kroady = fRecoParam->GetRoad1y();
462 Double_t kroadz = fPadLength * 1.5 + 1.;
463 // correction to y for the tilting angle
464 Float_t zcorr = kZcorr ? fTilt * (fZProb - fZref[0]) : 0.;
467 AliTRDcluster *clusters[kClusterCandidates];
468 Double_t cond[4], yexp[knTimebins], zexp[knTimebins],
469 yres[kClusterCandidates], zres[kClusterCandidates];
470 Int_t ncl, *index = 0x0, tboundary[knTimebins];
472 // Do cluster projection
473 Int_t nYclusters = 0; Bool_t kEXIT = kFALSE;
474 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
475 fX[iTime] = layer[iTime].GetX() - fX0;
476 zexp[iTime] = fZref[0] + fZref[1] * fX[iTime];
477 yexp[iTime] = fYref[0] + fYref[1] * fX[iTime] - zcorr;
479 // build condition and process clusters
480 cond[0] = yexp[iTime] - kroady; cond[1] = yexp[iTime] + kroady;
481 cond[2] = zexp[iTime] - kroadz; cond[3] = zexp[iTime] + kroadz;
482 layer[iTime].GetClusters(cond, index, ncl);
483 for(Int_t ic = 0; ic<ncl; ic++){
484 AliTRDcluster *c = layer[iTime].GetCluster(index[ic]);
485 clusters[nYclusters] = c;
486 yres[nYclusters++] = c->GetY() - yexp[iTime];
487 if(nYclusters >= kClusterCandidates) {
488 AliWarning(Form("Cluster candidates reached limit %d. Some may be lost.", kClusterCandidates));
493 tboundary[iTime] = nYclusters;
497 // Evaluate truncated mean on the y direction
498 Double_t mean, sigma;
499 AliMathBase::EvaluateUni(nYclusters, yres, mean, sigma, Int_t(nYclusters*.8)-2);
500 //purge cluster candidates
501 Int_t nZclusters = 0;
502 for(Int_t ic = 0; ic<nYclusters; ic++){
503 if(yres[ic] - mean > 4. * sigma){
507 zres[nZclusters++] = clusters[ic]->GetZ() - zexp[clusters[ic]->GetLocalTimeBin()];
510 // Evaluate truncated mean on the z direction
511 AliMathBase::EvaluateUni(nZclusters, zres, mean, sigma, Int_t(nZclusters*.8)-2);
512 //purge cluster candidates
513 for(Int_t ic = 0; ic<nZclusters; ic++){
514 if(zres[ic] - mean > 4. * sigma){
521 // Select only one cluster/TimeBin
522 Int_t lastCluster = 0;
524 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
525 ncl = tboundary[iTime] - lastCluster;
527 AliTRDcluster *c = 0x0;
529 c = clusters[lastCluster];
531 Float_t dold = 9999.; Int_t iptr = lastCluster;
532 for(int ic=lastCluster; ic<tboundary[iTime]; ic++){
533 if(!clusters[ic]) continue;
534 Float_t y = yexp[iTime] - clusters[ic]->GetY();
535 Float_t z = zexp[iTime] - clusters[ic]->GetZ();
536 Float_t d = y * y + z * z;
537 if(d > dold) continue;
543 //Int_t GlobalIndex = layer[iTime].GetGlobalIndex(index);
544 //fIndexes[iTime] = GlobalIndex;
545 fClusters[iTime] = c;
546 fY[iTime] = c->GetY();
547 fZ[iTime] = c->GetZ();
548 fdQ[iTime] = c->GetQ()/layer[iTime].GetdX();
549 lastCluster = tboundary[iTime];
553 // number of minimum numbers of clusters expected for the tracklet
554 Int_t kClmin = Int_t(fRecoParam->GetFindableClusters()*fgTimeBins);
556 AliWarning(Form("Not enough clusters to fit the tracklet %d [%d].", fN2, kClmin));
561 // update used clusters
563 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
564 if(!fClusters[iTime]) continue;
565 if((fClusters[iTime]->IsUsed())) fNUsed++;
568 if (fN2-fNUsed < kClmin){
569 AliWarning(Form("Too many clusters already in use %d (from %d).", fNUsed, fN2));
577 //____________________________________________________________________
578 Bool_t AliTRDseedV1::Fit()
581 // Linear fit of the tracklet
586 // True if successful
588 // Detailed description
589 // 2. Check if tracklet crosses pad row boundary
590 // 1. Calculate residuals in the y (r-phi) direction
591 // 3. Do a Least Square Fit to the data
594 //Float_t sigmaexp = 0.05 + TMath::Abs(fYref[1] * 0.25); // Expected r.m.s in y direction
595 Float_t ycrosscor = fPadLength * fTilt * 0.5; // Y correction for crossing
596 Float_t anglecor = fTilt * fZref[1]; // Correction to the angle
598 // calculate residuals
599 Float_t yres[knTimebins]; // y (r-phi) residuals
600 Int_t zint[knTimebins], // Histograming of the z coordinate
601 zout[2*knTimebins];//
604 for (Int_t iTime = 0; iTime < fTimeBinsRange; iTime++) {
605 if (!fClusters[iTime]) continue;
606 yres[iTime] = fY[iTime] - fYref[0] - (fYref[1] + anglecor) * fX[iTime];
607 zint[fN] = Int_t(fZ[iTime]);
611 // calculate pad row boundary crosses
612 Int_t kClmin = Int_t(fRecoParam->GetFindableClusters()*fTimeBinsRange);
613 Int_t nz = AliMathBase::Freq(fN, zint, zout, kFALSE);
615 if(nz <= 1) zout[3] = 0;
616 if(zout[1] + zout[3] < kClmin) {
617 AliWarning(Form("Not enough clusters to fit the cross boundary tracklet %d [%d].", zout[1]+zout[3], kClmin));
620 // Z distance bigger than pad - length
621 if (TMath::Abs(zout[0]-zout[2]) > fPadLength) zout[3]=0;
634 // we will use only the clusters which are in the detector range
635 for(int iTime=0; iTime<fTimeBinsRange; iTime++){
636 fUsable[iTime] = kFALSE;
637 if (!fClusters[iTime]) continue;
638 npads = fClusters[iTime]->GetNPads();
640 fUsable[iTime] = kTRUE;
643 Float_t weight = 1.0;
644 if(npads > 5) weight = 0.2;
645 else if(npads > 4) weight = 0.5;
647 sumwx += fX[iTime] * weight;
648 sumwx2 += fX[iTime] * fX[iTime] * weight;
649 sumwy += weight * yres[iTime];
650 sumwxy += weight * yres[iTime] * fX[iTime];
651 sumwz += weight * fZ[iTime];
652 sumwxz += weight * fZ[iTime] * fX[iTime];
655 AliWarning(Form("Not enough clusters to fit the tracklet %d [%d].", fN2, kClmin));
659 fMeanz = sumwz / sumw;
662 // Tracklet on boundary
663 Float_t correction = 0;
665 if (fMeanz < fZProb) correction = ycrosscor;
666 if (fMeanz > fZProb) correction = -ycrosscor;
669 Double_t det = sumw * sumwx2 - sumwx * sumwx;
670 fYfitR[0] = (sumwx2 * sumwy - sumwx * sumwxy) / det;
671 fYfitR[1] = (sumw * sumwxy - sumwx * sumwy) / det;
674 for (Int_t i = 0; i < fTimeBinsRange+1; i++) {
675 if (!fUsable[i]) continue;
676 Float_t delta = yres[i] - fYfitR[0] - fYfitR[1] * fX[i];
677 fSigmaY2 += delta*delta;
679 fSigmaY2 = TMath::Sqrt(fSigmaY2 / Float_t(fN2-2));
681 fZfitR[0] = (sumwx2 * sumwz - sumwx * sumwxz) / det;
682 fZfitR[1] = (sumw * sumwxz - sumwx * sumwz) / det;
683 fZfit[0] = (sumwx2 * sumwz - sumwx * sumwxz) / det;
684 fZfit[1] = (sumw * sumwxz - sumwx * sumwz) / det;
685 fYfitR[0] += fYref[0] + correction;
686 fYfitR[1] += fYref[1];
687 fYfit[0] = fYfitR[0];
688 fYfit[1] = fYfitR[1];
693 //_____________________________________________________________________________
694 Float_t AliTRDseedV1::FitRiemanTilt(AliTRDseedV1 *cseed, Bool_t terror)
697 // Fit the Rieman tilt
700 // Fitting with tilting pads - kz not fixed
701 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
702 Int_t nTimeBins = cal->GetNumberOfTimeBins();
703 TLinearFitter fitterT2(4,"hyp4");
704 fitterT2.StoreData(kTRUE);
705 Float_t xref2 = (cseed[2].fX0 + cseed[3].fX0) * 0.5; // Reference x0 for z
708 fitterT2.ClearPoints();
710 for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
711 // printf("\nLayer %d\n", iLayer);
712 // cseed[iLayer].Print();
713 if (!cseed[iLayer].IsOK()) continue;
714 Double_t tilt = cseed[iLayer].fTilt;
716 for (Int_t itime = 0; itime < nTimeBins+1; itime++) {
717 // printf("\ttime %d\n", itime);
718 if (!cseed[iLayer].fUsable[itime]) continue;
719 // x relative to the midle chamber
720 Double_t x = cseed[iLayer].fX[itime] + cseed[iLayer].fX0 - xref2;
721 Double_t y = cseed[iLayer].fY[itime];
722 Double_t z = cseed[iLayer].fZ[itime];
728 Double_t x2 = cseed[iLayer].fX[itime] + cseed[iLayer].fX0; // Global x
729 Double_t t = 1.0 / (x2*x2 + y*y);
731 uvt[0] = 2.0 * x2 * uvt[1];
732 uvt[2] = 2.0 * tilt * uvt[1];
733 uvt[3] = 2.0 * tilt *uvt[1] * x;
734 uvt[4] = 2.0 * (y + tilt * z) * uvt[1];
736 Double_t error = 2.0 * uvt[1];
738 error *= cseed[iLayer].fSigmaY;
741 error *= 0.2; //Default error
743 // printf("\tadd point :\n");
744 // for(int i=0; i<5; i++) printf("%f ", uvt[i]);
746 fitterT2.AddPoint(uvt,uvt[4],error);
753 Double_t rpolz0 = fitterT2.GetParameter(3);
754 Double_t rpolz1 = fitterT2.GetParameter(4);
757 // Linear fitter - not possible to make boundaries
758 // non accept non possible z and dzdx combination
760 Bool_t acceptablez = kTRUE;
761 for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
762 if (cseed[iLayer].IsOK()) {
763 Double_t zT2 = rpolz0 + rpolz1 * (cseed[iLayer].fX0 - xref2);
764 if (TMath::Abs(cseed[iLayer].fZProb - zT2) > cseed[iLayer].fPadLength * 0.5 + 1.0) {
765 acceptablez = kFALSE;
770 Double_t zmf = cseed[2].fZref[0] + cseed[2].fZref[1] * (xref2 - cseed[2].fX0);
771 Double_t dzmf = (cseed[2].fZref[1] + cseed[3].fZref[1]) * 0.5;
772 fitterT2.FixParameter(3,zmf);
773 fitterT2.FixParameter(4,dzmf);
775 fitterT2.ReleaseParameter(3);
776 fitterT2.ReleaseParameter(4);
777 rpolz0 = fitterT2.GetParameter(3);
778 rpolz1 = fitterT2.GetParameter(4);
781 Double_t chi2TR = fitterT2.GetChisquare() / Float_t(npointsT);
783 params[0] = fitterT2.GetParameter(0);
784 params[1] = fitterT2.GetParameter(1);
785 params[2] = fitterT2.GetParameter(2);
786 Double_t curvature = 1.0 + params[1] * params[1] - params[2] * params[0];
788 for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
790 Double_t x = cseed[iLayer].fX0;
797 Double_t res2 = (x * params[0] + params[1]);
799 res2 = 1.0 - params[2]*params[0] + params[1]*params[1] - res2;
801 res2 = TMath::Sqrt(res2);
802 y = (1.0 - res2) / params[0];
806 Double_t x0 = -params[1] / params[0];
807 if (-params[2]*params[0] + params[1]*params[1] + 1 > 0) {
808 Double_t rm1 = params[0] / TMath::Sqrt(-params[2]*params[0] + params[1]*params[1] + 1);
809 if (1.0/(rm1*rm1) - (x-x0) * (x-x0) > 0.0) {
810 Double_t res = (x - x0) / TMath::Sqrt(1.0 / (rm1*rm1) - (x-x0)*(x-x0));
811 if (params[0] < 0) res *= -1.0;
815 z = rpolz0 + rpolz1 * (x - xref2);
817 cseed[iLayer].fYref[0] = y;
818 cseed[iLayer].fYref[1] = dy;
819 cseed[iLayer].fZref[0] = z;
820 cseed[iLayer].fZref[1] = dz;
821 cseed[iLayer].fC = curvature;
829 //___________________________________________________________________
830 void AliTRDseedV1::Print()
833 // Printing the seedstatus
836 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
837 Int_t nTimeBins = cal->GetNumberOfTimeBins();
839 printf("Seed status :\n");
840 printf(" fTilt = %f\n", fTilt);
841 printf(" fPadLength = %f\n", fPadLength);
842 printf(" fX0 = %f\n", fX0);
843 for(int ic=0; ic<nTimeBins; ic++) {
844 const Char_t *isUsable = fUsable[ic]?"Yes":"No";
845 printf(" %d X[%f] Y[%f] Z[%f] Indexes[%d] clusters[%p] usable[%s]\n"
851 , ((void*) fClusters[ic])
855 printf(" fYref[0] =%f fYref[1] =%f\n", fYref[0], fYref[1]);
856 printf(" fZref[0] =%f fZref[1] =%f\n", fZref[0], fZref[1]);
857 printf(" fYfit[0] =%f fYfit[1] =%f\n", fYfit[0], fYfit[1]);
858 printf(" fYfitR[0]=%f fYfitR[1]=%f\n", fYfitR[0], fYfitR[1]);
859 printf(" fZfit[0] =%f fZfit[1] =%f\n", fZfit[0], fZfit[1]);
860 printf(" fZfitR[0]=%f fZfitR[1]=%f\n", fZfitR[0], fZfitR[1]);
861 printf(" fSigmaY =%f\n", fSigmaY);
862 printf(" fSigmaY2=%f\n", fSigmaY2);
863 printf(" fMeanz =%f\n", fMeanz);
864 printf(" fZProb =%f\n", fZProb);
865 printf(" fLabels[0]=%d fLabels[1]=%d\n", fLabels[0], fLabels[1]);
866 printf(" fN =%d\n", fN);
867 printf(" fN2 =%d (>8 isOK)\n",fN2);
868 printf(" fNUsed =%d\n", fNUsed);
869 printf(" fFreq =%d\n", fFreq);
870 printf(" fNChange=%d\n", fNChange);
871 printf(" fMPads =%f\n", fMPads);
873 printf(" fC =%f\n", fC);
874 printf(" fCC =%f\n",fCC);
875 printf(" fChi2 =%f\n", fChi2);
876 printf(" fChi2Z =%f\n", fChi2Z);