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)
61 for(int islice=0; islice < knSlices; islice++) fdEdx[islice] = 0.;
62 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) fProb[ispec] = -1.;
65 //____________________________________________________________________
66 AliTRDseedV1::AliTRDseedV1(const AliTRDseedV1 &ref)
67 :AliTRDseed((AliTRDseed&)ref)
74 ,fRecoParam(ref.fRecoParam)
77 // Copy Constructor performing a deep copy
81 if(ref.fOwner) SetOwner();
82 for(int islice=0; islice < knSlices; islice++) fdEdx[islice] = ref.fdEdx[islice];
83 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) fProb[ispec] = ref.fProb[ispec];
87 //____________________________________________________________________
88 AliTRDseedV1& AliTRDseedV1::operator=(const AliTRDseedV1 &ref)
91 // Assignment Operator using the copy function
102 //____________________________________________________________________
103 AliTRDseedV1::~AliTRDseedV1()
106 // Destructor. The RecoParam object belongs to the underlying tracker.
109 //AliInfo(Form("fOwner[%s]", fOwner?"YES":"NO"));
112 for(int itb=0; itb<knTimebins; itb++){
113 if(!fClusters[itb]) continue;
114 //AliInfo(Form("deleting c %p @ %d", fClusters[itb], itb));
115 delete fClusters[itb];
116 fClusters[itb] = 0x0;
120 //____________________________________________________________________
121 void AliTRDseedV1::Copy(TObject &ref) const
128 AliTRDseedV1 &target = (AliTRDseedV1 &)ref;
130 target.fPlane = fPlane;
135 target.fRecoParam = fRecoParam;
137 for(int islice=0; islice < knSlices; islice++) target.fdEdx[islice] = fdEdx[islice];
138 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) target.fProb[ispec] = fProb[ispec];
140 AliTRDseed::Copy(target);
144 //____________________________________________________________
145 void AliTRDseedV1::Init(AliTRDtrack *track)
147 // Initialize this tracklet using the track information
150 // track - the TRD track used to initialize the tracklet
152 // Detailed description
153 // The function sets the starting point and direction of the
154 // tracklet according to the information from the TRD track.
157 // The TRD track has to be propagated to the beginning of the
158 // chamber where the tracklet will be constructed
162 track->GetProlongation(fX0, y, z);
164 fYref[1] = track->GetSnp()/(1. - track->GetSnp()*track->GetSnp());
166 fZref[1] = track->GetTgl();
168 //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());
172 //____________________________________________________________________
173 void AliTRDseedV1::CookdEdx(Int_t nslices)
175 // Calculates average dE/dx for all slices and store them in the internal array fdEdx.
178 // nslices : number of slices for which dE/dx should be calculated
180 // store results in the internal array fdEdx. This can be accessed with the method
181 // AliTRDseedV1::GetdEdx()
183 // Detailed description
184 // Calculates average dE/dx for all slices. Depending on the PID methode
185 // the number of slices can be 3 (LQ) or 8(NN).
186 // The calculation of dQ/dl are done using the tracklet fit results (see AliTRDseedV1::GetdQdl(Int_t)) i.e.
188 // dQ/dl = qc/(dx * sqrt(1 + dy/dx^2 + dz/dx^2))
190 // The following effects are included in the calculation:
191 // 1. calibration values for t0 and vdrift (using x coordinate to calculate slice)
192 // 2. cluster sharing (optional see AliTRDrecoParam::SetClusterSharing())
196 Int_t nclusters[knSlices];
197 for(int i=0; i<knSlices; i++){
201 Float_t clength = (/*.5 * */AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick());
203 AliTRDcluster *cluster = 0x0;
204 for(int ic=0; ic<fgTimeBins; ic++){
205 if(!(cluster = fClusters[ic])) continue;
206 Float_t x = cluster->GetX();
208 // Filter clusters for dE/dx calculation
210 // 1.consider calibration effects for slice determination
212 if(cluster->IsInChamber()) slice = Int_t(TMath::Abs(fX0 - x) * nslices / clength);
213 else slice = x < fX0 ? 0 : nslices-1;
215 // 2. take sharing into account
216 Float_t w = cluster->IsShared() ? .5 : 1.;
218 // 3. take into account large clusters TODO
219 //w *= c->GetNPads() > 3 ? .8 : 1.;
222 fdEdx[slice] += w * GetdQdl(ic); //fdQdl[ic];
224 } // End of loop over clusters
226 // calculate mean charge per slice
227 for(int is=0; is<nslices; is++) if(nclusters[is]) fdEdx[is] /= nclusters[is];
230 //____________________________________________________________________
231 Float_t AliTRDseedV1::GetdQdl(Int_t ic) const
233 return fClusters[ic] ? TMath::Abs(fClusters[ic]->GetQ()) /fdX / TMath::Sqrt(1. + fYfit[1]*fYfit[1] + fZfit[1]*fZfit[1]) : 0.;
236 //____________________________________________________________________
237 Double_t* AliTRDseedV1::GetProbability()
239 // Fill probability array for tracklet from the DB.
244 // returns pointer to the probability array and 0x0 if missing DB access
246 // Detailed description
249 // retrive calibration db
250 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
252 AliError("No access to calibration data");
256 // Retrieve the CDB container class with the parametric detector response
257 const AliTRDCalPID *pd = calibration->GetPIDObject(fRecoParam->GetPIDMethod());
259 AliError("No access to AliTRDCalPID object");
263 // calculate tracklet length TO DO
264 Float_t length = (AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick());
265 /// TMath::Sqrt((1.0 - fSnp[iPlane]*fSnp[iPlane]) / (1.0 + fTgl[iPlane]*fTgl[iPlane]));
268 CookdEdx(fRecoParam->GetNdEdxSlices());
270 // Sets the a priori probabilities
271 for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
272 fProb[ispec] = pd->GetProbability(ispec, fMom, &fdEdx[0], length, fPlane);
278 //____________________________________________________________________
279 Float_t AliTRDseedV1::GetQuality(Bool_t kZcorr) const
282 // Returns a quality measurement of the current seed
285 Float_t zcorr = kZcorr ? fTilt * (fZProb - fZref[0]) : 0.;
286 return .5 * (18.0 - fN2)
287 + 10.* TMath::Abs(fYfit[1] - fYref[1])
288 + 5.* TMath::Abs(fYfit[0] - fYref[0] + zcorr)
289 + 2. * TMath::Abs(fMeanz - fZref[0]) / fPadLength;
292 //____________________________________________________________________
293 void AliTRDseedV1::GetCovAt(Double_t /*x*/, Double_t *cov) const
295 // Computes covariance in the y-z plane at radial point x
297 const Float_t k0= .2; // to be checked in FindClusters
298 Double_t sy20 = k0*TMath::Tan(fYfit[1]); sy20 *= sy20;
300 Double_t sy2 = fSigmaY2*fSigmaY2 + sy20;
301 Double_t sz2 = fPadLength/12.;
303 //printf("Yfit[1] %f sy20 %f SigmaY2 %f\n", fYfit[1], sy20, fSigmaY2);
306 cov[1] = fTilt*(sy2-sz2);
311 //____________________________________________________________________
312 void AliTRDseedV1::SetOwner(Bool_t own)
314 //AliInfo(Form("own [%s] fOwner[%s]", own?"YES":"NO", fOwner?"YES":"NO"));
317 for(int ic=0; ic<knTimebins; ic++){
318 if(!fClusters[ic]) continue;
319 fClusters[ic] = new AliTRDcluster(*fClusters[ic]);
324 for(int ic=0; ic<knTimebins; ic++){
325 if(!fClusters[ic]) continue;
326 delete fClusters[ic];
327 //fClusters[ic] = tracker->GetClusters(index) TODO
334 //____________________________________________________________________
335 Bool_t AliTRDseedV1::AttachClustersIter(AliTRDstackLayer *layer
341 // Iterative process to register clusters to the seed.
342 // In iteration 0 we try only one pad-row and if quality not
343 // sufficient we try 2 pad-rows (about 5% of tracks cross 2 pad-rows)
347 AliError("Seed can not be used without a valid RecoParam.");
351 //AliInfo(Form("TimeBins = %d TimeBinsRange = %d", fgTimeBins, fTimeBinsRange));
354 Double_t kroady = fRecoParam->GetRoad1y();
355 Double_t kroadz = fPadLength * .5 + 1.;
357 // initialize configuration parameters
358 Float_t zcorr = kZcorr ? fTilt * (fZProb - fZref[0]) : 0.;
359 Int_t niter = kZcorr ? 1 : 2;
364 for (Int_t iter = 0; iter < niter; iter++) {
365 //AliInfo(Form("iter = %i", iter));
367 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
368 // define searching configuration
369 Double_t dxlayer = layer[iTime].GetX() - fX0;
372 //Try 2 pad-rows in second iteration
374 zexp = fZref[0] + fZref[1] * dxlayer - zcorr;
375 if (zexp > c->GetZ()) zexp = c->GetZ() + fPadLength*0.5;
376 if (zexp < c->GetZ()) zexp = c->GetZ() - fPadLength*0.5;
378 } else zexp = fZref[0];
379 yexp = fYref[0] + fYref[1] * dxlayer - zcorr;
381 // Get and register cluster
382 Int_t index = layer[iTime].SearchNearestCluster(yexp, zexp, kroady, kroadz);
383 if (index < 0) continue;
384 AliTRDcluster *cl = (AliTRDcluster*) layer[iTime].GetCluster(index);
386 Int_t globalIndex = layer[iTime].GetGlobalIndex(index);
387 fIndexes[iTime] = globalIndex;
388 fClusters[iTime] = cl;
389 fY[iTime] = cl->GetY();
390 fZ[iTime] = cl->GetZ();
395 // calculate length of the time bin (calibration aware)
396 Int_t irp = 0; Float_t x[2]; Int_t tb[2];
397 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
398 if(!fClusters[iTime]) continue;
399 x[irp] = fClusters[iTime]->GetX();
404 fdX = (x[1] - x[0]) / (tb[0] - tb[1]);
406 // update X0 from the clusters (calibration/alignment aware)
407 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
408 if(!layer[iTime].IsT0()) continue;
409 if(fClusters[iTime]){
410 fX0 = fClusters[iTime]->GetX();
412 } else { // we have to infere the position of the anode wire from the other clusters
413 for (Int_t jTime = iTime+1; jTime < fgTimeBins; jTime++) {
414 if(!fClusters[jTime]) continue;
415 fX0 = fClusters[jTime]->GetX() + fdX * (jTime - iTime);
421 // update YZ reference point
424 // update x reference positions (calibration/alignment aware)
425 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
426 if(!fClusters[iTime]) continue;
427 fX[iTime] = fClusters[iTime]->GetX() - fX0;
430 AliTRDseed::Update();
434 tquality = GetQuality(kZcorr);
435 if(tquality < quality) break;
436 else quality = tquality;
440 if (!IsOK()) return kFALSE;
447 //____________________________________________________________________
448 Bool_t AliTRDseedV1::AttachClusters(AliTRDstackLayer *layer
452 // Projective algorithm to attach clusters to seeding tracklets
458 // Detailed description
459 // 1. Collapse x coordinate for the full detector plane
460 // 2. truncated mean on y (r-phi) direction
462 // 4. truncated mean on z direction
468 AliError("Seed can not be used without a valid RecoParam.");
472 const Int_t kClusterCandidates = 2 * knTimebins;
475 Double_t kroady = fRecoParam->GetRoad1y();
476 Double_t kroadz = fPadLength * 1.5 + 1.;
477 // correction to y for the tilting angle
478 Float_t zcorr = kZcorr ? fTilt * (fZProb - fZref[0]) : 0.;
481 AliTRDcluster *clusters[kClusterCandidates];
482 Double_t cond[4], yexp[knTimebins], zexp[knTimebins],
483 yres[kClusterCandidates], zres[kClusterCandidates];
484 Int_t ncl, *index = 0x0, tboundary[knTimebins];
486 // Do cluster projection
487 Int_t nYclusters = 0; Bool_t kEXIT = kFALSE;
488 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
489 fX[iTime] = layer[iTime].GetX() - fX0;
490 zexp[iTime] = fZref[0] + fZref[1] * fX[iTime];
491 yexp[iTime] = fYref[0] + fYref[1] * fX[iTime] - zcorr;
493 // build condition and process clusters
494 cond[0] = yexp[iTime] - kroady; cond[1] = yexp[iTime] + kroady;
495 cond[2] = zexp[iTime] - kroadz; cond[3] = zexp[iTime] + kroadz;
496 layer[iTime].GetClusters(cond, index, ncl);
497 for(Int_t ic = 0; ic<ncl; ic++){
498 AliTRDcluster *c = layer[iTime].GetCluster(index[ic]);
499 clusters[nYclusters] = c;
500 yres[nYclusters++] = c->GetY() - yexp[iTime];
501 if(nYclusters >= kClusterCandidates) {
502 AliWarning(Form("Cluster candidates reached limit %d. Some may be lost.", kClusterCandidates));
507 tboundary[iTime] = nYclusters;
511 // Evaluate truncated mean on the y direction
512 Double_t mean, sigma;
513 AliMathBase::EvaluateUni(nYclusters, yres, mean, sigma, Int_t(nYclusters*.8)-2);
514 //purge cluster candidates
515 Int_t nZclusters = 0;
516 for(Int_t ic = 0; ic<nYclusters; ic++){
517 if(yres[ic] - mean > 4. * sigma){
521 zres[nZclusters++] = clusters[ic]->GetZ() - zexp[clusters[ic]->GetLocalTimeBin()];
524 // Evaluate truncated mean on the z direction
525 AliMathBase::EvaluateUni(nZclusters, zres, mean, sigma, Int_t(nZclusters*.8)-2);
526 //purge cluster candidates
527 for(Int_t ic = 0; ic<nZclusters; ic++){
528 if(zres[ic] - mean > 4. * sigma){
535 // Select only one cluster/TimeBin
536 Int_t lastCluster = 0;
538 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
539 ncl = tboundary[iTime] - lastCluster;
541 AliTRDcluster *c = 0x0;
543 c = clusters[lastCluster];
545 Float_t dold = 9999.; Int_t iptr = lastCluster;
546 for(int ic=lastCluster; ic<tboundary[iTime]; ic++){
547 if(!clusters[ic]) continue;
548 Float_t y = yexp[iTime] - clusters[ic]->GetY();
549 Float_t z = zexp[iTime] - clusters[ic]->GetZ();
550 Float_t d = y * y + z * z;
551 if(d > dold) continue;
557 //Int_t GlobalIndex = layer[iTime].GetGlobalIndex(index);
558 //fIndexes[iTime] = GlobalIndex;
559 fClusters[iTime] = c;
560 fY[iTime] = c->GetY();
561 fZ[iTime] = c->GetZ();
562 lastCluster = tboundary[iTime];
566 // number of minimum numbers of clusters expected for the tracklet
567 Int_t kClmin = Int_t(fRecoParam->GetFindableClusters()*fgTimeBins);
569 AliWarning(Form("Not enough clusters to fit the tracklet %d [%d].", fN2, kClmin));
574 // update used clusters
576 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
577 if(!fClusters[iTime]) continue;
578 if((fClusters[iTime]->IsUsed())) fNUsed++;
581 if (fN2-fNUsed < kClmin){
582 AliWarning(Form("Too many clusters already in use %d (from %d).", fNUsed, fN2));
590 //____________________________________________________________________
591 Bool_t AliTRDseedV1::Fit()
594 // Linear fit of the tracklet
599 // True if successful
601 // Detailed description
602 // 2. Check if tracklet crosses pad row boundary
603 // 1. Calculate residuals in the y (r-phi) direction
604 // 3. Do a Least Square Fit to the data
607 //Float_t sigmaexp = 0.05 + TMath::Abs(fYref[1] * 0.25); // Expected r.m.s in y direction
608 Float_t ycrosscor = fPadLength * fTilt * 0.5; // Y correction for crossing
609 Float_t anglecor = fTilt * fZref[1]; // Correction to the angle
611 // calculate residuals
612 Float_t yres[knTimebins]; // y (r-phi) residuals
613 Int_t zint[knTimebins], // Histograming of the z coordinate
614 zout[2*knTimebins];//
617 for (Int_t iTime = 0; iTime < fgTimeBins; iTime++) {
618 if (!fClusters[iTime]) continue;
619 if (!fClusters[iTime]->IsInChamber()) continue;
620 yres[iTime] = fY[iTime] - fYref[0] - (fYref[1] + anglecor) * fX[iTime] + fTilt * (fZ[iTime] - fZref[0]);
621 zint[fN] = Int_t(fZ[iTime]);
625 // calculate pad row boundary crosses
626 Int_t kClmin = Int_t(fRecoParam->GetFindableClusters()*fgTimeBins);
627 Int_t nz = AliMathBase::Freq(fN, zint, zout, kFALSE);
629 if(nz <= 1) zout[3] = 0;
630 if(zout[1] + zout[3] < kClmin) {
631 AliWarning(Form("Not enough clusters to fit the cross boundary tracklet %d [%d].", zout[1]+zout[3], kClmin));
634 // Z distance bigger than pad - length
635 if (TMath::Abs(zout[0]-zout[2]) > fPadLength) zout[3]=0;
648 // we will use only the clusters which are in the detector range
649 for(int iTime=0; iTime<fgTimeBins; iTime++){
650 fUsable[iTime] = kFALSE;
651 if (!fClusters[iTime]) continue;
652 npads = fClusters[iTime]->GetNPads();
654 fUsable[iTime] = kTRUE;
657 Float_t weight = 1.0;
658 if(npads > 5) weight = 0.2;
659 else if(npads > 4) weight = 0.5;
661 sumwx += fX[iTime] * weight;
662 sumwx2 += fX[iTime] * fX[iTime] * weight;
663 sumwy += weight * yres[iTime];
664 sumwxy += weight * yres[iTime] * fX[iTime];
665 sumwz += weight * fZ[iTime];
666 sumwxz += weight * fZ[iTime] * fX[iTime];
669 AliWarning(Form("Not enough clusters to fit the tracklet %d [%d].", fN2, kClmin));
673 fMeanz = sumwz / sumw;
676 // Tracklet on boundary
677 Float_t correction = 0;
679 if (fMeanz < fZProb) correction = ycrosscor;
680 if (fMeanz > fZProb) correction = -ycrosscor;
683 Double_t det = sumw * sumwx2 - sumwx * sumwx;
684 fYfitR[0] = (sumwx2 * sumwy - sumwx * sumwxy) / det;
685 fYfitR[1] = (sumw * sumwxy - sumwx * sumwy) / det;
688 for (Int_t i = 0; i < fgTimeBins+1; i++) {
689 if (!fUsable[i]) continue;
690 Float_t delta = yres[i] - fYfitR[0] - fYfitR[1] * fX[i];
691 fSigmaY2 += delta*delta;
693 fSigmaY2 = TMath::Sqrt(fSigmaY2 / Float_t(fN2-2));
695 fZfitR[0] = (sumwx2 * sumwz - sumwx * sumwxz) / det;
696 fZfitR[1] = (sumw * sumwxz - sumwx * sumwz) / det;
697 fZfit[0] = (sumwx2 * sumwz - sumwx * sumwxz) / det;
698 fZfit[1] = (sumw * sumwxz - sumwx * sumwz) / det;
699 fYfitR[0] += fYref[0] + correction;
700 fYfitR[1] += fYref[1];
701 fYfit[0] = fYfitR[0];
702 fYfit[1] = fYfitR[1];
707 //_____________________________________________________________________________
708 Float_t AliTRDseedV1::FitRiemanTilt(AliTRDseedV1 *cseed, Bool_t terror)
711 // Fit the Rieman tilt
714 // Fitting with tilting pads - kz not fixed
715 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
716 Int_t nTimeBins = cal->GetNumberOfTimeBins();
717 TLinearFitter fitterT2(4,"hyp4");
718 fitterT2.StoreData(kTRUE);
719 Float_t xref2 = (cseed[2].fX0 + cseed[3].fX0) * 0.5; // Reference x0 for z
722 fitterT2.ClearPoints();
724 for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
725 // printf("\nLayer %d\n", iLayer);
726 // cseed[iLayer].Print();
727 if (!cseed[iLayer].IsOK()) continue;
728 Double_t tilt = cseed[iLayer].fTilt;
730 for (Int_t itime = 0; itime < nTimeBins+1; itime++) {
731 // printf("\ttime %d\n", itime);
732 if (!cseed[iLayer].fUsable[itime]) continue;
733 // x relative to the midle chamber
734 Double_t x = cseed[iLayer].fX[itime] + cseed[iLayer].fX0 - xref2;
735 Double_t y = cseed[iLayer].fY[itime];
736 Double_t z = cseed[iLayer].fZ[itime];
742 Double_t x2 = cseed[iLayer].fX[itime] + cseed[iLayer].fX0; // Global x
743 Double_t t = 1.0 / (x2*x2 + y*y);
745 uvt[0] = 2.0 * x2 * uvt[1];
746 uvt[2] = 2.0 * tilt * uvt[1];
747 uvt[3] = 2.0 * tilt *uvt[1] * x;
748 uvt[4] = 2.0 * (y + tilt * z) * uvt[1];
750 Double_t error = 2.0 * uvt[1];
751 error *= terror ? cseed[iLayer].fSigmaY : .2;
753 // printf("\tadd point :\n");
754 // for(int i=0; i<5; i++) printf("%f ", uvt[i]);
756 fitterT2.AddPoint(uvt,uvt[4],error);
763 Double_t rpolz0 = fitterT2.GetParameter(3);
764 Double_t rpolz1 = fitterT2.GetParameter(4);
767 // Linear fitter - not possible to make boundaries
768 // non accept non possible z and dzdx combination
770 Bool_t acceptablez = kTRUE;
771 for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
772 if (cseed[iLayer].IsOK()) {
773 Double_t zT2 = rpolz0 + rpolz1 * (cseed[iLayer].fX0 - xref2);
774 if (TMath::Abs(cseed[iLayer].fZProb - zT2) > cseed[iLayer].fPadLength * 0.5 + 1.0) {
775 acceptablez = kFALSE;
780 Double_t zmf = cseed[2].fZref[0] + cseed[2].fZref[1] * (xref2 - cseed[2].fX0);
781 Double_t dzmf = (cseed[2].fZref[1] + cseed[3].fZref[1]) * 0.5;
782 fitterT2.FixParameter(3,zmf);
783 fitterT2.FixParameter(4,dzmf);
785 fitterT2.ReleaseParameter(3);
786 fitterT2.ReleaseParameter(4);
787 rpolz0 = fitterT2.GetParameter(3);
788 rpolz1 = fitterT2.GetParameter(4);
791 Double_t chi2TR = fitterT2.GetChisquare() / Float_t(npointsT);
793 params[0] = fitterT2.GetParameter(0);
794 params[1] = fitterT2.GetParameter(1);
795 params[2] = fitterT2.GetParameter(2);
796 Double_t curvature = 1.0 + params[1] * params[1] - params[2] * params[0];
798 for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
800 Double_t x = cseed[iLayer].fX0;
807 Double_t res2 = (x * params[0] + params[1]);
809 res2 = 1.0 - params[2]*params[0] + params[1]*params[1] - res2;
811 res2 = TMath::Sqrt(res2);
812 y = (1.0 - res2) / params[0];
816 Double_t x0 = -params[1] / params[0];
817 if (-params[2]*params[0] + params[1]*params[1] + 1 > 0) {
818 Double_t rm1 = params[0] / TMath::Sqrt(-params[2]*params[0] + params[1]*params[1] + 1);
819 if (1.0/(rm1*rm1) - (x-x0) * (x-x0) > 0.0) {
820 Double_t res = (x - x0) / TMath::Sqrt(1.0 / (rm1*rm1) - (x-x0)*(x-x0));
821 if (params[0] < 0) res *= -1.0;
825 z = rpolz0 + rpolz1 * (x - xref2);
827 cseed[iLayer].fYref[0] = y;
828 cseed[iLayer].fYref[1] = dy;
829 cseed[iLayer].fZref[0] = z;
830 cseed[iLayer].fZref[1] = dz;
831 cseed[iLayer].fC = curvature;
839 //___________________________________________________________________
840 void AliTRDseedV1::Print()
843 // Printing the seedstatus
846 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
847 Int_t nTimeBins = cal->GetNumberOfTimeBins();
849 printf("Seed status :\n");
850 printf(" fTilt = %f\n", fTilt);
851 printf(" fPadLength = %f\n", fPadLength);
852 printf(" fX0 = %f\n", fX0);
853 for(int ic=0; ic<nTimeBins; ic++) {
854 const Char_t *isUsable = fUsable[ic]?"Yes":"No";
855 printf(" %d X[%f] Y[%f] Z[%f] Indexes[%d] clusters[%p] usable[%s]\n"
861 , ((void*) fClusters[ic])
865 printf(" fYref[0] =%f fYref[1] =%f\n", fYref[0], fYref[1]);
866 printf(" fZref[0] =%f fZref[1] =%f\n", fZref[0], fZref[1]);
867 printf(" fYfit[0] =%f fYfit[1] =%f\n", fYfit[0], fYfit[1]);
868 printf(" fYfitR[0]=%f fYfitR[1]=%f\n", fYfitR[0], fYfitR[1]);
869 printf(" fZfit[0] =%f fZfit[1] =%f\n", fZfit[0], fZfit[1]);
870 printf(" fZfitR[0]=%f fZfitR[1]=%f\n", fZfitR[0], fZfitR[1]);
871 printf(" fSigmaY =%f\n", fSigmaY);
872 printf(" fSigmaY2=%f\n", fSigmaY2);
873 printf(" fMeanz =%f\n", fMeanz);
874 printf(" fZProb =%f\n", fZProb);
875 printf(" fLabels[0]=%d fLabels[1]=%d\n", fLabels[0], fLabels[1]);
876 printf(" fN =%d\n", fN);
877 printf(" fN2 =%d (>8 isOK)\n",fN2);
878 printf(" fNUsed =%d\n", fNUsed);
879 printf(" fFreq =%d\n", fFreq);
880 printf(" fNChange=%d\n", fNChange);
881 printf(" fMPads =%f\n", fMPads);
883 printf(" fC =%f\n", fC);
884 printf(" fCC =%f\n",fCC);
885 printf(" fChi2 =%f\n", fChi2);
886 printf(" fChi2Z =%f\n", fChi2Z);