// date: 27/04/2010 //
// Authors: Magnus Mager, Stefan Rossegger, Jim Thomas //
////////////////////////////////////////////////////////////////////////////////
+#include "Riostream.h"
#include <TH2F.h>
#include <TMath.h>
}
-AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(const AliExternalTrackParam * trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream){
+AliExternalTrackParam * AliTPCCorrection::FitDistortedTrack(AliExternalTrackParam & trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream){
//
// Fit the track parameters - without and with distortion
// 1. Space points in the TPC are simulated along the trajectory
const Double_t kSigmaZ=0.1;
const Double_t kMass = TDatabasePDG::Instance()->GetParticle("pi+")->Mass();
- AliExternalTrackParam track(*trackIn); //
+ AliExternalTrackParam track(trackIn); //
// generate points
AliTrackPointArray pointArray0(npoints0);
AliTrackPointArray pointArray1(npoints0);
AliTrackerBase::PropagateTrackTo(track0,refX,kMass,2.,kTRUE,kMaxSnp);
track1->Rotate(track0->GetAlpha());
- AliTrackerBase::PropagateTrackTo(track1,refX,kMass,2.,kFALSE,kMaxSnp);
+ track1->PropagateTo(track0->GetX(),AliTrackerBase::GetBz());
if (pcstream) (*pcstream)<<Form("fitDistort%s",GetName())<<
"point0.="<<&pointArray0<< // points
"track0.="<<track0<< // fitted track
"track1.="<<track1<< // fitted distorted track
"\n";
+ new(&trackIn) AliExternalTrackParam(*track0);
delete track0;
return track1;
}
+
+void AliTPCCorrection::MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t ptype, TObjArray * corrArray, Int_t step, Bool_t debug ){
+ //
+ // Make a fit tree:
+ // For each partial correction (specified in array) and given track topology (phi, theta, snp, refX)
+ // calculates partial distortions
+ // Partial distortion is stored in the resulting tree
+ // Output is storred in the file distortion_<dettype>_<partype>.root
+ // Partial distortion is stored with the name given by correction name
+ //
+ //
+ // Parameters of function:
+ // input - input tree
+ // dtype - distortion type 0 - ITSTPC, 1 -TPCTRD, 2 - TPCvertex
+ // ppype - parameter type
+ // corrArray - array with partial corrections
+ // step - skipe entries - if 1 all entries processed - it is slow
+ // debug 0 if debug on also space points dumped - it is slow
+ const Int_t kMinEntries=50;
+ Double_t phi,theta, snp, mean,rms, entries;
+ tinput->SetBranchAddress("theta",&theta);
+ tinput->SetBranchAddress("phi", &phi);
+ tinput->SetBranchAddress("snp",&snp);
+ tinput->SetBranchAddress("mean",&mean);
+ tinput->SetBranchAddress("rms",&rms);
+ tinput->SetBranchAddress("entries",&entries);
+ TTreeSRedirector *pcstream = new TTreeSRedirector(Form("distortion%d_%d.root",dtype,ptype));
+ //
+ Int_t nentries=tinput->GetEntries();
+ Int_t ncorr=corrArray->GetEntries();
+ Double_t corrections[100]; //
+ Double_t tPar[5];
+ Double_t cov[15]={0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ Double_t refX=0;
+ Int_t dir=0;
+ if (dtype==0) {refX=85; dir=-1;}
+ if (dtype==1) {refX=245; dir=1;}
+ if (dtype==2) {refX=0; dir=-1;}
+ //
+ for (Int_t ientry=0; ientry<nentries; ientry+=step){
+ tinput->GetEntry(ientry);
+ tPar[0]=0;
+ tPar[1]=theta*refX;
+ tPar[2]=snp;
+ tPar[3]=theta;
+ tPar[4]=0.00001; // should be calculated - non equal to 0
+ cout<<endl<<endl;
+ cout<<"Entry\n\n"<<ientry<<endl;
+ cout<<"dtype="<<dtype<< // detector match type
+ "ptype="<<ptype<< // parameter type
+ "theta="<<theta<< // theta
+ "phi="<<phi<< // phi
+ "snp="<<phi<< // snp
+ "mean="<<mean<< // mean dist value
+ "rms="<<rms<< // rms
+ "entries="<<entries<<endl; // number of entries in bin
+
+ if (TMath::Abs(snp)>0.251) continue;
+ (*pcstream)<<"fit"<<
+ "dtype="<<dtype<< // detector match type
+ "ptype="<<ptype<< // parameter type
+ "theta="<<theta<< // theta
+ "phi="<<phi<< // phi
+ "snp="<<snp<< // snp
+ "mean="<<mean<< // mean dist value
+ "rms="<<rms<< // rms
+ "entries="<<entries;// number of entries in bin
+ //
+ for (Int_t icorr=0; icorr<ncorr; icorr++) {
+ AliTPCCorrection *corr = (AliTPCCorrection*)corrArray->At(icorr);
+ corrections[icorr]=0;
+ if (entries>kMinEntries){
+ AliExternalTrackParam trackIn(refX,phi,tPar,cov);
+ AliExternalTrackParam *trackOut = 0;
+ if (debug) trackOut=corr->FitDistortedTrack(trackIn, refX, dir,pcstream);
+ if (!debug) trackOut=corr->FitDistortedTrack(trackIn, refX, dir,0);
+ corrections[icorr]= trackOut->GetParameter()[ptype]-trackIn.GetParameter()[ptype];
+ delete trackOut;
+ }
+ (*pcstream)<<"fit"<<
+ Form("%s=",corr->GetName())<<corrections[icorr]; // dump correction value
+ }
+ (*pcstream)<<"fit"<<"\n";
+ }
+ delete pcstream;
+}
+
+
+
+
void AliTPCCorrection::StoreInOCDB(Int_t startRun, Int_t endRun, const char *comment){
//
// Store object in the OCDB
// normally called directly in the correction classes which inherit from this class
virtual void SetOmegaTauT1T2(Float_t omegaTau,Float_t t1,Float_t t2);
- AliExternalTrackParam * FitDistortedTrack(const AliExternalTrackParam * trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream);
+ AliExternalTrackParam * FitDistortedTrack(AliExternalTrackParam & trackIn, Double_t refX, Int_t dir,TTreeSRedirector *pcstream);
void StoreInOCDB(Int_t startRun, Int_t endRun, const char *comment=0);
+ static void MakeTrackDistortionTree(TTree *tinput, Int_t dtype, Int_t ptype, TObjArray * corrArray, Int_t step=1, Bool_t debug=0);
protected:
TH2F* CreateTH2F(const char *name,const char *title,
const char *xlabel,const char *ylabel,const char *zlabel,
Double_t dr =fC2*corr;
dx[0]= TMath::Cos(phi)*dr-TMath::Sin(phi)*drphi;
dx[1]= TMath::Sin(phi)*dr+TMath::Cos(phi)*drphi;
- dx[2]= 0.001*dTheta*(r-rmiddle); // dtheta in mrad
+ dx[2]= -0.001*dTheta*(r-rmiddle); // dtheta in mrad
}
#include "AliTPCPointCorrection.h"
#include <TGeoManager.h>
#include <TGeoPhysicalNode.h>
-
+#include "TDatabasePDG.h"
ClassImp(AliTPCcalibCalib)
AliTPCcalibCalib::AliTPCcalibCalib():
AliExternalTrackParam * trackInOld = (AliExternalTrackParam*)track->GetInnerParam();
AliExternalTrackParam * trackOuter = (AliExternalTrackParam*)track->GetOuterParam();
AliExternalTrackParam * trackOutOld = (AliExternalTrackParam *)friendTrack->GetTPCOut();
+ Double_t mass = TDatabasePDG::Instance()->GetParticle("pi+")->Mass();
+
AliExternalTrackParam trackIn = *trackOutOld;
//
// Refit in
//
-
for (Int_t irow=159; irow>0; irow--){
AliTPCclusterMI *cl=seed->GetClusterPointer(irow);
if (!cl) continue;
cov[0]*=cov[0];
cov[2]*=cov[2];
trackIn.GetXYZ(xyz);
- Double_t bz = AliTracker::GetBz(xyz);
+ // Double_t bz = AliTracker::GetBz(xyz);
+
+ // if (!trackIn.PropagateTo(r[0],bz)) continue;
+ if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,0.1,kFALSE)) continue;
- if (!trackIn.PropagateTo(r[0],bz)) continue;
if (RejectCluster(cl,&trackIn)) continue;
nclIn++;
trackIn.Update(&r[1],cov);
cov[0]*=cov[0];
cov[2]*=cov[2];
trackOut.GetXYZ(xyz);
- Double_t bz = AliTracker::GetBz(xyz);
- if (!trackOut.PropagateTo(r[0],bz)) continue;
+ //Double_t bz = AliTracker::GetBz(xyz);
+ // if (!trackOut.PropagateTo(r[0],bz)) continue;
+ if (!AliTracker::PropagateTrackToBxByBz(&trackOut, r[0],mass,0.1,kFALSE)) continue;
+
if (RejectCluster(cl,&trackOut)) continue;
nclOut++;
trackOut.Update(&r[1],cov);
cov[0]*=cov[0];
cov[2]*=cov[2];
trackIn.GetXYZ(xyz);
- Double_t bz = AliTracker::GetBz(xyz);
+ //Double_t bz = AliTracker::GetBz(xyz);
+
+ // if (!trackIn.PropagateTo(r[0],bz)) continue;
+ if (!AliTracker::PropagateTrackToBxByBz(&trackIn, r[0],mass,0.1,kFALSE)) continue;
- if (!trackIn.PropagateTo(r[0],bz)) continue;
if (RejectCluster(cl,&trackIn)) continue;
nclIn++;
trackIn.Update(&r[1],cov);
entry->SetOwner(kTRUE);
fPadGainFactor = (AliTPCCalPad*)entry->GetObject();
}else{
- AliFatal("TPC - Missing calibration entry")
+ AliFatal("TPC - Missing calibration entry TPC/Calib/PadGainFactor")
}
//
entry = GetCDBEntry("TPC/Calib/TimeGain");
entry->SetOwner(kTRUE);
fTimeGainSplines = (TObjArray*)entry->GetObject();
}else{
- AliFatal("TPC - Missing calibration entry")
+ AliFatal("TPC - Missing calibration entry TPC/Calib/Timegain")
}
//
entry = GetCDBEntry("TPC/Calib/GainFactorDedx");
entry->SetOwner(kTRUE);
fDedxGainFactor = (AliTPCCalPad*)entry->GetObject();
}else{
- AliFatal("TPC - Missing calibration entry")
+ AliFatal("TPC - Missing calibration entry TPC/Calib/gainFactordEdx")
}
//
entry = GetCDBEntry("TPC/Calib/PadTime0");
AliFatal("TPC - Missing calibration entry")
}
- entry = GetCDBEntry("TPC/Calib/Distortion");
+ entry = GetCDBEntry("TPC/Calib/Distortion TPC/Calib/PadTime0");
if (entry){
//if (fPadTime0) delete fPadTime0;
entry->SetOwner(kTRUE);
entry->SetOwner(kTRUE);
fParam = (AliTPCParam*)(entry->GetObject()->Clone());
}else{
- AliFatal("TPC - Missing calibration entry")
+ AliFatal("TPC - Missing calibration entry TPC/Calib/Parameters")
}
entry = GetCDBEntry("TPC/Calib/ClusterParam");
}else{
AliError("TPC - Missing calibration entry")
}
+ //TPC space point correction data
+ entry = GetCDBEntry("TPC/Calib/Correction");
+ if (entry){
+ //entry->SetOwner(kTRUE);
+ fComposedCorrection=dynamic_cast<AliTPCCorrection*>(entry->GetObject());
+ fComposedCorrection->Init();
+ }else{
+ AliError("TPC - Missing calibration entry- TPC/Calib/Correction")
+ }
+
//
if (!fTransform) {
fTransform=new AliTPCTransform();
const Double_t kVdYErr = 0.05; // initial uncertainty of the vd correction
const Double_t kOutCut = 1.0; // outlyer cut in AliRelAlgnmentKalman
const Double_t kMinPt = 0.3; // minimal pt
- const Int_t kN=500; // deepnes of history
+ const Int_t kN=50; // deepnes of history
static Int_t kglast=0;
static Double_t* kgdP[4]={new Double_t[kN], new Double_t[kN], new Double_t[kN], new Double_t[kN]};
/*
AliExternalTrackParam pITS(*(friendTrack->GetITSOut())); // ITS standalone if possible
AliExternalTrackParam pITS2(*(friendTrack->GetITSOut())); //TPC-ITS track
pITS2.Rotate(pTPC.GetAlpha());
- pITS2.PropagateTo(pTPC.GetX(),fMagF);
+ // pITS2.PropagateTo(pTPC.GetX(),fMagF);
+ AliTracker::PropagateTrackToBxByBz(&pITS2,pTPC.GetX(),0.1,0.1,kFALSE);
+
AliESDfriendTrack *itsfriendTrack=0;
//
// try to find standalone ITS track corresponing to the TPC if possible
pITS=(*(itsfriendTrack->GetITSOut()));
//
pITS.Rotate(pTPC.GetAlpha());
- pITS.PropagateTo(pTPC.GetX(),fMagF);
+ //pITS.PropagateTo(pTPC.GetX(),fMagF);
+ AliTracker::PropagateTrackToBxByBz(&pITS,pTPC.GetX(),0.1,0.1,kFALSE);
if (TMath::Abs(pITS2.GetY()-pITS.GetY())> kMaxDy) continue;
hasAlone=kTRUE;
}
const Double_t kVdErr = 0.1; // initial uncertainty of the vd correction
const Double_t kVdYErr = 0.05; // initial uncertainty of the vd correction
const Double_t kOutCut = 1.0; // outlyer cut in AliRelAlgnmentKalman
- const Int_t kN=500; // deepnes of history
+ const Double_t kRefX = 275; // reference X
+ const Int_t kN=50; // deepnes of history
static Int_t kglast=0;
static Double_t* kgdP[4]={new Double_t[kN], new Double_t[kN], new Double_t[kN], new Double_t[kN]};
//
if (track->GetTRDclusters(dummycl)<kMinTRD) return; // minimal amount of clusters
if (track->GetTPCNcls()<kMinTPC) return; // minimal amount of clusters cut
if (!friendTrack->GetTRDIn()) return;
+ if (!track->IsOn(AliESDtrack::kTRDrefit)) return;
+ if (!track->IsOn(AliESDtrack::kTRDout)) return;
if (!track->GetInnerParam()) return;
- if (!track->GetOuterParam()) return;
+ if (!friendTrack->GetTPCOut()) return;
// exclude crossing track
- if (track->GetOuterParam()->GetZ()*track->GetInnerParam()->GetZ()<0) return;
+ if (friendTrack->GetTPCOut()->GetZ()*track->GetInnerParam()->GetZ()<0) return;
if (TMath::Abs(track->GetInnerParam()->GetZ())<kMinZ) return;
//
- AliExternalTrackParam &pTPC=(AliExternalTrackParam &)(*(track->GetOuterParam()));
+ AliExternalTrackParam &pTPC=(AliExternalTrackParam &)(*(friendTrack->GetTPCOut()));
+ AliTracker::PropagateTrackToBxByBz(&pTPC,kRefX,0.1,0.1,kFALSE);
AliExternalTrackParam pTRD(*(friendTrack->GetTRDIn()));
pTRD.Rotate(pTPC.GetAlpha());
- pTRD.PropagateTo(pTPC.GetX(),fMagF);
+ // pTRD.PropagateTo(pTPC.GetX(),fMagF);
+ AliTracker::PropagateTrackToBxByBz(&pTRD,pTPC.GetX(),0.1,0.1,kFALSE);
+
((Double_t*)pTRD.GetCovariance())[2]+=3.*3.; // increas sys errors
((Double_t*)pTRD.GetCovariance())[9]+=0.1*0.1; // increse sys errors
Int_t entries=(kglast<kN)?kglast:kN;
for (Int_t i=0;i<4;i++){
vecMedian[i] = TMath::Median(entries,kgdP[i]);
+
vecRMS[i] = TMath::RMS(entries,kgdP[i]);
vecDeltaN[i] = 0;
if (vecRMS[i]>0.){
const Double_t kVdYErr = 0.05; // initial uncertainty of the vd correction
const Double_t kOutCut = 1.0; // outlyer cut in AliRelAlgnmentKalman
- const Int_t kN=1000; // deepnes of history
+ const Int_t kN=50; // deepnes of history
static Int_t kglast=0;
static Double_t* kgdP[4]={new Double_t[kN], new Double_t[kN], new Double_t[kN], new Double_t[kN]};
//
if (track->GetTOFsignal()<=0) return;
if (!friendTrack->GetTPCOut()) return;
if (!track->GetInnerParam()) return;
- if (!track->GetOuterParam()) return;
+ if (!friendTrack->GetTPCOut()) return;
const AliTrackPointArray *points=friendTrack->GetTrackPointArray();
if (!points) return;
- AliExternalTrackParam pTPC(*(track->GetOuterParam()));
+ AliExternalTrackParam pTPC(*(friendTrack->GetTPCOut()));
AliExternalTrackParam pTOF(pTPC);
Double_t mass = TDatabasePDG::Instance()->GetParticle("mu+")->Mass();
Int_t npoints = points->GetNPoints();
//
if (track->GetTPCNcls()<kMinTPC) return; // minimal amount of clusters cut
// exclude crossing track
- if (track->GetOuterParam()->GetZ()*track->GetInnerParam()->GetZ()<0) return;
+ if (friendTrack->GetTPCOut()->GetZ()*track->GetInnerParam()->GetZ()<0) return;
//
if (TMath::Abs(pTOF.GetY()-pTPC.GetY()) >kMaxDy) return;
if (TMath::Abs(pTOF.GetSnp()-pTPC.GetSnp())>kMaxAngle) return;
axisName[3] ="snp";
//
// delta y
- xminTrack[0] =-1.0; xmaxTrack[0]=1.0; //
+ xminTrack[0] =-1.5; xmaxTrack[0]=1.5; //
fResHistoTPCITS[0] = new THnSparseS("TPCITS#Delta_{Y} (cm)","#Delta_{Y} (cm)", 4, binsTrack,xminTrack, xmaxTrack);
fResHistoTPCvertex[0] = new THnSparseS("TPCVertex#Delta_{Y} (cm)","#Delta_{Y} (cm)", 4, binsTrack,xminTrack, xmaxTrack);
- xminTrack[0] =-1.0; xmaxTrack[0]=1.0; //
+ xminTrack[0] =-1.5; xmaxTrack[0]=1.5; //
fResHistoTPCTRD[0] = new THnSparseS("TPCTRD#Delta_{Y} (cm)","#Delta_{Y} (cm)", 4, binsTrack,xminTrack, xmaxTrack);
//
// delta z
//
Double_t histoX[4];
const AliExternalTrackParam * pTPCIn = pTrack->GetInnerParam();
- const AliExternalTrackParam * pTPCvertex = pTrack->GetTPCInnerParam();
+ AliExternalTrackParam pTPCvertex(*(pTrack->GetInnerParam()));
//
AliExternalTrackParam lits(*pTrack);
- lits.Rotate(pTPCvertex->GetAlpha());
- lits.PropagateTo(pTPCvertex->GetX(),fMagF);
+ if (TMath::Abs(pTrack->GetY())>3) return; // beam pipe
+ pTPCvertex.Rotate(lits.GetAlpha());
+ //pTPCvertex.PropagateTo(pTPCvertex->GetX(),fMagF);
+ AliTracker::PropagateTrackToBxByBz(&pTPCvertex,lits.GetX(),0.1,2,kFALSE);
+ AliTracker::PropagateTrackToBxByBz(&pTPCvertex,lits.GetX(),0.1,0.1,kFALSE);
Double_t xyz[3];
pTPCIn->GetXYZ(xyz);
Double_t phi= TMath::ATan2(xyz[1],xyz[0]);
Float_t dca[2], cov[3];
pTrack->GetImpactParametersTPC(dca,cov);
for (Int_t ihisto=0; ihisto<5; ihisto++){
- histoX[0]=pTPCvertex->GetParameter()[ihisto]-lits.GetParameter()[ihisto];
- if (ihisto<2) histoX[0]=dca[ihisto];
+ histoX[0]=pTPCvertex.GetParameter()[ihisto]-lits.GetParameter()[ihisto];
+ // if (ihisto<2) histoX[0]=dca[ihisto];
fResHistoTPCvertex[ihisto]->Fill(histoX);
}
}
//
AliExternalTrackParam ltrd(*pTRDIn);
ltrd.Rotate(pTPCOut->GetAlpha());
- ltrd.PropagateTo(pTPCOut->GetX(),fMagF);
+ // ltrd.PropagateTo(pTPCOut->GetX(),fMagF);
+ AliTracker::PropagateTrackToBxByBz(<rd,pTPCOut->GetX(),0.1,0.1,kFALSE);
for (Int_t ihisto=0; ihisto<5; ihisto++){
histoX[0]=pTPCOut->GetParameter()[ihisto]-ltrd.GetParameter()[ihisto];