* provided "as is" without express or implied warranty. *
**************************************************************************/
-/* $Id$ */
+/* $Id: AliTRDseedV1.cxx 60233 2013-01-10 09:04:08Z abercuci $ */
////////////////////////////////////////////////////////////////////////////
////
////////////////////////////////////////////////////////////////////////////
#include "TMath.h"
+#include "TGeoManager.h"
#include "TTreeStream.h"
#include "TGraphErrors.h"
fZref[0] = 0.; fZref[1] = 0.;
fYfit[0] = 0.; fYfit[1] = 0.;
fZfit[0] = 0.; fZfit[1] = 0.;
- memset(fdEdx, 0, kNslices*sizeof(Float_t));
+ memset(fdEdx, 0, kNdEdxSlices*sizeof(Float_t));
for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) fProb[ispec] = -1.;
fLabels[0]=-1; fLabels[1]=-1; // most freq MC labels
fLabels[2]=0; // number of different labels for tracklet
}
}
-//____________________________________________________________________
-void AliTRDseedV1::Clear(Option_t *)
-{
- // clean
- if (IsOwner()) {
- for(int itb=0; itb<kNclusters; itb++){
- if(!fClusters[itb]) continue;
- //AliInfo(Form("deleting c %p @ %d", fClusters[itb], itb));
- delete fClusters[itb];
- fClusters[itb] = NULL;
- }
- }
-}
-
//____________________________________________________________________
void AliTRDseedV1::Copy(TObject &ref) const
{
target.fZref[0] = fZref[0]; target.fZref[1] = fZref[1];
target.fYfit[0] = fYfit[0]; target.fYfit[1] = fYfit[1];
target.fZfit[0] = fZfit[0]; target.fZfit[1] = fZfit[1];
- memcpy(target.fdEdx, fdEdx, kNslices*sizeof(Float_t));
+ memcpy(target.fdEdx, fdEdx, kNdEdxSlices*sizeof(Float_t));
memcpy(target.fProb, fProb, AliPID::kSPECIES*sizeof(Float_t));
memcpy(target.fLabels, fLabels, 3*sizeof(Int_t));
memcpy(target.fRefCov, fRefCov, 7*sizeof(Double_t));
//____________________________________________________________
-Bool_t AliTRDseedV1::Init(AliTRDtrackV1 *track)
+Bool_t AliTRDseedV1::Init(const AliTRDtrackV1 *track)
{
// Initialize this tracklet using the track information
//
fZref[0] = 0.; fZref[1] = 0.;
fYfit[0] = 0.; fYfit[1] = 0.;
fZfit[0] = 0.; fZfit[1] = 0.;
- memset(fdEdx, 0, kNslices*sizeof(Float_t));
+ memset(fdEdx, 0, kNdEdxSlices*sizeof(Float_t));
for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) fProb[ispec] = -1.;
fLabels[0]=-1; fLabels[1]=-1; // most freq MC labels
fLabels[2]=0; // number of different labels for tracklet
// 3. cluster size
//
- memset(fdEdx, 0, kNslices*sizeof(Float_t));
+ memset(fdEdx, 0, kNdEdxSlices*sizeof(Float_t));
const Double_t kDriftLength = (.5 * AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick());
AliTRDcluster *c(NULL);
AliTRDcluster *c(NULL); Float_t qt(0.);
for(int ic=0; ic<kNclusters; ic++){
if(!(c=fClusters[ic])) continue;
- if(c->IsInChamber() && !useOutliers) continue;
+ if(!c->IsInChamber() && !useOutliers) continue;
qt += TMath::Abs(c->GetQ());
}
return qt;
//____________________________________________________________________
-Bool_t AliTRDseedV1::GetEstimatedCrossPoint(Float_t &x, Float_t &z) const
+Double_t AliTRDseedV1::EstimatedCrossPoint(AliTRDpadPlane *pp)
{
-// 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;
+// 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 radial offset from anode wire in case of raw cross.
- x=0.; z=0.;
+ Int_t row[] = {-1, -1};
+ Double_t zoff(0.5 * (pp->GetRow0() + pp->GetRowEnd())), sx(0.), mean(0.5*pp->GetNrows()-0.5);
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;
+ fS2Y = 0.;
+
+ if(!IsRowCross()){
+ for(int ic=0; ic<kNtb; ic++){
+ if(!(c=fClusters[ic])) continue;
+ if(!c->IsInChamber()) continue;
+ row[0] = c->GetPadRow();
+ fZfit[0] = Int_t(mean-row[0])*pp->GetLengthIPad() +
+ 0.5*(mean-row[0]>0.?1.:-1.)*(row[0]>0&&row[0]<pp->GetNrows()-1?pp->GetLengthIPad():pp->GetLengthOPad());
+ break;
}
- }
- 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;
+ } else {
+ Float_t tbm[2] = {0.}; // mean value of time bin in rows
+ Int_t tb[kNtb]={0}, //array of time bins from first row
+ nc[2] = {0}, // no. of clusters in rows
+ mc(0); // no. of common clusters
+ Bool_t w[2] = {kFALSE, kFALSE}; // acceptance flag for rows
+ // Find radial range for first row
+ for(int ic(0); ic<kNtb; ic++){
+ tb[ic]= -1;
+ if(!(c=fClusters[ic]) || !c->IsInChamber()) continue;
+ if(row[0]<0) row[0] = c->GetPadRow();
+ tb[nc[0]++] = ic; tbm[0] += ic;
+ }
+ if(nc[0]>2){
+ tbm[0] /= nc[0];
+ w[0] = kTRUE;
+ }
+ // Find radial range for second row
+ for(int ic(kNtb), jc(0); ic<kNclusters; ic++, jc++){
+ if(!(c=fClusters[ic]) || !c->IsInChamber()) continue;
+ if(row[1]<0) row[1] = c->GetPadRow();
+ tbm[1] += jc; nc[1]++;
+ for(Int_t kc(0); kc<nc[0]; kc++)
+ if(tb[kc]==jc){
+ tb[kc] += 100; // mark common cluster
+ mc++;
+ break;
+ }
+ }
+ if(nc[1]>2){
+ tbm[1] /= nc[1];
+ w[1] = kTRUE;
+ }
+ //printf("0 : %f[%2d] 1 : %f[%2d] mc[%d]\n", tbm[0], nc[0], tbm[1], nc[1], mc);
+ if(!w[0] && !w[1]){
+ AliError("Too few clusters to estimate tracklet.");
+ return -1;
+ }
+ if(!w[0] || !w[1]){
+ SetBit(kRowCross, kFALSE); // reset RC bit
+ if(w[1]) row[0] = row[1];
+ fZfit[0] = Int_t(mean-row[0])*pp->GetLengthIPad() +
+ 0.5*(mean-row[0]>0.?1.:-1.)*(row[0]>0&&row[0]<pp->GetNrows()-1?pp->GetLengthIPad():pp->GetLengthOPad());
+ }else{ // find the best matching timebin
+ fZfit[0] = Int_t(mean-0.5*(row[0]+row[1]))*pp->GetLengthIPad();
+ Int_t itb(0), dtb(0);
+ if(!mc) { // no common range
+ itb = Int_t(0.5*(tbm[0] + tbm[1]));
+ dtb = Int_t(0.5*TMath::Abs(tbm[0] - tbm[1])); // simple parameterization of the cluster gap
+ } else {
+ Double_t rmax(100.); Int_t itbStart(-1), itbStop(0);
+ // compute distance from
+ for(Int_t jc(0); jc<nc[0]; jc++){
+ if(tb[jc] < 100) continue;
+ Int_t ltb(tb[jc]-100);
+ Double_t r = (1. - ltb/tbm[0])*(1. - ltb/tbm[1]);
+ //printf("tb[%2d] dr[%f %f %f] rmax[%f]\n", ltb, r, 1. - ltb/tbm[0], 1. - ltb/tbm[1], rmax);
+ if(TMath::Abs(r)<rmax){ rmax = TMath::Abs(r); itb = ltb; }
+ if(itbStart<0) itbStart = ltb;
+ itbStop = ltb;
+ }
+ dtb = itbStop-itbStart+1;
+ }
+ AliTRDCommonParam *cp = AliTRDCommonParam::Instance();
+ Double_t freq(cp?cp->GetSamplingFrequency():10.);
+ fS2Y = ((itb+0.5)/freq - fT0 - 0.189)*fVD; // xOff
+ sx = dtb*fVD*0.288675134594812921/freq;
+ }
+ }
+
+ // correct for the bias in dzdx
+ Float_t dx(fX0-fS2Y);
+ fZfit[1] = (fZfit[0]+zoff)/dx;
+ if(!IsRowCross()) fZfit[1] *= 1.09;
+ // compute local z @ anode wire
+ //fZfit[0]+= fZfit[1]*fS2Y;
+// printf("EstimatedCrossPoint : zoff[%f]\n", zoff);
+// fS2Z = 0.05+0.4*TMath::Abs(fZfit[1]);
+ Float_t s2dzdx(0.0245-0.0014*fZfit[1]+0.0557*fZfit[1]*fZfit[1]); s2dzdx*=s2dzdx;
+ fS2Z = fZfit[1]*fZfit[1]*sx*sx+fS2Y*fS2Y*s2dzdx;
+
+ return fS2Y;
}
//____________________________________________________________________
//
// Charge of the clusters at timebin
//
- Float_t Q = 0;
+ Float_t q = 0;
if(fClusters[tb] /*&& fClusters[tb]->IsInChamber()*/)
- Q += TMath::Abs(fClusters[tb]->GetQ());
+ q += TMath::Abs(fClusters[tb]->GetQ());
if(fClusters[tb+kNtb] /*&& fClusters[tb+kNtb]->IsInChamber()*/)
- Q += TMath::Abs(fClusters[tb+kNtb]->GetQ());
- return Q/TMath::Sqrt(1. + fYref[1]*fYref[1] + fZref[1]*fZref[1]);
+ q += TMath::Abs(fClusters[tb+kNtb]->GetQ());
+ return q/TMath::Sqrt(1. + fYref[1]*fYref[1] + fZref[1]*fZref[1]);
}
//____________________________________________________________________
//
Double_t p = fPt*TMath::Sqrt(1.+fZref[1]*fZref[1]);
- Double_t p2 = p*p;
- Double_t tgl2 = fZref[1]*fZref[1];
- Double_t pt2 = fPt*fPt;
if(err){
- Double_t s2 =
+ Double_t p2 = p*p;
+ Double_t tgl2 = fZref[1]*fZref[1];
+ Double_t pt2 = fPt*fPt;
+ Double_t s2 =
p2*tgl2*pt2*pt2*fRefCov[4]
-2.*p2*fZref[1]*fPt*pt2*fRefCov[5]
+p2*pt2*fRefCov[6];
// - Neural Network [default] - option "nn"
// - 2D Likelihood - option "!nn"
+ AliWarning(Form("Obsolete function. Use AliTRDPIDResponse::GetResponse() instead."));
+
AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
if (!calibration) {
AliError("No access to calibration data");
if(fkReconstructor){
Double_t sys[15]; memset(sys, 0, 15*sizeof(Double_t));
fkReconstructor->GetRecoParam()->GetSysCovMatrix(sys);
- sy2 += sys[0];
- sz2 += sys[1];
+// sy2 += sys[0];
+// sz2 += sys[1];
}
// rotate covariance matrix if no RC
cov[0] = (sy2+t2*sz2)*correction;
cov[1] = GetTilt()*(sz2 - sy2)*correction;
cov[2] = (t2*sy2+sz2)*correction;
- } else {
- cov[0] = sy2; cov[1] = 0.; cov[2] = sy2;
- }
+ } else {
+ cov[0] = sy2; cov[1] = 0.; cov[2] = sz2;
+ }
AliDebug(4, Form("C(%6.1f %+6.3f %6.1f) RC[%c]", 1.e4*TMath::Sqrt(cov[0]), cov[1], 1.e4*TMath::Sqrt(cov[2]), IsRowCross()?'y':'n'));
}
memset(s2y, 0, kNrows*kNcls*sizeof(Double_t));
memset(blst, 0, kNrows*kNcls*sizeof(Bool_t)); //this is 8 times faster to memset than "memset(clst, 0, kNrows*kNcls*sizeof(AliTRDcluster*))"
- Double_t roady(0.), s2Mean(0.), sMean(0.); Int_t ns2Mean(0);
+ Double_t roady(0.), s2Mean(0.); Int_t ns2Mean(0);
// Do cluster projection and pick up cluster candidates
AliTRDcluster *c(NULL);
for(Int_t ir(kNrows);ir--;) clst[ir].Clear();
return kFALSE;
}
- s2Mean /= ns2Mean; sMean = TMath::Sqrt(s2Mean);
+ s2Mean /= ns2Mean; //sMean = TMath::Sqrt(s2Mean);
//Double_t sRef(TMath::Sqrt(s2Mean+s2yTrk)); // reference error parameterization
// organize row candidates
// initialize debug streamer
TTreeSRedirector *pstreamer(NULL);
- if(recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 3 && fkReconstructor->IsDebugStreaming()) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
+ if((recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 3 && fkReconstructor->IsDebugStreaming())||
+ AliTRDReconstructor::GetStreamLevel()>3) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
if(pstreamer){
// save config. for calibration
TVectorD vdy[2], vdx[2], vs2[2];
<< "\n";
vdx[0].Clear(); vdy[0].Clear(); vs2[0].Clear();
vdx[1].Clear(); vdy[1].Clear(); vs2[1].Clear();
- if(recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 4){
+ if(recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 4 ||AliTRDReconstructor::GetStreamLevel()>4){
Int_t idx(idxRow[1]);
if(idx<0){
for(Int_t ir(0); ir<kNrows; ir++){
}
}
}
- if(!pstreamer && recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 2 && fkReconstructor->IsDebugStreaming()) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
+ if(!pstreamer &&
+ ( (recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 2 && fkReconstructor->IsDebugStreaming()) ||
+ AliTRDReconstructor::GetStreamLevel()>2 )
+ ) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
if(pstreamer){
// save config. for calibration
TVectorD vidx, vn, vx, vy, vr, vs, vsm, vp, vf;
if(f[is]<1.e-2){
AliDebug(1, Form("Seed seg[%d] row[%2d] n[%2d] f[%f]<0.01.", is, idxRow[0], n[0][is], f[is]));
SetErrorMsg(kAttachClAttach);
- if(!pstreamer && recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 1 && fkReconstructor->IsDebugStreaming()) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
+ if(!pstreamer &&
+ ( (recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 1 && fkReconstructor->IsDebugStreaming()) ||
+ AliTRDReconstructor::GetStreamLevel()>1 )
+ ) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
if(pstreamer){
UChar_t stat(0);
if(IsKink()) SETBIT(stat, 1);
// clear local copy of clusters
for(Int_t ir(0); ir<kNrows; ir++) clst[ir].Clear();
- if(!pstreamer && recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 1 && fkReconstructor->IsDebugStreaming()) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
+ if(!pstreamer &&
+ ((recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 1 && fkReconstructor->IsDebugStreaming()) ||
+ AliTRDReconstructor::GetStreamLevel()>1 )
+ ) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
if(pstreamer){
UChar_t stat(0);
if(IsKink()) SETBIT(stat, 1);
kDZDX=kFALSE;
}
- Float_t w = 1.;
- if(c->GetNPads()>4) w = .5;
- if(c->GetNPads()>5) w = .2;
+// TODO use this information to adjust cluster error parameterization
+// Float_t w = 1.;
+// if(c->GetNPads()>4) w = .5;
+// if(c->GetNPads()>5) w = .2;
// cluster charge
qc[n] = TMath::Abs(c->GetQ());
//____________________________________________________________________
-Bool_t AliTRDseedV1::FitRobust(Bool_t chg)
+Bool_t AliTRDseedV1::FitRobust(AliTRDpadPlane *pp, Int_t opt)
{
//
// 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>
TTreeSRedirector *pstreamer(NULL);
- const AliTRDrecoParam* const recoParam = fkReconstructor->GetRecoParam(); if(recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 3 && fkReconstructor->IsDebugStreaming()) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
+ const AliTRDrecoParam* const recoParam = fkReconstructor->GetRecoParam();
+ if( (recoParam->GetStreamLevel(AliTRDrecoParam::kTracker) > 3 && fkReconstructor->IsDebugStreaming()) ||
+ AliTRDReconstructor::GetStreamLevel()>3 ) pstreamer = fkReconstructor->GetDebugStream(AliTRDrecoParam::kTracker);
// factor to scale y pulls.
// ideally if error parametrization correct this is 1.
if(!attach){
AliWarning("No usable AttachClusters calib object.");
} else {
- kScalePulls = attach->GetScaleCov();//*lyScaler;
+ //kScalePulls = attach->GetScaleCov();//*lyScaler;
}
// Retrieve chamber status
SetChmbGood(calibration->IsChamberGood(fDet));
if(!IsChmbGood()) kScalePulls*=10.;
}
- Double_t xc[kNclusters], yc[kNclusters], sy[kNclusters];
- Int_t n(0), // clusters used in fit
- row[]={-1, 0}; // pad row spanned by the tracklet
+
+ // evaluate locally z and dzdx from TRD only information
+ if(EstimatedCrossPoint(pp)<0.) return kFALSE;
+
+ //printf("D%03d RC[%c] dzdx[%f %f] opt[%d]\n", fDet, IsRowCross()?'y':'n', fZref[1], fZfit[1], opt);
+ Double_t //xchmb = 0.5 * AliTRDgeometry::AmThick() + AliTRDgeometry::DrThick(),
+ //zchmb = 0.5 * (pp->GetRow0() + pp->GetRowEnd()),
+ z0 = 0.5 * (pp->GetRow0() + pp->GetRowEnd()) + fZfit[0], z;
+ Double_t xc[kNclusters], yc[kNclusters], dz(0.), dzdx(0.), s2dz(0.), s2dzdx(0.), sy[kNclusters],
+ cs(0.);
+ Int_t n(0), // clusters used in fit
+ row[]={-1, -1},// pad row spanned by the tracklet
+ col(-1); // pad column of current cluster
AliTRDcluster *c(NULL), **jc = &fClusters[0];
for(Int_t ic=0; ic<kNtb; ic++, ++jc) {
if(!(c = (*jc))) continue;
if(!c->IsInChamber()) continue;
if(row[0]<0){
- fZfit[0] = c->GetZ();
- fZfit[1] = 0.;
row[0] = c->GetPadRow();
+ z = pp->GetRowPos(row[0]) - 0.5*pp->GetRowSize(row[0]);
+ switch(opt){
+ case 0: // no dz correction (only for RC tracklet) and dzdx from chamber position assuming primary
+ dzdx = IsRowCross()?fZfit[1]:0.;
+ s2dzdx= IsRowCross()?(0.0245-0.0014*dzdx+0.0557*dzdx*dzdx):(0.0379-0.0006*dzdx+0.0771*dzdx*dzdx);
+ s2dzdx*=s2dzdx;
+ dz = IsRowCross()?(z - z0):0.;//5*dzdx*xchmb;
+ s2dz = IsRowCross()?(2.5e-4+1.e-2*dzdx*dzdx+1.e-2*TMath::Abs(dzdx)):0.;
+ break;
+ case 1: // dz correction only for RC tracklet and dzdx from reference
+ dzdx = fZref[1];
+ dz = IsRowCross()?(z - z0):0.;//5*dzdx*xchmb;
+ break;
+ case 2: // full z correction (z0 & dzdx from reference)
+ dzdx = fZref[1];
+ dz = c->GetZ()-fZref[0];
+ break;
+ default:
+ AliError(Form("Wrong option fit %d !", opt));
+ break;
+ }
+ }
+ if(col != c->GetPadCol()){
+ col = c->GetPadCol();
+ cs = pp->GetColSize(col);
}
- xc[n] = c->GetX();
- yc[n] = c->GetY();
- sy[n] = c->GetSigmaY2()>0?(TMath::Min(TMath::Sqrt(c->GetSigmaY2()), 0.08)):0.08;
+ //Use local cluster coordinates - the code should be identical with AliTRDtransform::Transform() !!!
+ //A.Bercuci 27.11.13
+ xc[n] = c->GetXloc(fT0, fVD); // c->GetX();
+ yc[n] = c->GetYloc(pp->GetColPos(col) + .5*cs, fS2PRF, cs) - xc[n]*fExB; //c->GetY();
+ yc[n]-= fPad[2]*(dz+xc[n]*dzdx);
+// sy[n] = c->GetSigmaY2()>0?(TMath::Min(TMath::Sqrt(c->GetSigmaY2()), 0.08)):0.08;
+ sy[n] = c->GetSigmaY2()>0?(TMath::Min(Double_t(c->GetSigmaY2()), 6.4e-3)):6.4e-3;
+ sy[n]+= fPad[2]*fPad[2]*(s2dz+xc[n]*xc[n]*s2dzdx);
+ sy[n] = TMath::Sqrt(sy[n]);
n++;
}
- Double_t corr = fPad[2]*fPad[0];
-
for(Int_t ic=kNtb; ic<kNclusters; ic++, ++jc) {
if(!(c = (*jc))) continue;
if(!c->IsInChamber()) continue;
- if(row[1]==0) row[1] = c->GetPadRow() - row[0];
- xc[n] = c->GetX();
- yc[n] = c->GetY() + corr*row[1];
- sy[n] = c->GetSigmaY2()>0?(TMath::Min(TMath::Sqrt(c->GetSigmaY2()), 0.08)):0.08;
+ if(row[1]<0){
+ row[1] = c->GetPadRow();
+ z = pp->GetRowPos(row[1]) - 0.5*pp->GetRowSize(row[1]);
+ switch(opt){
+ case 0: // no dz correction (only for RC tracklet) and dzdx from chamber position assuming primary
+ //dzdx = fZfit[1];
+ dz = z - z0;
+ break;
+ case 1: // dz correction only for RC tracklet and dzdx from reference
+ //dzdx = fZref[1];
+ dz = z - z0;
+ break;
+ case 2: // full z correction (z0 & dzdx from reference)
+ //dzdx = fZref[1];
+ dz = c->GetZ()-fZref[0];
+ break;
+ default:
+ AliError(Form("Wrong option fit %d !", opt));
+ break;
+ }
+ }
+ if(col != c->GetPadCol()){
+ col = c->GetPadCol();
+ cs = pp->GetColSize(col);
+ }
+ //Use local cluster coordinates - the code should be identical with AliTRDtransform::Transform() !!!
+ //A.Bercuci 27.11.13
+ xc[n] = c->GetXloc(fT0, fVD); // c->GetX();
+ yc[n] = c->GetYloc(pp->GetColPos(col) + .5*cs, fS2PRF, cs) - xc[n]*fExB ;
+ yc[n] -= fPad[2]*(dz+xc[n]*dzdx);
+ //sy[n] = c->GetSigmaY2()>0?(TMath::Min(TMath::Sqrt(c->GetSigmaY2()), 0.08)):0.08;
+ sy[n] = c->GetSigmaY2()>0?(TMath::Min(Double_t(c->GetSigmaY2()), 6.4e-3)):6.4e-3;
+ sy[n]+= fPad[2]*fPad[2]*(s2dz+xc[n]*xc[n]*s2dzdx);
+ sy[n] = TMath::Sqrt(sy[n]);
n++;
}
+
UChar_t status(0);
- Double_t par[3] = {0.,0.,fX0}, cov[3];
+ // the ref radial position is set close to the minimum of
+ // the y variance of the tracklet
+ fX = 0.;//set reference to anode wire
+ Double_t par[3] = {0.,0.,fX}, cov[3];
if(!AliTRDtrackletOflHelper::Fit(n, xc, yc, sy, par, 1.5, cov)){
AliDebug(1, Form("Tracklet fit failed D[%03d].", fDet));
SetErrorMsg(kFitCl);
return kFALSE;
}
- fYfit[0] = par[0];
- fYfit[1] = par[1];
+ fYfit[0] = par[0] - fX * par[1];
+ fYfit[1] = -par[1];
+ //printf(" yfit: %f [%f] x[%e] dydx[%f]\n", fYfit[0], par[0], fX, par[1]);
// store covariance
fCov[0] = kScalePulls*cov[0]; // variance of y0
fCov[1] = kScalePulls*cov[2]; // covariance of y0, dydx
fCov[2] = kScalePulls*cov[1]; // variance of dydx
- // the ref radial position is set at the minimum of
- // the y variance of the tracklet
- fX = 0.;//-fCov[1]/fCov[2];
// check radial position
Float_t xs=fX+.5*AliTRDgeometry::CamHght();
if(xs < 0. || xs > AliTRDgeometry::CamHght()+AliTRDgeometry::CdrHght()){
SetErrorMsg(kFitFailedY);
return kFALSE;
}
- fS2Y = fCov[0] + fX*fCov[1];
- fS2Z = fPad[0]*fPad[0]/12.;
- AliDebug(2, Form("[I] x[cm]=%6.2f y[cm]=%+5.2f z[cm]=%+6.2f dydx[deg]=%+5.2f sy[um]=%6.2f sz[cm]=%6.2f", GetX(), GetY(), GetZ(), TMath::ATan(fYfit[1])*TMath::RadToDeg(), TMath::Sqrt(fS2Y)*1.e4, TMath::Sqrt(fS2Z)));
- if(IsRowCross()){
- Float_t x,z;
- if(!GetEstimatedCrossPoint(x,z)){
- AliDebug(2, Form("Failed(I) getting crossing point D[%03d].", fDet));
- SetErrorMsg(kFitFailedY);
- return kTRUE;
- }
- //if(IsPrimary()){
- fZfit[0] = fX0*z/x;
- fZfit[1] = z/x;
- fS2Z = 0.05+0.4*TMath::Abs(fZfit[1]); fS2Z *= fS2Z;
- //}
- AliDebug(2, Form("s2y[%f] s2z[%f]", fS2Y, fS2Z));
- AliDebug(2, Form("[II] x[cm]=%6.2f y[cm]=%+5.2f z[cm]=%+6.2f dydx[deg]=%+5.2f sy[um]=%6.2f sz[um]=%6.2f dzdx[deg]=%+5.2f", GetX(), GetY(), GetZ(), TMath::ATan(fYfit[1])*TMath::RadToDeg(), TMath::Sqrt(fS2Y)*1.e4, TMath::Sqrt(fS2Z)*1.e4, TMath::ATan(fZfit[1])*TMath::RadToDeg()));
+ if(!IsRowCross()){
+ Double_t padEffLength(fPad[0] - TMath::Abs(dzdx));
+ fS2Z = padEffLength*padEffLength/12.;
}
+ AliDebug(2, Form("[I] x[cm]=%6.2f y[cm]=%+5.2f z[cm]=%+6.2f dydx[deg]=%+5.2f", GetX(), GetY(), GetZ(), TMath::ATan(fYfit[1])*TMath::RadToDeg()));
if(pstreamer){
Float_t x= fX0 -fX,
AliMathBase::EvaluateUni(n, dy, m, s, 0);
(*pstreamer) << "FitRobust4"
<< "stat=" << status
- << "chg=" << chg
+ << "opt=" << opt
<< "ncl=" << n
<< "det=" << fDet
<< "x0=" << fX0
return kTRUE;
}
+//___________________________________________________________________
+void AliTRDseedV1::SetXYZ(TGeoHMatrix *mDet/*, Float_t zpp*/)
+{
+// Apply alignment to the local position of tracklet
+// A.Bercuci @ 27.11.2013
+
+// Int_t stk(AliTRDgeometry::GetStack(fDet));
+// Float_t zcorr[] = {-1.37, -0.59, 0., 0.62, 1.30};
+ Double_t loc[] = {AliTRDgeometry::AnodePos(), GetLocalY(), fZfit[0]}, trk[3]={0.};
+ mDet->LocalToMaster(loc, trk);
+ fX0 = trk[0];
+ fY = trk[1];
+ fZ = trk[2];//-zcorr[stk];
+ fZfit[1] = fZ/(fX0-fS2Y);
+
+ if(!IsRowCross()){fZfit[1] *= 1.09; return;}
+ // recalculate local z coordinate assuming primary track for row cross tracklets
+ Double_t zoff(fZ-fZfit[0]); // no alignment aware !
+ //printf("SetXYZ : zoff[%f] zpp[%f]\n", zoff, zpp);
+ fZfit[0] = fX0*fZfit[1] - zoff;
+ // recalculate tracking coordinates based on the new z coordinate
+ loc[2] = fZfit[0];
+ mDet->LocalToMaster(loc, trk);
+ fX0 = trk[0];
+ fY = trk[1];
+ fZ = trk[2];//-zcorr[stk];
+ fZfit[1] = /*(IsRowCross()?1.05:1.09)**/fZ/(fX0-fS2Y);
+}
+
+
//___________________________________________________________________
void AliTRDseedV1::Print(Option_t *o) const
{