#include "AliTPCParamSR.h"
#include "AliTPCcalibTimeGain.h"
#include "AliTPCcalibGainMult.h"
+#include "AliTPCcalibAlign.h"
#include "AliSplineFit.h"
#include "AliTPCComposedCorrection.h"
#include "AliTPCExBTwist.h"
#include "TChain.h"
#include "TCut.h"
#include "AliTrackerBase.h"
+#include "AliTracker.h"
#include "AliTPCPreprocessorOffline.h"
+#include "AliTPCCorrectionFit.h"
-
+using std::endl;
+using std::cout;
ClassImp(AliTPCPreprocessorOffline)
AliTPCPreprocessorOffline::AliTPCPreprocessorOffline():
TObjArray *hisArray =timeDrift->GetHistoDrift();
{for (Int_t i=0; i<hisArray->GetEntriesFast(); i++){
THnSparse* addHist=(THnSparse*)hisArray->UncheckedAt(i);
- if (addHist->GetEntries()<fMinEntries) continue;
if (!addHist) continue;
+ if (addHist->GetEntries()<fMinEntries) continue;
TH1D* histo =addHist->Projection(3);
TH1D* histoTime=addHist->Projection(0);
printf("%s\t%f\t%d\t%d\n",histo->GetName(), histo->GetEntries(),histo->FindFirstBinAbove(0),histo->FindLastBinAbove(0));
Float_t maxGain = fMaxGain;
TGraphErrors *gr = (TGraphErrors*)fGainArray->FindObject("TGRAPHERRORS_MEAN_GAIN_BEAM_ALL");
- if(!gr) return kFALSE;
+ if (!gr) {
+ gr = (TGraphErrors*)fGainArray->FindObject("TGRAPHERRORS_MEAN_GAIN_COSMIC_ALL");
+ if (!gr) return kFALSE;
+ Printf("Assuming given run is a cosmic run. Using gain calibration from Fermi-plateau muons.");
+ }
if(gr->GetN()<1) return kFALSE;
// check whether gain in the range
arrayTRD=timeDrift->GetAlignTRDTPC();
arrayTOF=timeDrift->GetAlignTOFTPC();
- if (arrayITS->GetEntries()>0) mstatITS= AliTPCcalibDButil::MakeStatRelKalman(arrayITS,0.9,50,fMaxVdriftCorr);
- if (arrayTOF->GetEntries()>0) mstatTOF= AliTPCcalibDButil::MakeStatRelKalman(arrayTOF,0.9,1000,fMaxVdriftCorr);
- if (arrayTRD->GetEntries()>0) mstatTRD= AliTPCcalibDButil::MakeStatRelKalman(arrayTRD,0.9,50,fMaxVdriftCorr);
+ if (arrayITS->GetEntries()>0) mstatITS= AliTPCcalibDButil::MakeStatRelKalman(arrayITS,0.7,50,fMaxVdriftCorr);
+ if (arrayTOF->GetEntries()>0) mstatTOF= AliTPCcalibDButil::MakeStatRelKalman(arrayTOF,0.7,1000,fMaxVdriftCorr);
+ if (arrayTRD->GetEntries()>0) mstatTRD= AliTPCcalibDButil::MakeStatRelKalman(arrayTRD,0.7,50,fMaxVdriftCorr);
//
TObjArray * arrayITSP= AliTPCcalibDButil::SmoothRelKalman(arrayITS,*mstatITS, 0, 5.);
TObjArray * arrayITSM= AliTPCcalibDButil::SmoothRelKalman(arrayITS,*mstatITS, 1, 5.);
AnalyzeAttachment(startRunNumber,endRunNumber);
AnalyzePadRegionGain();
AnalyzeGainMultiplicity();
+ AnalyzeGainChamberByChamber();
//
// 3. Make control plots
//
}
+Bool_t AliTPCPreprocessorOffline::AnalyzeGainChamberByChamber(){
+ //
+ // get chamber by chamber gain
+ //
+ TGraphErrors *grShort = fGainMult->GetGainPerChamber(0);
+ TGraphErrors *grMedium = fGainMult->GetGainPerChamber(1);
+ TGraphErrors *grLong = fGainMult->GetGainPerChamber(2);
+ if (grShort==0x0 || grMedium==0x0 || grLong==0x0) {
+ delete grShort;
+ delete grMedium;
+ delete grLong;
+ return kFALSE;
+ }
+
+ fGainArray->AddLast(grShort);
+ fGainArray->AddLast(grMedium);
+ fGainArray->AddLast(grLong);
+
+ return kTRUE;
+}
void AliTPCPreprocessorOffline::UpdateOCDBGain(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath){
//
void AliTPCPreprocessorOffline::MakeFitTime(){
//
- // mak aligment fit - store results in the file
+ // make aligment fit - store results in the file
//
const Int_t kMinEntries=1000;
MakeChainTime();
fstringFast+="dITS*FAlignRot1++";
fstringFast+="dITS*FAlignRot2++";
- TCut cutFit="entries>10&&abs(mean)>0.00001";
+ TCut cutFit="entries>10&&abs(mean)>0.00001&&rms>0";
fAlignTree->SetAlias("err","rms");
TString *strDeltaITS = TStatToolkit::FitPlaneConstrain(fAlignTree,"mean:err", fstringFast.Data(),cutFit, chi2,npoints,param,covar,-1,0, npointsMax, 1);
void AliTPCPreprocessorOffline::MakeChainTime(){
+ //
+ //
//
TFile f("CalibObjects.root");
+
// const char *cdtype[7]={"ITS","TRD","Vertex","TOF","TPC","TPC0","TPC1"};
//const char *cptype[5]={"dy","dz","dsnp","dtheta","d1pt"};
const char * hname[5]={"dy","dz","dsnp","dtheta","d1pt"};
Int_t run=0;
- AliTPCcalibTime *calibTime= (AliTPCcalibTime*) f.Get("calibTime");
+ AliTPCcalibTime *calibTime = 0;
+ TObjArray * array = (TObjArray*)f.Get("TPCCalib");
+ if (array){
+ calibTime = (AliTPCcalibTime *)array->FindObject("calibTime");
+ } else {
+ calibTime = (AliTPCcalibTime*)f.Get("calibTime");
+ }
if (!calibTime) return;
+ AliTPCCorrectionFit::CreateAlignMaps(AliTracker::GetBz(), run);
TTreeSRedirector *pcstream = new TTreeSRedirector("meanITSVertex.root");
//
Int_t ihis=0;
his->GetAxis(1)->SetRangeUser(-1.1,1.1);
his->GetAxis(2)->SetRange(0,1000000);
his->GetAxis(3)->SetRangeUser(-0.35,0.35);
- AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("ITS%s",hname[ihis]),run,85.,ihis,5);
+ AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("ITS%s",hname[ihis]),run,85.,ihis,3);
}
ihis=1;
his = calibTime->GetResHistoTPCITS(ihis);
his->GetAxis(1)->SetRangeUser(-1.1,1.1);
his->GetAxis(2)->SetRange(0,1000000);
his->GetAxis(3)->SetRangeUser(-0.35,0.35);
- AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("ITS%s",hname[ihis]),run,85.,ihis,5);
+ AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("ITS%s",hname[ihis]),run,85.,ihis,3);
}
ihis=2;
his = calibTime->GetResHistoTPCITS(ihis);
his->GetAxis(1)->SetRangeUser(-1.1,1.1);
his->GetAxis(2)->SetRange(0,1000000);
his->GetAxis(3)->SetRangeUser(-0.35,0.35);
- AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("ITS%s",hname[ihis]),run,85.,ihis,5);
+ AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("ITS%s",hname[ihis]),run,85.,ihis,3);
}
ihis=0;
his = calibTime->GetResHistoTPCvertex(ihis);
his->GetAxis(1)->SetRangeUser(-1.1,1.1);
his->GetAxis(2)->SetRange(0,1000000);
his->GetAxis(3)->SetRangeUser(-0.35,0.35);
- AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("Vertex%s",hname[ihis]),run,0.,ihis,5);
+ AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("Vertex%s",hname[ihis]),run,0.,ihis,3);
}
ihis=2;
his = calibTime->GetResHistoTPCvertex(ihis);
his->GetAxis(1)->SetRangeUser(-1.1,1.1);
his->GetAxis(2)->SetRange(0,1000000);
his->GetAxis(3)->SetRangeUser(-0.35,0.35);
- AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("Vertex%s",hname[ihis]),run,0.,ihis,5);
+ AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("Vertex%s",hname[ihis]),run,0.,ihis,3);
}
ihis=1;
his->GetAxis(1)->SetRangeUser(-1.1,1.1);
his->GetAxis(2)->SetRange(0,1000000);
his->GetAxis(3)->SetRangeUser(-0.35,0.35);
- AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("Vertex%s",hname[ihis]),run,0.,ihis,5);
+ AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("Vertex%s",hname[ihis]),run,0.,ihis,3);
}
ihis=0;
his->GetAxis(1)->SetRangeUser(-1.1,1.1);
his->GetAxis(2)->SetRange(0,1000000);
his->GetAxis(3)->SetRangeUser(-0.35,0.35);
- AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("TOF%s",hname[ihis]),run,0.,ihis,10);
+ AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("TOF%s",hname[ihis]),run,0.,ihis,3);
}
ihis=0;
his->GetAxis(1)->SetRangeUser(-1.1,1.1);
his->GetAxis(2)->SetRange(0,1000000);
his->GetAxis(3)->SetRangeUser(-0.35,0.35);
- AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("TRD%s",hname[ihis]),run,0.,ihis,10);
+ AliTPCCorrection::MakeDistortionMap(his,pcstream, Form("TRD%s",hname[ihis]),run,0.,ihis,3);
}
delete pcstream;
}
+Double_t AliTPCPreprocessorOffline::EvalAtPar(Double_t phi0, Double_t snp, Double_t refX, Double_t theta, Int_t corr, Int_t ptype, Int_t nsteps){
+ //
+ // Fit the distortion along the line with the parabolic model
+ // Parameters:
+ // phi0 - phi at the entrance of the TPC
+ // snp - local inclination angle at the entrance of the TPC
+ // refX - ref X where the distortion is evanluated
+ // theta
+ //
+ static TLinearFitter fitter(3,"pol2");
+ fitter.ClearPoints();
+ if (nsteps<3) nsteps=3;
+ Double_t deltaX=(245-85)/(nsteps);
+ for (Int_t istep=0; istep<(nsteps+1); istep++){
+ //
+ Double_t localX =85.+deltaX*istep;
+ Double_t localPhi=phi0+deltaX*snp*istep;
+ Double_t sector = 9*localPhi/TMath::Pi();
+ if (sector<0) sector+=18;
+ Double_t y=AliTPCCorrection::GetCorrSector(sector,localX,theta,1,corr);
+ Double_t dlocalX=AliTPCCorrection::GetCorrSector(sector,localX,theta,0,corr);
+ Double_t x[1]={localX-dlocalX};
+ fitter.AddPoint(x,y);
+ }
+ fitter.Eval();
+ Double_t par[3];
+ par[0]=fitter.GetParameter(0);
+ par[1]=fitter.GetParameter(1);
+ par[2]=fitter.GetParameter(2);
+
+ if (ptype==0) return par[0]+par[1]*refX+par[2]*refX*refX;
+ if (ptype==2) return par[1]+2*par[2]*refX;
+ if (ptype==4) return par[2];
+ return 0;
+}
+
+
+
+
+
void AliTPCPreprocessorOffline::MakePrimitivesTime(){
//
f->Close();
}
-
-
-