#include <TFile.h>
#include <TGraph2D.h>
#include <TH3F.h>
+#include <TH2F.h>
#include <TClonesArray.h>
#include <TPolyLine3D.h>
#include <TPolyMarker3D.h>
,fRoc(AliTPCROC::Instance())
,fPoints(0x0)
,fDistPoints(0x0)
+ ,fProjectionType("XYT")
+ ,fTimeZmin(0.)
+ ,fTimeZmax(0.)
+ ,fGlobalXmin(0.)
+ ,fGlobalXmax(0.)
+ ,fGlobalYmin(0.)
+ ,fGlobalYmax(0.)
{
fEventArray = new TClonesArray("AliToyMCEvent");
,fRoc(drawer.fRoc)
,fPoints(drawer.fPoints)
,fDistPoints(drawer.fDistPoints)
-{
+ ,fProjectionType("XYT")
+ ,fTimeZmin(0.)
+ ,fTimeZmax(0.)
+ ,fGlobalXmin(0.)
+ ,fGlobalXmax(0.)
+ ,fGlobalYmin(0.)
+ ,fGlobalYmax(0.)
+ {
//
}
//_____________________________________________________
xp = prot.GetX();
yp = prot.GetY();
+ Double_t ztime=zDrifted;
+ Double_t globx=xp;
+ Double_t globy=yp;
+
+// if (fProje)
if(track->GetSpacePoint(iPoint)->GetRow()!=255) {
//delete fDispGraph;
//fDispGraph = new TGraph2D();
delete fDispHist;
-
- fDispHist = new TH3F("fDispHist","",100,-fMaxZ0, fMaxZ0, 100,-(fOFCRadius +10), fOFCRadius +10,100,-(fOFCRadius +10), fOFCRadius +10);
+
+ Double_t timeZmin=-fMaxZ0;
+ Double_t timeZmax= fMaxZ0;
+ Double_t globXmin=-(fOFCRadius +10);
+ Double_t globXmax= fOFCRadius +10 ;
+ Double_t globYmin=-(fOFCRadius +10);
+ Double_t globYmax= fOFCRadius +10 ;
+
+ const Double_t epsilon=.001;
+
+ TString title;
+ if (fTimeZmax>fTimeZmin) {
+ timeZmin=fTimeZmin;
+ timeZmax=fTimeZmax;
+ }
+ if (fGlobalXmax>fGlobalXmin) {
+ globXmin=fGlobalXmin;
+ globXmax=fGlobalXmax;
+ }
+ if (fGlobalYmax>fGlobalYmin) {
+ globYmin=fGlobalYmin;
+ globYmax=fGlobalYmax;
+ }
+ if (fProjectionType=="XYT"){
+ fDispHist = new TH3F("fDispHist",";#it{z} [cm]; #it{x} [cm]; #it{y} [cm]",
+ 100, timeZmin-10, timeZmax+10,
+ 100, globXmin, globXmax ,
+ 100, globYmin, globYmax);
+ } else if (fProjectionType=="XT"){
+ fDispHist = new TH2F("fDispHist",";#it{z} [cm]; #it{x} [cm]",
+ 100, timeZmin-10, timeZmax+10,
+ 100, globXmin, globXmax);
+ } else if (fProjectionType=="YT"){
+ fDispHist = new TH2F("fDispHist",";#it{z} [cm]; #it{y} [cm]",
+ 100, timeZmin-10, timeZmax+10,
+ 100, globYmin, globYmax);
+ } else if (fProjectionType=="RT"){
+ fDispHist = new TH2F("fDispHist",";#it{z} [cm]; #it{r} [cm]",
+ 100, timeZmin-10, timeZmax+10,
+ 100, globYmin, globYmax);
+ } else {
+ AliError(Form("Display Format not known: %s",fProjectionType.Data()));
+ return;
+ }
+
+
+
//if(!fDispGraph) fDispGraph = new TGraph();
//fDispGraph->Clear();
fDispHist->SetStats(0);
- fDispHist->GetXaxis()->SetTitle("z [cm]");
- fDispHist->GetYaxis()->SetTitle("x [cm]");
- fDispHist->GetZaxis()->SetTitle("y [cm]");
fDispHist->Draw();
gPad->SetPhi(0);
gPad->SetTheta(0);
- TPolyLine3D *endCap1 = new TPolyLine3D();
- TPolyLine3D *endCap2 = new TPolyLine3D();
- TPolyLine3D *cage[16] ={0x0};
- TPolyLine3D *innerCage[16] ={0x0};
- TPolyLine3D *innerEndCap1 = new TPolyLine3D();
- TPolyLine3D *innerEndCap2 = new TPolyLine3D();
- for(Int_t i = 0; i<16; i++){
+
+ TPolyLine3D *endCap1 = 0x0;
+ if (timeZmin-epsilon<-fMaxZ0)
+ endCap1=new TPolyLine3D();
+ printf("time: %p, %.2f,, %.2f, %.2f, %.2f, %d\n",endCap1,fTimeZmin,fTimeZmax,timeZmin-epsilon,fMaxZ0, timeZmin-epsilon<-fMaxZ0);
+ TPolyLine3D *endCap2 = 0x0;
+ if (timeZmax+epsilon> fMaxZ0)
+ endCap2=new TPolyLine3D();
+
+ TPolyLine3D *outerCE = 0x0;
+ if (timeZmin<0 && timeZmax>0 )
+ outerCE=new TPolyLine3D();
+
+ TPolyLine3D *cage[18] ={0x0};
+
+ TPolyLine3D *innerCage[18] ={0x0};
+
+ TPolyLine3D *innerEndCap1 = 0x0;
+ if (timeZmin-epsilon<-fMaxZ0)
+ innerEndCap1=new TPolyLine3D();
+
+ TPolyLine3D *innerEndCap2 = 0x0;
+ if (timeZmax+epsilon> fMaxZ0)
+ innerEndCap2=new TPolyLine3D();
+
+ TPolyLine3D *innerCE = 0x0;
+ if (timeZmin<0 && timeZmax>0 )
+ innerCE=new TPolyLine3D();
+
+ Int_t iPoint=0;
+ Double_t angle = 0.;
+ Double_t globalX = 0.;
+ Double_t globalY = 0.;
+ Double_t globalXi = 0.;
+ Double_t globalYi = 0.;
+
+ for(Int_t i = 0; i<18; i++){
+ angle = i*TMath::TwoPi()/18;
+ globalX = fOFCRadius*TMath::Cos(angle);
+ globalY = fOFCRadius*TMath::Sin(angle);
+ globalXi = fIFCRadius*TMath::Cos(angle);
+ globalYi = fIFCRadius*TMath::Sin(angle);
- cage[i] = new TPolyLine3D();
- cage[i]->SetPoint(0,-fMaxZ0,fOFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
- cage[i]->SetPoint(1,fMaxZ0,fOFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
- innerCage[i] = new TPolyLine3D();
- innerCage[i]->SetPoint(0,-fMaxZ0,fIFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
- innerCage[i]->SetPoint(1,fMaxZ0,fIFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
-
- endCap1->SetPoint(i,fMaxZ0,fOFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
- endCap2->SetPoint(i,-fMaxZ0,fOFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
-
- innerEndCap1->SetPoint(i,fMaxZ0,fIFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
- innerEndCap2->SetPoint(i,-fMaxZ0,fIFCRadius*TMath::Cos(i*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(i*TMath::TwoPi()/16)) ;
- innerCage[i]->Draw("same");
- if(!(i%2)) cage[i]->Draw("same");
+ cage[iPoint] = new TPolyLine3D();
+ cage[iPoint]->SetPoint(0,timeZmin,globalX ,globalY) ;
+ cage[iPoint]->SetPoint(1, timeZmax,globalX ,globalY) ;
+ innerCage[iPoint] = new TPolyLine3D();
+ innerCage[iPoint]->SetPoint(0,timeZmin,globalXi ,globalYi) ;
+ innerCage[iPoint]->SetPoint(1, timeZmax,globalXi ,globalYi) ;
+
+ // only draw if inside range
+ if (endCap1) { endCap1->SetPoint(i,timeZmax, globalX, globalY); }
+ if (endCap2) { endCap2->SetPoint(i,timeZmin, globalX, globalY); }
+ if (outerCE) { outerCE->SetPoint(i, 0., globalX, globalY); }
- }
- endCap1->SetPoint(16,fMaxZ0,fOFCRadius*TMath::Cos(16*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(16*TMath::TwoPi()/16)) ;
- endCap2->SetPoint(16,-fMaxZ0,fOFCRadius*TMath::Cos(16*TMath::TwoPi()/16) ,fOFCRadius*TMath::Sin(16*TMath::TwoPi()/16)) ;
-
- innerEndCap1->SetPoint(16,fMaxZ0,fIFCRadius*TMath::Cos(16*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(16*TMath::TwoPi()/16)) ;
- innerEndCap2->SetPoint(16,-fMaxZ0,fIFCRadius*TMath::Cos(16*TMath::TwoPi()/16) ,fIFCRadius*TMath::Sin(16*TMath::TwoPi()/16)) ;
+ if (innerEndCap1) { innerEndCap1->SetPoint(i, timeZmax, globalXi, globalYi); }
+ if (innerEndCap2) { innerEndCap2->SetPoint(i, timeZmin, globalXi, globalYi); }
+ if (innerCE) { innerCE->SetPoint(i, 0., globalXi, globalYi); }
+ innerCage[iPoint]->Draw("same");
+
+ if(!(i%2))
+ cage[iPoint]->Draw("same");
- //fDispGraph->SetTitle("ToyMC display");
-
- endCap1->Draw("same");
- endCap2->Draw("same");
+ ++iPoint;
+ }
- innerEndCap2->Draw("same");
- innerEndCap1->Draw("same");
+ //
+ // close endplate and CE polygons
+ //
+ Int_t i=18;
+ angle = i*TMath::TwoPi()/18;
+ globalX = fOFCRadius*TMath::Cos(angle);
+ globalY = fOFCRadius*TMath::Sin(angle);
+ globalXi = fIFCRadius*TMath::Cos(angle);
+ globalYi = fIFCRadius*TMath::Sin(angle);
+ // only draw if inside range
+ if (endCap1) { endCap1->SetPoint(i, timeZmax, globalX, globalY); }
+ if (endCap2) { endCap2->SetPoint(i, timeZmin, globalX, globalY); }
+ if (outerCE) { outerCE->SetPoint(i, 0., globalX, globalY); }
+
+ if (innerEndCap1) { innerEndCap1->SetPoint(i, timeZmax, globalXi, globalYi); }
+ if (innerEndCap2) { innerEndCap2->SetPoint(i, timeZmin, globalXi, globalYi); }
+ if (innerCE) { innerCE ->SetPoint(i, 0., globalXi, globalYi); }
+
+ if (endCap1) { endCap1->Draw("same"); }
+ if (endCap2) { endCap2->Draw("same"); }
+ if (outerCE) { outerCE->Draw("same"); }
-
-
+ if (innerEndCap1) { innerEndCap1->Draw("same"); }
+ if (innerEndCap2) { innerEndCap2->Draw("same"); }
+ if (innerCE) { innerCE ->Draw("same"); }
+
}
//________________________________________________________________
void DrawGeometry();
void DrawEvents(Bool_t both = kFALSE, Bool_t before = kTRUE);
// void DrawEvents(Bool_t time = kTRUE, Bool_t both = kTRUE, Bool_t before = kTRUE);
-
+
+ void SetProjectionType(const char* type) { fProjectionType=type; fProjectionType.ToUpper(); }
+ void SetRangeTimeZ (Float_t min, Float_t max) { fTimeZmin=min; fTimeZmax=max; }
+ void SetRangeGlobalX(Float_t min, Float_t max) { fGlobalXmin=min; fGlobalXmax=max; }
+ void SetRangeGlobalR(Float_t min, Float_t max) { fGlobalXmin=min; fGlobalXmax=max; }
+ void SetRangeGlobalY(Float_t min, Float_t max) { fGlobalYmin=min; fGlobalYmax=max; }
+
const AliToyMCEvent* GetEvent(Int_t eventnr) const {return static_cast<const AliToyMCEvent*>(fEventArray->At(eventnr));}
private:
TString fFileName;
AliToyMCEvent* fEvent;
TClonesArray* fEventArray;
- TH3F* fDispHist;
+ TH1* fDispHist;
Double_t fCenterTime;
Double_t fDriftVel;
TClonesArray *fPoints;
TClonesArray *fDistPoints;
+ TString fProjectionType; // projection type, x,y,z,r combinations
+ Float_t fTimeZmin; // Xmin (time axis)
+ Float_t fTimeZmax; // Xmax (time axis)
+ Float_t fGlobalXmin; // Ymin (global x)
+ Float_t fGlobalXmax; // Ymax (global x)
+ Float_t fGlobalYmin; // Zmin (global y)
+ Float_t fGlobalYmax; // Zmax (global y)
+
Bool_t ConnectInputTree();
ClassDef(AliToyMCDrawer, 1);
// after the correction set the time bin as z-Position in case of a T0 seed
if ( fCreateT0seed )
- xyz[2]=seedCluster[iseed]->GetTimeBin() + ( xyz[2] - zBeforeCorr )/GetVDrift();
+ xyz[2]=seedCluster[iseed]->GetTimeBin() + sign*( zBeforeCorr - xyz[2] )/GetVDrift();
// xyz[2]=seedCluster[iseed]->GetTimeBin()*sign;
seedPoint[iseed].SetXYZ(xyz);
}
if ( fCreateT0seed )
- xyz[2]=cl->GetTimeBin() + ( xyz[2] - zBeforeCorr )/GetVDrift();
+ xyz[2]=cl->GetTimeBin() + sign*( zBeforeCorr - xyz[2] )/GetVDrift();
// xyz[2]=cl->GetTimeBin();
pIn.SetXYZ(xyz);
}
}
- tFirst->GetListOfFriends()->Print();
+ if (tFirst->GetListOfFriends()) tFirst->GetListOfFriends()->Print();
return tFirst;
}
class AliTPCCorrection;
class AliTPCseed;
class AliTPCtrackerRow;
+class AliToyMCTrack;
+class AliTPCclusterMI;
class AliRieman;
+class AliTrackPoint;
+class AliTPCParam;
class AliToyMCReconstruction : public TObject {
public:
void InitSpaceCharge();
+ void SetLongT0seed(Bool_t l) { fLongT0seed=l; }
+ Bool_t GetLongT0seed() const { return fLongT0seed; }
+
static TTree* ConnectTrees(const char* files);
Double_t GetVDrift() const;
// current reconstruction info
Double_t fTime0; // current time0 used for reconstruction
Bool_t fCreateT0seed; // if current seed is the T0 seed
+ Bool_t fLongT0seed; // if we should use a t0 seed including all clusters in the seed range
TTreeSRedirector *fStreamer; // debug streamer
TFile *fInputFile; // input file
+#include "TString.h"
+#include "TFile.h"
+#include "TCanvas.h"
+#include "TMath.h"
+#include "TTree.h"
+#include "TTreeStream.h"
+#include "TROOT.h"
+#include "TSystem.h"
+#include "TStyle.h"
+#include "AliTPCCorrection.h"
+
void makeComparisonTree(TString filename, TString addToName)
{
TFile fn(filename.Data());
gROOT->cd();
- fTPCCorrection=(AliTPCCorrection*)fn.Get("map");
+ AliTPCCorrection *fTPCCorrection=(AliTPCCorrection*)fn.Get("map");
fn.Close();
TString outFile=addToName;
fileName.Append(".root");
TFile f(fileName.Data());
gROOT->cd();
- TTree *t=f.Get("t");
+ TTree *t=(TTree*)f.Get("t");
gStyle->SetTitleX(0.18);
gStyle->SetTitleW(1-.18-.1);
f.Close();
}
+void makeHistosDist(TString addToName) {
+ TString fileName; //("test_");
+ fileName.Append(addToName.Data());
+ fileName.Append(".root");
+ TFile f(fileName.Data());
+ gROOT->cd();
+ TTree *t=(TTree*)f.Get("t");
+ gStyle->SetTitleX(0.18);
+ gStyle->SetTitleW(1-.18-.1);
+
+ t->SetMarkerStyle(20);
+ t->SetMarkerSize(.8);
+
+ TCanvas *c=0x0;
+ c=GetCanvas(addToName+"_zResDist");
+ t->Draw("zd-z:z:r","","colz");
+ c->SaveAs(Form("%s_zResDist.png",addToName.Data()));
+ //
+ c=GetCanvas(addToName+"_rResDist");
+ t->Draw("rd-r:z:r","","colz");
+ c->SaveAs(Form("%s_rResDist.png",addToName.Data()));
+ //
+ c=GetCanvas(addToName+"_phiResDist");
+ t->Draw("phid-phi:z:r","abs(phid-phi)<1","colz");
+ c->SaveAs(Form("%s_phiResDist.png",addToName.Data()));
+ //
+ c=GetCanvas(addToName+"_rphiResDist");
+ t->Draw("(phid*rd)-(phi*r):z+(r-84)/(254-84)*18:r","abs(phid-phi)<1","colz");
+ c->SaveAs(Form("%s_rphiResDist.png",addToName.Data()));
+
+ f.Close();
+}
void makeAllHistos() {
}
+void makeAllHistosDist() {
+ makeHistosDist("LUT_05");
+ makeHistosDist("LUT_10");
+ makeHistosDist("LUT_20");
+
+}
+
TCanvas *GetCanvas(TString addToName)
{
TString cName(addToName);
cName.Prepend("c_");
- TCanvas *c=gROOT->GetListOfCanvases()->FindObject(cName.Data());
+ TCanvas *c=(TCanvas*)gROOT->GetListOfCanvases()->FindObject(cName.Data());
if (!c) c=new TCanvas(cName.Data(),addToName.Data());
c->Clear();
c->cd();
--- /dev/null
+/*
+ *
+
+ .L $ALICE_ROOT/TPC/Upgrade/macros/finalPlots.C+g
+ finalPlots("eps10/medStat/*.debug.root","eps20/medStat/*.debug.root")
+
+ finalPlots("eps10/medStat/*.debug.root","eps20/medStat/*.debug.root","/data/Work/software/svncern/papers/TDR/08-Monitoring_calib/figs")
+
+
+*/
+
+#include "TLegend.h"
+#include "TCanvas.h"
+#include "TString.h"
+#include "TStyle.h"
+#include "TColor.h"
+#include "TPaveStats.h"
+#include "TH1.h"
+#include "TFile.h"
+#include "TTree.h"
+#include "TROOT.h"
+#include "TSystem.h"
+#include "AliToyMCReconstruction.h"
+
+void SetStyle();
+TCanvas *GetCanvas(TString name, TString title, Float_t nx=1, Float_t ny=1);
+void SaveCanvas(TCanvas *c);
+void DrawOnTop(TPad *c, TObjArray &arrHists, Bool_t stats);
+
+TString fSaveDir;
+
+void finalPlots(const char* filesEps10, const char* filesEps20, TString saveDir="")
+{
+ fSaveDir=saveDir;
+
+ TString idealUndistorted("t1_0_0_130_10.");
+ TString idealDistorted("t1_1_3_130_10.");
+ TString distorted("t0_1_0_130_10.");
+ TString realTracking("t0_1_2_130_10.");
+
+ SetStyle();
+
+ TTree *tEps10=AliToyMCReconstruction::ConnectTrees(filesEps10);
+ TTree *tEps20=AliToyMCReconstruction::ConnectTrees(filesEps20);
+
+ TString test(tEps10->GetCurrentFile()->GetName());
+ if (!test.Contains("0_0_0_")) {
+ printf("ERROR: default file is not '0_0_0'\n");
+ return;
+ }
+
+ if (tEps10->GetListOfFriends()->GetEntries()!=5 || tEps20->GetListOfFriends()->GetEntries()!=5) {
+ printf("ERROR: wrong number of entries in the friends, not default\n");
+ return;
+ }
+
+ TString drawStr;
+
+ //
+ // T0seed resolution
+ //
+ TCanvas *cT0res=GetCanvas("T0seedResolution","T0 seed resolution");
+ //ideal undistorted
+ TH1F *hT0resI = new TH1F("hT0resI","T0 resolution;(#it{t}_{0}^{seed}-#it{t}_{0}) #upoint #it{v}_{drift};#tracks",100,-50.1,50.1);
+ drawStr=Form("(%sfTime0-t0)*vDrift",idealUndistorted.Data());
+ tEps20->Draw(drawStr+">>hT0resI","","goff");
+ //fully distorted
+ TH1F *hT0resD = new TH1F("hT0resD","T0 resolution;(#it{t}_{0}^{seed}-#it{t}_{0}) #upoint #it{v}_{drift};#tracks",100,-50.1,50.1);
+ hT0resD->SetLineColor(kRed);
+ drawStr=Form("(%sfTime0-t0)*vDrift",distorted.Data());
+ tEps20->Draw(drawStr+">>hT0resD","","goff");
+ //distorted and average correction
+ TH1F *hT0resDC = new TH1F("hT0resDC","T0 resolution;(#it{t}_{0}^{seed}-#it{t}_{0}) #upoint #it{v}_{drift};#tracks",100,-50.1,50.1);
+// hT0resDC->SetLineColor(kGreen+2);
+ drawStr=Form("(%sfTime0-t0)*vDrift",realTracking.Data());
+ tEps20->Draw(drawStr+">>hT0resDC","","goff");
+
+// hT0resI->Draw();
+// hT0resD->Draw("same");
+ hT0resDC->Draw(/*"same"*/);
+
+ SaveCanvas(cT0res);
+
+ //
+ // Track parameter resolution (y) with ideal clusters at the ITS and inner wall of the TPC
+ //
+ TCanvas *cYresComparison=GetCanvas("YresComparison","Comparison of Yres for ideal clusters");
+ //ideal clusters at the ITS outermost point
+ TH1F *hYresITS = new TH1F("hYresITS",";#it{y}_{TPC}-#it{y}_{ITS};#tracks",100,-0.21,0.21);
+ drawStr=Form("%strackITS.fP[0]-%stRealITS.fP[0]",idealUndistorted.Data(),idealUndistorted.Data());
+ tEps20->Draw(drawStr+">>hYresITS","","goff");
+ hYresITS->SetLineColor(kRed);
+
+ TH1F *hYresTPC = new TH1F("hYresTPC",";#it{y}_{TPC}-#it{y}_{ITS};#tracks",100,-0.21,0.21);
+ drawStr=Form("%strackITS2.fP[0]-%stRealITS2.fP[0]",idealUndistorted.Data(),idealUndistorted.Data());
+ tEps20->Draw(drawStr+">>hYresTPC","","goff");
+
+ hYresTPC->Draw();
+ hYresITS->Draw("same");
+
+ SaveCanvas(cYresComparison);
+
+ //
+ // Track parameter resolution (y) with fully distorted clusters at the inner wall of the TPC
+ //
+
+ TCanvas *cYresDistorted=GetCanvas("YresDistorted","Yres for fully distorted clusters");
+ //ideal clusters at the ITS outermost point
+ TH1F *hYresDist = new TH1F("hYresDist",";#it{y}_{TPC}-#it{y}_{ITS};#tracks",100,-15.5,15.5);
+ drawStr=Form("%strackITS2.fP[0]-%stRealITS2.fP[0]",distorted.Data(),distorted.Data());
+ tEps20->Draw(drawStr+">>hYresDist","","goff");
+
+ hYresDist->Draw();
+
+ SaveCanvas(cYresDistorted);
+
+ //
+ // Track parameter resolution (y) with fully distorted and corrected clusters (Tzero seed)
+ // at the inner wall of the TPC
+ //
+
+ TCanvas *cYresDistCorrTzeroSeed=GetCanvas("YresDistCorrTzeroSeed","Yres for fully distorted/corrected clusters (Tzero seed)");
+ //ideal clusters at the ITS outermost point
+ TH1F *hYresDistCorrTzeroSeed = new TH1F("hYresDistCorrTzeroSeed",";#it{y}_{TPC}-#it{y}_{ITS};#tracks",100,-.5,1.5);
+ drawStr=Form("%strackITS2.fP[0]-%stRealITS2.fP[0]",realTracking.Data(),realTracking.Data());
+ tEps20->Draw(drawStr+">>hYresDistCorrTzeroSeed","","goff");
+
+ hYresDistCorrTzeroSeed->Draw();
+
+ SaveCanvas(cYresDistCorrTzeroSeed);
+
+ //
+ // Track parameter resolution (y) with fully distorted and corrected clusters (Tzero seed)
+ // at the inner wall of the TPC
+ //
+
+ TCanvas *cYresDistCorrTzero=GetCanvas("YresDistCorrTzero","Yres for fully distorted/corrected clusters (Tzero)");
+ //ideal clusters at the ITS outermost point
+ TH1F *hYresDistCorrTzero = new TH1F("hYresDistCorrTzero",";#it{y}_{TPC}-#it{y}_{ITS};#tracks",100,-.5,1.5);
+ drawStr=Form("%strackITS2.fP[0]-%stRealITS2.fP[0]",idealDistorted.Data(),idealDistorted.Data());
+ tEps20->Draw(drawStr+">>hYresDistCorrTzero","","goff");
+
+ hYresDistCorrTzero->Draw();
+
+ SaveCanvas(cYresDistCorrTzero);
+
+
+ //
+ // plot all params
+ //
+
+ TString titles[5]={"#it{y}_{TPC}-#it{y}_{ITS}","#it{z}_{TPC}-#it{z}_{ITS}","sin(#it{#alpha})_{TPC}-sin(#it{#alpha})_{ITS}","tan(#it{#lambda})_{TPC}-tan(#it{#lambda})_{ITS}","1/#it{p}_{T TPC}-1/#it{p}_{T ITS}"};
+ Double_t min[5]={-.5,-0.199,-.009,-.0019,-.039};
+ Double_t max[5]={1.5, 0.199, .009, .0019, .09};
+ TString type[3]={idealUndistorted,idealDistorted,realTracking};
+ Int_t colors[3]={kBlack,kGreen-2,kRed};
+
+ TLegend *leg=new TLegend(.1,.55,.95,.95);
+ leg->SetTextSize(0.075);
+ leg->SetBorderSize(1);
+ leg->SetFillColor(10);
+ TCanvas *cResParams=GetCanvas("ResParams","Resolution of parameters",1.2,1.8);
+ cResParams->Divide(2,3);
+ for (Int_t i=0;i<5;++i){
+ TPad *pad=(TPad*)cResParams->cd(i+1);
+ TObjArray arr;
+ for (Int_t it=0; it<3; ++it) {
+ TH1F *hResParams=new TH1F(Form("hResParams_%d_%d",i,it),
+ Form(";%s;#tracks",titles[i].Data()),
+ 100,min[i],max[i]);
+ drawStr=Form("%strackITS2.fP[%d]-tRealITS2.fP[%d]",type[it].Data(),i,i);
+ tEps20->Draw(drawStr+Form(">>hResParams_%d_%d",i,it),"","goff");
+ hResParams->SetLineColor(colors[it]);
+ arr.Add(hResParams);
+ }
+ if (i==0) {
+ leg->AddEntry(arr.At(0),"no distortions (ideal)","l");
+ leg->AddEntry(arr.At(1),"distorted/corrected (t_{0})","l");
+ leg->AddEntry(arr.At(2),"distorted/corrected (t_{0}^{seed})","l");
+ }
+ DrawOnTop(pad,arr,kTRUE);
+ }
+
+ cResParams->cd(6);
+ leg->Draw();
+ SaveCanvas(cResParams);
+}
+
+
+TCanvas *GetCanvas(TString name, TString title, Float_t nx, Float_t ny)
+{
+ TCanvas *c=(TCanvas*)gROOT->GetListOfCanvases()->FindObject(name.Data());
+ if (!c) c=new TCanvas(name,title,nx*700,ny*500);
+ c->Clear();
+ c->cd();
+ return c;
+}
+
+void SaveCanvas(TCanvas *c)
+{
+ //
+ //
+ //
+
+ if (fSaveDir.IsNull()) return;
+
+ c->SaveAs(Form("/tmp/%s.eps",c->GetName()));
+ gSystem->Exec(Form("ps2pdf -dEPSCrop /tmp/%s.eps %s/%s.pdf",c->GetName(),fSaveDir.Data(),c->GetName()));
+}
+
+void DrawOnTop(TPad *c, TObjArray &arrHists, Bool_t /*stats*/)
+{
+ Double_t min=0,max=0;
+ Double_t ystatMax=gStyle->GetStatY();
+ Double_t ystatH =gStyle->GetStatH()*2./3.;
+ const Int_t nHists=arrHists.GetEntriesFast();
+ for (Int_t iHist=0; iHist<nHists; ++iHist) {
+ TH1 *h=(TH1*)arrHists.UncheckedAt(iHist);
+ TPad *pad = new TPad(Form("%s_%d",c->GetName(),iHist+1),"",0,0,1,1);
+ pad->SetFillStyle(4000);
+ pad->SetFrameFillStyle(0);
+ pad->Draw();
+ pad->cd();
+ if (iHist>0) {
+ h->SetMinimum(min);
+ h->SetMaximum(max);
+ pad->SetTicky(0);
+ pad->SetTickx(0);
+ }
+ h->Draw((iHist==0)?"":"AH");
+ pad->Update();
+ if (iHist==0){
+ min=pad->GetUymin();
+ max=pad->GetUymax();
+ printf("min: %.2f %.2f\n",min,max);
+ }
+ TPaveStats *ps = (TPaveStats*)h->GetListOfFunctions()->FindObject("stats");
+ if (!ps) printf("shitttt %s\n",h->GetName());
+ else {
+ ps->SetTextColor(h->GetLineColor());
+ ps->SetY2NDC(ystatMax-iHist*ystatH);
+ ps->SetY1NDC(ystatMax-(iHist+1)*ystatH);}
+ }
+}
+
+void SetStyle()
+{
+ const Int_t NCont=255;
+ //const Int_t NCont=50;
+
+ TStyle *st = new TStyle("mystyle","mystyle");
+ gROOT->GetStyle("Plain")->Copy((*st));
+ st->SetTitleX(0.1);
+ st->SetTitleW(0.8);
+ st->SetTitleH(0.08);
+ st->SetStatX(.95);
+ st->SetStatY(.95);
+ st->SetStatW(.25);
+ st->SetStatH(.25);
+ st->SetNumberContours(NCont);
+ st->SetPalette(1,0);
+ st->SetOptStat("rm");
+ st->SetOptTitle(0);
+ st->SetOptFit(0);
+ st->SetGridColor(kGray+1);
+// st->SetPadGridX(kTRUE);
+// st->SetPadGridY(kTRUE);
+ st->SetPadTickX(kTRUE);
+ st->SetPadTickY(kTRUE);
+ st->SetMarkerStyle(20);
+ st->SetMarkerSize(.5);
+
+ st->SetPadLeftMargin(0.12);
+ st->SetPadBottomMargin(0.12);
+ st->SetPadRightMargin(0.05);
+ st->SetPadTopMargin(0.05);
+ st->cd();
+
+ Int_t nimTPCFont=42; //or 62 for sans serif font
+ //default definitions
+ st->SetTextFont(nimTPCFont);
+ st->SetTitleFont(nimTPCFont, "T");
+ st->SetTitleFont(nimTPCFont, "XYZ");
+ st->SetLabelFont(nimTPCFont,"XYZ");
+ st->SetLabelSize(0.045,"XYZ");
+ st->SetTitleSize(0.05,"XYZ");
+ st->SetTitleOffset(1.1,"XZ");
+ st->SetTitleOffset(1.3,"Y");
+ st->SetStatFont(nimTPCFont);
+ st->SetOptTitle(0);
+ st->SetPalette(1,0);
+ st->SetStatBorderSize(1);
+ new TColor(2001,1,1,1);
+ st->SetFillColor(2001);
+ st->SetTickLength(gStyle->GetTickLength()/696.*472.,"y");
+
+ const Int_t NRGBs = 5;
+ Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
+ Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
+ Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
+ Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
+ //grey
+ // Double_t stops[5] = {0.00, 0.34, 0.61, 0.84, 1.00};
+ // Double_t red[5] = {1.00, 0.84, 0.61, 0.34, 0.00};
+ // Double_t green[5] = {1.00, 0.84, 0.61, 0.34, 0.00};
+ // Double_t blue[5] = {1.00, 0.84, 0.61, 0.34, 0.00};
+
+ TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
+
+ st->cd();
+}
+