#include "AliTPCseed.h"
#include "AliTPCReconstructor.h"
#include "AliTPCClusterParam.h"
+#include "AliTPCCalPad.h"
+#include "AliTPCCalROC.h"
+#include "AliTPCcalibDB.h"
+#include "AliTPCParam.h"
+
+
ClassImp(AliTPCseed)
AliTPCtrack(),
fEsd(0x0),
fClusterOwner(kFALSE),
- fPoints(0x0),
- fEPoints(0x0),
fRow(0),
fSector(-1),
fRelativeSector(-1),
fCurrentSigmaY2(1e10),
fCurrentSigmaZ2(1e10),
+ fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
+ fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
+ fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
+ fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
+ //
fErrorY2(1e10),
fErrorZ2(1e10),
fCurrentCluster(0x0),
AliTPCtrack(s),
fEsd(0x0),
fClusterOwner(clusterOwner),
- fPoints(0x0),
- fEPoints(0x0),
fRow(0),
fSector(-1),
fRelativeSector(-1),
- fCurrentSigmaY2(1e10),
- fCurrentSigmaZ2(1e10),
+ fCurrentSigmaY2(-1),
+ fCurrentSigmaZ2(-1),
+ fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
+ fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
+ fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
+ fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
fErrorY2(1e10),
fErrorZ2(1e10),
fCurrentCluster(0x0),
AliTPCtrack(t),
fEsd(0x0),
fClusterOwner(kFALSE),
- fPoints(0x0),
- fEPoints(0x0),
fRow(0),
fSector(-1),
fRelativeSector(-1),
- fCurrentSigmaY2(1e10),
- fCurrentSigmaZ2(1e10),
+ fCurrentSigmaY2(-1),
+ fCurrentSigmaZ2(-1),
+ fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
+ fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
+ fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
+ fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
fErrorY2(1e10),
fErrorZ2(1e10),
fCurrentCluster(0x0),
AliTPCtrack(xr, alpha, xx, cc, index),
fEsd(0x0),
fClusterOwner(kFALSE),
- fPoints(0x0),
- fEPoints(0x0),
fRow(0),
fSector(-1),
fRelativeSector(-1),
- fCurrentSigmaY2(1e10),
- fCurrentSigmaZ2(1e10),
+ fCurrentSigmaY2(-1),
+ fCurrentSigmaZ2(-1),
+ fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
+ fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
+ fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
+ fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
fErrorY2(1e10),
fErrorZ2(1e10),
fCurrentCluster(0x0),
AliTPCseed::~AliTPCseed(){
//
// destructor
- if (fPoints) delete fPoints;
- fPoints =0;
- if (fEPoints) delete fEPoints;
- fEPoints = 0;
fNoCluster =0;
if (fClusterOwner){
for (Int_t icluster=0; icluster<160; icluster++){
fClusterOwner = param.fClusterOwner;
// leave out fPoint, they are also not copied in the copy ctor...
// but deleted in the dtor... strange...
- // fPoints =
- // fEPoints =
fRow = param.fRow;
fSector = param.fSector;
fRelativeSector = param.fRelativeSector;
return &fTrackPoints[i];
}
-void AliTPCseed::RebuildSeed()
-{
- //
- // rebuild seed to be ready for storing
- AliTPCclusterMI cldummy;
- cldummy.SetQ(0);
- AliTPCTrackPoint pdummy;
- pdummy.GetTPoint().SetShared(10);
- for (Int_t i=0;i<160;i++){
- AliTPCclusterMI * cl0 = fClusterPointer[i];
- AliTPCTrackPoint *trpoint = (AliTPCTrackPoint*)fPoints->UncheckedAt(i);
- if (cl0){
- trpoint->GetTPoint() = *(GetTrackPoint(i));
- trpoint->GetCPoint() = *cl0;
- trpoint->GetCPoint().SetQ(TMath::Abs(cl0->GetQ()));
- }
- else{
- *trpoint = pdummy;
- trpoint->GetCPoint()= cldummy;
- }
-
- }
-
-}
Double_t AliTPCseed::GetDensityFirst(Int_t n)
Int_t idx=GetClusterIndex(n); // save the current cluster index
AliCluster cl(*c); cl.SetSigmaY2(fErrorY2); cl.SetSigmaZ2(fErrorZ2);
+ Float_t dx = ((AliTPCclusterMI*)c)->GetX()-GetX();
+ if (TMath::Abs(dx)>0){
+ Float_t ty = TMath::Tan(TMath::ASin(GetSnp()));
+ Float_t dy = dx*ty;
+ Float_t dz = dx*TMath::Sqrt(1.+ty*ty)*GetTgl();
+ cl.SetY(c->GetY()-dy);
+ cl.SetZ(c->GetZ()-dz);
+ }
+
if (!AliTPCtrack::Update(&cl,chisq,index)) return kFALSE;
+
+ if (fCMeanSigmaY2p30<0){
+ fCMeanSigmaY2p30= c->GetSigmaY2(); //! current mean sigma Y2 - mean30%
+ fCMeanSigmaZ2p30= c->GetSigmaZ2(); //! current mean sigma Z2 - mean30%
+ fCMeanSigmaY2p30R = 1; //! current mean sigma Y2 - mean5%
+ fCMeanSigmaZ2p30R = 1; //! current mean sigma Z2 - mean5%
+ }
+ //
+ fCMeanSigmaY2p30= 0.70*fCMeanSigmaY2p30 +0.30*c->GetSigmaY2();
+ fCMeanSigmaZ2p30= 0.70*fCMeanSigmaZ2p30 +0.30*c->GetSigmaZ2();
+ if (fCurrentSigmaY2>0){
+ fCMeanSigmaY2p30R = 0.7*fCMeanSigmaY2p30R +0.3*c->GetSigmaY2()/fCurrentSigmaY2;
+ fCMeanSigmaZ2p30R = 0.7*fCMeanSigmaZ2p30R +0.3*c->GetSigmaZ2()/fCurrentSigmaZ2;
+ }
+
SetClusterIndex(n,idx); // restore the current cluster index
return kTRUE;
Float_t weight[200];
Int_t index[200];
//Int_t nc = 0;
- // TClonesArray & arr = *fPoints;
Float_t meanlog = 100.;
Float_t mean[4] = {0,0,0,0};
//
fNShared =0;
+ Float_t gainGG = 1;
+ if (AliTPCcalibDB::Instance()->GetParameters()){
+ gainGG= AliTPCcalibDB::Instance()->GetParameters()->GetGasGain()/20000.; //relative gas gain
+ }
+
+
for (Int_t of =0; of<4; of++){
for (Int_t i=of+i1;i<i2;i+=4)
{
- Int_t index = fIndex[i];
- if (index<0||index&0x8000) continue;
+ Int_t clindex = fIndex[i];
+ if (clindex<0||clindex&0x8000) continue;
//AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i);
AliTPCTrackerPoint * point = GetTrackPoint(i);
}
if (rsigma>1.5) ampc/=1.3; // if big backround
amp[nc[of]] = ampc;
+ amp[nc[of]] /=gainGG;
angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez);
weight[nc[of]] = w;
nc[of]++;
-Float_t AliTPCseed::CookdEdxNorm(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2){
+Float_t AliTPCseed::CookdEdxNorm(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2, AliTPCCalPad * gainMap, Bool_t posNorm, Bool_t padNorm){
//
// calculates dedx using the cluster
// normalization parametrization taken from AliTPCClusterParam
//
AliTPCClusterParam * parcl = AliTPCClusterParam::Instance();
+ if (!parcl) parcl = AliTPCcalibDB::Instance()->GetClusterParam();
if (!parcl) return 0;
Float_t amp[160];
Int_t indexes[160];
Int_t ncl=0;
//
//
+ Float_t gainGG = 1;
+ if (AliTPCcalibDB::Instance()->GetParameters()){
+ gainGG= 20000./AliTPCcalibDB::Instance()->GetParameters()->GetGasGain(); //relative gas gain
+ }
+
const Float_t ktany = TMath::Tan(TMath::DegToRad()*10);
- const Float_t kedgey =4.;
+ const Float_t kedgey =3.;
+ //
//
for (Int_t irow=i1; irow<i2; irow++){
AliTPCclusterMI* cluster = GetClusterPointer(irow);
if (!cluster) continue;
if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster
Float_t charge= (type%2)? cluster->GetMax():cluster->GetQ();
+ if (!gainMap) gainMap = AliTPCcalibDB::Instance()->GetDedxGainFactor();
+ if (gainMap) {
+ Float_t factor = 1;
+ AliTPCCalROC * roc = gainMap->GetCalROC(cluster->GetDetector());
+ if (irow < 63) { // IROC
+ factor = roc->GetValue(irow, TMath::Nint(cluster->GetPad()))*1.55;
+ } else { // OROC
+ factor = roc->GetValue(irow - 63, TMath::Nint(cluster->GetPad()));
+ }
+ if (factor>0.5) charge/=factor;
+ }
+
//do normalization
Float_t corr=1;
Int_t ipad= 0;
corr = parcl->Qnorm(ipad,type,dr,ty,tz);
}
amp[ncl]=charge/corr;
-
+ amp[ncl]/=gainGG;
+ if (posNorm){
+ //
+ //
+ //
+ corr = parcl->QnormPos(ipad,type, cluster->GetPad(),cluster->GetTimeBin(), cluster->GetZ(),
+ cluster->GetSigmaY2(),cluster->GetSigmaZ2(),cluster->GetMax(),cluster->GetQ());
+ amp[ncl]/=corr;
+ }
+
+
amp[ncl] *= 2.0; // put mean value to channel 50
- if (ipad==0) {
- amp[ncl] /= 0.65; // this we will take form OCDB
- } else
- if (ipad==2){
- amp[ncl] /=1.57;
- }else{
- }
+ if (padNorm){
+ corr=1;
+ if (type==0 && parcl->fQpadTnorm) corr = (*parcl->fQpadTnorm)[ipad];
+ if (type==1 && parcl->fQpadTnorm) corr = (*parcl->fQpadMnorm)[ipad];
+ amp[ncl]/=corr;
+ }
+
+ // if (ipad==0) {
+// amp[ncl] /= 0.65; // this we will take form OCDB
+// } else
+// if (ipad==2){
+// amp[ncl] /=1.57;
+// }else{
+// }
ncl++;
}
Float_t mean = (meanc>0)? means/meanc:0;
return mean;
}
+
+
+
+Int_t AliTPCseed::RefitTrack(AliTPCseed *seed, AliExternalTrackParam * parin, AliExternalTrackParam * parout){
+ //
+ // Refit the track
+ // return value - number of used clusters
+ //
+ //
+ const Int_t kMinNcl =10;
+ AliTPCseed *track=new AliTPCseed(*seed);
+ Int_t sector=-1;
+ // reset covariance
+ //
+ Double_t covar[15];
+ for (Int_t i=0;i<15;i++) covar[i]=0;
+ covar[0]=10.*10.;
+ covar[2]=10.*10.;
+ covar[5]=10.*10./(64.*64.);
+ covar[9]=10.*10./(64.*64.);
+ covar[14]=1*1;
+ //
+
+ Float_t xmin=1000, xmax=-10000;
+ Int_t imin=158, imax=0;
+ for (Int_t i=0;i<160;i++) {
+ AliTPCclusterMI *c=track->GetClusterPointer(i);
+ if (!c) continue;
+ if (sector<0) sector = c->GetDetector();
+ if (c->GetX()<xmin) xmin=c->GetX();
+ if (c->GetX()>xmax) xmax=c->GetX();
+ if (i<imin) imin=i;
+ if (i>imax) imax=i;
+ }
+ if(imax-imin<kMinNcl) {
+ delete track;
+ return 0 ;
+ }
+ // Not succes to rotate
+ if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) {
+ delete track;
+ return 0;
+ }
+ //
+ //
+ // fit from inner to outer row
+ //
+ AliExternalTrackParam paramIn;
+ AliExternalTrackParam paramOut;
+ Bool_t isOK=kTRUE;
+ Int_t ncl=0;
+ //
+ //
+ //
+ for (Int_t i=imin; i<=imax; i++){
+ AliTPCclusterMI *c=track->GetClusterPointer(i);
+ if (!c) continue;
+ // if (RejectCluster(c,track)) continue;
+ sector = (c->GetDetector()%18);
+ if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) {
+ //continue;
+ }
+ Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()};
+ Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation
+ if (!track->PropagateTo(r[0])) {
+ isOK=kFALSE;
+ }
+ if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE;
+ }
+ if (!isOK) { delete track; return 0;}
+ track->AddCovariance(covar);
+ //
+ //
+ //
+ for (Int_t i=imax; i>=imin; i--){
+ AliTPCclusterMI *c=track->GetClusterPointer(i);
+ if (!c) continue;
+ //if (RejectCluster(c,track)) continue;
+ sector = (c->GetDetector()%18);
+ if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) {
+ //continue;
+ }
+ Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()};
+ Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation
+ if (!track->PropagateTo(r[0])) {
+ isOK=kFALSE;
+ }
+ if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE;
+ }
+ //if (!isOK) { delete track; return 0;}
+ paramIn = *track;
+ track->AddCovariance(covar);
+ //
+ //
+ for (Int_t i=imin; i<=imax; i++){
+ AliTPCclusterMI *c=track->GetClusterPointer(i);
+ if (!c) continue;
+ sector = (c->GetDetector()%18);
+ if (!track->Rotate(TMath::DegToRad()*(sector%18*20.+10.)-track->GetAlpha())) {
+ //continue;
+ }
+ ncl++;
+ //if (RejectCluster(c,track)) continue;
+ Double_t r[3]={c->GetX(),c->GetY(),c->GetZ()};
+ Double_t cov[3]={0.01,0.,0.01}; //TODO: correct error parametrisation
+ if (!track->PropagateTo(r[0])) {
+ isOK=kFALSE;
+ }
+ if ( !((static_cast<AliExternalTrackParam*>(track)->Update(&r[1],cov)))) isOK=kFALSE;
+ }
+ //if (!isOK) { delete track; return 0;}
+ paramOut=*track;
+ //
+ //
+ //
+ if (parin) (*parin)=paramIn;
+ if (parout) (*parout)=paramOut;
+ return ncl;
+}
+
+
+
+Bool_t AliTPCseed::RefitTrack(AliTPCseed* /*seed*/, Bool_t /*out*/){
+ //
+ //
+ //
+ return kFALSE;
+}
+
+
+
+
+
+
+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*snp1);
+ //
+ Double_t tgl1=param->GetTgl();
+ tanz=tgl1/TMath::Sqrt(1.-snp1*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*snp1);
+ //
+ Double_t tgl1=param->GetTgl();
+ tanz=tgl1/TMath::Sqrt(1.-snp1*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()));
+}