////////////////////////////////////////////////////////////////////////////
#include <TSystem.h>
-
+#include <TStyle.h>
#include <TROOT.h>
#include <TObjArray.h>
#include <TH3.h>
#include <TH2.h>
#include <TH1.h>
+#include <THnSparse.h>
#include <TF1.h>
#include <TCanvas.h>
#include <TGaxis.h>
#include "AliTRDresolution.h"
#include "AliTRDgeometry.h"
+#include "AliTRDtransform.h"
#include "AliTRDpadPlane.h"
#include "AliTRDcluster.h"
#include "AliTRDseedV1.h"
#include "AliTRDrecoParam.h"
#include "AliTRDpidUtil.h"
#include "AliTRDinfoGen.h"
-
+#include "AliAnalysisManager.h"
#include "info/AliTRDclusterInfo.h"
+#include "info/AliTRDeventInfo.h"
ClassImp(AliTRDresolution)
-
-UChar_t const AliTRDresolution::fgNproj[kNviews] = {
- 2, 2, 5, 5, 5,
- 2, 5, 11, 11, 11
-};
-Char_t const * AliTRDresolution::fgPerformanceName[kNviews] = {
- "Charge"
+ClassImp(AliTRDresolution::AliTRDresolutionProjection)
+
+Int_t const AliTRDresolution::fgkNbins[kNdim] = {
+ Int_t(kNbunchCross)/*bc*/,
+ 180/*phi*/,
+ 50/*eta*/,
+ 50/*dy*/,
+ 40/*dphi*/,
+ 50/*dz*/,
+ 3/*chg*species*/,
+ kNpt/*pt*/
+}; //! no of bins/projection
+Double_t const AliTRDresolution::fgkMin[kNdim] = {
+ -1.5,
+ -TMath::Pi(),
+ -1.,
+ -1.5,
+ -10.,
+ -2.5,
+ -1.5,
+ -0.5
+}; //! low limits for projections
+Double_t const AliTRDresolution::fgkMax[kNdim] = {
+ 1.5,
+ TMath::Pi(),
+ 1.,
+ 1.5,
+ 10.,
+ 2.5,
+ 1.5,
+ kNpt-0.5
+}; //! high limits for projections
+Char_t const *AliTRDresolution::fgkTitle[kNdim] = {
+ "bunch cross",
+ "#phi [rad]",
+ "#eta",
+ "#Deltay [cm]",
+ "#Delta#phi [deg]",
+ "#Deltaz [cm]",
+ "chg*spec*rc",
+ "bin_p_{t}"
+}; //! title of projection
+
+Char_t const * AliTRDresolution::fgPerformanceName[kNclasses] = {
+ "Det2Cluster"
,"Cluster2Track"
,"Tracklet2Track"
- ,"Tracklet2TRDin"
- ,"Tracklet2TRDout"
+ ,"Tracklet2TRDin"
,"Cluster2MC"
,"Tracklet2MC"
,"TRDin2MC"
- ,"TRDout2MC"
,"TRD2MC"
+// ,"Tracklet2TRDout"
+// ,"TRDout2MC"
};
-Char_t const * AliTRDresolution::fgParticle[11]={
- " p bar", " K -", " #pi -", " #mu -", " e -",
- " No PID",
- " e +", " #mu +", " #pi +", " K +", " p",
-};
-
-// Configure segmentation for y resolution/residuals
-Int_t const AliTRDresolution::fgkNresYsegm[3] = {
- AliTRDgeometry::kNsector
- ,AliTRDgeometry::kNsector*AliTRDgeometry::kNstack
- ,AliTRDgeometry::kNdet
-};
-Char_t const *AliTRDresolution::fgkResYsegmName[3] = {
- "Sector", "Stack", "Detector"};
-
+Float_t AliTRDresolution::fgPtBin[kNpt+1];
//________________________________________________________
AliTRDresolution::AliTRDresolution()
:AliTRDrecoTask()
- ,fSegmentLevel(0)
,fIdxPlot(0)
,fIdxFrame(0)
- ,fPtThreshold(1.)
- ,fDyRange(1.5)
+ ,fPtThreshold(.3)
+ ,fDyRange(0.75)
+ ,fBCbinTOF(0)
+ ,fBCbinFill(0)
+ ,fProj(NULL)
,fDBPDG(NULL)
- ,fGraphS(NULL)
- ,fGraphM(NULL)
,fCl(NULL)
,fMCcl(NULL)
-/* ,fTrklt(NULL)
- ,fMCtrklt(NULL)*/
{
//
// Default constructor
//
SetNameTitle("TRDresolution", "TRD spatial and momentum resolution");
- SetSegmentationLevel();
+ MakePtSegmentation();
}
//________________________________________________________
-AliTRDresolution::AliTRDresolution(char* name)
+AliTRDresolution::AliTRDresolution(char* name, Bool_t xchange)
:AliTRDrecoTask(name, "TRD spatial and momentum resolution")
- ,fSegmentLevel(0)
,fIdxPlot(0)
,fIdxFrame(0)
- ,fPtThreshold(1.)
- ,fDyRange(1.5)
+ ,fPtThreshold(.3)
+ ,fDyRange(0.75)
+ ,fBCbinTOF(0)
+ ,fBCbinFill(0)
+ ,fProj(NULL)
,fDBPDG(NULL)
- ,fGraphS(NULL)
- ,fGraphM(NULL)
,fCl(NULL)
,fMCcl(NULL)
-/* ,fTrklt(NULL)
- ,fMCtrklt(NULL)*/
{
//
// Default constructor
//
InitFunctorList();
- SetSegmentationLevel();
-
- DefineOutput(kClToTrk, TObjArray::Class()); // cluster2track
- DefineOutput(kClToMC, TObjArray::Class()); // cluster2mc
-/* DefineOutput(kTrkltToTrk, TObjArray::Class()); // tracklet2track
- DefineOutput(kTrkltToMC, TObjArray::Class()); // tracklet2mc*/
+ MakePtSegmentation();
+ if(xchange){
+ SetUseExchangeContainers();
+ DefineOutput(kClToTrk, TObjArray::Class()); // cluster2track
+ DefineOutput(kClToMC, TObjArray::Class()); // cluster2mc
+ }
}
//________________________________________________________
//
// Destructor
//
-
- if(fGraphS){fGraphS->Delete(); delete fGraphS;}
- if(fGraphM){fGraphM->Delete(); delete fGraphM;}
+ if (AliAnalysisManager::GetAnalysisManager() && AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;
+ if(fProj){fProj->Delete(); delete fProj;}
if(fCl){fCl->Delete(); delete fCl;}
if(fMCcl){fMCcl->Delete(); delete fMCcl;}
-/* if(fTrklt){fTrklt->Delete(); delete fTrklt;}
- if(fMCtrklt){fMCtrklt->Delete(); delete fMCtrklt;}*/
}
// spatial resolution
AliTRDrecoTask::UserCreateOutputObjects();
- InitExchangeContainers();
+ if(UseExchangeContainers()) InitExchangeContainers();
}
//________________________________________________________
{
// Init containers for subsequent tasks (AliTRDclusterResolution)
- fCl = new TObjArray(200);
- fCl->SetOwner(kTRUE);
- fMCcl = new TObjArray();
- fMCcl->SetOwner(kTRUE);
-/* fTrklt = new TObjArray();
- fTrklt->SetOwner(kTRUE);
- fMCtrklt = new TObjArray();
- fMCtrklt->SetOwner(kTRUE);*/
+ fCl = new TObjArray(200); fCl->SetOwner(kTRUE);
+ fMCcl = new TObjArray(); fMCcl->SetOwner(kTRUE);
PostData(kClToTrk, fCl);
PostData(kClToMC, fMCcl);
-/* PostData(kTrkltToTrk, fTrklt);
- PostData(kTrkltToMC, fMCtrklt);*/
}
//________________________________________________________
// Execution part
//
- fCl->Delete();
- fMCcl->Delete();
+ if(fCl) fCl->Delete();
+ if(fMCcl) fMCcl->Delete();
AliTRDrecoTask::UserExec(opt);
}
//________________________________________________________
-Bool_t AliTRDresolution::Pulls(Double_t dyz[2], Double_t cov[3], Double_t tilt) const
+Bool_t AliTRDresolution::Pulls(Double_t* /*dyz[2]*/, Double_t* /*cov[3]*/, Double_t /*tilt*/) const
{
-// Helper function to calculate pulls in the yz plane
+// Helper function to calculate pulls in the yz plane
// using proper tilt rotation
// Uses functionality defined by AliTRDseedV1.
+ return kTRUE;
+/*
Double_t t2(tilt*tilt);
+ // exit door until a bug fix is found for AliTRDseedV1::GetCovSqrt
// rotate along pad
Double_t cc[3];
- cc[0] = cov[0] - 2.*tilt*cov[1] + t2*cov[2];
+ cc[0] = cov[0] - 2.*tilt*cov[1] + t2*cov[2];
cc[1] = cov[1]*(1.-t2) + tilt*(cov[0] - cov[2]);
cc[2] = t2*cov[0] + 2.*tilt*cov[1] + cov[2];
// do sqrt
- Double_t sqr[3]={0., 0., 0.};
+ Double_t sqr[3]={0., 0., 0.};
if(AliTRDseedV1::GetCovSqrt(cc, sqr)) return kFALSE;
- Double_t invsqr[3]={0., 0., 0.};
+ Double_t invsqr[3]={0., 0., 0.};
if(AliTRDseedV1::GetCovInv(sqr, invsqr)<1.e-40) return kFALSE;
Double_t tmp(dyz[0]);
dyz[0] = invsqr[0]*tmp + invsqr[1]*dyz[1];
dyz[1] = invsqr[1]*tmp + invsqr[2]*dyz[1];
return kTRUE;
+*/
}
//________________________________________________________
-TH1* AliTRDresolution::PlotCharge(const AliTRDtrackV1 *track)
+TH1* AliTRDresolution::DetCluster(const TObjArray *cls)
{
//
- // Plots the charge distribution
+ // Plot the cluster distributions
//
- if(track) fkTrack = track;
- if(!fkTrack){
- AliDebug(4, "No Track defined.");
+ if(cls) fkClusters = cls;
+ if(!fkClusters){
+ AliDebug(4, "No Clusters defined.");
return NULL;
}
- TObjArray *arr = NULL;
- if(!fContainer || !(arr = ((TObjArray*)fContainer->At(kCharge)))){
- AliWarning("No output container defined.");
+ Int_t ncl(0);
+ if(!(ncl = fkClusters->GetEntriesFast())){
+ AliDebug(1, "No RecPoints defined.");
return NULL;
}
- TH3S* h = NULL;
-
- AliTRDseedV1 *fTracklet = NULL;
- AliTRDcluster *c = NULL;
- for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
- if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
- if(!fTracklet->IsOK()) continue;
- Float_t x0 = fTracklet->GetX0();
- Float_t dqdl, dl;
- for(Int_t itb=AliTRDseedV1::kNtb; itb--;){
- if(!(c = fTracklet->GetClusters(itb))){
- if(!(c = fTracklet->GetClusters(AliTRDseedV1::kNtb+itb))) continue;
- }
- dqdl = fTracklet->GetdQdl(itb, &dl);
- if(dqdl<1.e-5) continue;
- dl /= 0.15; // dl/dl0, dl0 = 1.5 mm for nominal vd
- (h = (TH3S*)arr->At(0))->Fill(dl, x0-c->GetX(), dqdl);
- }
-
-// if(!HasMCdata()) continue;
-// UChar_t s;
-// Float_t pt0, y0, z0, dydx0, dzdx0;
-// if(!fMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) continue;
-
+ Int_t det(-1);
+ AliTRDcluster *cl(NULL);
+ for(Int_t icl(0); icl<ncl; icl++){
+ if(!(cl = (AliTRDcluster*)(*fkClusters)[icl])) continue;
+ det = cl->GetDetector(); break;
}
- return h;
+ if(det<0){
+ AliDebug(1, "No useful clusters defined.");
+ return NULL;
+ }
+ THnSparse *H(NULL);
+ if(!fContainer || !(H = ((THnSparse*)fContainer->At(kDetector)))){
+ AliWarning("No output container defined.");
+ return NULL;
+ }
+ Int_t ly(AliTRDgeometry::GetLayer(det)),
+ stk(AliTRDgeometry::GetStack(det));
+ Double_t val[kNdim],
+ alpha((0.5+AliTRDgeometry::GetSector(det))*AliTRDgeometry::GetAlpha()),
+ cs(TMath::Cos(alpha)),
+ sn(TMath::Sin(alpha));
+ for(Int_t icl(0); icl<ncl; icl++){
+ if(!(cl = (AliTRDcluster*)(*fkClusters)[icl])) continue;
+ val[kBC] = ly;
+ val[kPhi] = TMath::ATan2(cl->GetX()*sn + cl->GetY()*cs, cl->GetX()*cs - cl->GetY()*sn);
+ val[kEta] = (5-stk)*16-cl->GetPadRow()-1-(stk<3?4:0);
+ val[kYrez]= TMath::Abs(cl->GetQ());
+ val[4] = fEvent->GetMultiplicity();
+ H->Fill(val);
+ }
+ return NULL;
}
-
//________________________________________________________
TH1* AliTRDresolution::PlotCluster(const AliTRDtrackV1 *track)
{
AliDebug(4, "No Track defined.");
return NULL;
}
- TObjArray *arr = NULL;
- if(!fContainer || !(arr = ((TObjArray*)fContainer->At(kCluster)))){
- AliWarning("No output container defined.");
+ if(fkESD && TMath::Abs(fkESD->GetTOFbc()) > 1){
+ AliDebug(4, Form("Track with BC_index[%d] not used.", fkESD->GetTOFbc()));
return NULL;
}
- ULong_t status = fkESD ? fkESD->GetStatus():0;
-
- Int_t sgm[3];
- Double_t covR[7], cov[3], dy[2], dz[2];
- Float_t pt, x0, y0, z0, dydx, dzdx, tilt(0.);
- const AliTRDgeometry *geo(AliTRDinfoGen::Geometry());
- AliTRDseedV1 *fTracklet(NULL); TObjArray *clInfoArr(NULL);
- // do LINEAR track refit if asked by the user
- // it is the user responsibility to check if B=0T
- Float_t param[10]; memset(param, 0, 10*sizeof(Float_t));
- Int_t np(0), nrc(0); AliTrackPoint clusters[300];
- if(HasTrackRefit()){
- Bool_t kPrimary(kFALSE);
- for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
- if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
- if(!fTracklet->IsOK()) continue;
- x0 = fTracklet->GetX0();
- tilt = fTracklet->GetTilt();
- AliTRDcluster *c = NULL;
- fTracklet->ResetClusterIter(kFALSE);
- while((c = fTracklet->PrevCluster())){
- Float_t xyz[3] = {c->GetX(), c->GetY(), c->GetZ()};
- clusters[np].SetCharge(tilt);
- clusters[np].SetClusterType(0);
- clusters[np].SetVolumeID(ily);
- clusters[np].SetXYZ(xyz);
- np++;
- }
- if(fTracklet->IsRowCross()){
- Float_t xcross(0.), zcross(0.);
- if(fTracklet->GetEstimatedCrossPoint(xcross, zcross)){
- clusters[np].SetCharge(tilt);
- clusters[np].SetClusterType(1);
- clusters[np].SetVolumeID(ily);
- clusters[np].SetXYZ(xcross, 0., zcross);
- np++;
- nrc++;
- }
- }
- if(fTracklet->IsPrimary()) kPrimary = kTRUE;
- }
- if(kPrimary){
- clusters[np].SetCharge(tilt);
- clusters[np].SetClusterType(1);
- clusters[np].SetVolumeID(-1);
- clusters[np].SetXYZ(0., 0., 0.);
- np++;
- }
- if(!FitTrack(np, clusters, param)) {
- AliDebug(1, "Linear track Fit failed.");
- return NULL;
- }
- if(HasTrackSelection()){
- Bool_t kReject(kFALSE);
- if(fkTrack->GetNumberOfTracklets() != AliTRDgeometry::kNlayer) kReject = kTRUE;
- if(!kReject && !UseTrack(np, clusters, param)) kReject = kTRUE;
- if(kReject){
- AliDebug(1, "Reject track for residuals analysis.");
- return NULL;
- }
- }
+ if(fkESD && fPt<fPtThreshold){
+ AliDebug(4, Form("Track with pt[%6.4f] under threshold.", fPt));
+ return NULL;
+ }
+ THnSparse *H(NULL);
+ if(!fContainer || !(H = ((THnSparse*)fContainer->At(kCluster)))){
+ AliWarning("No output container defined.");
+ return NULL;
}
+
+ AliTRDgeometry *geo(AliTRDinfoGen::Geometry());
+ Double_t val[kNdim],
+ alpha(0.), cs(-2.), sn(0.); //Float_t exb, vd, t0, s2, dl, dt;
+ TObjArray *clInfoArr(NULL);
+ AliTRDseedV1 *fTracklet(NULL);
+ AliTRDcluster *c(NULL), *cc(NULL);
for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
if(!fTracklet->IsOK()) continue;
- x0 = fTracklet->GetX0();
- pt = fTracklet->GetPt();
- sgm[2] = fTracklet->GetDetector();
- sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
- sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
-
- // retrive the track angle with the chamber
- if(HasTrackRefit()){
- Float_t par[3];
- if(!FitTracklet(ily, np, clusters, param, par)) continue;
- dydx = par[2];//param[3];
- dzdx = param[4];
- y0 = par[1] + dydx * (x0 - par[0]);//param[1] + dydx * (x0 - param[0]);
- z0 = param[2] + dzdx * (x0 - param[0]);
- } else {
- y0 = fTracklet->GetYref(0);
- z0 = fTracklet->GetZref(0);
- dydx = fTracklet->GetYref(1);
- dzdx = fTracklet->GetZref(1);
+ //fTracklet->GetCalibParam(exb, vd, t0, s2, dl, dt);
+ val[kBC] = ily;
+ if(cs<-1.){
+ alpha = (0.5+AliTRDgeometry::GetSector(fTracklet->GetDetector()))*AliTRDgeometry::GetAlpha();
+ cs = TMath::Cos(alpha);
+ sn = TMath::Sin(alpha);
}
- printf("RC[%c] Primary[%c]\n"
- " Fit : y0[%f] z0[%f] dydx[%f] dzdx[%f]\n"
- " Ref: y0[%f] z0[%f] dydx[%f] dzdx[%f]\n", fTracklet->IsRowCross()?'y':'n', fTracklet->IsPrimary()?'y':'n', y0, z0, dydx, dzdx
- ,fTracklet->GetYref(0),fTracklet->GetZref(0),fTracklet->GetYref(1),fTracklet->GetZref(1));
- tilt = fTracklet->GetTilt();
- fTracklet->GetCovRef(covR);
- Double_t t2(tilt*tilt)
- ,corr(1./(1. + t2))
- ,cost(TMath::Sqrt(corr));
- AliTRDcluster *c = NULL;
- fTracklet->ResetClusterIter(kFALSE);
- while((c = fTracklet->PrevCluster())){
- Float_t xc = c->GetX();
- Float_t yc = c->GetY();
- Float_t zc = c->GetZ();
- Float_t dx = x0 - xc;
- Float_t yt = y0 - dx*dydx;
- Float_t zt = z0 - dx*dzdx;
- dy[0] = yc-yt; dz[0]= zc-zt;
-
- // rotate along pad
- dy[1] = cost*(dy[0] - dz[0]*tilt);
- dz[1] = cost*(dz[0] + dy[0]*tilt);
- if(pt>fPtThreshold && c->IsInChamber()) ((TH3S*)arr->At(0))->Fill(dydx, dy[1], sgm[fSegmentLevel]);
-
- // tilt rotation of covariance for clusters
+ val[kPhi] = TMath::ATan2(fTracklet->GetX()*sn + fTracklet->GetY()*cs, fTracklet->GetX()*cs - fTracklet->GetY()*sn);
+ Float_t tgl = fTracklet->GetZ()/fTracklet->GetX()/TMath::Sqrt(1.+fTracklet->GetY()*fTracklet->GetY()/fTracklet->GetX()/fTracklet->GetX());
+ val[kEta] = -TMath::Log(TMath::Tan(0.5 * (0.5*TMath::Pi() - TMath::ATan(tgl))));
+ val[kPt] = TMath::ATan(fTracklet->GetYref(1))*TMath::RadToDeg();
+ Float_t corr = 1./TMath::Sqrt(1.+fTracklet->GetYref(1)*fTracklet->GetYref(1)+fTracklet->GetZref(1)*fTracklet->GetZref(1));
+ Int_t row0(-1);
+ Float_t padCorr(fTracklet->GetTilt()*fTracklet->GetPadLength());
+ fTracklet->ResetClusterIter(kTRUE);
+ while((c = fTracklet->NextCluster())){
+ Float_t xc(c->GetX()),
+ q(TMath::Abs(c->GetQ()));
+ if(row0<0) row0 = c->GetPadRow();
+
+ val[kYrez] = c->GetY() + padCorr*(c->GetPadRow() - row0) -fTracklet->GetYat(xc);
+ val[kPrez] = fTracklet->GetX0()-xc;
+ val[kZrez] = 0.; Int_t ic(0), tb(c->GetLocalTimeBin());;
+ if((cc = fTracklet->GetClusters(tb-1))) {val[kZrez] += TMath::Abs(cc->GetQ()); ic++;}
+ if((cc = fTracklet->GetClusters(tb-2))) {val[kZrez] += TMath::Abs(cc->GetQ()); ic++;}
+ if(ic) val[kZrez] /= (ic*q);
+ val[kSpeciesChgRC]= fTracklet->IsRowCross()?0.:(TMath::Max(q*corr, Float_t(3.)));
+ H->Fill(val);
+/* // tilt rotation of covariance for clusters
Double_t sy2(c->GetSigmaY2()), sz2(c->GetSigmaZ2());
cov[0] = (sy2+t2*sz2)*corr;
cov[1] = tilt*(sz2 - sy2)*corr;
// sum with track covariance
cov[0]+=covR[0]; cov[1]+=covR[1]; cov[2]+=covR[2];
Double_t dyz[2]= {dy[1], dz[1]};
- Pulls(dyz, cov, tilt);
- ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dyz[0], dyz[1]);
-
+ Pulls(dyz, cov, tilt);*/
+
// Get z-position with respect to anode wire
+ Float_t yt(fTracklet->GetYref(0)-val[kZrez]*fTracklet->GetYref(1)),
+ zt(fTracklet->GetZref(0)-val[kZrez]*fTracklet->GetZref(1));
Int_t istk = geo->GetStack(c->GetDetector());
AliTRDpadPlane *pp = geo->GetPadPlane(ily, istk);
- Float_t row0 = pp->GetRow0();
- Float_t d = row0 - zt + pp->GetAnodeWireOffset();
+ Float_t rowZ = pp->GetRow0();
+ Float_t d = rowZ - zt + pp->GetAnodeWireOffset();
d -= ((Int_t)(2 * d)) / 2.0;
if (d > 0.25) d = 0.5 - d;
AliTRDclusterInfo *clInfo(NULL);
clInfo = new AliTRDclusterInfo;
clInfo->SetCluster(c);
- Float_t covF[] = {cov[0], cov[1], cov[2]};
- clInfo->SetGlobalPosition(yt, zt, dydx, dzdx, covF);
- clInfo->SetResolution(dy[1]);
+ //Float_t covF[] = {cov[0], cov[1], cov[2]};
+ clInfo->SetGlobalPosition(yt, zt, fTracklet->GetYref(1), fTracklet->GetZref(1)/*, covF*/);
+ clInfo->SetResolution(val[kYrez]);
clInfo->SetAnisochronity(d);
- clInfo->SetDriftLength(dx);
- clInfo->SetTilt(tilt);
+ clInfo->SetDriftLength(val[kZrez]);
+ clInfo->SetTilt(fTracklet->GetTilt());
if(fCl) fCl->Add(clInfo);
- else AliDebug(1, "Cl exchange container missing. Activate by calling \"InitExchangeContainers()\"");
+ //else AliDebug(1, "Cl exchange container missing. Activate by calling \"InitExchangeContainers()\"");
- if(DebugLevel()>=1){
- if(!clInfoArr){
+ if(DebugLevel()>=2){
+ if(!clInfoArr){
clInfoArr=new TObjArray(AliTRDseedV1::kNclusters);
clInfoArr->SetOwner(kFALSE);
}
clInfoArr->Add(clInfo);
}
}
- if(DebugLevel()>=1 && clInfoArr){
+ if(DebugLevel()>=2 && clInfoArr){
+ ULong_t status = fkESD->GetStatus();
(*DebugStream()) << "cluster"
<<"status=" << status
<<"clInfo.=" << clInfoArr
}
if(clInfoArr) delete clInfoArr;
- return (TH3S*)arr->At(0);
+ if(!track) return NULL;
+ // special care for EVE usage
+ TH1 *h(NULL);
+ if((h = (TH1*)gDirectory->Get(Form("%s_proj_%d", H->GetName(), kYrez)))) delete h;
+ return H->Projection(kYrez);
}
//________________________________________________________
TH1* AliTRDresolution::PlotTracklet(const AliTRDtrackV1 *track)
{
-// Plot normalized residuals for tracklets to track.
-//
+// Plot normalized residuals for tracklets to track.
+//
// We start from the result that if X=N(|m|, |Cov|)
// BEGIN_LATEX
// (Cov^{-1})^{1/2}X = N((Cov^{-1})^{1/2}*|m|, |1|)
// END_LATEX
-// in our case X=(y_trklt - y_trk z_trklt - z_trk) and |Cov| = |Cov_trklt| + |Cov_trk| at the radial
-// reference position.
+// in our case X=(y_trklt - y_trk z_trklt - z_trk) and |Cov| = |Cov_trklt| + |Cov_trk| at the radial
+// reference position.
if(track) fkTrack = track;
if(!fkTrack){
AliDebug(4, "No Track defined.");
return NULL;
}
- TObjArray *arr = NULL;
- if(!fContainer || !(arr = (TObjArray*)fContainer->At(kTrack ))){
+ if(fkESD && TMath::Abs(fkESD->GetTOFbc())>1){
+ AliDebug(4, Form("Track with BC_index[%d] not used.", fkESD->GetTOFbc()));
+ //return NULL;
+ }
+ THnSparse *H(NULL);
+ if(!fContainer || !(H = (THnSparse*)fContainer->At(kTracklet))){
AliWarning("No output container defined.");
return NULL;
}
- Int_t sgm[3];
- Double_t cov[3], covR[7]/*, sqr[3], inv[3]*/;
- Double_t pt, phi, tht, x, dx, dy[2], dz[2];
- AliTRDseedV1 *fTracklet(NULL);
+ const Int_t ndim(kNdim+8);
+ Double_t val[ndim],
+ alpha(0.), cs(-2.), sn(0.);
+ Float_t sz[AliTRDseedV1::kNtb], pos[AliTRDseedV1::kNtb];
+ Int_t ntbGap[AliTRDseedV1::kNtb];
+ AliTRDseedV1 *fTracklet(NULL);
for(Int_t il(0); il<AliTRDgeometry::kNlayer; il++){
if(!(fTracklet = fkTrack->GetTracklet(il))) continue;
- if(!fTracklet->IsOK()) continue;
- sgm[2] = fTracklet->GetDetector();
- sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
- sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
- x = fTracklet->GetX();
- dx = fTracklet->GetX0() - x;
- pt = fTracklet->GetPt();
- phi = fTracklet->GetYref(1);
- tht = fTracklet->GetZref(1);
- // compute dy and dz
- dy[0]= fTracklet->GetYref(0)-dx*fTracklet->GetYref(1) - fTracklet->GetY();
- dz[0]= fTracklet->GetZref(0)-dx*fTracklet->GetZref(1) - fTracklet->GetZ();
- Double_t tilt(fTracklet->GetTilt())
- ,t2(tilt*tilt)
- ,corr(1./(1. + t2))
- ,cost(TMath::Sqrt(corr));
- Bool_t rc(fTracklet->IsRowCross());
-
- // calculate residuals using tilt rotation
- dy[1]= cost*(dy[0] - dz[0]*tilt);
- dz[1]= cost*(dz[0] + dy[0]*tilt);
- ((TH3S*)arr->At(0))->Fill(phi, dy[1], sgm[fSegmentLevel]+rc*fgkNresYsegm[fSegmentLevel]);
- ((TH3S*)arr->At(2))->Fill(tht, dz[1], rc);
-
- // compute covariance matrix
- fTracklet->GetCovAt(x, cov);
- fTracklet->GetCovRef(covR);
- cov[0] += covR[0]; cov[1] += covR[1]; cov[2] += covR[2];
- Double_t dyz[2]= {dy[1], dz[1]};
- Pulls(dyz, cov, tilt);
- ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dyz[0], dyz[1]);
- ((TH3S*)arr->At(3))->Fill(tht, dyz[1], rc);
-
- Double_t dphi((phi-fTracklet->GetYfit(1))/(1-phi*fTracklet->GetYfit(1)));
- Double_t dtht((tht-fTracklet->GetZfit(1))/(1-tht*fTracklet->GetZfit(1)));
- ((TH2I*)arr->At(4))->Fill(phi, TMath::ATan(dphi));
-
- if(DebugLevel()>=1){
+ if(!fTracklet->IsOK() || !fTracklet->IsChmbGood()) continue;
+ val [kBC] = il;
+ if(cs<-1.){
+ alpha = (0.5+AliTRDgeometry::GetSector(fTracklet->GetDetector()))*AliTRDgeometry::GetAlpha();
+ cs = TMath::Cos(alpha);
+ sn = TMath::Sin(alpha);
+ }
+ val[kPhi] = TMath::ATan2(fTracklet->GetX()*sn + fTracklet->GetY()*cs, fTracklet->GetX()*cs - fTracklet->GetY()*sn);
+ Float_t tgl = fTracklet->GetZ()/fTracklet->GetX()/TMath::Sqrt(1.+fTracklet->GetY()*fTracklet->GetY()/fTracklet->GetX()/fTracklet->GetX());//fTracklet->GetTgl();
+ val[kEta] = -TMath::Log(TMath::Tan(0.5 * (0.5*TMath::Pi() - TMath::ATan(tgl))));
+
+ val[kSpeciesChgRC]= fTracklet->IsRowCross()?0:fkTrack->Charge();// fSpecies;
+ val[kPt] = fPt<0.8?0:(fPt<1.5?1:2);//GetPtBin(fTracklet->GetMomentum());
+ Double_t dyt(fTracklet->GetYfit(0) - fTracklet->GetYref(0)),
+ dzt(fTracklet->GetZfit(0) - fTracklet->GetZref(0)),
+ dydx(fTracklet->GetYfit(1)),
+ tilt(fTracklet->GetTilt());
+ // correct for tilt rotation
+ val[kYrez] = dyt - dzt*tilt;
+ val[kZrez] = dzt + dyt*tilt;
+ dydx+= tilt*fTracklet->GetZref(1);
+ val[kPrez] = TMath::ATan((dydx - fTracklet->GetYref(1))/(1.+ fTracklet->GetYref(1)*dydx)) * TMath::RadToDeg();
+ if(fTracklet->IsRowCross()) val[kSpeciesChgRC]= 0.;
+ val[kNdim] = fTracklet->GetdQdl()*2.e-3;
+ val[kNdim+1] = fEvent?fEvent->GetMultiplicity():0;
+ val[kNdim+2] = 1.e2*fTracklet->GetTBoccupancy()/AliTRDseedV1::kNtb;
+ Int_t n = fTracklet->GetChargeGaps(sz, pos, ntbGap);
+ val[kNdim+3] = 0.; for(Int_t igap(0); igap<n; igap++) val[kNdim+3] += sz[igap];
+ for(Int_t ifill(0); ifill<3; ifill++){ val[kNdim+4+ifill]=0.;val[kNdim+5+ifill]=0.;}
+ for(Int_t igap(0), ifill(0); igap<n&&ifill<2; igap++){
+ if(ntbGap[igap]<2) continue;
+ val[kNdim+4+ifill] = sz[igap];
+ val[kNdim+5+ifill] = pos[igap];
+ ifill++;
+ }
+ H->Fill(val);
+
+// // compute covariance matrix
+// fTracklet->GetCovAt(x, cov);
+// fTracklet->GetCovRef(covR);
+// cov[0] += covR[0]; cov[1] += covR[1]; cov[2] += covR[2];
+// Double_t dyz[2]= {dy[1], dz[1]};
+// Pulls(dyz, cov, tilt);
+// ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dyz[0], dyz[1]);
+// ((TH3S*)arr->At(3))->Fill(tht, dyz[1], rc);
+
+ if(DebugLevel()>=3){
+ Bool_t rc(fTracklet->IsRowCross());
UChar_t err(fTracklet->GetErrorMsg());
+ Double_t x(fTracklet->GetX()),
+ pt(fTracklet->GetPt()),
+ yt(fTracklet->GetYref(0)),
+ zt(fTracklet->GetZref(0)),
+ phi(fTracklet->GetYref(1)),
+ tht(fTracklet->GetZref(1));
+ Int_t ncl(fTracklet->GetN()), det(fTracklet->GetDetector());
(*DebugStream()) << "tracklet"
<<"pt=" << pt
+ <<"x=" << x
+ <<"yt=" << yt
+ <<"zt=" << zt
<<"phi=" << phi
<<"tht=" << tht
- <<"det=" << sgm[2]
- <<"dy0=" << dy[0]
- <<"dz0=" << dz[0]
- <<"dy=" << dy[1]
- <<"dz=" << dz[1]
- <<"dphi="<< dphi
- <<"dtht="<< dtht
- <<"dyp=" << dyz[0]
- <<"dzp=" << dyz[1]
+ <<"det=" << det
+ <<"n=" << ncl
+ <<"dy0=" << dyt
+ <<"dz0=" << dzt
+ <<"dy=" << val[kYrez]
+ <<"dz=" << val[kZrez]
+ <<"dphi="<< val[kPrez]
+ <<"dQ ="<< val[kNdim]
<<"rc=" << rc
<<"err=" << err
<< "\n";
}
}
- return (TH2I*)arr->At(0);
+ if(!track) return NULL;
+ // special care for EVE usage
+ TH1 *h(NULL);
+ if((h = (TH1*)gDirectory->Get(Form("%s_proj_%d", H->GetName(), kYrez)))) delete h;
+ return H->Projection(kYrez);
}
//________________________________________________________
TH1* AliTRDresolution::PlotTrackIn(const AliTRDtrackV1 *track)
{
-// Store resolution/pulls of Kalman before updating with the TRD information
-// at the radial position of the first tracklet. The following points are used
-// for comparison
+// Store resolution/pulls of Kalman before updating with the TRD information
+// at the radial position of the first tracklet. The following points are used
+// for comparison
// - the (y,z,snp) of the first TRD tracklet
// - the (y, z, snp, tgl, pt) of the MC track reference
-//
-// Additionally the momentum resolution/pulls are calculated for usage in the
-// PID calculation.
+//
+// Additionally the momentum resolution/pulls are calculated for usage in the
+// PID calculation.
+ //printf("AliTRDresolution::PlotTrackIn() :: track[%p]\n", (void*)track);
if(track) fkTrack = track;
if(!fkTrack){
AliDebug(4, "No Track defined.");
return NULL;
}
- TObjArray *arr = NULL;
- if(!fContainer || !(arr = (TObjArray*)fContainer->At(kTrackIn))){
- AliWarning("No output container defined.");
+ //fkTrack->Print();
+ TH1 *h(NULL); // EVE projection
+ // check container
+ THnSparseI *H=(THnSparseI*)fContainer->At(kTrackIn);
+ if(!H){
+ AliError(Form("Missing container @ %d", Int_t(kTrackIn)));
return NULL;
}
- AliExternalTrackParam *tin = NULL;
+ // check input track status
+ AliExternalTrackParam *tin(NULL);
if(!(tin = fkTrack->GetTrackIn())){
- AliWarning("Track did not entered TRD fiducial volume.");
+ AliError("Track did not entered TRD fiducial volume.");
return NULL;
}
- TH1 *h = NULL;
-
+ // check first tracklet
+ AliTRDseedV1 *fTracklet(fkTrack->GetTracklet(0));
+ if(!fTracklet){
+ AliDebug(3, "No Tracklet in ly[0]. Skip track.");
+ if(!track) return NULL;
+ // special care for EVE usage
+ if((h = (TH1*)gDirectory->Get(Form("%s_proj_%d", H->GetName(), kYrez)))) delete h;
+ return H->Projection(kYrez);
+ }
+ if(!fTracklet->IsOK() || !fTracklet->IsChmbGood()){
+ AliDebug(3, "Tracklet or Chamber not OK. Skip track.");
+ if(!track) return NULL;
+ // special care for EVE usage
+ if((h = (TH1*)gDirectory->Get(Form("%s_proj_%d", H->GetName(), kYrez)))) delete h;
+ return H->Projection(kYrez);
+ }
+ // check radial position
Double_t x = tin->GetX();
- AliTRDseedV1 *fTracklet = NULL;
- for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
- if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
- break;
- }
- if(!fTracklet || TMath::Abs(x-fTracklet->GetX())>1.e-3){
- AliWarning("Tracklet did not match Track.");
- return NULL;
- }
- Int_t sgm[3];
- sgm[2] = fTracklet->GetDetector();
- sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
- sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
- Double_t tilt(fTracklet->GetTilt())
- ,t2(tilt*tilt)
- ,corr(1./(1. + t2))
- ,cost(TMath::Sqrt(corr));
- Bool_t rc(fTracklet->IsRowCross());
-
- const Int_t kNPAR(5);
- Double_t parR[kNPAR]; memcpy(parR, tin->GetParameter(), kNPAR*sizeof(Double_t));
- Double_t covR[3*kNPAR]; memcpy(covR, tin->GetCovariance(), 3*kNPAR*sizeof(Double_t));
- Double_t cov[3]; fTracklet->GetCovAt(x, cov);
-
- // define sum covariances
- TMatrixDSym COV(kNPAR); TVectorD PAR(kNPAR);
- Double_t *pc = &covR[0], *pp = &parR[0];
- for(Int_t ir=0; ir<kNPAR; ir++, pp++){
- PAR(ir) = (*pp);
- for(Int_t ic = 0; ic<=ir; ic++,pc++){
- COV(ir,ic) = (*pc); COV(ic,ir) = (*pc);
- }
- }
- PAR[4] = TMath::Abs(PAR[4]); // remove sign of pt !!
- //COV.Print(); PAR.Print();
-
- //TODO Double_t dydx = TMath::Sqrt(1.-parR[2]*parR[2])/parR[2];
- Double_t dy[2]={parR[0] - fTracklet->GetY(), 0.}
- ,dz[2]={parR[1] - fTracklet->GetZ(), 0.}
- ,dphi(TMath::ASin(PAR[2])-TMath::ATan(fTracklet->GetYfit(1)));
- // calculate residuals using tilt rotation
- dy[1] = cost*(dy[0] - dz[0]*tilt);
- dz[1] = cost*(dz[0] + dy[0]*tilt);
-
- if(1./PAR[4]>fPtThreshold) ((TH3S*)arr->At(0))->Fill(fTracklet->GetYref(1), dy[1], sgm[fSegmentLevel]+rc*fgkNresYsegm[fSegmentLevel]);
- ((TH3S*)arr->At(2))->Fill(fTracklet->GetZref(1), dz[1], rc);
- ((TH2I*)arr->At(4))->Fill(fTracklet->GetYref(1), dphi);
-
- Double_t dyz[2] = {dy[1], dz[1]};
- Double_t cc[3] = {COV(0,0)+cov[0], COV(0,1)+cov[1], COV(1,1)+cov[2]};
- Pulls(dyz, cc, tilt);
- ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dyz[0], dyz[1]);
- ((TH3S*)arr->At(3))->Fill(fTracklet->GetZref(1), dyz[1], rc);
-
-
-
- // register reference histo for mini-task
- h = (TH2I*)arr->At(0);
-
- if(DebugLevel()>=2){
+ if(TMath::Abs(x-fTracklet->GetX())>1.e-3){
+ AliDebug(1, Form("Tracklet did not match Track. dx[cm]=%+4.1f", x-fTracklet->GetX()));
+ if(!track) return NULL;
+ // special care for EVE usage
+ if((h = (TH1*)gDirectory->Get(Form("%s_proj_%d", H->GetName(), kYrez)))) delete h;
+ return H->Projection(kYrez);
+ }
+ //printf("USE y[%+f] dydx[%+f]\n", fTracklet->GetYfit(0), fTracklet->GetYfit(1));
+
+ Int_t bc(fkESD?fkESD->GetTOFbc()/2:0);
+ const Double_t *parR(tin->GetParameter());
+ Double_t dyt(fTracklet->GetYfit(0)-parR[0]), dzt(fTracklet->GetZfit(0)-parR[1]),
+ phit(fTracklet->GetYfit(1)),
+ tilt(fTracklet->GetTilt()),
+ norm(1./TMath::Sqrt((1.-parR[2])*(1.+parR[2])));
+
+ // correct for tilt rotation
+ Double_t dy = dyt - dzt*tilt,
+ dz = dzt + dyt*tilt,
+ dx = dy/(parR[2]*norm-parR[3]*norm*tilt);
+ phit += tilt*parR[3];
+ Double_t dphi = TMath::ATan(phit) - TMath::ASin(parR[2]);
+
+ Double_t val[kNdim+3];
+ val[kBC] = bc==0?0:(bc<0?-1.:1.);
+ Double_t alpha = (0.5+AliTRDgeometry::GetSector(fTracklet->GetDetector()))*AliTRDgeometry::GetAlpha(),
+ cs = TMath::Cos(alpha),
+ sn = TMath::Sin(alpha);
+ val[kPhi] = TMath::ATan2(fTracklet->GetX()*sn + fTracklet->GetY()*cs, fTracklet->GetX()*cs - fTracklet->GetY()*sn);
+ Float_t tgl = fTracklet->GetZ()/fTracklet->GetX()/TMath::Sqrt(1.+fTracklet->GetY()*fTracklet->GetY()/fTracklet->GetX()/fTracklet->GetX());
+ val[kEta] = -TMath::Log(TMath::Tan(0.5 * (0.5*TMath::Pi() - TMath::ATan(tgl))));
+ val[kYrez] = dy;
+ val[kZrez] = fTracklet->IsRowCross()?dz:(fTracklet->GetdQdl()*5.e-4 - 2.5);
+ val[kPrez] = dphi*TMath::RadToDeg();
+ val[kSpeciesChgRC]= fTracklet->IsRowCross()?0:fSpecies;
+ val[kPt] = fPt<0.8?0:(fPt<1.5?1:2);//GetPtBin(fPt);
+ val[kNdim] = fTracklet->GetDetector();
+ val[kNdim+1] = dx;
+ val[kNdim+2] = fEvent?fEvent->GetBunchFill():0;
+ H->Fill(val);
+ if(DebugLevel()>=3){
(*DebugStream()) << "trackIn"
- << "x=" << x
- << "P=" << &PAR
- << "C=" << &COV
- << "\n";
-
- Double_t y = fTracklet->GetY();
- Double_t z = fTracklet->GetZ();
- (*DebugStream()) << "trackletIn"
- << "y=" << y
- << "z=" << z
- << "Vy=" << cov[0]
- << "Cyz=" << cov[1]
- << "Vz=" << cov[2]
+ <<"tracklet.=" << fTracklet
+ <<"trackIn.=" << tin
<< "\n";
}
-
- if(!HasMCdata()) return h;
- UChar_t s;
- Float_t dx, pt0, x0=fTracklet->GetX0(), y0, z0, dydx0, dzdx0;
- if(!fkMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) return h;
- Int_t pdg = fkMC->GetPDG(),
- sIdx(AliTRDpidUtil::Pdg2Pid(TMath::Abs(pdg))+1), // species index
- sign(0);
- if(!fDBPDG) fDBPDG=TDatabasePDG::Instance();
- TParticlePDG *ppdg(fDBPDG->GetParticle(pdg));
- if(ppdg) sign = ppdg->Charge() > 0. ? 1 : -1;
-
- // translate to reference radial position
- dx = x0 - x; y0 -= dx*dydx0; z0 -= dx*dzdx0;
- Float_t norm = 1./TMath::Sqrt(1.+dydx0*dydx0); // 1/sqrt(1+tg^2(phi))
- //Fill MC info
- TVectorD PARMC(kNPAR);
- PARMC[0]=y0; PARMC[1]=z0;
- PARMC[2]=dydx0*norm; PARMC[3]=dzdx0*norm;
- PARMC[4]=1./pt0;
-
-// TMatrixDSymEigen eigen(COV);
-// TVectorD evals = eigen.GetEigenValues();
-// TMatrixDSym evalsm(kNPAR);
-// for(Int_t ir=0; ir<kNPAR; ir++) for(Int_t ic=0; ic<kNPAR; ic++) evalsm(ir,ic) = (ir==ic ? evals(ir): 0.);
-// TMatrixD evecs = eigen.GetEigenVectors();
-// TMatrixD sqrcov(evecs, TMatrixD::kMult, TMatrixD(evalsm, TMatrixD::kMult, evecs.T()));
-
- // fill histos
- if(!(arr = (TObjArray*)fContainer->At(kMCtrackIn))) {
- AliWarning("No MC container defined.");
- return h;
- }
-
- // y resolution/pulls
- if(pt0>fPtThreshold) ((TH3S*)arr->At(0))->Fill(dydx0, PARMC[0]-PAR[0], sgm[fSegmentLevel]);
- ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], (PARMC[0]-PAR[0])/TMath::Sqrt(COV(0,0)), (PARMC[1]-PAR[1])/TMath::Sqrt(COV(1,1)));
- // z resolution/pulls
- ((TH3S*)arr->At(2))->Fill(dzdx0, PARMC[1]-PAR[1], 0);
- ((TH3S*)arr->At(3))->Fill(dzdx0, (PARMC[1]-PAR[1])/TMath::Sqrt(COV(1,1)), 0);
- // phi resolution/snp pulls
- ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ASin(PARMC[2])-TMath::ASin(PAR[2]));
- ((TH2I*)arr->At(5))->Fill(dydx0, (PARMC[2]-PAR[2])/TMath::Sqrt(COV(2,2)));
- // theta resolution/tgl pulls
- ((TH2I*)arr->At(6))->Fill(dzdx0, TMath::ATan((PARMC[3]-PAR[3])/(1-PARMC[3]*PAR[3])));
- ((TH2I*)arr->At(7))->Fill(dzdx0, (PARMC[3]-PAR[3])/TMath::Sqrt(COV(3,3)));
- // pt resolution\\1/pt pulls\\p resolution/pull
- ((TH3S*)arr->At(8))->Fill(pt0, PARMC[4]/PAR[4]-1., sign*sIdx);
- ((TH3S*)arr->At(9))->Fill(PARMC[4], (PARMC[4]-PAR[4])/TMath::Sqrt(COV(4,4)), sign*sIdx);
-
- Double_t p0 = TMath::Sqrt(1.+ PARMC[3]*PARMC[3])*pt0, p;
- p = TMath::Sqrt(1.+ PAR[3]*PAR[3])/PAR[4];
- ((TH3S*)arr->At(10))->Fill(p0, p/p0-1., sign*sIdx);
-// Float_t sp =
-// p*p*PAR[4]*PAR[4]*COV(4,4)
-// +2.*PAR[3]*COV(3,4)/PAR[4]
-// +PAR[3]*PAR[3]*COV(3,3)/p/p/PAR[4]/PAR[4]/PAR[4]/PAR[4];
-// if(sp>0.) ((TH3S*)arr->At(11))->Fill(p0, (p0-p)/TMath::Sqrt(sp), sign*sIdx);
-
- // fill debug for MC
- if(DebugLevel()>=3){
- (*DebugStream()) << "trackInMC"
- << "P=" << &PARMC
- << "\n";
- }
- return h;
+ if(!track) return NULL;
+ // special care for EVE usage
+ if((h = (TH1*)gDirectory->Get(Form("%s_proj_%d", H->GetName(), kYrez)))) delete h;
+ return H->Projection(kYrez);
}
+/*
//________________________________________________________
TH1* AliTRDresolution::PlotTrackOut(const AliTRDtrackV1 *track)
{
-// Store resolution/pulls of Kalman after last update with the TRD information
-// at the radial position of the first tracklet. The following points are used
-// for comparison
+// Store resolution/pulls of Kalman after last update with the TRD information
+// at the radial position of the first tracklet. The following points are used
+// for comparison
// - the (y,z,snp) of the first TRD tracklet
// - the (y, z, snp, tgl, pt) of the MC track reference
-//
-// Additionally the momentum resolution/pulls are calculated for usage in the
-// PID calculation.
+//
+// Additionally the momentum resolution/pulls are calculated for usage in the
+// PID calculation.
if(track) fkTrack = track;
- if(!fkTrack){
- AliDebug(4, "No Track defined.");
- return NULL;
- }
- TObjArray *arr = NULL;
- if(!fContainer || !(arr = (TObjArray*)fContainer->At(kTrackOut))){
- AliWarning("No output container defined.");
- return NULL;
- }
- AliExternalTrackParam *tout = NULL;
- if(!(tout = fkTrack->GetTrackOut())){
- AliDebug(2, "Track did not exit TRD.");
- return NULL;
- }
- TH1 *h(NULL);
-
- Double_t x = tout->GetX();
- AliTRDseedV1 *fTracklet(NULL);
- for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
- if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
- break;
- }
- if(!fTracklet || TMath::Abs(x-fTracklet->GetX())>1.e-3){
- AliWarning("Tracklet did not match Track position.");
- return NULL;
- }
- Int_t sgm[3];
- sgm[2] = fTracklet->GetDetector();
- sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
- sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
- Double_t tilt(fTracklet->GetTilt())
- ,t2(tilt*tilt)
- ,corr(1./(1. + t2))
- ,cost(TMath::Sqrt(corr));
- Bool_t rc(fTracklet->IsRowCross());
-
- const Int_t kNPAR(5);
- Double_t parR[kNPAR]; memcpy(parR, tout->GetParameter(), kNPAR*sizeof(Double_t));
- Double_t covR[3*kNPAR]; memcpy(covR, tout->GetCovariance(), 3*kNPAR*sizeof(Double_t));
- Double_t cov[3]; fTracklet->GetCovAt(x, cov);
-
- // define sum covariances
- TMatrixDSym COV(kNPAR); TVectorD PAR(kNPAR);
- Double_t *pc = &covR[0], *pp = &parR[0];
- for(Int_t ir=0; ir<kNPAR; ir++, pp++){
- PAR(ir) = (*pp);
- for(Int_t ic = 0; ic<=ir; ic++,pc++){
- COV(ir,ic) = (*pc); COV(ic,ir) = (*pc);
- }
- }
- PAR[4] = TMath::Abs(PAR[4]); // remove sign of pt !!
- //COV.Print(); PAR.Print();
-
- //TODO Double_t dydx = TMath::Sqrt(1.-parR[2]*parR[2])/parR[2];
- Double_t dy[3]={parR[0] - fTracklet->GetY(), 0., 0.}
- ,dz[3]={parR[1] - fTracklet->GetZ(), 0., 0.}
- ,dphi(TMath::ASin(PAR[2])-TMath::ATan(fTracklet->GetYfit(1)));
- // calculate residuals using tilt rotation
- dy[1] = cost*(dy[0] - dz[0]*tilt);
- dz[1] = cost*(dz[0] + dy[0]*tilt);
-
- if(1./PAR[4]>fPtThreshold) ((TH3S*)arr->At(0))->Fill(fTracklet->GetYref(1), 1.e2*dy[1], sgm[fSegmentLevel]+rc*fgkNresYsegm[fSegmentLevel]); // scale to fit general residual range !!!
- ((TH3S*)arr->At(2))->Fill(fTracklet->GetZref(1), dz[1], rc);
- ((TH2I*)arr->At(4))->Fill(fTracklet->GetYref(1), dphi);
-
- Double_t dyz[2] = {dy[1], dz[1]};
- Double_t cc[3] = {COV(0,0)+cov[0], COV(0,1)+cov[1], COV(1,1)+cov[2]};
- Pulls(dyz, cc, tilt);
- ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dyz[0], dyz[1]);
- ((TH3S*)arr->At(3))->Fill(fTracklet->GetZref(1), dyz[1], rc);
-
- // register reference histo for mini-task
- h = (TH2I*)arr->At(0);
-
- if(DebugLevel()>=2){
- (*DebugStream()) << "trackOut"
- << "x=" << x
- << "P=" << &PAR
- << "C=" << &COV
- << "\n";
-
- Double_t y = fTracklet->GetY();
- Double_t z = fTracklet->GetZ();
- (*DebugStream()) << "trackletOut"
- << "y=" << y
- << "z=" << z
- << "Vy=" << cov[0]
- << "Cyz=" << cov[1]
- << "Vz=" << cov[2]
- << "\n";
- }
-
-
- if(!HasMCdata()) return h;
- UChar_t s;
- Float_t dx, pt0, x0=fTracklet->GetX0(), y0, z0, dydx0, dzdx0;
- if(!fkMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) return h;
- Int_t pdg = fkMC->GetPDG(),
- sIdx(AliTRDpidUtil::Pdg2Pid(TMath::Abs(pdg))+1), // species index
- sign(0);
- if(!fDBPDG) fDBPDG=TDatabasePDG::Instance();
- TParticlePDG *ppdg(fDBPDG->GetParticle(pdg));
- if(ppdg) sign = ppdg->Charge() > 0. ? 1 : -1;
-
- // translate to reference radial position
- dx = x0 - x; y0 -= dx*dydx0; z0 -= dx*dzdx0;
- Float_t norm = 1./TMath::Sqrt(1.+dydx0*dydx0); // 1/sqrt(1+tg^2(phi))
- //Fill MC info
- TVectorD PARMC(kNPAR);
- PARMC[0]=y0; PARMC[1]=z0;
- PARMC[2]=dydx0*norm; PARMC[3]=dzdx0*norm;
- PARMC[4]=1./pt0;
-
-// TMatrixDSymEigen eigen(COV);
-// TVectorD evals = eigen.GetEigenValues();
-// TMatrixDSym evalsm(kNPAR);
-// for(Int_t ir=0; ir<kNPAR; ir++) for(Int_t ic=0; ic<kNPAR; ic++) evalsm(ir,ic) = (ir==ic ? evals(ir): 0.);
-// TMatrixD evecs = eigen.GetEigenVectors();
-// TMatrixD sqrcov(evecs, TMatrixD::kMult, TMatrixD(evalsm, TMatrixD::kMult, evecs.T()));
-
- // fill histos
- if(!(arr = (TObjArray*)fContainer->At(kMCtrackOut))){
- AliWarning("No MC container defined.");
- return h;
- }
- // y resolution/pulls
- if(pt0>fPtThreshold) ((TH3S*)arr->At(0))->Fill(dydx0, PARMC[0]-PAR[0], sgm[fSegmentLevel]);
- ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], (PARMC[0]-PAR[0])/TMath::Sqrt(COV(0,0)), (PARMC[1]-PAR[1])/TMath::Sqrt(COV(1,1)));
- // z resolution/pulls
- ((TH3S*)arr->At(2))->Fill(dzdx0, PARMC[1]-PAR[1], 0);
- ((TH3S*)arr->At(3))->Fill(dzdx0, (PARMC[1]-PAR[1])/TMath::Sqrt(COV(1,1)), 0);
- // phi resolution/snp pulls
- ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ASin(PARMC[2])-TMath::ASin(PAR[2]));
- ((TH2I*)arr->At(5))->Fill(dydx0, (PARMC[2]-PAR[2])/TMath::Sqrt(COV(2,2)));
- // theta resolution/tgl pulls
- ((TH2I*)arr->At(6))->Fill(dzdx0, TMath::ATan((PARMC[3]-PAR[3])/(1-PARMC[3]*PAR[3])));
- ((TH2I*)arr->At(7))->Fill(dzdx0, (PARMC[3]-PAR[3])/TMath::Sqrt(COV(3,3)));
- // pt resolution\\1/pt pulls\\p resolution/pull
- ((TH3S*)arr->At(8))->Fill(pt0, PARMC[4]/PAR[4]-1., sign*sIdx);
- ((TH3S*)arr->At(9))->Fill(PARMC[4], (PARMC[4]-PAR[4])/TMath::Sqrt(COV(4,4)), sign*sIdx);
-
- Double_t p0 = TMath::Sqrt(1.+ PARMC[3]*PARMC[3])*pt0, p;
- p = TMath::Sqrt(1.+ PAR[3]*PAR[3])/PAR[4];
- ((TH3S*)arr->At(10))->Fill(p0, p/p0-1., sign*sIdx);
-// Float_t sp =
-// p*p*PAR[4]*PAR[4]*COV(4,4)
-// +2.*PAR[3]*COV(3,4)/PAR[4]
-// +PAR[3]*PAR[3]*COV(3,3)/p/p/PAR[4]/PAR[4]/PAR[4]/PAR[4];
-// if(sp>0.) ((TH3S*)arr->At(11))->Fill(p0, (p0-p)/TMath::Sqrt(sp), sign*sIdx);
-
- // fill debug for MC
- if(DebugLevel()>=3){
- (*DebugStream()) << "trackOutMC"
- << "P=" << &PARMC
- << "\n";
- }
- return h;
+ return NULL;
}
-
+*/
//________________________________________________________
TH1* AliTRDresolution::PlotMC(const AliTRDtrackV1 *track)
{
// Plot MC distributions
//
- if(!HasMCdata()){
- AliDebug(2, "No MC defined. Results will not be available.");
- return NULL;
- }
+ if(!HasMCdata()) return NULL;
if(track) fkTrack = track;
if(!fkTrack){
AliDebug(4, "No Track defined.");
return NULL;
}
+ Int_t bc(TMath::Abs(fkESD->GetTOFbc()));
+
+ THnSparse *H(NULL);
if(!fContainer){
AliWarning("No output container defined.");
return NULL;
Int_t pdg = fkMC->GetPDG(),
sIdx(AliTRDpidUtil::Pdg2Pid(TMath::Abs(pdg))+1), // species index
sign(0),
- sgm[3],
+// sgm[3],
label(fkMC->GetLabel());
+// fSegmentLevel(0);
if(!fDBPDG) fDBPDG=TDatabasePDG::Instance();
TParticlePDG *ppdg(fDBPDG->GetParticle(pdg));
if(ppdg) sign = ppdg->Charge() > 0. ? 1 : -1;
- TObjArray *arr(NULL);TH1 *h(NULL);
+ TH1 *h(NULL);
+ AliTRDgeometry *geo(AliTRDinfoGen::Geometry());
+ AliTRDseedV1 *fTracklet(NULL); TObjArray *clInfoArr(NULL);
UChar_t s;
- Double_t xAnode, x, y, z, pt, dydx, dzdx, dzdl;
+ Double_t x, y, z, pt, dydx, dzdx, dzdl;
Float_t pt0, x0, y0, z0, dx, dy, dz, dydx0, dzdx0;
Double_t covR[7]/*, cov[3]*/;
- if(DebugLevel()>=3){
- TVectorD dX(12), dY(12), dZ(12), vPt(12), dPt(12), cCOV(12*15);
- fkMC->PropagateKalman(&dX, &dY, &dZ, &vPt, &dPt, &cCOV);
- (*DebugStream()) << "MCkalman"
- << "pdg=" << pdg
- << "dx=" << &dX
- << "dy=" << &dY
- << "dz=" << &dZ
- << "pt=" << &vPt
- << "dpt=" << &dPt
- << "cov=" << &cCOV
- << "\n";
- }
- AliTRDgeometry *geo(AliTRDinfoGen::Geometry());
- AliTRDseedV1 *fTracklet(NULL); TObjArray *clInfoArr(NULL);
+/* if(DebugLevel()>=3){
+ // get first detector
+ Int_t det = -1;
+ for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
+ if(!(fTracklet = fkTrack->GetTracklet(ily))) continue;
+ det = fTracklet->GetDetector();
+ break;
+ }
+ if(det>=0){
+ TVectorD X(12), Y(12), Z(12), dX(12), dY(12), dZ(12), vPt(12), dPt(12), budget(12), cCOV(12*15);
+ Double_t m(-1.);
+ m = fkTrack->GetMass();
+ if(fkMC->PropagateKalman(&X, &Y, &Z, &dX, &dY, &dZ, &vPt, &dPt, &budget, &cCOV, m)){
+ (*DebugStream()) << "MCkalman"
+ << "pdg=" << pdg
+ << "det=" << det
+ << "x=" << &X
+ << "y=" << &Y
+ << "z=" << &Z
+ << "dx=" << &dX
+ << "dy=" << &dY
+ << "dz=" << &dZ
+ << "pt=" << &vPt
+ << "dpt=" << &dPt
+ << "bgt=" << &budget
+ << "cov=" << &cCOV
+ << "\n";
+ }
+ }
+ }*/
+ AliTRDcluster *c(NULL);
+ Double_t val[kNdim+1];
for(Int_t ily=0; ily<AliTRDgeometry::kNlayer; ily++){
if(!(fTracklet = fkTrack->GetTracklet(ily)))/* ||
!fTracklet->IsOK())*/ continue;
- sgm[2] = fTracklet->GetDetector();
- sgm[0] = AliTRDgeometry::GetSector(sgm[2]);
- sgm[1] = sgm[0] * AliTRDgeometry::kNstack + AliTRDgeometry::GetStack(sgm[2]);
- Double_t tilt(fTracklet->GetTilt())
- ,t2(tilt*tilt)
- ,corr(1./(1. + t2))
- ,cost(TMath::Sqrt(corr));
- x0 = fTracklet->GetX0();
- //radial shift with respect to the MC reference (radial position of the pad plane)
- x= fTracklet->GetX();
- Bool_t rc(fTracklet->IsRowCross());
- if(!fkMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, s)) continue;
- xAnode = fTracklet->GetX0();
+ x= x0 = fTracklet->GetX();
+ Bool_t rc(fTracklet->IsRowCross()); Float_t eta, phi;
+ if(!fkMC->GetDirections(x0, y0, z0, dydx0, dzdx0, pt0, eta, phi, s)) continue;
// MC track position at reference radial position
dx = x0 - x;
- if(DebugLevel()>=4){
- (*DebugStream()) << "MC"
- << "det=" << sgm[2]
- << "pdg=" << pdg
- << "sgn=" << sign
- << "pt=" << pt0
- << "x=" << x0
- << "y=" << y0
- << "z=" << z0
- << "dydx=" << dydx0
- << "dzdx=" << dzdx0
- << "\n";
- }
Float_t ymc = y0 - dx*dydx0;
Float_t zmc = z0 - dx*dzdx0;
- //p = pt0*TMath::Sqrt(1.+dzdx0*dzdx0); // pt -> p
+ //phi -= TMath::Pi();
+
+ val[kBC] = ily;
+ val[kPhi] = phi;
+ val[kEta] = eta;
+ val[kSpeciesChgRC]= rc?0.:sign*sIdx;
+ val[kPt] = pt0<0.8?0:(pt0<1.5?1:2);//GetPtBin(pt0);
+ Double_t tilt(fTracklet->GetTilt());
+// ,t2(tilt*tilt)
+// ,corr(1./(1. + t2))
+// ,cost(TMath::Sqrt(corr));
+
+ AliExternalTrackParam *tin(fkTrack->GetTrackIn());
+ if(ily==0 && tin){ // trackIn residuals
+ // check radial position
+ if(TMath::Abs(tin->GetX()-x)>1.e-3) AliDebug(1, Form("TrackIn radial mismatch. dx[cm]=%+4.1f", tin->GetX()-x));
+ else{
+ val[kBC] = (bc>=kNbunchCross)?(kNbunchCross-1):bc;
+ val[kYrez] = tin->GetY()-ymc;
+ val[kZrez] = tin->GetZ()-zmc;
+ val[kPrez] = (TMath::ASin(tin->GetSnp())-TMath::ATan(dydx0))*TMath::RadToDeg();
+ if((H = (THnSparseI*)fContainer->At(kMCtrackIn))) H->Fill(val);
+ }
+ }
+ //if(bc>1) break; // do nothing for the rest of TRD objects if satellite bunch
- // Kalman position at reference radial position
- dx = xAnode - x;
+ // track residuals
dydx = fTracklet->GetYref(1);
dzdx = fTracklet->GetZref(1);
dzdl = fTracklet->GetTgl();
- y = fTracklet->GetYref(0) - dx*dydx;
+ y = fTracklet->GetYref(0);
dy = y - ymc;
- z = fTracklet->GetZref(0) - dx*dzdx;
+ z = fTracklet->GetZref(0);
dz = z - zmc;
pt = TMath::Abs(fTracklet->GetPt());
fTracklet->GetCovRef(covR);
- arr = (TObjArray*)((TObjArray*)fContainer->At(kMCtrack))->At(ily);
- // y resolution/pulls
- if(pt0>fPtThreshold) ((TH3S*)arr->At(0))->Fill(dydx0, dy, sgm[fSegmentLevel]);
- ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dy/TMath::Sqrt(covR[0]), dz/TMath::Sqrt(covR[2]));
- // z resolution/pulls
- ((TH3S*)arr->At(2))->Fill(dzdx0, dz, 0);
- ((TH3S*)arr->At(3))->Fill(dzdx0, dz/TMath::Sqrt(covR[2]), 0);
- // phi resolution/ snp pulls
- Double_t dtgp = (dydx - dydx0)/(1.- dydx*dydx0);
- ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ATan(dtgp));
- Double_t dsnp = dydx/TMath::Sqrt(1.+dydx*dydx) - dydx0/TMath::Sqrt(1.+dydx0*dydx0);
- ((TH2I*)arr->At(5))->Fill(dydx0, dsnp/TMath::Sqrt(covR[3]));
- // theta resolution/ tgl pulls
- Double_t dzdl0 = dzdx0/TMath::Sqrt(1.+dydx0*dydx0),
- dtgl = (dzdl - dzdl0)/(1.- dzdl*dzdl0);
- ((TH2I*)arr->At(6))->Fill(dzdl0,
- TMath::ATan(dtgl));
- ((TH2I*)arr->At(7))->Fill(dzdl0, (dzdl - dzdl0)/TMath::Sqrt(covR[4]));
- // pt resolution \\ 1/pt pulls \\ p resolution for PID
- Double_t p0 = TMath::Sqrt(1.+ dzdl0*dzdl0)*pt0,
- p = TMath::Sqrt(1.+ dzdl*dzdl)*pt;
- ((TH3S*)((TObjArray*)arr->At(8)))->Fill(pt0, pt/pt0-1., sign*sIdx);
- ((TH3S*)((TObjArray*)arr->At(9)))->Fill(1./pt0, (1./pt-1./pt0)/TMath::Sqrt(covR[6]), sign*sIdx);
- ((TH3S*)((TObjArray*)arr->At(10)))->Fill(p0, p/p0-1., sign*sIdx);
-
- // Fill Debug stream for Kalman track
+ val[kYrez] = dy;
+ val[kPrez] = TMath::ATan((dydx - dydx0)/(1.+ dydx*dydx0))*TMath::RadToDeg();
+ val[kZrez] = dz;
+ val[kNdim] = 1.e2*(pt/pt0-1.);
+ if((H = (THnSparse*)fContainer->At(kMCtrack))) H->Fill(val);
+/* // theta resolution/ tgl pulls
+ Double_t dzdl0 = dzdx0/TMath::Sqrt(1.+dydx0*dydx0),
+ dtgl = (dzdl - dzdl0)/(1.- dzdl*dzdl0);
+ ((TH2I*)arr->At(6))->Fill(dzdl0, TMath::ATan(dtgl));
+ ((TH2I*)arr->At(7))->Fill(dzdl0, (dzdl - dzdl0)/TMath::Sqrt(covR[4]));
+ // pt resolution \\ 1/pt pulls \\ p resolution for PID
+ Double_t p0 = TMath::Sqrt(1.+ dzdl0*dzdl0)*pt0,
+ p = TMath::Sqrt(1.+ dzdl*dzdl)*pt;
+ ((TH3S*)((TObjArray*)arr->At(8)))->Fill(pt0, pt/pt0-1., sign*sIdx);
+ ((TH3S*)((TObjArray*)arr->At(9)))->Fill(1./pt0, (1./pt-1./pt0)/TMath::Sqrt(covR[6]), sign*sIdx);
+ ((TH3S*)((TObjArray*)arr->At(10)))->Fill(p0, p/p0-1., sign*sIdx);*/
+
+ // Fill Debug stream for MC track
if(DebugLevel()>=4){
+ Int_t det(fTracklet->GetDetector());
+ (*DebugStream()) << "MC"
+ << "det=" << det
+ << "pdg=" << pdg
+ << "sgn=" << sign
+ << "pt=" << pt0
+ << "x=" << x0
+ << "y=" << y0
+ << "z=" << z0
+ << "dydx=" << dydx0
+ << "dzdx=" << dzdx0
+ << "\n";
+
+ // Fill Debug stream for Kalman track
(*DebugStream()) << "MCtrack"
<< "pt=" << pt
<< "x=" << x
<< "\n";
}
- // recalculate tracklet based on the MC info
- AliTRDseedV1 tt(*fTracklet);
- tt.SetZref(0, z0 - (x0-xAnode)*dzdx0);
- tt.SetZref(1, dzdx0);
- tt.SetReconstructor(AliTRDinfoGen::Reconstructor());
- tt.Fit(1);
- x= tt.GetX();y= tt.GetY();z= tt.GetZ();
- dydx = tt.GetYfit(1);
- dx = x0 - x;
- ymc = y0 - dx*dydx0;
- zmc = z0 - dx*dzdx0;
- dy = y-ymc;
- dz = z-zmc;
- Float_t dphi = (dydx - dydx0);
- dphi /= (1.- dydx*dydx0);
-
- // add tracklet residuals for y and dydx
- arr = (TObjArray*)fContainer->At(kMCtracklet);
-
- if(pt0>fPtThreshold) ((TH3S*)arr->At(0))->Fill(dydx0, dy, sgm[fSegmentLevel]);
- if(tt.GetS2Y()>0. && tt.GetS2Z()>0.) ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dy/TMath::Sqrt(tt.GetS2Y()), dz/TMath::Sqrt(tt.GetS2Z()));
- ((TH3S*)arr->At(2))->Fill(dzdl0, dz, rc);
- if(tt.GetS2Z()>0.) ((TH3S*)arr->At(3))->Fill(dzdl0, dz/TMath::Sqrt(tt.GetS2Z()), rc);
- ((TH2I*)arr->At(4))->Fill(dydx0, TMath::ATan(dphi));
-
+ // tracklet residuals
+ dydx = fTracklet->GetYfit(1) + tilt*dzdx0;
+ dzdx = fTracklet->GetZfit(1);
+ y = fTracklet->GetYfit(0);
+ dy = y - ymc;
+ z = fTracklet->GetZfit(0);
+ dz = z - zmc;
+ val[kYrez] = dy - dz*tilt;
+ val[kPrez] = TMath::ATan((dydx - dydx0)/(1.+ dydx*dydx0))*TMath::RadToDeg();
+ val[kZrez] = dz + dy*tilt;
+// val[kNdim] = pt/pt0-1.;
+ if((H = (THnSparse*)fContainer->At(kMCtracklet))) H->Fill(val);
+
+
// Fill Debug stream for tracklet
if(DebugLevel()>=4){
- Float_t s2y = tt.GetS2Y();
- Float_t s2z = tt.GetS2Z();
+ Float_t s2y = fTracklet->GetS2Y();
+ Float_t s2z = fTracklet->GetS2Z();
(*DebugStream()) << "MCtracklet"
<< "rc=" << rc
<< "x=" << x
<< "\n";
}
- AliTRDpadPlane *pp = geo->GetPadPlane(ily, AliTRDgeometry::GetStack(sgm[2]));
+ AliTRDpadPlane *pp = geo->GetPadPlane(ily, AliTRDgeometry::GetStack(fTracklet->GetDetector()));
Float_t zr0 = pp->GetRow0() + pp->GetAnodeWireOffset();
//Double_t exb = AliTRDCommonParam::Instance()->GetOmegaTau(1.5);
- arr = (TObjArray*)fContainer->At(kMCcluster);
- AliTRDcluster *c = NULL;
- tt.ResetClusterIter(kFALSE);
- while((c = tt.PrevCluster())){
- Float_t q = TMath::Abs(c->GetQ());
- x = c->GetX(); y = c->GetY();z = c->GetZ();
- dx = x0 - x;
+ H = (THnSparse*)fContainer->At(kMCcluster);
+ val[kPt] = TMath::ATan(dydx0)*TMath::RadToDeg();
+ //Float_t corr = 1./TMath::Sqrt(1.+dydx0*dydx0+dzdx0*dzdx0);
+ Int_t row0(-1);
+ Float_t padCorr(tilt*fTracklet->GetPadLength());
+ fTracklet->ResetClusterIter(kTRUE);
+ while((c = fTracklet->NextCluster())){
+ if(row0<0) row0 = c->GetPadRow();
+ x = c->GetX();//+fXcorr[c->GetDetector()][c->GetLocalTimeBin()];
+ y = c->GetY() + padCorr*(c->GetPadRow() - row0);
+ z = c->GetZ();
+ dx = x0 - x;
ymc= y0 - dx*dydx0;
zmc= z0 - dx*dzdx0;
- dy = cost*(y - ymc - tilt*(z-zmc));
- dz = cost*(z - zmc + tilt*(y-ymc));
-
- // Fill Histograms
- if(q>20. && q<250. && pt0>fPtThreshold && c->IsInChamber()){
- ((TH3S*)arr->At(0))->Fill(dydx0, dy, sgm[fSegmentLevel]);
- ((TH3S*)arr->At(1))->Fill(sgm[fSegmentLevel], dy/TMath::Sqrt(c->GetSigmaY2()), dz/TMath::Sqrt(c->GetSigmaZ2()));
- }
+ dy = y - ymc;
+ dz = z - zmc;
+ val[kYrez] = dy - dz*tilt;
+ val[kPrez] = dx;
+ val[kZrez] = 0.; AliTRDcluster *cc(NULL); Int_t ic(0), tb(c->GetLocalTimeBin()); Float_t q(TMath::Abs(c->GetQ()));
+ if((cc = fTracklet->GetClusters(tb-1))) {val[kZrez] += TMath::Abs(cc->GetQ()); ic++;}
+ if((cc = fTracklet->GetClusters(tb-2))) {val[kZrez] += TMath::Abs(cc->GetQ()); ic++;}
+ if(ic) val[kZrez] /= (ic*q);
+ if(H) H->Fill(val);
+
// Fill calibration container
Float_t d = zr0 - zmc;
clInfo->SetTilt(tilt);
if(fMCcl) fMCcl->Add(clInfo);
else AliDebug(1, "MCcl exchange container missing. Activate by calling \"InitExchangeContainers()\"");
- if(DebugLevel()>=5){
- if(!clInfoArr){
+ if(DebugLevel()>=5){
+ if(!clInfoArr){
clInfoArr=new TObjArray(AliTRDseedV1::kNclusters);
clInfoArr->SetOwner(kFALSE);
}
}
+//__________________________________________________________________________
+Int_t AliTRDresolution::GetPtBin(Float_t pt)
+{
+// Find pt bin according to local pt segmentation
+ Int_t ipt(-1);
+ while(ipt<AliTRDresolution::kNpt){
+ if(pt<fgPtBin[ipt+1]) break;
+ ipt++;
+ }
+ return ipt;
+}
+
+//________________________________________________________
+Float_t AliTRDresolution::GetMeanStat(TH1 *h, Float_t cut, Option_t *opt)
+{
+// return mean number of entries/bin of histogram "h"
+// if option "opt" is given the following values are accepted:
+// "<" : consider only entries less than "cut"
+// ">" : consider only entries greater than "cut"
+
+ //Int_t dim(h->GetDimension());
+ Int_t nbx(h->GetNbinsX()), nby(h->GetNbinsY()), nbz(h->GetNbinsZ());
+ Double_t sum(0.); Int_t n(0);
+ for(Int_t ix(1); ix<=nbx; ix++)
+ for(Int_t iy(1); iy<=nby; iy++)
+ for(Int_t iz(1); iz<=nbz; iz++){
+ if(strcmp(opt, "")==0){sum += h->GetBinContent(ix, iy, iz); n++;}
+ else{
+ if(strcmp(opt, "<")==0) {
+ if(h->GetBinContent(ix, iy, iz)<cut) {sum += h->GetBinContent(ix, iy, iz); n++;}
+ } else if(strcmp(opt, ">")==0){
+ if(h->GetBinContent(ix, iy, iz)>cut) {sum += h->GetBinContent(ix, iy, iz); n++;}
+ } else {sum += h->GetBinContent(ix, iy, iz); n++;}
+ }
+ }
+ return n>0?sum/n:0.;
+}
+
+//________________________________________________________
+void AliTRDresolution::GetRangeZ(TH2 *h2, Float_t &min, Float_t &max)
+{
+// Get range on Z axis such to avoid outliers
+
+ Double_t cnt[20000], c, m, s;
+ Int_t nx(h2->GetXaxis()->GetNbins()), ny(h2->GetYaxis()->GetNbins()), nc(0);
+ for(Int_t ix(1); ix<=nx; ix++){
+ for(Int_t iy(1); iy<=ny; iy++){
+ if((c = h2->GetBinContent(ix, iy))<10) continue;
+ cnt[nc++] = c;
+ if(nc==20000) break;
+ }
+ if(nc==20000) break;
+ }
+ AliMathBase::EvaluateUni(nc, cnt, m, s, 0);
+ min = m-s; max = m+2.*s;
+}
+
//________________________________________________________
Bool_t AliTRDresolution::GetRefFigure(Int_t ifig)
{
// Get the reference figures
//
- Float_t xy[4] = {0., 0., 0., 0.};
if(!gPad){
AliWarning("Please provide a canvas to draw results.");
return kFALSE;
}
- Int_t selection[100], n(0), selStart(0); //
+/* Int_t selection[100], n(0), selStart(0); //
Int_t ly0(0), dly(5);
- //Int_t ly0(1), dly(2); // used for SA
- TList *l(NULL); TVirtualPad *pad(NULL);
- TGraphErrors *g(NULL);TGraphAsymmErrors *ga(NULL);
+ TList *l(NULL); TVirtualPad *pad(NULL); */
switch(ifig){
- case 0: // charge resolution
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- ((TVirtualPad*)l->At(0))->cd();
- ga=((TGraphAsymmErrors*)((TObjArray*)fGraphM->At(kCharge))->At(0));
- if(ga->GetN()) ga->Draw("apl");
- ((TVirtualPad*)l->At(1))->cd();
- g = ((TGraphErrors*)((TObjArray*)fGraphS->At(kCharge))->At(0));
- if(g->GetN()) g->Draw("apl");
+ case 0:
break;
- case 1: // cluster2track residuals
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -.3; xy[1] = -100.; xy[2] = .3; xy[3] = 1000.;
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kCluster, 0, 1, n, selection)) break;
- pad=(TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kCluster, 0, 1, n, selection)) break;
- return kTRUE;
- case 2: // cluster2track residuals
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -.3; xy[1] = -100.; xy[2] = .3; xy[3] = 1000.;
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kCluster, 0, 1, n, selection)) break;
- xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-0.5; xy[3] = 2.5;
- pad=(TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- if(!GetGraphArray(xy, kCluster, 1, 1)) break;
- return kTRUE;
- case 3: // kTrack y
- gPad->Divide(3, 2, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -.3; xy[1] = -20.; xy[2] = .3; xy[3] = 100.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrack, 0, 1, n, selection)) break;
-
- ((TVirtualPad*)l->At(1))->cd();
- selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrack, 0, 1, n, selection)) break;
-
- ((TVirtualPad*)l->At(2))->cd();
- selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrack, 0, 1, n, selection)) break;
-
- ((TVirtualPad*)l->At(3))->cd();
- selStart=fgkNresYsegm[fSegmentLevel]; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrack, 0, 1, n, selection, "[RC]")) break;
-
- ((TVirtualPad*)l->At(4))->cd();
- selStart=fgkNresYsegm[fSegmentLevel]/3+fgkNresYsegm[fSegmentLevel]; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrack, 0, 1, n, selection, "[RC]")) break;
-
- ((TVirtualPad*)l->At(5))->cd();
- selStart=2*fgkNresYsegm[fSegmentLevel]/3+fgkNresYsegm[fSegmentLevel]; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrack, 0, 1, n, selection, "[RC]")) break;
- return kTRUE;
- case 4: // kTrack z
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
-
- xy[0] = -1.; xy[1] = -150.; xy[2] = 1.; xy[3] = 1000.;
- ((TVirtualPad*)l->At(0))->cd();
- selection[0]=1;
- if(!GetGraphArray(xy, kTrack, 2, 1, 1, selection)) break;
+ }
+ AliWarning(Form("Reference plot [%d] missing result", ifig));
+ return kFALSE;
+}
- xy[0] = -1.; xy[1] = -1500.; xy[2] = 1.; xy[3] = 10000.;
- ((TVirtualPad*)l->At(1))->cd();
- selection[0]=0;
- if(!GetGraphArray(xy, kTrack, 2, 1, 1, selection)) break;
- return kTRUE;
- case 5: // kTrack pulls
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
+//________________________________________________________
+void AliTRDresolution::MakePtSegmentation(Float_t pt0, Float_t dpt)
+{
+// Build pt segments
+ for(Int_t j(0); j<=kNpt; j++){
+ pt0+=(TMath::Exp(j*j*dpt)-1.);
+ fgPtBin[j]=pt0;
+ }
+}
- xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraphArray(xy, kTrack, 1, 1)) break;
+//________________________________________________________
+void AliTRDresolution::MakeSummary()
+{
+// Build summary plots
- xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraphArray(xy, kTrack, 3, 1)) break;
- return kTRUE;
- case 6: // kTrack phi
- xy[0] = -.3; xy[1] = -5.; xy[2] = .3; xy[3] = 50.;
- if(GetGraph(&xy[0], kTrack , 4)) return kTRUE;
- break;
- case 7: // kTrackIn y
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -.3; xy[1] = -1500.; xy[2] = .3; xy[3] = 5000.;
- pad = ((TVirtualPad*)l->At(0)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrackIn, 0, 1, n, selection)) break;
- pad=((TVirtualPad*)l->At(1)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrackIn, 0, 1, n, selection)) break;
- return kTRUE;
- case 8: // kTrackIn y
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -.3; xy[1] = -1500.; xy[2] = .3; xy[3] = 5000.;
- pad = ((TVirtualPad*)l->At(0)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrackIn, 0, 1, n, selection)) break;
- xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
- pad=((TVirtualPad*)l->At(1)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- if(!GetGraphArray(xy, kTrackIn, 1, 1)) break;
- return kTRUE;
- case 9: // kTrackIn z
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -1.; xy[1] = -1000.; xy[2] = 1.; xy[3] = 4000.;
- pad = ((TVirtualPad*)l->At(0)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- selection[0]=1;
- if(!GetGraphArray(xy, kTrackIn, 2, 1, 1, selection)) break;
- xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
- pad = ((TVirtualPad*)l->At(1)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- if(!GetGraphArray(xy, kTrackIn, 3, 1)) break;
- return kTRUE;
- case 10: // kTrackIn phi
- xy[0] = -.3; xy[1] = -5.; xy[2] = .3; xy[3] = 50.;
- if(GetGraph(&xy[0], kTrackIn, 4)) return kTRUE;
- break;
- case 11: // kTrackOut y
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -.3; xy[1] = -50.; xy[2] = .3; xy[3] = 150.;
- pad = ((TVirtualPad*)l->At(0)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrackOut, 0, 1, n, selection)) break;
- pad=((TVirtualPad*)l->At(1)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrackOut, 0, 1, n, selection)) break;
- return kTRUE;
- case 12: // kTrackOut y
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -.3; xy[1] = -50.; xy[2] = .3; xy[3] = 150.;
- pad = ((TVirtualPad*)l->At(0)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kTrackOut, 0, 1, n, selection)) break;
- xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
- pad=((TVirtualPad*)l->At(1)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- if(!GetGraphArray(xy, kTrackOut, 1, 1)) break;
- return kTRUE;
- case 13: // kTrackOut z
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -1.; xy[1] = -1000.; xy[2] = 1.; xy[3] = 4000.;
- pad = ((TVirtualPad*)l->At(0)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- if(!GetGraphArray(xy, kTrackOut, 2, 1)) break;
- xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
- pad = ((TVirtualPad*)l->At(1)); pad->cd();
- pad->SetMargin(0.1, 0.1, 0.1, 0.01);
- if(!GetGraphArray(xy, kTrackOut, 3, 1)) break;
- return kTRUE;
- case 14: // kTrackOut phi
- xy[0] = -.3; xy[1] = -5.; xy[2] = .3; xy[3] = 50.;
- if(GetGraph(&xy[0], kTrackOut, 4)) return kTRUE;
- break;
- case 15: // kMCcluster
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3]=650.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCcluster, 0, 1, n, selection)) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCcluster, 0, 1, n, selection)) break;
- return kTRUE;
- case 16: // kMCcluster
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3]=650.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCcluster, 0, 1, n, selection)) break;
- ((TVirtualPad*)l->At(1))->cd();
- xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
- if(!GetGraphArray(xy, kMCcluster, 1, 1)) break;
- return kTRUE;
- case 17: //kMCtracklet [y]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3] =500.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtracklet, 0, 1, n, selection)) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtracklet, 0, 1, n, selection)) break;
- return kTRUE;
- case 18: //kMCtracklet [y]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3] =500.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtracklet, 0, 1, n, selection)) break;
- ((TVirtualPad*)l->At(1))->cd();
- xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
- if(!GetGraphArray(xy, kMCtracklet, 1, 1)) break;
- return kTRUE;
- case 19: //kMCtracklet [z]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-1.; xy[1]=-100.; xy[2]=1.; xy[3] =2500.;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraphArray(xy, kMCtracklet, 2)) break;
- xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraphArray(xy, kMCtracklet, 3)) break;
- return kTRUE;
- case 20: //kMCtracklet [phi]
- xy[0]=-.3; xy[1]=-3.; xy[2]=.3; xy[3] =25.;
- if(!GetGraph(&xy[0], kMCtracklet, 4)) break;
- return kTRUE;
- case 21: //kMCtrack [y] ly [0]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*0.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer1")) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*0.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer1")) break;
- return kTRUE;
- case 22: //kMCtrack [y] ly [1]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*1.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer2")) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*1.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer2")) break;
- return kTRUE;
- case 23: //kMCtrack [y] ly [2]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*2.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer3")) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*2.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer3")) break;
- return kTRUE;
- case 24: //kMCtrack [y] ly [3]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*3.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer4")) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*3.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer4")) break;
- return kTRUE;
- case 25: //kMCtrack [y] ly [4]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*4.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer5")) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*4.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer5")) break;
- return kTRUE;
- case 26: //kMCtrack [y] ly [5]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.2; xy[1]=-50.; xy[2]=.2; xy[3] =400.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*5.); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer6")) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=Int_t(fgkNresYsegm[fSegmentLevel]*5.5); for(n=0; n<fgkNresYsegm[fSegmentLevel]/2; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 0, 1, n, selection, "Layer6")) break;
- return kTRUE;
- case 27: //kMCtrack [y pulls]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 5.5;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=0; for(n=0; n<6; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 1, 1, n, selection)) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=6; for(n=0; n<6; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrack, 1, 1, n, selection)) break;
- return kTRUE;
- case 28: //kMCtrack [z]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-1.; xy[1]=-1500.; xy[2]=1.; xy[3] =6000.;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraphArray(xy, kMCtrack, 2)) break;
- xy[0] = -1.; xy[1] = -1.5; xy[2] = 1.; xy[3] = 5.;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraphArray(xy, kMCtrack, 3)) break;
- return kTRUE;
- case 29: //kMCtrack [phi/snp]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.2; xy[1]=-0.5; xy[2]=.2; xy[3] =10.;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraphArray(xy, kMCtrack, 4)) break;
- xy[0] = -.2; xy[1] = -1.5; xy[2] = .2; xy[3] = 5.;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraphArray(xy, kMCtrack, 5)) break;
- return kTRUE;
- case 30: //kMCtrack [theta/tgl]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-1.; xy[1]=-0.5; xy[2]=1.; xy[3] =5.;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraphArray(xy, kMCtrack, 6)) break;
- xy[0] = -.2; xy[1] = -0.5; xy[2] = .2; xy[3] = 2.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraphArray(xy, kMCtrack, 7)) break;
- return kTRUE;
- case 31: //kMCtrack [pt]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // pi selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 2; // pi-
- selection[n++] = il*11 + 8; // pi+
- }
- xy[0] = 0.2; xy[1] = -.7; xy[2] = 7.; xy[3] = 4.;
- //xy[0] = 0.2; xy[1] = -1.; xy[2] = 7.; xy[3] = 10.; // SA
- if(!GetGraphArray(xy, kMCtrack, 8, kTRUE, n, selection, "#pi#pm")) break;
- pad->Modified(); pad->Update(); pad->SetLogx();
- pad = (TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // mu selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 3; // mu-
- selection[n++] = il*11 + 7; // mu+
- }
- if(!GetGraphArray(xy, kMCtrack, 8, kTRUE, n, selection, "#mu#pm")) break;
- pad->Modified(); pad->Update(); pad->SetLogx();
- return kTRUE;
- case 32: //kMCtrack [pt]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // p selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 0; // p bar
- selection[n++] = il*11 + 10; // p
- }
- xy[0] = 0.2; xy[1] = -.7; xy[2] = 7.; xy[3] = 8.;
- //xy[0] = 0.2; xy[1] = -1.; xy[2] = 7.; xy[3] = 10.; // SA
- if(!GetGraphArray(xy, kMCtrack, 8, kTRUE, n, selection, "p&p bar")) break;
- pad->Modified(); pad->Update(); pad->SetLogx();
- pad = (TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // e selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 4; // e-
- selection[n++] = il*11 + 6; // e+
- }
- xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 12.;
- //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 14.; // SA
- if(!GetGraphArray(xy, kMCtrack, 8, kTRUE, n, selection, "e#pm")) break;
- pad->Modified(); pad->Update(); pad->SetLogx();
- return kTRUE;
- case 33: //kMCtrack [1/pt] pulls
- xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 3.5;
- //xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 4.5; // SA
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // pi selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 2; // pi-
- selection[n++] = il*11 + 8; // pi+
- }
- if(!GetGraphArray(xy, kMCtrack, 9, kTRUE, n, selection, "#pi#pm")) break;
- pad = (TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // mu selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 3; // mu-
- selection[n++] = il*11 + 7; // mu+
- }
- if(!GetGraphArray(xy, kMCtrack, 9, kTRUE, n, selection, "#mu#pm")) break;
- return kTRUE;
- case 34: //kMCtrack [1/pt] pulls
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // p selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 0; // p bar
- selection[n++] = il*11 + 10; // p
- }
- xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 3.5;
- //xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 6.; // SA
- if(!GetGraphArray(xy, kMCtrack, 9, kTRUE, n, selection, "p & p bar")) break;
- pad = (TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // e selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 4; // e-
- selection[n++] = il*11 + 6; // e+
+ if(!fProj){
+ AliError("Missing results");
+ return;
+ }
+ TVirtualPad *p(NULL); TCanvas *cOut(NULL);
+ TObjArray *arr(NULL); TH2 *h2(NULL);
+
+ // cluster resolution
+ // define palette
+ gStyle->SetPalette(1);
+ const Int_t nClViews(9);
+ const Char_t *vClName[nClViews] = {"ClY", "ClYn", "ClYp", "ClQn", "ClQp", "ClYXTCp", "ClYXTCn", "ClYXPh", "ClYXPh"};
+ const UChar_t vClOpt[nClViews] = {1, 1, 1, 0, 0, 0, 0, 0, 1};
+ const Int_t nTrkltViews(19);
+ const Char_t *vTrkltName[nTrkltViews] = {
+ "TrkltY", "TrkltYn", "TrkltYp", "TrkltY", "TrkltYn", "TrkltYp",
+ "TrkltPh", "TrkltPhn", "TrkltPhp",
+ "TrkltQ", "TrkltQn", "TrkltQp",
+ "TrkltQS", "TrkltQSn", "TrkltQSp",
+ "TrkltTBn", "TrkltTBp", "TrkltTBn", "TrkltTBp"
+// "TrkltYnl0", "TrkltYpl0", "TrkltPhnl0", "TrkltPhpl0", "TrkltQnl0", "TrkltQpl0", // electrons low pt
+/* "TrkltYnl1", "TrkltYpl1", "TrkltPhnl1", "TrkltPhpl1", "TrkltQnl1", "TrkltQpl1", // muons low pt
+ "TrkltYnl2", "TrkltYpl2", "TrkltPhnl2", "TrkltPhpl2", "TrkltQnl2", "TrkltQpl2" // pions low pt*/
+ };
+ const UChar_t vTrkltOpt[nTrkltViews] = {
+ 0, 0, 0, 1, 1, 1,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 0,
+ 0, 0, 1, 1
+ };
+ const Int_t nTrkInViews(5);
+ const Char_t *vTrkInName[nTrkInViews][6] = {
+ {"TrkInY", "TrkInYn", "TrkInYp", "TrkInRCZ", "TrkInPhn", "TrkInPhp"},
+ {"TrkInY", "TrkInYn", "TrkInYp", "TrkInRCZ", "TrkInPhn", "TrkInPhp"},
+ {"TrkInYnl", "TrkInYni", "TrkInYnh", "TrkInYpl", "TrkInYpi", "TrkInYph"},
+ {"TrkInXnl", "TrkInXpl", "TrkInXl", "TrkInYnh", "TrkInYph", "TrkInYh"},
+ {"TrkInPhnl", "TrkInPhni", "TrkInPhnh", "TrkInPhpl", "TrkInPhpi", "TrkInPhph"},
+ //{"TrkInRCX", "TrkInRCY", "TrkInRCPh", "TrkInRCZl", "TrkInRCZi", "TrkInRCZh"}
+ };
+ const UChar_t vTrkInOpt[nTrkInViews] = {0, 1, 0, 0, 0};
+ const Float_t min[6] = {0.15, 0.15, 0.15, 0.15, 0.5, 0.5};
+ const Float_t max[6] = {0.6, 0.6, 0.6, 0.6, 2.3, 2.3};
+ const Char_t *ttt[6] = {"#sigma(#Deltay) [cm]", "#sigma(#Deltay) [cm]", "#sigma(#Deltay) [cm]", "#sigma(#Deltaz) [cm]", "#sigma(#Delta#phi) [deg]", "#sigma(#Delta#phi) [deg]"};
+
+ const Int_t nTrkViews(27);
+ const Char_t *vTrkName[nTrkViews] = {
+ "TrkY", "TrkYn", "TrkYp",
+ "TrkPh", "TrkPhn", "TrkPhp",
+ "TrkDPt", "TrkDPtn", "TrkDPtp",
+ "TrkYnl0", "TrkYpl0", "TrkPhnl0", "TrkPhpl0", "TrkDPtnl0", "TrkDPtpl0", // electrons low pt
+ "TrkYnl1", "TrkYpl1", "TrkPhnl1", "TrkPhpl1", "TrkDPtnl1", "TrkDPtpl1", // muons low pt
+ "TrkYnl2", "TrkYpl2", "TrkPhnl2", "TrkPhpl2", "TrkDPtnl2", "TrkDPtpl2" // pions low pt
+ };
+ const Char_t *typName[] = {"", "MC"};
+ const Int_t nx(2048), ny(1536);
+
+ if((arr = (TObjArray*)fProj->At(kDetector))){
+ cOut = new TCanvas(Form("%s_Det", GetName()), "Detector performance", 2*nx, 2*ny);
+ cOut->Divide(AliTRDgeometry::kNlayer,AliTRDeventInfo::kCentralityClasses, 1.e-5, 1.e-5);
+ for(Int_t icen(0); icen<AliTRDeventInfo::kCentralityClasses; icen++){
+ Float_t zmin(1.e10), zmax(0.);
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ if(!(h2 = (TH2*)arr->FindObject(Form("HDetQ%d%d_yx", ily, icen)))) continue;
+ Float_t m, M; GetRangeZ(h2, m, M);
+ if(m<zmin) zmin=m;
+ if(M>zmax) zmax=M;
+ }
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ p=cOut->cd(icen*AliTRDgeometry::kNlayer+ily+1); p->SetRightMargin(0.1572581);p->SetTopMargin(0.08262712);
+ if(!(h2 = (TH2*)arr->FindObject(Form("HDetQ%d%d_yx", ily, icen)))) continue;
+ SetRangeZ(h2, zmin, zmax);
+ h2->Draw("colz");
+ MakeDetectorPlot(ily);
+ }
}
- xy[0] = 0.; xy[1] = -2.; xy[2] = 2.; xy[3] = 4.5;
- if(!GetGraphArray(xy, kMCtrack, 9, kTRUE, n, selection, "e#pm")) break;
- return kTRUE;
- case 35: //kMCtrack [p]
- xy[0] = 0.2; xy[1] = -.7; xy[2] = 7.; xy[3] = 4.;
- //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 10.;
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // pi selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 2; // pi-
- selection[n++] = il*11 + 8; // pi+
+ cOut->SaveAs(Form("%s.gif", cOut->GetName()));
+ }
+ for(Int_t ityp(0); ityp<(HasMCdata()?2:1); ityp++){
+ if((arr = (TObjArray*)fProj->At(ityp?kMCcluster:kCluster))){
+ for(Int_t iview(0); iview<nClViews; iview++){
+ cOut = new TCanvas(Form("%s_%s%s_%d", GetName(), typName[ityp], vClName[iview], vClOpt[iview]), "Cluster Resolution", nx, ny);
+ cOut->Divide(3,2, 1.e-5, 1.e-5);
+ Int_t nplot(0);
+ for(Int_t iplot(0); iplot<6; iplot++){
+ p=cOut->cd(iplot+1); p->SetRightMargin(0.1572581);p->SetTopMargin(0.08262712);
+ if(!(h2 = (TH2*)arr->FindObject(Form("H%s%s%d_2D", typName[ityp], vClName[iview], iplot)))) continue;
+ nplot++;
+ if(vClOpt[iview]==0) h2->Draw("colz");
+ else if(vClOpt[iview]==1) DrawSigma(h2, "#sigma(#Deltay) [#mum]", 3.2e2, 5.e2, 1.e4);
+ MakeDetectorPlot(iplot);
+ }
+ if(nplot==6) cOut->SaveAs(Form("%s.gif", cOut->GetName()));
+ else delete cOut;
+ }
}
- if(!GetGraphArray(xy, kMCtrack, 10, kTRUE, n, selection, "#pi#pm")) break;
- pad->Modified(); pad->Update(); pad->SetLogx();
- pad = (TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // mu selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 3; // mu-
- selection[n++] = il*11 + 7; // mu+
+ // tracklet systematic
+ if((arr = (TObjArray*)fProj->At(ityp?kMCtracklet:kTracklet))){
+ for(Int_t iview(0); iview<nTrkltViews; iview++){
+ cOut = new TCanvas(Form("%s_%s%s_%d", GetName(), typName[ityp], vTrkltName[iview], vTrkltOpt[iview]), "Tracklet Resolution", nx, ny);
+ cOut->Divide(3,2, 1.e-5, 1.e-5);
+ Int_t nplot(0);
+ for(Int_t iplot(0); iplot<6; iplot++){
+ p=cOut->cd(iplot+1); p->SetRightMargin(0.1572581); p->SetTopMargin(0.08262712);
+ if(!(h2 = (TH2*)arr->FindObject(Form("H%s%s%d_2D", typName[ityp], vTrkltName[iview], iplot)))) continue;
+ nplot++;
+ if(vTrkltOpt[iview]==0) h2->Draw("colz");
+ else DrawSigma(h2, "#sigma(#Deltay) [cm]", .15, .6);
+ MakeDetectorPlot(iplot);
+ }
+ if(nplot==6){
+ cOut->Modified();cOut->Update();
+ cOut->SaveAs(Form("%s.gif", cOut->GetName()));
+ }
+ delete cOut;
+ }
}
- if(!GetGraphArray(xy, kMCtrack, 10, kTRUE, n, selection, "#mu#pm")) break;
- pad->Modified(); pad->Update(); pad->SetLogx();
- return kTRUE;
- case 36: //kMCtrack [p]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // p selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 0; // p bar
- selection[n++] = il*11 + 10; // p
+ // trackIn systematic
+ if((arr = (TObjArray*)fProj->At(ityp?kMCtrackIn:kTrackIn))){
+ for(Int_t iview(0); iview<nTrkInViews; iview++){
+ cOut = new TCanvas(Form("%s_%s%s_%d", GetName(), typName[ityp], vTrkInName[iview][0], vTrkInOpt[iview]), "Track IN Resolution", nx, ny);
+ cOut->Divide(3,2, 1.e-5, 1.e-5);
+ Int_t nplot(0);
+ for(Int_t iplot(0); iplot<6; iplot++){
+ p=cOut->cd(iplot+1); p->SetRightMargin(0.1572581); p->SetTopMargin(0.08262712);
+ if(!(h2 = (TH2*)arr->FindObject(Form("H%s%s_2D", typName[ityp], vTrkInName[iview][iplot])))){
+ AliInfo(Form("Missing H%s%s_2D", typName[ityp], vTrkInName[iview][iplot]));
+ continue;
+ }
+ nplot++;
+ if(vTrkInOpt[iview]==0) h2->Draw("colz");
+ else DrawSigma(h2, ttt[iplot], min[iplot], max[iplot]);
+ MakeDetectorPlot(0);
+ }
+ if(nplot==6) cOut->SaveAs(Form("%s.gif", cOut->GetName()));
+ else delete cOut;
+ }
+ // species
+ const Char_t *plot[] = {"Ph", "Q", "QS"};
+ for(Int_t iview(0); iview<3; iview++){
+ cOut = new TCanvas(Form("%s_%sTrkInSpc%s", GetName(), typName[ityp], plot[iview]), "Track IN PID", Int_t(1.5*nx), Int_t(1.5*ny));
+ cOut->Divide(5,3, 1.e-5, 1.e-5);
+ Int_t nplot(0); const Char_t *chName[] = {"p", "n", ""};
+ for(Int_t iplot(0); iplot<3; iplot++){
+ for(Int_t ispec(0); ispec<AliPID::kSPECIES; ispec++){
+ p=cOut->cd(iplot*AliPID::kSPECIES+ispec+1); p->SetRightMargin(0.1572581); p->SetTopMargin(0.08262712);
+ if(!(h2 = (TH2*)arr->FindObject(Form("H%sTrkIn%s%s%d_2D", typName[ityp], plot[iview], chName[iplot], ispec)))) {
+ AliInfo(Form("Missing H%sTrkIn%s%s%d_2D", typName[ityp], plot[iview], chName[iplot], ispec));
+ continue;
+ }
+ nplot++;
+ h2->Draw("colz");
+ MakeDetectorPlot(0);
+ }
+ }
+ if(nplot==15) cOut->SaveAs(Form("%s.gif", cOut->GetName()));
+ else delete cOut;
+ }
}
- xy[0] = 0.2; xy[1] = -.7; xy[2] = 7.; xy[3] = 8.;
- //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 12.; // SA
- if(!GetGraphArray(xy, kMCtrack, 10, kTRUE, n, selection, "p & p bar")) break;
- pad->Modified(); pad->Update(); pad->SetLogx();
- pad = (TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- // e selection
- n=0;
- for(Int_t il(ly0); il<AliTRDgeometry::kNlayer; il+=dly){
- selection[n++] = il*11 + 4; // e-
- selection[n++] = il*11 + 6; // e+
+ }
+ // track MC systematic
+ if((arr = (TObjArray*)fProj->At(kMCtrack))) {
+ for(Int_t iview(0); iview<nTrkViews; iview++){
+ cOut = new TCanvas(Form("%s_MC%s", GetName(), vTrkName[iview]), "Track Resolution", nx, ny);
+ cOut->Divide(3,2, 1.e-5, 1.e-5);
+ Int_t nplot(0);
+ for(Int_t iplot(0); iplot<6; iplot++){
+ p=cOut->cd(iplot+1); p->SetRightMargin(0.1572581); p->SetTopMargin(0.08262712);
+ if(!(h2 = (TH2*)arr->FindObject(Form("HMC%s%d_2D", vTrkName[iview], iplot)))) continue;
+ h2->Draw("colz"); nplot++;
+ }
+ if(nplot==6) cOut->SaveAs(Form("%s.gif", cOut->GetName()));
+ else delete cOut;
}
- xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 12.;
- //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 14.; // SA
- if(!GetGraphArray(xy, kMCtrack, 10, kTRUE, n, selection, "e#pm")) break;
- pad->Modified(); pad->Update(); pad->SetLogx();
- return kTRUE;
- case 37: // kMCtrackIn [y]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.25; xy[1]=-1000.; xy[2]=.25; xy[3] =3000.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrackIn, 0, 1, n, selection)) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(&xy[0], kMCtrackIn, 0, 1, n, selection)) break;
- return kTRUE;
- case 38: // kMCtrackIn [y]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.25; xy[1]=-1000.; xy[2]=.25; xy[3] =3000.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrackIn, 0, 1, n, selection)) break;
- xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraphArray(xy, kMCtrackIn, 1, 1)) break;
- return kTRUE;
- case 39: // kMCtrackIn [z]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-1.; xy[1]=-500.; xy[2]=1.; xy[3] =800.;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraphArray(xy, kMCtrackIn, 2, 1)) break;
- xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraphArray(xy, kMCtrackIn, 3, 1)) break;
- return kTRUE;
- case 40: // kMCtrackIn [phi|snp]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.25; xy[1]=-0.5; xy[2]=.25; xy[3] =2.5;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraph(&xy[0], kMCtrackIn, 4)) break;
- xy[0] = -.25; xy[1] = -0.5; xy[2] = .25; xy[3] = 1.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraph(&xy[0], kMCtrackIn, 5)) break;
- return kTRUE;
- case 41: // kMCtrackIn [theta|tgl]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-1.; xy[1]=-1.; xy[2]=1.; xy[3] =4.;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraph(&xy[0], kMCtrackIn, 6)) break;
- xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 1.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraph(&xy[0], kMCtrackIn, 7)) break;
- return kTRUE;
- case 42: // kMCtrackIn [pt]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = 0.2; xy[1] = -.8; xy[2] = 7.; xy[3] = 6.;
- //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 10.; // SA
- pad=(TVirtualPad*)l->At(0); pad->cd(); pad->SetLogx();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
- if(!GetGraphArray(xy, kMCtrackIn, 8, 1, n, selection)) break;
- pad = (TVirtualPad*)l->At(1); pad->cd(); pad->SetLogx();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
- if(!GetGraphArray(xy, kMCtrackIn, 8, 1, n, selection)) break;
- return kTRUE;
- case 43: //kMCtrackIn [1/pt] pulls
- xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 3.5;
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
- if(!GetGraphArray(xy, kMCtrackIn, 9, 1, n, selection)) break;
- pad = (TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
- if(!GetGraphArray(xy, kMCtrackIn, 9, 1, n, selection)) break;
- return kTRUE;
- case 44: // kMCtrackIn [p]
- xy[0] = 0.2; xy[1] = -.8; xy[2] = 7.; xy[3] = 6.;
- //xy[0] = 0.2; xy[1] = -1.5; xy[2] = 7.; xy[3] = 10.;
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- pad = ((TVirtualPad*)l->At(0));pad->cd();pad->SetLogx();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
- if(!GetGraphArray(xy, kMCtrackIn, 10, 1, n, selection)) break;
- pad = ((TVirtualPad*)l->At(1)); pad->cd();pad->SetLogx();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
- if(!GetGraphArray(xy, kMCtrackIn, 10, 1, n, selection)) break;
- return kTRUE;
- case 45: // kMCtrackOut [y]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3] =400.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=0; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrackOut, 0, 1, n, selection)) break;
- ((TVirtualPad*)l->At(1))->cd();
- selStart=fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(&xy[0], kMCtrackOut, 0, 1, n, selection)) break;
- return kTRUE;
- case 46: // kMCtrackOut [y]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.3; xy[1]=-50.; xy[2]=.3; xy[3] =400.;
- ((TVirtualPad*)l->At(0))->cd();
- selStart=2*fgkNresYsegm[fSegmentLevel]/3; for(n=0; n<fgkNresYsegm[fSegmentLevel]/3; n++) selection[n]=selStart+n;
- if(!GetGraphArray(xy, kMCtrackOut, 0, 1, n, selection)) break;
- xy[0] = -.5; xy[1] = -0.5; xy[2] = fgkNresYsegm[fSegmentLevel]-.5; xy[3] = 2.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraphArray(xy, kMCtrackOut, 1, 1)) break;
- return kTRUE;
- case 47: // kMCtrackOut [z]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-1.; xy[1]=-500.; xy[2]=1.; xy[3] =1500.;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraphArray(xy, kMCtrackOut, 2, 1)) break;
- xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 2.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraphArray(xy, kMCtrackOut, 3, 1)) break;
- return kTRUE;
- case 48: // kMCtrackOut [phi|snp]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-.25; xy[1]=-0.5; xy[2]=.25; xy[3] =2.5;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraph(&xy[0], kMCtrackOut, 4)) break;
- xy[0] = -.25; xy[1] = -0.5; xy[2] = .25; xy[3] = 1.5;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraph(&xy[0], kMCtrackOut, 5)) break;
- return kTRUE;
- case 49: // kMCtrackOut [theta|tgl]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0]=-1.; xy[1]=-1.; xy[2]=1.; xy[3] =4.;
- ((TVirtualPad*)l->At(0))->cd();
- if(!GetGraph(&xy[0], kMCtrackOut, 6)) break;
- xy[0] = -1.; xy[1] = -0.5; xy[2] = 1.; xy[3] = 15.;
- ((TVirtualPad*)l->At(1))->cd();
- if(!GetGraph(&xy[0], kMCtrackOut, 7)) break;
- return kTRUE;
- case 50: // kMCtrackOut [pt]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = 0.2; xy[1] = -.8; xy[2] = 7.; xy[3] = 6.;
- pad=(TVirtualPad*)l->At(0); pad->cd(); pad->SetLogx();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
- if(!GetGraphArray(xy, kMCtrackOut, 8, 1, n, selection)) break;
- pad = (TVirtualPad*)l->At(1); pad->cd();pad->SetLogx();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
- if(!GetGraphArray(xy, kMCtrackOut, 8, 1, n, selection)) break;
- return kTRUE;
- case 51: //kMCtrackOut [1/pt] pulls
- xy[0] = 0.; xy[1] = -1.; xy[2] = 2.; xy[3] = 3.5;
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- pad = (TVirtualPad*)l->At(0); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
- if(!GetGraphArray(xy, kMCtrackOut, 9, 1, n, selection)) break;
- pad = (TVirtualPad*)l->At(1); pad->cd();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
- if(!GetGraphArray(xy, kMCtrackOut, 9, 1, n, selection)) break;
- return kTRUE;
- case 52: // kMCtrackOut [p]
- gPad->Divide(2, 1, 1.e-5, 1.e-5); l=gPad->GetListOfPrimitives();
- xy[0] = 0.2; xy[1] = -.8; xy[2] = 7.; xy[3] = 6.;
- pad = ((TVirtualPad*)l->At(0));pad->cd();pad->SetLogx();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=2; selection[n++]=3; selection[n++]=7; selection[n++]=8;
- if(!GetGraphArray(xy, kMCtrackOut, 10, 1, n, selection)) break;
- pad = ((TVirtualPad*)l->At(1)); pad->cd();pad->SetLogx();
- pad->SetMargin(0.125, 0.015, 0.1, 0.015);
- n=0; selection[n++]=0; selection[n++]=4; selection[n++]=6; selection[n++]=10;
- if(!GetGraphArray(xy, kMCtrackOut, 10, 1, n, selection)) break;
- return kTRUE;
}
- AliWarning(Form("Reference plot [%d] missing result", ifig));
- return kFALSE;
+
+
+ gStyle->SetPalette(1);
}
//________________________________________________________
-void AliTRDresolution::MakeSummary()
+void AliTRDresolution::DrawSigma(TH2 *h2, const Char_t *title, Float_t m, Float_t M, Float_t scale)
{
-// Build summary plots
-
- if(!fGraphS || !fGraphM){
- AliError("Missing results");
- return;
- }
- Float_t xy[4] = {0., 0., 0., 0.};
- Float_t range[2];
- TH2 *h2 = new TH2I("h2SF", "", 20, -.2, .2, fgkNresYsegm[fSegmentLevel], -0.5, fgkNresYsegm[fSegmentLevel]-0.5);
- h2->GetXaxis()->CenterTitle();
- h2->GetYaxis()->CenterTitle();
- h2->GetZaxis()->CenterTitle();h2->GetZaxis()->SetTitleOffset(1.4);
-
- Int_t ih2(0), iSumPlot(0);
- TCanvas *cOut = new TCanvas(Form("TRDsummary%s_%d", GetName(), iSumPlot++), "Cluster & Tracklet Resolution", 1024, 768);
- cOut->Divide(3,2, 2.e-3, 2.e-3, kYellow-7);
- TVirtualPad *p(NULL);
-
- p=cOut->cd(1);
- p->SetRightMargin(0.16);p->SetTopMargin(0.06);
- h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
- h2->SetTitle(Form("Cluster-Track R-Phi Residuals;tg(#phi);%s;Sigma [#mum]", fgkResYsegmName[fSegmentLevel]));
- MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphS->At(kCluster))->At(0), h2);
- GetRange(h2, 1, range);
- h2->GetZaxis()->SetRangeUser(range[0], range[1]);
- h2->Draw("colz");
- h2->SetContour(7);
-
- p=cOut->cd(2);
- p->SetRightMargin(0.16);p->SetTopMargin(0.06);
- h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
- h2->SetTitle(Form("Cluster-Track R-Phi Systematics;tg(#phi);%s;Mean [#mum]", fgkResYsegmName[fSegmentLevel]));
- MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphM->At(kCluster))->At(0), h2);
- GetRange(h2, 0, range);
- h2->GetZaxis()->SetRangeUser(range[0], range[1]);
- h2->Draw("colz");
- h2->SetContour(7);
-
- p=cOut->cd(3);
- p->SetRightMargin(0.06);p->SetTopMargin(0.06);
- xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
- GetGraphArray(xy, kCluster, 1, 1);
-
- p=cOut->cd(4);
- p->SetRightMargin(0.16);p->SetTopMargin(0.06);
- h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
- h2->SetTitle(Form("Tracklet-Track R-Phi Residuals;tg(#phi);%s;Sigma [#mum]", fgkResYsegmName[fSegmentLevel]));
- MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphS->At(kTrack))->At(0), h2);
- GetRange(h2, 1, range);
- h2->GetZaxis()->SetRangeUser(range[0], range[1]);
- h2->Draw("colz");
- h2->SetContour(7);
-
- p=cOut->cd(5);
- p->SetRightMargin(0.16);p->SetTopMargin(0.06);
- h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
- h2->SetTitle(Form("Tracklet-Track R-Phi Systematics;tg(#phi);%s;Mean [#mum]", fgkResYsegmName[fSegmentLevel]));
- MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphM->At(kTrack))->At(0), h2);
- GetRange(h2, 0, range);
- h2->GetZaxis()->SetRangeUser(range[0], range[1]);
- h2->Draw("colz");
- h2->SetContour(7);
-
- p=cOut->cd(6);
- p->SetRightMargin(0.06);p->SetTopMargin(0.06);
- xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
- GetGraphArray(xy, kTrack, 1, 1);
-
- cOut->SaveAs(Form("%s.gif", cOut->GetName()));
-
- if(!HasMCdata() ||
- (!fGraphS->At(kMCcluster) || !fGraphM->At(kMCcluster) ||
- !fGraphS->At(kMCtracklet) || !fGraphM->At(kMCtracklet))){
- delete cOut;
- return;
+ // Draw error bars scaled with "scale" instead of content values
+ //use range [m,M] if limits are specified
+
+ if(!h2) return;
+ TAxis *ax(h2->GetXaxis()), *ay(h2->GetYaxis());
+ TH2F *h2e = new TH2F(Form("%s_E", h2->GetName()),
+ Form("%s;%s;%s;%s", h2->GetTitle(), ax->GetTitle(), ay->GetTitle(), title),
+ ax->GetNbins(), ax->GetXmin(), ax->GetXmax(),
+ ay->GetNbins(), ay->GetXmin(), ay->GetXmax());
+ h2e->SetContour(9);
+ TAxis *az(h2e->GetZaxis());
+ if(M>m) az->SetRangeUser(m, M);
+ az->CenterTitle();
+ az->SetTitleOffset(1.5);
+ for(Int_t ix(1); ix<=h2->GetNbinsX(); ix++){
+ for(Int_t iy(1); iy<=h2->GetNbinsY(); iy++){
+ if(h2->GetBinContent(ix, iy)<-100.) continue;
+ Float_t v(scale*h2->GetBinError(ix, iy));
+ if(M>m && v<m) v=m+TMath::Abs((M-m)*1.e-3);
+ h2e->SetBinContent(ix, iy, v);
+ }
}
- cOut->Clear(); cOut->SetName(Form("TRDsummary%s_%d", GetName(), iSumPlot++));
- cOut->Divide(3, 2, 2.e-3, 2.e-3, kBlue-10);
-
- p=cOut->cd(1);
- p->SetRightMargin(0.16);p->SetTopMargin(0.06);
- h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
- h2->SetTitle(Form("Cluster-MC R-Phi Resolution;tg(#phi);%s;Sigma [#mum]", fgkResYsegmName[fSegmentLevel]));
- MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphS->At(kMCcluster))->At(0), h2);
- GetRange(h2, 1, range);
- h2->GetZaxis()->SetRangeUser(range[0], range[1]);
- h2->Draw("colz");
- h2->SetContour(7);
-
- p=cOut->cd(2);
- p->SetRightMargin(0.16);p->SetTopMargin(0.06);
- h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
- h2->SetContour(7);
- h2->SetTitle(Form("Cluster-MC R-Phi Systematics;tg(#phi);%s;Mean [#mum]", fgkResYsegmName[fSegmentLevel]));
- MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphM->At(kMCcluster))->At(0), h2);
- GetRange(h2, 0, range);
- h2->GetZaxis()->SetRangeUser(range[0], range[1]);
- h2->Draw("colz");
- h2->SetContour(7);
-
- p=cOut->cd(3);
- p->SetRightMargin(0.06);p->SetTopMargin(0.06);
- xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
- GetGraphArray(xy, kMCcluster, 1, 1);
-
- p=cOut->cd(4);
- p->SetRightMargin(0.16);p->SetTopMargin(0.06);
- h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
- h2->SetContour(7);
- h2->SetTitle(Form("Tracklet-MC R-Phi Resolution;tg(#phi);%s;Sigma [#mum]", fgkResYsegmName[fSegmentLevel]));
- MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphS->At(kMCtracklet))->At(0), h2);
- GetRange(h2, 1, range);
- h2->GetZaxis()->SetRangeUser(range[0], range[1]);
- h2->Draw("colz");
- h2->SetContour(7);
-
- p=cOut->cd(5);
- p->SetRightMargin(0.16);p->SetTopMargin(0.06);
- h2=(TH2I*)h2->Clone(Form("h2SF_%d", ih2++));
- h2->SetContour(7);
- h2->SetTitle(Form("Tracklet-MC R-Phi Systematics;tg(#phi);%s;Mean [#mum]", fgkResYsegmName[fSegmentLevel]));
- MakeSummaryPlot((TObjArray*) ((TObjArray*)fGraphM->At(kMCtracklet))->At(0), h2);
- GetRange(h2, 0, range);
- h2->GetZaxis()->SetRangeUser(range[0], range[1]);
- h2->Draw("colz");
- h2->SetContour(7);
-
- p=cOut->cd(6);
- p->SetRightMargin(0.06);p->SetTopMargin(0.06);
- xy[0]=-.5; xy[1]=-0.5; xy[2]=fgkNresYsegm[fSegmentLevel]-.5; xy[3]=2.5;
- GetGraphArray(xy, kMCtracklet, 1, 1);
-
- cOut->SaveAs(Form("%s.gif", cOut->GetName()));
- delete cOut;
+ h2e->Draw("colz");
}
//________________________________________________________
void AliTRDresolution::GetRange(TH2 *h2, Char_t mod, Float_t *range)
{
-// Returns the range of the bulk of data in histogram h2. Removes outliers.
+// Returns the range of the bulk of data in histogram h2. Removes outliers.
// The "range" vector should be initialized with 2 elements
// Option "mod" can be any of
-// - 0 : gaussian like distribution
-// - 1 : tailed distribution
+// - 0 : gaussian like distribution
+// - 1 : tailed distribution
Int_t nx(h2->GetNbinsX())
, ny(h2->GetNbinsY())
AliMathBase::EvaluateUni(n, data, mean, sigm, Int_t(n*.8));
range[0]=mean-3.*sigm; range[1]=mean+3.*sigm;
- if(mod==1) range[0]=TMath::Max(Float_t(1.e-3), range[0]);
+ if(mod==1) range[0]=TMath::Max(Float_t(1.e-3), range[0]);
AliDebug(2, Form("h[%s] range0[%f %f]", h2->GetName(), range[0], range[1]));
TH1S h1("h1SF0", "", 100, range[0], range[1]);
h1.FillN(n,data,0);
delete [] data;
-
+
switch(mod){
- case 0:// gaussian distribution
+ case 0:// gaussian distribution
{
TF1 fg("fg", "gaus", mean-3.*sigm, mean+3.*sigm);
h1.Fit(&fg, "QN");
AliDebug(2, Form(" rangeG[%f %f]", range[0], range[1]));
break;
}
- case 1:// tailed distribution
- {
+ case 1:// tailed distribution
+ {
Int_t bmax(h1.GetMaximumBin());
Int_t jBinMin(1), jBinMax(100);
for(Int_t ibin(bmax); ibin--;){
jBinMin=ibin; break;
}
}
- for(Int_t ibin(bmax); ibin++;){
- if(h1.GetBinContent(ibin)<1.){
- jBinMax=ibin; break;
- }
+ for(Int_t ibin(bmax); ibin++;){
+ if(h1.GetBinContent(ibin)<1.){
+ jBinMax=ibin; break;
+ }
+ }
+ range[0]=h1.GetBinCenter(jBinMin); range[1]=h1.GetBinCenter(jBinMax);
+ AliDebug(2, Form(" rangeT[%f %f]", range[0], range[1]));
+ break;
+ }
+ }
+
+ return;
+}
+
+//________________________________________________________
+Bool_t AliTRDresolution::MakeProjectionDetector()
+{
+// Analyse cluster
+ const Int_t kNcontours(9);
+ const Int_t kNstat(100);
+ if(fProj && fProj->At(kDetector)) return kTRUE;
+ if(!fContainer){
+ AliError("Missing data container.");
+ return kFALSE;
+ }
+ THnSparse *H(NULL);
+ if(!(H = (THnSparse*)fContainer->FindObject("hDet2Cluster"))){
+ AliInfo(Form("Missing/Wrong data @ hDet2Cluster."));
+ return kTRUE;
+ }
+ Int_t ndim(H->GetNdimensions());
+ Int_t coord[kNdim]; memset(coord, 0, sizeof(Int_t) * kNdim); Double_t v = 0.;
+ TAxis *aa[kNdim], *ac(NULL); memset(aa, 0, sizeof(TAxis*) * kNdim);
+ for(Int_t id(0); id<ndim; id++) aa[id] = H->GetAxis(id);
+ Int_t nCen(1);
+ if(ndim > 4){
+ ac = H->GetAxis(4);
+ nCen = AliTRDeventInfo::kCentralityClasses;
+ }
+ // build list of projections
+ const Int_t nsel(AliTRDgeometry::kNlayer*AliTRDeventInfo::kCentralityClasses);
+ // define rebinning strategy
+ const Int_t nEtaPhi(4); Int_t rebinEtaPhiX[nEtaPhi] = {1, 2, 2, 1}, rebinEtaPhiY[nEtaPhi] = {2, 1, 1, 5};
+ const Char_t *cenName[AliTRDeventInfo::kCentralityClasses] = {"0-10%", "10-20%", "20-50%", "50-80%", "80-100%"};
+ AliTRDresolutionProjection hp[kDetNproj]; TObjArray php(kDetNproj);
+ Int_t ih(0), isel(-1), np[nsel]; memset(np, 0, nsel*sizeof(Int_t));
+ for(Int_t icen(0); icen<nCen; icen++){
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ isel++; // new selection
+ hp[ih].Build(Form("HDetQ%d%d", ily, icen),
+ Form("Detectors :: Q Ly[%d] Cen[%s]", ily, cenName[icen]),
+ kEta, kPhi, kYrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ hp[ih].SetShowRange(10., 55.);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ }
+ }
+ AliInfo(Form("Build %3d 3D projections.", ih));
+
+ Int_t ly(0), cen(0);
+ for (Long64_t ib(0); ib < H->GetNbins(); ib++) {
+ v = H->GetBinContent(ib, coord); if(v<1.) continue;
+ ly = coord[kBC]-1;
+
+ // centrality selection
+ cen = 0;
+ if(ac) cen = coord[4]-1;
+
+ isel = cen*AliTRDgeometry::kNlayer+ly; Int_t ioff=isel;
+// AliDebug(4, Form("SELECTION[%d] :: ch[%c] pt[%c] sp[%d] ly[%d]\n", np[isel], ch==2?'Z':chName[ch], ptName[pt], sp, ly));
+ for(Int_t jh(0); jh<np[isel]; jh++) ((AliTRDresolutionProjection*)php.At(ioff+jh))->Increment(coord, v);
+ }
+ TObjArray *arr(NULL);
+ fProj->AddAt(arr = new TObjArray(kDetNproj), kDetector);
+
+ TH2 *h2(NULL); Int_t jh(0);
+ for(; ih--; ){
+ if(!hp[ih].fH) continue;
+ if(!(h2 = hp[ih].Projection2D(kNstat, kNcontours, 0, kFALSE))) continue;
+ arr->AddAt(h2, jh++);
+ if(!(h2 = (TH2*)gDirectory->Get(Form("%s_yx", hp[ih].fH->GetName())))) continue;
+ arr->AddAt(h2, jh++);
+ }
+ AliTRDresolutionProjection *pr0(NULL), *pr1(NULL);
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HDetQ%d%d", ily, 0)))){
+ for(Int_t icen(1); icen<nCen; icen++){
+ if((pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HDetQ%d%d", ily, icen)))){
+ (*pr0)+=(*pr1);
+ }
+ }
+ pr0->fH->SetNameTitle(Form("HDetQ%d", ily), Form("Detectors :: Q Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours))) arr->AddAt(h2, jh++);
+ }
+ }
+ AliInfo(Form("Done %3d 2D projections.", jh));
+ return kTRUE;
+}
+
+//________________________________________________________
+Bool_t AliTRDresolution::MakeProjectionCluster(Bool_t mc)
+{
+// Analyse cluster
+ const Int_t kNcontours(9);
+ const Int_t kNstat(100);
+ Int_t cidx=mc?kMCcluster:kCluster;
+ if(fProj && fProj->At(cidx)) return kTRUE;
+ if(!fContainer){
+ AliError("Missing data container.");
+ return kFALSE;
+ }
+ const Char_t *projName[] = {"hCluster2Track", "hCluster2MC"};
+ THnSparse *H(NULL);
+ if(!(H = (THnSparse*)fContainer->FindObject(projName[Int_t(mc)]))){
+ AliError(Form("Missing/Wrong data @ %s.", projName[Int_t(mc)]));
+ return kFALSE;
+ }
+ Int_t ndim(H->GetNdimensions()); Bool_t debug(ndim>Int_t(kNdimCl));
+ Int_t coord[kNdim]; memset(coord, 0, sizeof(Int_t) * kNdim); Double_t v = 0.;
+ TAxis *aa[kNdim], *as(NULL), *apt(NULL); memset(aa, 0, sizeof(TAxis*) * kNdim);
+ for(Int_t id(0); id<ndim; id++) aa[id] = H->GetAxis(id);
+ if(ndim > Int_t(kPt)) apt = H->GetAxis(kPt);
+ if(ndim > Int_t(kSpeciesChgRC)) as = H->GetAxis(kSpeciesChgRC);
+ // build list of projections
+ const Int_t nsel(12);
+ // define rebinning strategy
+ const Int_t nEtaPhi(4); Int_t rebinEtaPhiX[nEtaPhi] = {1, 2, 5, 1}, rebinEtaPhiY[nEtaPhi] = {2, 1, 1, 5};
+ AliTRDresolutionProjection hp[kClNproj]; TObjArray php(kClNproj);
+ const Char_t chName[kNcharge] = {'n', 'p'};const Char_t chSgn[kNcharge] = {'-', '+'};
+ Int_t ih(0), isel(-1), np[nsel]; memset(np, 0, nsel*sizeof(Int_t));
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ for(Int_t ich(0); ich<kNcharge; ich++){
+ isel++; // new selection
+ hp[ih].Build(Form("H%sClY%c%d", mc?"MC":"", chName[ich], ily),
+ Form("Clusters[%c] :: #Deltay Ly[%d]", chSgn[ich], ily),
+ kEta, kPhi, kYrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ if(!debug) break;
+ hp[ih].Build(Form("H%sClQ%c%d", mc?"MC":"", chName[ich], ily),
+ Form("Clusters[%c] :: Q Ly[%d]", chSgn[ich], ily),
+ kEta, kPhi, kSpeciesChgRC, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ hp[ih].SetShowRange(20., 40.);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sClYXTC%c%d", mc?"MC":"", chName[ich], ily),
+ Form("Clusters[%c] :: #Deltay(x,TC) Ly[%d]", chSgn[ich], ily),
+ kPrez, kZrez, kYrez, aa);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sClYXPh%c%d", mc?"MC":"", chName[ich], ily),
+ Form("Clusters[%c] :: #Deltay(x,#Phi) Ly[%d]", chSgn[ich], ily),
+ kPrez, kPt, kYrez, aa);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ }
+ }
+ AliInfo(Form("Build %3d 3D projections.", ih));
+
+ Int_t ly(0), ch(0), rcBin(as?as->FindBin(0.):-1), chBin(apt?apt->FindBin(0.):-1), ioff(0);
+ for (Long64_t ib(0); ib < H->GetNbins(); ib++) {
+ v = H->GetBinContent(ib, coord); if(v<1.) continue;
+ ly = coord[kBC]-1;
+ // RC selection
+ if(rcBin>0 && coord[kSpeciesChgRC] == rcBin) continue;
+
+ // charge selection
+ ch = 0; // [-] track
+ if(chBin>0 && coord[kPt] > chBin) ch = 1; // [+] track
+
+ if(debug){
+ isel = ly*2+ch; ioff=isel*4;
+ } else {
+ isel = ly; ioff = isel;
+ }
+// AliDebug(4, Form("SELECTION[%d] :: ch[%c] pt[%c] sp[%d] ly[%d]\n", np[isel], ch==2?'Z':chName[ch], ptName[pt], sp, ly));
+ for(Int_t jh(0); jh<np[isel]; jh++) ((AliTRDresolutionProjection*)php.At(ioff+jh))->Increment(coord, v);
+ }
+ TObjArray *arr(NULL);
+ fProj->AddAt(arr = new TObjArray(kClNproj), cidx);
+
+ TH2 *h2(NULL); Int_t jh(0);
+ for(; ih--; ){
+ if(!hp[ih].fH) continue;
+ //if(hp[ih].fH->GetEntries()<100) continue;
+ Int_t mid(1), nstat(kNstat);
+ if(strchr(hp[ih].fH->GetName(), 'Q')){ mid=2; nstat=300;}
+ if(!(h2 = hp[ih].Projection2D(nstat, kNcontours, mid))) continue;
+ arr->AddAt(h2, jh++);
+ }
+ AliTRDresolutionProjection *pr0(NULL), *pr1(NULL);
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sClY%c%d", mc?"MC":"", chName[0], ily)))){
+ if((pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sClY%c%d", mc?"MC":"", chName[1], ily)))){
+ (*pr0)+=(*pr1);
+ pr0->fH->SetNameTitle(Form("H%sClY%d", mc?"MC":"", ily), Form("Clusters :: #Deltay Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ }
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sClYXPh%c%d", mc?"MC":"", chName[0], ily)))){
+ if((pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sClYXPh%c%d", mc?"MC":"", chName[1], ily)))){
+ (*pr0)+=(*pr1);
+ pr0->fH->SetNameTitle(Form("H%sClYXPh%d", mc?"MC":"", ily), Form("Clusters :: #Deltay(x,#Phi) Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ }
+ }
+ AliInfo(Form("Done %3d 2D projections.", jh));
+ return kTRUE;
+}
+
+//________________________________________________________
+Bool_t AliTRDresolution::MakeProjectionTracklet(Bool_t mc)
+{
+// Analyse tracklet
+ const Int_t kNcontours(9);
+ const Int_t kNstat(30);
+ const Int_t kNstatQ(30);
+ Int_t cidx=mc?kMCtracklet:kTracklet;
+ if(fProj && fProj->At(cidx)) return kTRUE;
+ if(!fContainer){
+ AliError("Missing data container.");
+ return kFALSE;
+ }
+ const Char_t *projName[] = {"hTracklet2Track", "hTracklet2MC"};
+ THnSparse *H(NULL);
+ if(!(H = (THnSparse*)fContainer->FindObject(projName[Int_t(mc)]))){
+ AliError(Form("Missing/Wrong data @ %s.", projName[Int_t(mc)]));
+ return kFALSE;
+ }
+ const Int_t mdim(kNdim+8);
+ Int_t ndim(H->GetNdimensions()); Bool_t debug(ndim>Int_t(kNdimTrklt));
+ Int_t coord[mdim]; memset(coord, 0, sizeof(Int_t) * mdim); Double_t v = 0.;
+ TAxis *aa[mdim], *as(NULL), *ap(NULL), *ac(NULL); memset(aa, 0, sizeof(TAxis*) * mdim);
+ for(Int_t id(0); id<ndim; id++) aa[id] = H->GetAxis(id);
+ if(ndim > Int_t(kSpeciesChgRC)) as = H->GetAxis(kSpeciesChgRC); // init species/charge selection
+ if(ndim > Int_t(kPt)) ap = H->GetAxis(kPt); // init pt selection
+ if(ndim > Int_t(kNdim)+1) ac = H->GetAxis(kNdim+1); // init centrality selection
+ // calculate size depending on debug level
+ const Int_t nCen(debug?Int_t(AliTRDeventInfo::kCentralityClasses):1);
+ const Int_t nPt(debug?Int_t(kNpt):1);
+ const Int_t nSpc(1);//ndim>kNdimTrklt?fgkNbins[kSpeciesChgRC]:1);
+ const Int_t nCh(debug?Int_t(kNcharge):1);
+
+ // build list of projections
+ const Int_t nsel(AliTRDeventInfo::kCentralityClasses*AliTRDgeometry::kNlayer*kNpt*(AliPID::kSPECIES*kNcharge + 1));
+ // define rebinning strategy
+ const Int_t nEtaPhi(4); Int_t rebinEtaPhiX[nEtaPhi] = {1, 2, 5, 1}, rebinEtaPhiY[nEtaPhi] = {2, 1, 1, 5};
+ AliTRDresolutionProjection hp[kTrkltNproj]; TObjArray php(kTrkltNproj);
+ Int_t ih(0), isel(-1), np[nsel]; memset(np, 0, nsel*sizeof(Int_t));
+ const Char_t chName[kNcharge] = {'n', 'p'};const Char_t chSgn[kNcharge] = {'-', '+'};
+ const Char_t ptName[kNpt] = {'l', 'i', 'h'};
+ const Char_t *ptCut[kNpt] = {"p_{t}[GeV/c]<0.8", "0.8<=p_{t}[GeV/c]<1.5", "p_{t}[GeV/c]>=1.5"};
+ const Char_t *cenName[AliTRDeventInfo::kCentralityClasses] = {"0-10%", "10-20%", "20-50%", "50-80%", "80-100%"};
+ for(Int_t icen(0); icen<nCen; icen++){
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ for(Int_t ipt(0); ipt<nPt; ipt++){
+ for(Int_t isp(0); isp<nSpc; isp++){
+ for(Int_t ich(0); ich<nCh; ich++){
+ isel++; // new selection
+ hp[ih].Build(Form("H%sTrkltY%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], isp, ily, icen),
+ Form("Tracklets[%s%c]:: #Deltay{%s} Ly[%d] Cen[%s]", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt], ily, cenName[icen]),
+ kEta, kPhi, kYrez, aa);
+ //hp[ih].SetShowRange(-0.1,0.1);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], isp, ily, icen),
+ Form("Tracklets[%s%c]:: #Delta#phi{%s} Ly[%d] Cen[%s]", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt], ily, cenName[icen]),
+ kEta, kPhi, kPrez, aa);
+ //hp[ih].SetShowRange(-0.5,0.5);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], isp, ily, icen),
+ Form("Tracklets[%s%c]:: dQdl{%s} Ly[%d] Cen[%s]", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt], ily, cenName[icen]),
+ kEta, kPhi, kNdim, aa);
+ hp[ih].SetShowRange(1.,2.3);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkltTB%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], isp, ily, icen),
+ Form("Tracklets[%s%c]:: OccupancyTB{%s} Ly[%d] Cen[%s]", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt], ily, cenName[icen]),
+ kEta, kPhi, kNdim+2, aa);
+ hp[ih].SetShowRange(30., 70.);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ }
+ }
+ if(ndim==kNdimTrklt) continue;
+
+ isel++; // new selection
+ hp[ih].Build(Form("H%sTrkltRCZ%c%d%d", mc?"MC":"", ptName[ipt], ily, icen),
+ Form("Tracklets[RC]:: #Deltaz{%s} Ly[%d] Cen[%s]", ptCut[ipt], ily, cenName[icen]),
+ kEta, kPhi, kZrez, aa);
+ // hp[ih].SetShowRange(-0.1,0.1);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkltRCY%c%d%d", mc?"MC":"", ptName[ipt], ily, icen),
+ Form("Tracklets[RC]:: #Deltay{%s} Ly[%d] Cen[%s]", ptCut[ipt], ily, cenName[icen]),
+ kEta, kPhi, kYrez, aa);
+ //hp[ih].SetShowRange(-0.1,0.1);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkltRCPh%c%d%d", mc?"MC":"", ptName[ipt], ily, icen),
+ Form("Tracklets[RC]:: #Delta#phi{%s} Ly[%d] Cen[%s]", ptCut[ipt], ily, cenName[icen]),
+ kEta, kPhi, kPrez, aa);
+ //hp[ih].SetShowRange(-0.1,0.1);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkltRCQ%c%d%d", mc?"MC":"", ptName[ipt], ily, icen),
+ Form("Tracklets[RC]:: dQdl{%s} Ly[%d] Cen[%s]", ptCut[ipt], ily, cenName[icen]),
+ kEta, kPhi, kNdim, aa);
+ //hp[ih].SetShowRange(-0.1,0.1);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ }
+ }
+ }
+ AliInfo(Form("Build %3d 3D projections.", ih));
+
+ Int_t ly(0), ch(0), sp(2), rcBin(as?as->FindBin(0.):-1), pt(0), cen(0), ioff(0), ispc(0);
+ for (Long64_t ib(0); ib < H->GetNbins(); ib++) {
+ v = H->GetBinContent(ib, coord);
+ if(v<1.) continue;
+ ly = coord[kBC]-1; // layer selection
+ // charge selection
+ ch = 0; sp=0;// [e-] track [dafault]
+ if(rcBin>0){ // debug mode in which species are also saved
+ sp = Int_t(TMath::Abs(as->GetBinCenter(coord[kSpeciesChgRC])))-1;
+ if(coord[kSpeciesChgRC] > rcBin) ch = 1; // [+] track
+ else if(coord[kSpeciesChgRC] == rcBin) ch = 2; // [RC] track
+ }
+ // pt selection
+ pt = 0; // low pt
+ if(ap) pt = TMath::Min(coord[kPt]-1, Int_t(kNpt)-1);
+ // centrality selection
+ cen = 0; // default
+ if(ac) cen = coord[kNdim+1]-1;
+ // global selection
+ if(ndim==kNdimTrklt){
+ ioff = ly*4;
+ isel = ly;
+ } else {
+ ispc = nSpc*nCh+1;
+ isel = cen*AliTRDgeometry::kNlayer*kNpt*ispc+ly*kNpt*ispc+pt*ispc; isel+=sp<0?(nSpc*nCh):(sp*nCh+ch);
+ ioff = 4*isel;
+ }
+ AliDebug(4, Form("SELECTION[%d] :: ch[%c] pt[%c] sp[%d] ly[%d] cen[%d]", np[isel], ch==2?'Z':chName[ch], ptName[pt], sp, ly, cen));
+ for(Int_t jh(0); jh<np[isel]; jh++) ((AliTRDresolutionProjection*)php.At(ioff+jh))->Increment(coord, v);
+ }
+ TObjArray *arr(NULL);
+ fProj->AddAt(arr = new TObjArray(kTrkltNproj), cidx);
+
+ TH2 *h2(NULL); Int_t jh(0);
+ for(; ih--; ){
+ if(!hp[ih].fH) continue;
+ Int_t mid(0), nstat(kNstat);
+ if(strchr(hp[ih].fH->GetName(), 'Q')){ mid=2; nstat=kNstatQ;}
+ if(!(h2 = hp[ih].Projection2D(nstat, kNcontours, mid))) continue;
+ arr->AddAt(h2, jh++);
+ }
+ // build combined performance plots
+ AliTRDresolutionProjection *pr0(NULL), *pr1(NULL);
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ for(Int_t ich(0); ich<nCh; ich++){
+ for(Int_t icen(0); icen<nCen; icen++){
+ for(Int_t ipt(0); ipt<nPt; ipt++){
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltY%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], 0, ily, icen)))){
+ for(Int_t isp(1); isp<nSpc; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltY%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], isp, ily, icen)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkltY%c%c%d%d", mc?"MC":"", chName[ich], ptName[ipt], ily, icen),
+ Form("Tracklets[%c]:: #Deltay{%s} Ly[%d] Cen[%s]", chSgn[ich], ptCut[ipt], ily, cenName[icen]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltY%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, icen)))) (*pr1)+=(*pr0);
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], 0, ily, icen)))){
+ for(Int_t isp(1); isp<nSpc; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], isp, ily, icen)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkltPh%c%c%d%d", mc?"MC":"", chName[ich], ptName[ipt], ily, icen),
+ Form("Tracklets[%c]:: #Delta#phi{%s} Ly[%d] Cen[%s]", chSgn[ich], ptCut[ipt], ily, cenName[icen]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, icen)))) (*pr1)+=(*pr0);
+ }
+ /*!dQ/dl*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], 0, ily, icen)))){
+ for(Int_t isp(1); isp<nSpc; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], isp, ily, icen)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkltQ%c%c%d%d", mc?"MC":"", chName[ich], ptName[ipt], ily, icen),
+ Form("Tracklets[%c]:: dQdl{%s} Ly[%d] Cen[%s]", chSgn[ich], ptCut[ipt], ily, cenName[icen]));
+ if((h2 = pr0->Projection2D(kNstatQ, kNcontours, 2))) arr->AddAt(h2, jh++);
+ pr0->fH->SetNameTitle(Form("H%sTrkltQS%c%c%d%d", mc?"MC":"", chName[ich], ptName[ipt], ily, icen),
+ Form("Tracklets[%c]:: dQdl{%s} Ly[%d] Cen[%s]", chSgn[ich], ptCut[ipt], ily, cenName[icen]));
+ pr0->SetShowRange(2.4, 5.1);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 0))) arr->AddAt(h2, jh++);
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, icen)))) (*pr1)+=(*pr0);
+ }
+ /*!TB occupancy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltTB%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], 0, ily, icen)))){
+ for(Int_t isp(1); isp<nSpc; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltTB%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[ipt], isp, ily, icen)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkltTB%c%c%d%d", mc?"MC":"", chName[ich], ptName[ipt], ily, icen),
+ Form("Tracklets[%c]:: OccupancyTB{%s} Ly[%d] Cen[%s]", chSgn[ich], ptCut[ipt], ily, cenName[icen]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours))) arr->AddAt(h2, jh++);
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltTB%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, icen)))) (*pr1)+=(*pr0);
+ }
+ } // end pt integration
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltY%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, icen)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltY%c%d%d", mc?"MC":"", chName[ich], ily, icen),
+ Form("Tracklets[%c]:: #Deltay Ly[%d] Cen[%s]", chSgn[ich], ily, cenName[icen]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(icen && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltY%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, 0)))) (*pr1)+=(*pr0);
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, icen)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltPh%c%d%d", mc?"MC":"", chName[ich], ily, icen),
+ Form("Tracklets[%c]:: #Delta#phi Ly[%d] Cen[%s]", chSgn[ich], ily, cenName[icen]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(icen && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, 0)))) (*pr1)+=(*pr0);
+ }
+ /*!dQ/dl*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, icen)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltQ%c%d%d", mc?"MC":"", chName[ich], ily, icen),
+ Form("Tracklets[%c]:: dQdl Ly[%d] Cen[%s]", chSgn[ich], ily, cenName[icen]));
+ pr0->SetShowRange(1.,2.3);
+ if((h2 = pr0->Projection2D(kNstatQ, kNcontours, 2))) arr->AddAt(h2, jh++);
+ pr0->fH->SetNameTitle(Form("H%sTrkltQS%c%d%d", mc?"MC":"", chName[ich], ily, icen),
+ Form("Tracklets[%c]:: dQdl Ly[%d] Cen[%s]", chSgn[ich], ily, cenName[icen]));
+ pr0->SetShowRange(2.4,5.1);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 0))) arr->AddAt(h2, jh++);
+ if(icen && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, 0)))) (*pr1)+=(*pr0);
+ }
+ /*!TB occupancy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltTB%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, icen)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltTB%c%d%d", mc?"MC":"", chName[ich], ily, icen),
+ Form("Tracklets[%c]:: OccupancyTB Ly[%d] Cen[%s]", chSgn[ich], ily, cenName[icen]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours))) arr->AddAt(h2, jh++);
+ if(icen && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltTB%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, 0)))) (*pr1)+=(*pr0);
+ }
+ } // end centrality integration
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltY%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltY%c%d", mc?"MC":"", chName[ich], ily), Form("Tracklets[%c] :: #Deltay Ly[%d]", chSgn[ich], ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ich && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltY%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))) (*pr1)+=(*pr0);
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltPh%c%d", mc?"MC":"", chName[ich], ily), Form("Tracklets[%c] :: #Delta#phi Ly[%d]", chSgn[ich], ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ich && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))) (*pr1)+=(*pr0);
+ }
+ /*!dQ/dl*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltQ%c%d", mc?"MC":"", chName[ich], ily), Form("Tracklets[%c] :: dQdl Ly[%d]", chSgn[ich], ily));
+ pr0->SetShowRange(1.,2.3);
+ if((h2 = pr0->Projection2D(kNstatQ, kNcontours, 2))) arr->AddAt(h2, jh++);
+ pr0->fH->SetNameTitle(Form("H%sTrkltQS%c%d", mc?"MC":"", chName[ich], ily), Form("Tracklets[%c] :: dQdl Ly[%d]", chSgn[ich], ily));
+ pr0->SetShowRange(2.4,5.1);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 0))) arr->AddAt(h2, jh++);
+ if(ich && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))) (*pr1)+=(*pr0);
+ }
+ /*!TB occupancy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltTB%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltTB%c%d", mc?"MC":"", chName[ich], ily), Form("Tracklets[%c] :: OccupancyTB Ly[%d]", chSgn[ich], ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours))) arr->AddAt(h2, jh++);
+ if(ich && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltTB%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))) (*pr1)+=(*pr0);
+ }
+ } // end charge integration
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltY%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltY%d", mc?"MC":"", ily), Form("Tracklets :: #Deltay Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltPh%d", mc?"MC":"", ily), Form("Tracklets :: #Delta#phi Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!dQdl*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltQ%d", mc?"MC":"", ily), Form("Tracklets :: dQdl Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ pr0->fH->SetNameTitle(Form("H%sTrkltQS%d", mc?"MC":"", ily), Form("Tracklets :: dQdl Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 0))) arr->AddAt(h2, jh++);
+ }
+ /*!TB occupancy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltTB%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltTB%d", mc?"MC":"", ily), Form("Tracklets :: OccupancyTB Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours))) arr->AddAt(h2, jh++);
+ }
+
+ /*! Row Cross processing*/
+ for(Int_t icen(0); icen<nCen; icen++){
+ /*!RC dz*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltRCZ%c%d%d", mc?"MC":"", ptName[0], ily, icen)))){
+ for(Int_t ipt(0); ipt<kNpt; ipt++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltRCZ%c%d%d", mc?"MC":"", ptName[ipt], ily, icen)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkltRCZ%d%d", mc?"MC":"", ily, icen), Form("Tracklets[RC]:: #Deltaz Ly[%d] Cen[%s]", ily, cenName[icen]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(icen && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltRCZ%c%d%d", mc?"MC":"", ptName[0], ily, 0)))) (*pr1)+=(*pr0);
+ }
+ } // end centrality integration for row cross
+ /*!RC dz*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltRCZ%c%d%d", mc?"MC":"", ptName[0], ily, 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkltRCZ%d", mc?"MC":"", ily), Form("Tracklets[RC] :: #Deltaz Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ } // end layer loop
+ AliInfo(Form("Done %3d 2D projections.", jh));
+ return kTRUE;
+}
+
+//________________________________________________________
+Bool_t AliTRDresolution::MakeProjectionTrackIn(Bool_t mc)
+{
+// Analyse track in
+ const Int_t kNcontours(9);
+ const Int_t kNstat(30);
+ Int_t cidx=mc?kMCtrackIn:kTrackIn;
+ if(fProj && fProj->At(cidx)) return kTRUE;
+ if(!fContainer){
+ AliError("Missing data container.");
+ return kFALSE;
+ }
+ const Char_t *projName[] = {"hTracklet2TRDin", "hTRDin2MC"};
+ THnSparse *H(NULL);
+ if(!(H = (THnSparse*)fContainer->FindObject(projName[Int_t(mc)]))){
+ AliError(Form("Missing/Wrong data @ %s.", projName[Int_t(mc)]));
+ return kFALSE;
+ }
+
+ const Int_t mdim(kNdim+3);
+ Int_t coord[mdim]; memset(coord, 0, sizeof(Int_t) * mdim); Double_t v = 0.;
+ Int_t ndim(H->GetNdimensions());
+ TAxis *aa[mdim], *as(NULL), *ap(NULL), *ax(NULL), *abf(NULL); memset(aa, 0, sizeof(TAxis*) * (mdim));
+ for(Int_t id(0); id<ndim; id++) aa[id] = H->GetAxis(id);
+ if(ndim > Int_t(kSpeciesChgRC)) as = H->GetAxis(kSpeciesChgRC);
+ if(ndim > Int_t(kPt)) ap = H->GetAxis(kPt);
+ if(ndim > Int_t(kNdim)+1) ax = H->GetAxis(kNdim+1);
+ if(ndim > Int_t(kNdim)+2) abf = H->GetAxis(kNdim+2);
+ //AliInfo(Form("Using : Species[%c] Pt[%c] BunchFill[%c]", as?'y':'n', ap?'y':'n', abf?'y':'n'));
+ const Int_t nPt(ndim>Int_t(kNdimTrkIn)?Int_t(kNpt):1);
+
+ // build list of projections
+ const Int_t nsel(kNpt*(AliPID::kSPECIES*kNcharge + 1));
+ const Char_t chName[kNcharge] = {'n', 'p'};const Char_t chSgn[kNcharge] = {'-', '+'};
+ const Char_t ptName[kNpt] = {'l', 'i', 'h'};
+ const Char_t *ptCut[kNpt] = {"p_{t}[GeV/c]<0.8", "0.8<=p_{t}[GeV/c]<1.5", "p_{t}[GeV/c]>=1.5"};
+ // define rebinning strategy
+ const Int_t nEtaPhi(4); Int_t rebinEtaPhiX[nEtaPhi] = {1, 2, 5, 1}, rebinEtaPhiY[nEtaPhi] = {2, 1, 1, 5};
+ AliTRDresolutionProjection hp[kMCTrkInNproj]; TObjArray php(kMCTrkInNproj+2);
+ Int_t ih(0), isel(-1), np[nsel]; memset(np, 0, nsel*sizeof(Int_t));
+ // define list of projections
+ for(Int_t ipt(0); ipt<nPt; ipt++){
+ for(Int_t isp(0); isp<AliPID::kSPECIES; isp++){
+ for(Int_t ich(0); ich<kNcharge; ich++){
+ isel++; // new selection
+ hp[ih].Build(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp),
+ Form("TrackIn[%s%c]:: #Deltay{%s}", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt]),
+ kEta, kPhi, kYrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp),
+ Form("TrackIn[%s%c]:: #Delta#phi{%s}", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt]),
+ kEta, kPhi, kPrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkInQ%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp),
+ Form("TrackIn[%s%c]:: dQdl {%s}", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt]),
+ kEta, kPhi, kZrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ if(!ax) continue;
+ hp[ih].Build(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp),
+ Form("TrackIn[%s%c]:: #Deltax{%s}", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt]),
+ kEta, kPhi, kNdim+1, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ }
+ }
+ isel++; // RC tracks
+ hp[ih].Build(Form("H%sTrkInRCZ%c", mc?"MC":"", ptName[ipt]),
+ Form("TrackIn[RC]:: #Deltaz{%s}", ptCut[ipt]),
+ kEta, kPhi, kZrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkInRCY%c", mc?"MC":"", ptName[ipt]),
+ Form("TrackIn[RC]:: #Deltay{%s}", ptCut[ipt]),
+ kEta, kPhi, kYrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("H%sTrkInRCPh%c", mc?"MC":"", ptName[ipt]),
+ Form("TrackIn[RC]:: #Delta#phi{%s}", ptCut[ipt]),
+ kEta, kPhi, kPrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ if(!ax) continue;
+ hp[ih].Build(Form("H%sTrkInRCX%c", mc?"MC":"", ptName[ipt]),
+ Form("TrackIn[RC]:: #Deltax{%s}", ptCut[ipt]),
+ kEta, kPhi, kNdim+1, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ }
+ AliInfo(Form("Build %3d 3D projections.", ih));
+
+ // fill projections
+ Int_t ch(0), pt(0), sp(1), rcBin(as?as->FindBin(0.):-1), ioff(0);
+ for (Long64_t ib(0); ib < H->GetNbins(); ib++) {
+ v = H->GetBinContent(ib, coord);
+ if(v<1.) continue;
+ if(fBCbinTOF>0 && coord[kBC]!=fBCbinTOF) continue; // TOF bunch cross cut
+ if(fBCbinFill>0 && abf && coord[kNdim+2]!=fBCbinTOF) continue; // Fill bunch cut
+ // charge selection
+ ch = 0; sp=1;// [-] track
+ if(rcBin>0){ // debug mode in which species are also saved
+ sp = Int_t(TMath::Abs(as->GetBinCenter(coord[kSpeciesChgRC])))-1;
+ if(coord[kSpeciesChgRC] > rcBin) ch = 1; // [+] track
+ else if(coord[kSpeciesChgRC] == rcBin) ch = 2; // [RC] track
+ }
+ // pt selection
+ pt = 0; // low pt
+ if(ap) pt = TMath::Min(coord[kPt]-1, Int_t(kNpt)-1);
+ // global selection
+ isel = pt*11; isel+=sp<0?10:(sp*kNcharge+ch);
+ ioff = isel*(ax?4:3);
+ AliDebug(4, Form("SELECTION[%d] :: ch[%c] pt[%c] sp[%d]\n", np[isel], ch==2?'Z':chName[ch], ptName[pt], sp));
+ for(Int_t jh(0); jh<np[isel]; jh++) ((AliTRDresolutionProjection*)php.At(ioff+jh))->Increment(coord, v);
+ }
+ TObjArray *arr(NULL);
+ fProj->AddAt(arr = new TObjArray(mc?kMCTrkInNproj:kTrkInNproj), cidx);
+
+ TH2 *h2(NULL); Int_t jh(0);
+ for(; ih--; ){
+ if(!hp[ih].fH) continue;
+ if(!(h2 = hp[ih].Projection2D(kNstat, kNcontours))) continue;
+ arr->AddAt(h2, jh++);
+ }
+ // build combined performance plots
+ // combine up the tree of projections
+ AliTRDresolutionProjection *pr0(NULL), *pr1(NULL);
+ AliTRDresolutionProjection xlow[2], specY[kNcharge*AliPID::kSPECIES], specPh[kNcharge*AliPID::kSPECIES], specQ[kNcharge*AliPID::kSPECIES];
+ for(Int_t ich(0); ich<kNcharge; ich++){
+ // PID dependency - summation over pt
+ for(Int_t isp(0); isp<AliPID::kSPECIES; isp++){
+ /*!dy*/
+ Int_t idx(ich*AliPID::kSPECIES+isp);
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[ich], ptName[0], isp)))){
+ specY[idx] = (*pr0);
+ specY[idx].SetNameTitle(Form("H%sTrkInY%c%d", mc?"MC":"", chName[ich], isp), "Sum over pt");
+ specY[idx].fH->SetNameTitle(Form("H%sTrkInY%c%d", mc?"MC":"", chName[ich], isp),
+ Form("TrackIn[%s%c]:: #Deltay", AliPID::ParticleLatexName(isp), chSgn[ich]));
+ for(Int_t ipt(1); ipt<nPt; ipt++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp)))) continue;
+ specY[idx]+=(*pr1);
+ }
+ php.AddLast(&specY[idx]);
+ if((h2 = specY[idx].Projection2D(kNstat, kNcontours, 1, kFALSE))) arr->AddAt(h2, jh++);
+ if((h2 = (TH2*)gDirectory->Get(Form("%s_yx", specY[idx].fH->GetName())))) arr->AddAt(h2, jh++);
+ if(ich && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%d", mc?"MC":"", chName[0], isp)))) (*pr1)+=specY[idx];
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[ich], ptName[0], isp)))){
+ specPh[idx] = (*pr0);
+ specPh[idx].SetNameTitle(Form("H%sTrkInPh%c%d", mc?"MC":"", chName[ich], isp), "Sum over pt");
+ specPh[idx].fH->SetNameTitle(Form("H%sTrkInPh%c%d", mc?"MC":"", chName[ich], isp),
+ Form("TrackIn[%s%c]:: #Delta#phi", AliPID::ParticleLatexName(isp), chSgn[ich]));
+ specPh[idx].SetShowRange(-1.5, 1.5);
+ for(Int_t ipt(1); ipt<nPt; ipt++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp)))) continue;
+ specPh[idx]+=(*pr1);
+ }
+ php.AddLast(&specPh[idx]);
+ if((h2 = specPh[idx].Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ich && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%d", mc?"MC":"", chName[0], isp)))) (*pr1)+=specPh[idx];
+ }
+ /*!dQdl*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInQ%c%c%d", mc?"MC":"", chName[ich], ptName[0], isp)))){
+ specQ[idx] = (*pr0);
+ specQ[idx].SetNameTitle(Form("H%sTrkInQ%c%d", mc?"MC":"", chName[ich], isp), "Sum over pt");
+ specQ[idx].fH->SetNameTitle(Form("H%sTrkInQ%c%d", mc?"MC":"", chName[ich], isp),
+ Form("TrackIn[%s%c]:: dQdl", AliPID::ParticleLatexName(isp), chSgn[ich]));
+ specQ[idx].SetShowRange(-2.2, -1.75);
+ specQ[idx].fH->GetZaxis()->SetTitle("dQdl [a.u.]");
+ for(Int_t ipt(1); ipt<nPt; ipt++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInQ%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp)))) continue;
+ specQ[idx]+=(*pr1);
+ }
+ php.AddLast(&specQ[idx]);
+ if((h2 = specQ[idx].Projection2D(kNstat, kNcontours, 2))) arr->AddAt(h2, jh++);
+ specQ[idx].fH->SetName(Form("H%sTrkInQS%c%d", mc?"MC":"", chName[ich], isp));
+ specQ[idx].SetShowRange(-1.75, -1.25);
+ if((h2 = specQ[idx].Projection2D(kNstat, kNcontours, 0))) arr->AddAt(h2, jh++);
+ if(ich && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInQ%c%d", mc?"MC":"", chName[0], isp)))) (*pr1)+=specQ[idx];
+ }
+ }
+ // pt dependency - summation over PID
+ for(Int_t ipt(0); ipt<nPt; ipt++){
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], 0)))){
+ for(Int_t isp(1); isp<AliPID::kSPECIES; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkInY%c%c", mc?"MC":"", chName[ich], ptName[ipt]),
+ Form("TrackIn[%c]:: #Deltay{%s}", chSgn[ich], ptCut[ipt]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[ich], ptName[0], 0)))) (*pr1)+=(*pr0);
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], 0)))){
+ for(Int_t isp(1); isp<AliPID::kSPECIES; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkInPh%c%c", mc?"MC":"", chName[ich], ptName[ipt]),
+ Form("TrackIn[%c]:: #Delta#phi{%s}", chSgn[ich], ptCut[ipt]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[ich], ptName[0], 0)))) (*pr1)+=(*pr0);
+ }
+ /*!dx*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], 0)))){
+ for(Int_t isp(1); isp<AliPID::kSPECIES; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[ich], ptName[ipt], isp)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkInX%c%c", mc?"MC":"", chName[ich], ptName[ipt]),
+ Form("TrackIn[%c]:: #Deltax{%s}", chSgn[ich], ptCut[ipt]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(!ipt){
+ xlow[ich] = (*pr0);
+ xlow[ich].SetNameTitle(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[ich], ptName[0], 5),
+ Form("TrackIn[%c]:: #Deltax{%s}", chSgn[ich], ptCut[0]));
+ php.AddLast(&xlow[ich]);
+ }
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[ich], ptName[0], 0)))) (*pr1)+=(*pr0);
+ }
+ }
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[ich], ptName[0], 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkInY%c", mc?"MC":"", chName[ich]),
+ Form("TrackIn[%c]:: #Deltay", chSgn[ich]));
+ pr0->SetShowRange(-0.3, 0.3);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ich && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[0], ptName[0], 0)))) (*pr1)+=(*pr0);
+ }
+ /*!dy high pt*/
+ if(ich && (pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[0], ptName[2], 0)))){
+ if((pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[ich], ptName[2], 0)))){
+ (*pr0)+=(*pr1);
+ pr0->fH->SetNameTitle(Form("H%sTrkInY%c", mc?"MC":"", ptName[2]), Form("TrackIn :: #Deltay{%s}", ptCut[2]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[ich], ptName[0], 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkInPh%c", mc?"MC":"", chName[ich]),
+ Form("TrackIn[%c]:: #Delta#phi", chSgn[ich]));
+ pr0->SetShowRange(-1., 1.);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ich==1 && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[0], ptName[0], 0)))) (*pr1)+=(*pr0);
+ }
+ /*!dx*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[ich], ptName[0], 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkInX%c", mc?"MC":"", chName[ich]),
+ Form("TrackIn[%c]:: #Deltax", chSgn[ich]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ich==1 && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[0], ptName[0], 0)))) (*pr1)+=(*pr0);
+ }
+ /*!dx low pt*/
+ if(ich && (pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[0], ptName[0], 5)))){
+ if((pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[ich], ptName[0], 5)))){
+ (*pr0)+=(*pr1);
+ pr0->fH->SetNameTitle(Form("H%sTrkInX%c", mc?"MC":"", ptName[0]), Form("TrackIn :: #Deltax{%s}", ptCut[0]));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ }
+ }
+ for(Int_t isp(0); isp<AliPID::kSPECIES; isp++){
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%d", mc?"MC":"", chName[0], isp)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkInY%d", mc?"MC":"", isp), Form("TrackIn[%s] :: #Deltay", AliPID::ParticleLatexName(isp)));
+ pr0->SetShowRange(-0.3, 0.3);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1, kFALSE))) arr->AddAt(h2, jh++);
+ if((h2 = (TH2*)gDirectory->Get(Form("%s_yx", pr0->fH->GetName())))) arr->AddAt(h2, jh++);
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%d", mc?"MC":"", chName[0], isp)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkInPh%d", mc?"MC":"", isp), Form("TrackIn[%s] :: #Delta#phi", AliPID::ParticleLatexName(isp)));
+ pr0->SetShowRange(-1., 1.);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!dQdl*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInQ%c%d", mc?"MC":"", chName[0], isp)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkInQ%d", mc?"MC":"", isp), Form("TrackIn[%s] :: dQdl", AliPID::ParticleLatexName(isp)));
+ pr0->SetShowRange(-2.2, -1.75);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 2))) arr->AddAt(h2, jh++);
+ pr0->fH->SetName(Form("H%sTrkInQS%d", mc?"MC":"", isp));
+ pr0->SetShowRange(-1.7, -1.25);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 0))) arr->AddAt(h2, jh++);
+ }
+ }
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInY%c%c%d", mc?"MC":"", chName[0], ptName[0], 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkInY", mc?"MC":""), "TrackIn :: #Deltay");
+ pr0->SetShowRange(-0.3, 0.3);
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInPh%c%c%d", mc?"MC":"", chName[0], ptName[0], 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkInPh", mc?"MC":""), "TrackIn :: #Delta#phi");
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!dx*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInX%c%c%d", mc?"MC":"", chName[0], ptName[0], 0)))){
+ pr0->fH->SetNameTitle(Form("H%sTrkInX", mc?"MC":""), "TrackIn :: #Deltax");
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!RC dz*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInRCZ%c", mc?"MC":"", ptName[0])))){
+ for(Int_t ipt(0); ipt<kNpt; ipt++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInRCZ%c", mc?"MC":"", ptName[ipt])))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkInRCZ", mc?"MC":""), "TrackIn[RC]:: #Deltaz");
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!RC dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInRCY%c", mc?"MC":"", ptName[0])))){
+ for(Int_t ipt(0); ipt<kNpt; ipt++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInRCY%c", mc?"MC":"", ptName[ipt])))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkInRCY", mc?"MC":""), "TrackIn[RC]:: #Deltay");
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!RC dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInRCPh%c", mc?"MC":"", ptName[0])))){
+ for(Int_t ipt(0); ipt<kNpt; ipt++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInRCPh%c", mc?"MC":"", ptName[ipt])))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkInRCPh", mc?"MC":""), "TrackIn[RC]:: #Delta#phi");
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!RC dx*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInRCX%c", mc?"MC":"", ptName[0])))){
+ for(Int_t ipt(0); ipt<kNpt; ipt++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkInRCX%c", mc?"MC":"", ptName[ipt])))) continue;
+ (*pr0)+=(*pr1);
+ }
+ pr0->fH->SetNameTitle(Form("H%sTrkInRCX", mc?"MC":""), "TrackIn[RC]:: #Deltax");
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ AliInfo(Form("Done %3d 2D projections.", jh));
+ return kTRUE;
+}
+
+
+//________________________________________________________
+Bool_t AliTRDresolution::MakeProjectionTrack()
+{
+// Analyse tracklet
+ const Int_t kNcontours(9);
+ const Int_t kNstat(30);
+ Int_t cidx(kMCtrack);
+ if(fProj && fProj->At(cidx)) return kTRUE;
+ if(!fContainer){
+ AliError("Missing data container.");
+ return kFALSE;
+ }
+ THnSparse *H(NULL);
+ if(!(H = (THnSparse*)fContainer->FindObject("hTRD2MC"))){
+ AliError("Missing/Wrong data @ hTRD2MC.");
+ return kFALSE;
+ }
+ Int_t ndim(H->GetNdimensions());
+ Int_t coord[kNdim+1]; memset(coord, 0, sizeof(Int_t) * (kNdim+1)); Double_t v = 0.;
+ TAxis *aa[kNdim+1], *as(NULL), *ap(NULL); memset(aa, 0, sizeof(TAxis*) * (kNdim+1));
+ for(Int_t id(0); id<ndim; id++) aa[id] = H->GetAxis(id);
+ if(ndim > kSpeciesChgRC) as = H->GetAxis(kSpeciesChgRC);
+ if(ndim > kPt) ap = H->GetAxis(kPt);
+
+ // build list of projections
+ const Int_t nsel(AliTRDgeometry::kNlayer*kNpt*AliPID::kSPECIES*7);//, npsel(3);
+ const Char_t chName[kNcharge] = {'n', 'p'};const Char_t chSgn[kNcharge] = {'-', '+'};
+ const Char_t ptName[kNpt] = {'l', 'i', 'h'};
+ const Char_t *ptCut[kNpt] = {"p_{t}[GeV/c]<0.8", "0.8<=p_{t}[GeV/c]<1.5", "p_{t}[GeV/c]>=1.5"};
+ // define rebinning strategy
+ const Int_t nEtaPhi(4); Int_t rebinEtaPhiX[nEtaPhi] = {1, 2, 5, 1}, rebinEtaPhiY[nEtaPhi] = {2, 1, 1, 5};
+ AliTRDresolutionProjection hp[kTrkNproj]; TObjArray php(kTrkNproj);
+ Int_t ih(0), isel(-1), np[nsel]; memset(np, 0, nsel*sizeof(Int_t));
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ for(Int_t ipt(0); ipt<kNpt; ipt++){
+ for(Int_t isp(0); isp<AliPID::kSPECIES; isp++){
+ for(Int_t ich(0); ich<kNcharge; ich++){
+ isel++; // new selection
+ hp[ih].Build(Form("HMCTrkY%c%c%d%d", chName[ich], ptName[ipt], isp, ily),
+ Form("Tracks[%s%c]:: #Deltay{%s} Ly[%d]", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt], ily),
+ kEta, kPhi, kYrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("HMCTrkPh%c%c%d%d", chName[ich], ptName[ipt], isp, ily),
+ Form("Tracks[%s%c]:: #Delta#phi{%s} Ly[%d]", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt], ily),
+ kEta, kPhi, kPrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ hp[ih].Build(Form("HMCTrkDPt%c%c%d%d", chName[ich], ptName[ipt], isp, ily),
+ Form("Tracks[%s%c]:: #Deltap_{t}/p_{t}{%s} Ly[%d]", AliPID::ParticleLatexName(isp), chSgn[ich], ptCut[ipt], ily),
+ kEta, kPhi, kNdim, aa);
+ hp[ih].SetShowRange(0.,10.);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ }
+ }
+ isel++; // new selection
+ hp[ih].Build(Form("HMCTrkZ%c%d", ptName[ipt], ily),
+ Form("Tracks[RC]:: #Deltaz{%s} Ly[%d]", ptCut[ipt], ily),
+ kEta, kPhi, kZrez, aa);
+ hp[ih].SetRebinStrategy(nEtaPhi, rebinEtaPhiX, rebinEtaPhiY);
+ php.AddLast(&hp[ih++]); np[isel]++;
+ }
+ }
+
+ Int_t ly(0), ch(0), pt(0), sp(2), rcBin(as?as->FindBin(0.):-1);
+ for (Long64_t ib(0); ib < H->GetNbins(); ib++) {
+ v = H->GetBinContent(ib, coord);
+ if(v<1.) continue;
+ ly = coord[kBC]-1; // layer selection
+ // charge selection
+ ch=0; sp=2;// [pi-] track [dafault]
+ if(rcBin>0){ // debug mode in which species are also saved
+ sp = Int_t(TMath::Abs(as->GetBinCenter(coord[kSpeciesChgRC])))-1;
+ if(coord[kSpeciesChgRC] > rcBin) ch = 1; // [+] track
+ else if(coord[kSpeciesChgRC] == rcBin) ch = 2; // [RC] track
+ }
+ // pt selection
+ pt = 0; // low pt [default]
+ if(ap) pt = coord[kPt]-1;
+ // global selection
+ Int_t ioff = ly*kNpt*31+pt*31; ioff+=3*(sp<0?10:(sp*kNcharge+ch));
+ isel = ly*kNpt*11+pt*11; isel+=sp<0?10:(sp*kNcharge+ch);
+ AliDebug(4, Form("SELECTION[%d] :: ch[%c] pt[%c] sp[%d] ly[%d]\n", np[isel], ch==2?'Z':chName[ch], ptName[pt], sp, ly));
+ for(Int_t jh(0); jh<np[isel]; jh++) ((AliTRDresolutionProjection*)php.At(ioff+jh))->Increment(coord, v);
+ }
+ TObjArray *arr(NULL);
+ fProj->AddAt(arr = new TObjArray(kTrkNproj), cidx);
+
+ TH2 *h2(NULL); Int_t jh(0);
+ for(; ih--; ){
+ if(!hp[ih].fH) continue;
+ if(!(h2 = hp[ih].Projection2D(kNstat, kNcontours))) continue;
+ arr->AddAt(h2, jh++);
+ }
+
+ // combine up the tree of projections
+ AliTRDresolutionProjection *pr0(NULL), *pr1(NULL);
+ //Int_t iproj(0), jproj(0);
+ for(Int_t ily(0); ily<AliTRDgeometry::kNlayer; ily++){
+ for(Int_t ich(0); ich<kNcharge; ich++){
+ for(Int_t ipt(0); ipt<kNpt; ipt++){
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkY%c%c%d%d", chName[ich], ptName[ipt], 0, ily)))){
+ for(Int_t isp(1); isp<AliPID::kSPECIES; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkY%c%c%d%d", chName[ich], ptName[ipt], isp, ily)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ AliDebug(2, Form("Rename %s to HMCTrkY%c%c%d", pr0->fH->GetName(), chName[ich], ptName[ipt], ily));
+ pr0->fH->SetNameTitle(Form("HMCTrkY%c%c%d", chName[ich], ptName[ipt], ily),
+ Form("Tracks[%c]:: #Deltay{%s} Ly[%d]", chSgn[ich], ptCut[ipt], ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkY%c%c%d%d", chName[ich], ptName[0], 0, ily)))) (*pr1)+=(*pr0);
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkPh%c%c%d%d", chName[ich], ptName[ipt], 0, ily)))){
+ for(Int_t isp(1); isp<AliPID::kSPECIES; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkPh%c%c%d%d", chName[ich], ptName[ipt], isp, ily)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ AliDebug(2, Form("Rename %s to HMCTrkPh%c%c%d", pr0->fH->GetName(), chName[ich], ptName[ipt], ily));
+ pr0->fH->SetNameTitle(Form("HMCTrkPh%c%c%d", chName[ich], ptName[ipt], ily),
+ Form("Tracks[%c]:: #Delta#phi{%s} Ly[%d]", chSgn[ich], ptCut[ipt], ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkPh%c%c%d%d", chName[ich], ptName[0], 0, ily)))) (*pr1)+=(*pr0);
+ }
+
+ /*!dpt/pt*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkDPt%c%c%d%d", chName[ich], ptName[ipt], 0, ily)))){
+ for(Int_t isp(1); isp<AliPID::kSPECIES; isp++){
+ if(!(pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkDPt%c%c%d%d", chName[ich], ptName[ipt], isp, ily)))) continue;
+ (*pr0)+=(*pr1);
+ }
+ AliDebug(2, Form("Rename %s to HMCTrkDPt%c%c%d", pr0->fH->GetName(), chName[ich], ptName[ipt], ily));
+ pr0->fH->SetNameTitle(Form("HMCTrkDPt%c%c%d", chName[ich], ptName[ipt], ily),
+ Form("Tracks[%c]:: #Deltap_{t}/p_{t}{%s} Ly[%d]", chSgn[ich], ptCut[ipt], ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ipt && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkDPt%c%c%d%d", chName[ich], ptName[0], 0, ily)))) (*pr1)+=(*pr0);
+ }
+ }
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkY%c%c%d%d", chName[ich], ptName[0], 0, ily)))){
+ pr0->fH->SetNameTitle(Form("HMCTrkY%c%d", chName[ich], ily),
+ Form("Tracks[%c]:: #Deltay Ly[%d]", chSgn[ich], ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ich==1 && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkY%c%c%d%d", chName[0], ptName[0], 0, ily)))) (*pr1)+=(*pr0);
+ }
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkPh%c%c%d%d", chName[ich], ptName[0], 0, ily)))){
+ pr0->fH->SetNameTitle(Form("HMCTrkPh%c%d", chName[ich], ily),
+ Form("Tracks[%c]:: #Delta#phi Ly[%d]", chSgn[ich], ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ich==1 && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkPh%c%c%d%d", chName[0], ptName[0], 0, ily)))) (*pr1)+=(*pr0);
+ }
+ /*!dpt/pt*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkDPt%c%c%d%d", chName[ich], ptName[0], 0, ily)))){
+ pr0->fH->SetNameTitle(Form("HMCTrkDPt%c%d", chName[ich], ily),
+ Form("Tracks[%c]:: #Deltap_{t}/p_{t} Ly[%d]", chSgn[ich], ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ if(ich==1 && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkDPt%c%c%d%d", chName[0], ptName[0], 0, ily)))) (*pr1)+=(*pr0);
+ }
+ }
+ /*!dy*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkY%c%c%d%d", chName[0], ptName[0], 0, ily)))){
+ pr0->fH->SetNameTitle(Form("HMCTrkY%d", ily), Form("Tracks :: #Deltay Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
}
- range[0]=h1.GetBinCenter(jBinMin); range[1]=h1.GetBinCenter(jBinMax);
- AliDebug(2, Form(" rangeT[%f %f]", range[0], range[1]));
- break;
- }
- }
-
- return;
-}
-
-//________________________________________________________
-void AliTRDresolution::MakeSummaryPlot(TObjArray *a, TH2 *h2)
-{
-// Core functionality for MakeSummary function.
-
- h2->Reset();
- Double_t x,y;
- TGraphErrors *g(NULL); TAxis *ax(h2->GetXaxis());
- for(Int_t iseg(0); iseg<fgkNresYsegm[fSegmentLevel]; iseg++){
- g=(TGraphErrors*)a->At(iseg);
- for(Int_t in(0); in<g->GetN(); in++){
- g->GetPoint(in, x, y);
- h2->SetBinContent(ax->FindBin(x), iseg+1, y);
+ /*!dphi*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkPh%c%c%d%d", chName[0], ptName[0], 0, ily)))){
+ pr0->fH->SetNameTitle(Form("HMCTrkPh%d", ily), Form("Tracks :: #Delta#phi Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
+ }
+ /*!dpt/pt*/
+ if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("HMCTrkDPt%c%c%d%d", chName[0], ptName[0], 0, ily)))){
+ pr0->fH->SetNameTitle(Form("HMCTrkDPt%d", ily), Form("Tracks :: #Deltap_{t}/p_{t} Ly[%d]", ily));
+ if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
}
}
+ AliInfo(Form("Done %3d 2D projections.", jh));
+ return kTRUE;
}
-
//________________________________________________________
Bool_t AliTRDresolution::PostProcess()
{
// Fit, Project, Combine, Extract values from the containers filled during execution
- /*fContainer = dynamic_cast<TObjArray*>(GetOutputData(0));*/
if (!fContainer) {
AliError("ERROR: list not available");
return kFALSE;
}
-
- // define general behavior parameters
- const Color_t fgColorS[11]={
- kOrange, kOrange-3, kMagenta+1, kViolet, kRed,
- kGray,
- kRed, kViolet, kMagenta+1, kOrange-3, kOrange
- };
- const Color_t fgColorM[11]={
- kCyan-5, kAzure-4, kBlue-7, kBlue+2, kViolet+10,
- kBlack,
- kViolet+10, kBlue+2, kBlue-7, kAzure-4, kCyan-5
- };
- const Marker_t fgMarker[11]={
- 30, 30, 26, 25, 24,
- 28,
- 20, 21, 22, 29, 29
- };
-
- TGraph *gm= NULL, *gs= NULL;
- if(!fGraphS && !fGraphM){
- TObjArray *aM(NULL), *aS(NULL);
- Int_t n = fContainer->GetEntriesFast();
- fGraphS = new TObjArray(n); fGraphS->SetOwner();
- fGraphM = new TObjArray(n); fGraphM->SetOwner();
- for(Int_t ig(0), nc(0); ig<n; ig++){
- fGraphM->AddAt(aM = new TObjArray(fgNproj[ig]), ig);
- fGraphS->AddAt(aS = new TObjArray(fgNproj[ig]), ig);
-
- for(Int_t ic=0; ic<fgNproj[ig]; ic++, nc++){
- AliDebug(2, Form("building G[%d] P[%d] N[%d]", ig, ic, fNcomp[nc]));
- if(fNcomp[nc]>1){
- TObjArray *agS(NULL), *agM(NULL);
- aS->AddAt(agS = new TObjArray(fNcomp[nc]), ic);
- aM->AddAt(agM = new TObjArray(fNcomp[nc]), ic);
- for(Int_t is=fNcomp[nc]; is--;){
- agS->AddAt(gs = new TGraphErrors(), is);
- Int_t is0(is%11), il0(is/11);
- gs->SetMarkerStyle(fgMarker[is0]);
- gs->SetMarkerColor(fgColorS[is0]);
- gs->SetLineColor(fgColorS[is0]);
- gs->SetLineStyle(il0);gs->SetLineWidth(2);
- gs->SetName(Form("s_%d_%02d_%02d", ig, ic, is));
-
- agM->AddAt(gm = new TGraphErrors(), is);
- gm->SetMarkerStyle(fgMarker[is0]);
- gm->SetMarkerColor(fgColorM[is0]);
- gm->SetLineColor(fgColorM[is0]);
- gm->SetLineStyle(il0);gm->SetLineWidth(2);
- gm->SetName(Form("m_%d_%02d_%02d", ig, ic, is));
- // this is important for labels in the legend
- if(ic==0) {
- gs->SetTitle(Form("%s %02d", fgkResYsegmName[fSegmentLevel], is%fgkNresYsegm[fSegmentLevel]));
- gm->SetTitle(Form("%s %02d", fgkResYsegmName[fSegmentLevel], is%fgkNresYsegm[fSegmentLevel]));
- } else if(ic==1) {
- gs->SetTitle(Form("%s Ly[%d]", is%2 ?"z":"y", is/2));
- gm->SetTitle(Form("%s Ly[%d]", is%2?"z":"y", is/2));
- } else if(ic==2||ic==3) {
- gs->SetTitle(Form("%s Ly[%d]", is%2 ?"RC":"no RC", is/2));
- gm->SetTitle(Form("%s Ly[%d]", is%2?"RC":"no RC", is/2));
- } else if(ic<=7) {
- gs->SetTitle(Form("Layer[%d]", is%AliTRDgeometry::kNlayer));
- gm->SetTitle(Form("Layer[%d]", is%AliTRDgeometry::kNlayer));
- } else {
- gs->SetTitle(Form("%s @ ly[%d]", fgParticle[is0], il0));
- gm->SetTitle(Form("%s @ ly[%d]", fgParticle[is0], il0));
- }
- }
- } else {
- aS->AddAt(gs = new TGraphErrors(), ic);
- gs->SetMarkerStyle(23);
- gs->SetMarkerColor(kRed);
- gs->SetLineColor(kRed);
- gs->SetNameTitle(Form("s_%d_%02d", ig, ic), "sigma");
-
- aM->AddAt(gm = ig ? (TGraph*)new TGraphErrors() : (TGraph*)new TGraphAsymmErrors(), ic);
- gm->SetLineColor(kBlack);
- gm->SetMarkerStyle(7);
- gm->SetMarkerColor(kBlack);
- gm->SetNameTitle(Form("m_%d_%02d", ig, ic), "mean");
- }
- }
- }
+ if(!fProj){
+ AliInfo("Building array of projections ...");
+ fProj = new TObjArray(kNclasses); fProj->SetOwner(kTRUE);
}
-/* printf("\n\n\n"); fGraphS->ls();
- printf("\n\n\n"); fGraphM->ls();*/
-
-
- // DEFINE MODELS
- // simple gauss
- TF1 fg("fGauss", "gaus", -.5, .5);
- // Landau for charge resolution
- TF1 fch("fClCh", "landau", 0., 1000.);
- // Landau for e+- pt resolution
- TF1 fpt("fPt", "landau", -0.1, 0.2);
-
//PROCESS EXPERIMENTAL DISTRIBUTIONS
- // Charge resolution
- //Process3DL(kCharge, 0, &fl);
+ // Clusters detector
+ if(!MakeProjectionDetector()) return kFALSE;
// Clusters residuals
- Process3D(kCluster, 0, &fg, 1.e4);
- Process3Dlinked(kCluster, 1, &fg);
+ if(!MakeProjectionCluster()) return kFALSE;
fNRefFigures = 3;
// Tracklet residual/pulls
- Process3D(kTrack , 0, &fg, 1.e4);
- Process3Dlinked(kTrack , 1, &fg);
- Process3D(kTrack , 2, &fg, 1.e4);
- Process3D(kTrack , 3, &fg);
- Process2D(kTrack , 4, &fg, 1.e3);
+ if(!MakeProjectionTracklet()) return kFALSE;
fNRefFigures = 7;
// TRDin residual/pulls
- Process3D(kTrackIn, 0, &fg, 1.e4);
- Process3Dlinked(kTrackIn, 1, &fg);
- Process3D(kTrackIn, 2, &fg, 1.e4);
- Process3D(kTrackIn, 3, &fg);
- Process2D(kTrackIn, 4, &fg, 1.e3);
+ if(!MakeProjectionTrackIn()) return kFALSE;
fNRefFigures = 11;
- // TRDout residual/pulls
- Process3D(kTrackOut, 0, &fg, 1.e3); // scale to fit - see PlotTrackOut
- Process3Dlinked(kTrackOut, 1, &fg);
- Process3D(kTrackOut, 2, &fg, 1.e4);
- Process3D(kTrackOut, 3, &fg);
- Process2D(kTrackOut, 4, &fg, 1.e3);
- fNRefFigures = 15;
if(!HasMCdata()) return kTRUE;
-
-
//PROCESS MC RESIDUAL DISTRIBUTIONS
// CLUSTER Y RESOLUTION/PULLS
- Process3D(kMCcluster, 0, &fg, 1.e4);
- Process3Dlinked(kMCcluster, 1, &fg, 1.);
+ if(!MakeProjectionCluster(kTRUE)) return kFALSE;
fNRefFigures = 17;
// TRACKLET RESOLUTION/PULLS
- Process3D(kMCtracklet, 0, &fg, 1.e4); // y
- Process3Dlinked(kMCtracklet, 1, &fg, 1.); // y pulls
- Process3D(kMCtracklet, 2, &fg, 1.e4); // z
- Process3D(kMCtracklet, 3, &fg, 1.); // z pulls
- Process2D(kMCtracklet, 4, &fg, 1.e3); // phi
+ if(!MakeProjectionTracklet(kTRUE)) return kFALSE;
fNRefFigures = 21;
// TRACK RESOLUTION/PULLS
- Process3Darray(kMCtrack, 0, &fg, 1.e4); // y
- Process3DlinkedArray(kMCtrack, 1, &fg); // y PULL
- Process3Darray(kMCtrack, 2, &fg, 1.e4); // z
- Process3Darray(kMCtrack, 3, &fg); // z PULL
- Process2Darray(kMCtrack, 4, &fg, 1.e3); // phi
- Process2Darray(kMCtrack, 5, &fg); // snp PULL
- Process2Darray(kMCtrack, 6, &fg, 1.e3); // theta
- Process2Darray(kMCtrack, 7, &fg); // tgl PULL
- Process3Darray(kMCtrack, 8, &fg, 1.e2); // pt resolution
- Process3Darray(kMCtrack, 9, &fg); // 1/pt pulls
- Process3Darray(kMCtrack, 10, &fg, 1.e2); // p resolution
+ if(!MakeProjectionTrack()) return kFALSE;
fNRefFigures+=16;
// TRACK TRDin RESOLUTION/PULLS
- Process3D(kMCtrackIn, 0, &fg, 1.e4);// y resolution
- Process3Dlinked(kMCtrackIn, 1, &fg); // y pulls
- Process3D(kMCtrackIn, 2, &fg, 1.e4);// z resolution
- Process3D(kMCtrackIn, 3, &fg); // z pulls
- Process2D(kMCtrackIn, 4, &fg, 1.e3);// phi resolution
- Process2D(kMCtrackIn, 5, &fg); // snp pulls
- Process2D(kMCtrackIn, 6, &fg, 1.e3);// theta resolution
- Process2D(kMCtrackIn, 7, &fg); // tgl pulls
- Process3D(kMCtrackIn, 8, &fg, 1.e2);// pt resolution
- Process3D(kMCtrackIn, 9, &fg); // 1/pt pulls
- Process3D(kMCtrackIn, 10, &fg, 1.e2);// p resolution
- fNRefFigures+=8;
-
- // TRACK TRDout RESOLUTION/PULLS
- Process3D(kMCtrackOut, 0, &fg, 1.e4);// y resolution
- Process3Dlinked(kMCtrackOut, 1, &fg); // y pulls
- Process3D(kMCtrackOut, 2, &fg, 1.e4);// z resolution
- Process3D(kMCtrackOut, 3, &fg); // z pulls
- Process2D(kMCtrackOut, 4, &fg, 1.e3);// phi resolution
- Process2D(kMCtrackOut, 5, &fg); // snp pulls
- Process2D(kMCtrackOut, 6, &fg, 1.e3);// theta resolution
- Process2D(kMCtrackOut, 7, &fg); // tgl pulls
- Process3D(kMCtrackOut, 8, &fg, 1.e2);// pt resolution
- Process3D(kMCtrackOut, 9, &fg); // 1/pt pulls
- Process3D(kMCtrackOut, 10, &fg, 1.e2);// p resolution
+ if(!MakeProjectionTrackIn(kTRUE)) return kFALSE;
fNRefFigures+=8;
return kTRUE;
}
//________________________________________________________
-TObjArray* AliTRDresolution::BuildMonitorContainerCluster(const char* name, Bool_t expand)
+TObjArray* AliTRDresolution::BuildMonitorContainerCluster(const char* name, Bool_t expand, Float_t range)
{
// Build performance histograms for AliTRDcluster.vs TRD track or MC
// - y reziduals/pulls
TH1 *h(NULL); char hname[100], htitle[300];
// tracklet resolution/pull in y direction
- sprintf(hname, "%s_%s_Y", GetNameId(), name);
- sprintf(htitle, "Y res for \"%s\" @ %s;tg(#phi);#Delta y [cm];%s", GetNameId(), name, fgkResYsegmName[fSegmentLevel]);
+ snprintf(hname, 100, "%s_%s_Y", GetNameId(), name);
+ snprintf(htitle, 300, "Y res for \"%s\" @ %s;tg(#phi);#Delta y [cm];%s", GetNameId(), name, "Detector");
+ Float_t rr = range<0.?fDyRange:range;
if(!(h = (TH3S*)gROOT->FindObject(hname))){
- Int_t nybins=fgkNresYsegm[fSegmentLevel];
+ Int_t nybins=50;
if(expand) nybins*=2;
- h = new TH3S(hname, htitle,
+ h = new TH3S(hname, htitle,
48, -.48, .48, // phi
- 60, -fDyRange, fDyRange, // dy
+ 60, -rr, rr, // dy
nybins, -0.5, nybins-0.5);// segment
} else h->Reset();
arr->AddAt(h, 0);
- sprintf(hname, "%s_%s_YZpull", GetNameId(), name);
- sprintf(htitle, "YZ pull for \"%s\" @ %s;%s;#Delta y / #sigma_{y};#Delta z / #sigma_{z}", GetNameId(), name, fgkResYsegmName[fSegmentLevel]);
+ snprintf(hname, 100, "%s_%s_YZpull", GetNameId(), name);
+ snprintf(htitle, 300, "YZ pull for \"%s\" @ %s;%s;#Delta y / #sigma_{y};#Delta z / #sigma_{z}", GetNameId(), name, "Detector");
if(!(h = (TH3S*)gROOT->FindObject(hname))){
- h = new TH3S(hname, htitle, fgkNresYsegm[fSegmentLevel], -0.5, fgkNresYsegm[fSegmentLevel]-0.5, 100, -4.5, 4.5, 100, -4.5, 4.5);
+ h = new TH3S(hname, htitle, 540, -0.5, 540-0.5, 100, -4.5, 4.5, 100, -4.5, 4.5);
} else h->Reset();
arr->AddAt(h, 1);
// - y reziduals/pulls
// - z reziduals/pulls
// - phi reziduals
- TObjArray *arr = BuildMonitorContainerCluster(name, expand);
+ TObjArray *arr = BuildMonitorContainerCluster(name, expand, 0.05);
arr->Expand(5);
TH1 *h(NULL); char hname[100], htitle[300];
// tracklet resolution/pull in z direction
- sprintf(hname, "%s_%s_Z", GetNameId(), name);
- sprintf(htitle, "Z res for \"%s\" @ %s;tg(#theta);#Delta z [cm];row cross", GetNameId(), name);
- if(!(h = (TH3S*)gROOT->FindObject(hname))){
- h = new TH3S(hname, htitle, 50, -1., 1., 100, -1.5, 1.5, 2, -0.5, 1.5);
+ snprintf(hname, 100, "%s_%s_Z", GetNameId(), name);
+ snprintf(htitle, 300, "Z res for \"%s\" @ %s;tg(#theta);#Delta z [cm]", GetNameId(), name);
+ if(!(h = (TH2S*)gROOT->FindObject(hname))){
+ h = new TH2S(hname, htitle, 50, -1., 1., 100, -.05, .05);
} else h->Reset();
arr->AddAt(h, 2);
- sprintf(hname, "%s_%s_Zpull", GetNameId(), name);
- sprintf(htitle, "Z pull for \"%s\" @ %s;tg(#theta);#Delta z / #sigma_{z};row cross", GetNameId(), name);
+ snprintf(hname, 100, "%s_%s_Zpull", GetNameId(), name);
+ snprintf(htitle, 300, "Z pull for \"%s\" @ %s;tg(#theta);#Delta z / #sigma_{z};row cross", GetNameId(), name);
if(!(h = (TH3S*)gROOT->FindObject(hname))){
h = new TH3S(hname, htitle, 50, -1., 1., 100, -5.5, 5.5, 2, -0.5, 1.5);
h->GetZaxis()->SetBinLabel(1, "no RC");
arr->AddAt(h, 3);
// tracklet to track phi resolution
- sprintf(hname, "%s_%s_PHI", GetNameId(), name);
- sprintf(htitle, "#Phi res for \"%s\" @ %s;tg(#phi);#Delta #phi [rad];entries", GetNameId(), name);
- if(!(h = (TH2I*)gROOT->FindObject(hname))){
- h = new TH2I(hname, htitle, 21, -.33, .33, 100, -.5, .5);
+ snprintf(hname, 100, "%s_%s_PHI", GetNameId(), name);
+ snprintf(htitle, 300, "#Phi res for \"%s\" @ %s;tg(#phi);#Delta #phi [rad];%s", GetNameId(), name, "Detector");
+ Int_t nsgms=540;
+ if(!(h = (TH3S*)gROOT->FindObject(hname))){
+ h = new TH3S(hname, htitle, 48, -.48, .48, 100, -.5, .5, nsgms, -0.5, nsgms-0.5);
} else h->Reset();
arr->AddAt(h, 4);
// - theta resolution, tgl pulls
// - pt resolution, 1/pt pulls, p resolution
- TObjArray *arr = BuildMonitorContainerTracklet(name);
+ TObjArray *arr = BuildMonitorContainerTracklet(name);
arr->Expand(11);
TH1 *h(NULL); char hname[100], htitle[300];
- TAxis *ax(NULL);
+ //TAxis *ax(NULL);
// snp pulls
- sprintf(hname, "%s_%s_SNPpull", GetNameId(), name);
- sprintf(htitle, "SNP pull for \"%s\" @ %s;tg(#phi);#Delta snp / #sigma_{snp};entries", GetNameId(), name);
+ snprintf(hname, 100, "%s_%s_SNPpull", GetNameId(), name);
+ snprintf(htitle, 300, "SNP pull for \"%s\" @ %s;tg(#phi);#Delta snp / #sigma_{snp};entries", GetNameId(), name);
if(!(h = (TH2I*)gROOT->FindObject(hname))){
h = new TH2I(hname, htitle, 60, -.3, .3, 100, -4.5, 4.5);
} else h->Reset();
arr->AddAt(h, 5);
// theta resolution
- sprintf(hname, "%s_%s_THT", GetNameId(), name);
- sprintf(htitle, "#Theta res for \"%s\" @ %s;tg(#theta);#Delta #theta [rad];entries", GetNameId(), name);
+ snprintf(hname, 100, "%s_%s_THT", GetNameId(), name);
+ snprintf(htitle, 300, "#Theta res for \"%s\" @ %s;tg(#theta);#Delta #theta [rad];entries", GetNameId(), name);
if(!(h = (TH2I*)gROOT->FindObject(hname))){
h = new TH2I(hname, htitle, 100, -1., 1., 100, -5e-3, 5e-3);
} else h->Reset();
arr->AddAt(h, 6);
// tgl pulls
- sprintf(hname, "%s_%s_TGLpull", GetNameId(), name);
- sprintf(htitle, "TGL pull for \"%s\" @ %s;tg(#theta);#Delta tgl / #sigma_{tgl};entries", GetNameId(), name);
+ snprintf(hname, 100, "%s_%s_TGLpull", GetNameId(), name);
+ snprintf(htitle, 300, "TGL pull for \"%s\" @ %s;tg(#theta);#Delta tgl / #sigma_{tgl};entries", GetNameId(), name);
if(!(h = (TH2I*)gROOT->FindObject(hname))){
h = new TH2I(hname, htitle, 100, -1., 1., 100, -4.5, 4.5);
} else h->Reset();
arr->AddAt(h, 7);
-
- const Int_t kNpt(14);
- const Int_t kNdpt(150);
+
+ const Int_t kNdpt(150);
const Int_t kNspc = 2*AliPID::kSPECIES+1;
Float_t lPt=0.1, lDPt=-.1, lSpc=-5.5;
Float_t binsPt[kNpt+1], binsSpc[kNspc+1], binsDPt[kNdpt+1];
for(Int_t i=0; i<kNdpt+1; i++,lDPt+=2.e-3) binsDPt[i]=lDPt;
// Pt resolution
- sprintf(hname, "%s_%s_Pt", GetNameId(), name);
- sprintf(htitle, "P_{t} res for \"%s\" @ %s;p_{t} [GeV/c];#Delta p_{t}/p_{t}^{MC};SPECIES", GetNameId(), name);
+ snprintf(hname, 100, "%s_%s_Pt", GetNameId(), name);
+ snprintf(htitle, 300, "#splitline{P_{t} res for}{\"%s\" @ %s};p_{t} [GeV/c];#Delta p_{t}/p_{t}^{MC};SPECIES", GetNameId(), name);
if(!(h = (TH3S*)gROOT->FindObject(hname))){
- h = new TH3S(hname, htitle,
+ h = new TH3S(hname, htitle,
kNpt, binsPt, kNdpt, binsDPt, kNspc, binsSpc);
- ax = h->GetZaxis();
- for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
+ //ax = h->GetZaxis();
+ //for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
} else h->Reset();
arr->AddAt(h, 8);
// 1/Pt pulls
- sprintf(hname, "%s_%s_1Pt", GetNameId(), name);
- sprintf(htitle, "1/P_{t} pull for \"%s\" @ %s;1/p_{t}^{MC} [c/GeV];#Delta(1/p_{t})/#sigma(1/p_{t});SPECIES", GetNameId(), name);
+ snprintf(hname, 100, "%s_%s_1Pt", GetNameId(), name);
+ snprintf(htitle, 300, "#splitline{1/P_{t} pull for}{\"%s\" @ %s};1/p_{t}^{MC} [c/GeV];#Delta(1/p_{t})/#sigma(1/p_{t});SPECIES", GetNameId(), name);
if(!(h = (TH3S*)gROOT->FindObject(hname))){
- h = new TH3S(hname, htitle,
+ h = new TH3S(hname, htitle,
kNpt, 0., 2., 100, -4., 4., kNspc, -5.5, 5.5);
- ax = h->GetZaxis();
- for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
+ //ax = h->GetZaxis();
+ //for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
} else h->Reset();
arr->AddAt(h, 9);
// P resolution
- sprintf(hname, "%s_%s_P", GetNameId(), name);
- sprintf(htitle, "P res for \"%s\" @ %s;p [GeV/c];#Delta p/p^{MC};SPECIES", GetNameId(), name);
+ snprintf(hname, 100, "%s_%s_P", GetNameId(), name);
+ snprintf(htitle, 300, "P res for \"%s\" @ %s;p [GeV/c];#Delta p/p^{MC};SPECIES", GetNameId(), name);
if(!(h = (TH3S*)gROOT->FindObject(hname))){
- h = new TH3S(hname, htitle,
+ h = new TH3S(hname, htitle,
kNpt, binsPt, kNdpt, binsDPt, kNspc, binsSpc);
- ax = h->GetZaxis();
- for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
+ //ax = h->GetZaxis();
+ //for(Int_t ib(1); ib<=ax->GetNbins(); ib++) ax->SetBinLabel(ib, fgParticle[ib-1]);
} else h->Reset();
arr->AddAt(h, 10);
if(fContainer) return fContainer;
- fContainer = new TObjArray(kNviews);
- //fContainer->SetOwner(kTRUE);
- TH1 *h(NULL);
- TObjArray *arr(NULL);
-
- // binnings for plots containing momentum or pt
- const Int_t kNpt(14), kNphi(48), kNdy(60);
- Float_t lPhi=-.48, lDy=-.3, lPt=0.1;
- Float_t binsPhi[kNphi+1], binsDy[kNdy+1], binsPt[kNpt+1];
- for(Int_t i=0; i<kNphi+1; i++,lPhi+=.02) binsPhi[i]=lPhi;
- for(Int_t i=0; i<kNdy+1; i++,lDy+=.01) binsDy[i]=lDy;
- for(Int_t i=0;i<kNpt+1; i++,lPt=TMath::Exp(i*.15)-1.) binsPt[i]=lPt;
-
- // cluster to track residuals/pulls
- fContainer->AddAt(arr = new TObjArray(2), kCharge);
- arr->SetName("Charge");
- if(!(h = (TH3S*)gROOT->FindObject("hCharge"))){
- h = new TH3S("hCharge", "Charge Resolution", 20, 1., 2., 24, 0., 3.6, 100, 0., 500.);
- h->GetXaxis()->SetTitle("dx/dx_{0}");
- h->GetYaxis()->SetTitle("x_{d} [cm]");
- h->GetZaxis()->SetTitle("dq/dx [ADC/cm]");
- } else h->Reset();
- arr->AddAt(h, 0);
-
- // cluster to track residuals/pulls
- fContainer->AddAt(BuildMonitorContainerCluster("Cl"), kCluster);
+ fContainer = new TObjArray(kNclasses); fContainer->SetOwner(kTRUE);
+ THnSparse *H(NULL);
+ const Int_t nhn(100); Char_t hn[nhn]; TString st;
+
+ //++++++++++++++++++++++
+ // cluster to detector
+ snprintf(hn, nhn, "h%s", fgPerformanceName[kDetector]);
+ if(!(H = (THnSparseI*)gROOT->FindObject(hn))){
+ const Int_t mdim(5);
+ const Char_t *cldTitle[mdim] = {"layer", fgkTitle[kPhi], "pad row", "centrality", "q [a.u.]"/*, "occupancy", "tb [10 Hz]"*/};
+ const Int_t cldNbins[mdim] = {AliTRDgeometry::kNlayer, fgkNbins[kPhi], 76, AliTRDeventInfo::kCentralityClasses, 100};
+ const Double_t cldMin[mdim] = {-0.5, fgkMin[kPhi], -0.5, -0.5, 0.},
+ cldMax[mdim] = {AliTRDgeometry::kNlayer-0.5, fgkMax[kPhi], 75.5, AliTRDeventInfo::kCentralityClasses - 0.5, 1200.};
+ st = "cluster proprieties;";
+ // define minimum info to be saved in non debug mode
+ Int_t ndim=DebugLevel()>=1?mdim:Int_t(kNdimDet);
+ for(Int_t idim(0); idim<ndim; idim++){ st += cldTitle[idim]; st+=";";}
+ H = new THnSparseI(hn, st.Data(), ndim, cldNbins, cldMin, cldMax);
+ } else H->Reset();
+ fContainer->AddAt(H, kDetector);
+ //++++++++++++++++++++++
+ // cluster to tracklet residuals/pulls
+ snprintf(hn, nhn, "h%s", fgPerformanceName[kCluster]);
+ if(!(H = (THnSparseI*)gROOT->FindObject(hn))){
+ const Char_t *clTitle[kNdim] = {"layer", fgkTitle[kPhi], fgkTitle[kEta], fgkTitle[kYrez], "#Deltax [cm]", "Q</Q", "Q/angle", "#Phi [deg]"};
+ const Int_t clNbins[kNdim] = {AliTRDgeometry::kNlayer, fgkNbins[kPhi], fgkNbins[kEta], fgkNbins[kYrez], 45, 30, 30, 15};
+ const Double_t clMin[kNdim] = {-0.5, fgkMin[kPhi], fgkMin[kEta], fgkMin[kYrez]/10., -.5, 0.1, -2., -45},
+ clMax[kNdim] = {AliTRDgeometry::kNlayer-0.5, fgkMax[kPhi], fgkMax[kEta], fgkMax[kYrez]/10., 4., 2.1, 118., 45};
+ st = "cluster spatial&charge resolution;";
+ // define minimum info to be saved in non debug mode
+ Int_t ndim=DebugLevel()>=1?Int_t(kNdim):Int_t(kNdimCl);
+ for(Int_t idim(0); idim<ndim; idim++){ st += clTitle[idim]; st+=";";}
+ H = new THnSparseI(hn, st.Data(), ndim, clNbins, clMin, clMax);
+ } else H->Reset();
+ fContainer->AddAt(H, kCluster);
+ //++++++++++++++++++++++
// tracklet to TRD track
- fContainer->AddAt(BuildMonitorContainerTracklet("Trk", kTRUE), kTrack);
+ snprintf(hn, nhn, "h%s", fgPerformanceName[kTracklet]);
+ if(!(H = (THnSparseI*)gROOT->FindObject(hn))){
+ const Int_t mdim(kNdim+8);
+ Char_t *trTitle[mdim]; memcpy(trTitle, fgkTitle, kNdim*sizeof(Char_t*));
+ Int_t trNbins[mdim]; memcpy(trNbins, fgkNbins, kNdim*sizeof(Int_t));
+ Double_t trMin[mdim]; memcpy(trMin, fgkMin, kNdim*sizeof(Double_t));
+ Double_t trMax[mdim]; memcpy(trMax, fgkMax, kNdim*sizeof(Double_t));
+ // set specific fields
+ trMin[kYrez] = -0.45; trMax[kYrez] = 0.45;
+ trMin[kPrez] = -4.5; trMax[kPrez] = 4.5;
+ trMin[kZrez] = -1.5; trMax[kZrez] = 1.5;
+ trTitle[kBC]=StrDup("layer"); trNbins[kBC] = AliTRDgeometry::kNlayer; trMin[kBC] = -0.5; trMax[kBC] = AliTRDgeometry::kNlayer-0.5;
+ Int_t jdim(kNdim); trTitle[jdim]=StrDup("dq/dl [a.u.]"); trNbins[jdim] = 100; trMin[jdim] = 0.; trMax[jdim] = 20;
+ jdim++; trTitle[jdim]=StrDup("centrality"); trNbins[jdim] = AliTRDeventInfo::kCentralityClasses; trMin[jdim] = -.5; trMax[jdim] = AliTRDeventInfo::kCentralityClasses - 0.5;
+ jdim++; trTitle[jdim]=StrDup("occupancy [%]"); trNbins[jdim] = 12; trMin[jdim] = 25.; trMax[jdim] = 85.;
+ jdim++; trTitle[jdim]=StrDup("gap [cm]"); trNbins[jdim] = 80; trMin[jdim] = 0.1; trMax[jdim] = 2.1;
+ jdim++; trTitle[jdim]=StrDup("size_{0} [cm]"); trNbins[jdim] = 16; trMin[jdim] = 0.15; trMax[jdim] = 1.75;
+ jdim++; trTitle[jdim]=StrDup("pos_{0} [cm]"); trNbins[jdim] = 10; trMin[jdim] = 0.; trMax[jdim] = 3.5;
+ jdim++; trTitle[jdim]=StrDup("size_{1} [cm]"); trNbins[jdim] = 16; trMin[jdim] = 0.15; trMax[jdim] = 1.75;
+ jdim++; trTitle[jdim]=StrDup("pos_{1} [cm]"); trNbins[jdim] = 10; trMin[jdim] = 0.; trMax[jdim] = 3.5;
+
+ st = "tracklet spatial&charge resolution;";
+ // define minimum info to be saved in non debug mode
+ Int_t ndim=DebugLevel()>=1?mdim:kNdimTrklt;
+ for(Int_t idim(0); idim<ndim; idim++){ st += trTitle[idim]; st+=";";}
+ H = new THnSparseI(hn, st.Data(), ndim, trNbins, trMin, trMax);
+ } else H->Reset();
+ fContainer->AddAt(H, kTracklet);
+ //++++++++++++++++++++++
// tracklet to TRDin
- fContainer->AddAt(BuildMonitorContainerTracklet("TrkIN", kTRUE), kTrackIn);
+ snprintf(hn, nhn, "h%s", fgPerformanceName[kTrackIn]);
+ if(!(H = (THnSparseI*)gROOT->FindObject(hn))){
+ // set specific fields
+ const Int_t mdim(kNdim+3);
+ Char_t *trinTitle[mdim]; memcpy(trinTitle, fgkTitle, kNdim*sizeof(Char_t*));
+ Int_t trinNbins[mdim]; memcpy(trinNbins, fgkNbins, kNdim*sizeof(Int_t));
+ Double_t trinMin[mdim]; memcpy(trinMin, fgkMin, kNdim*sizeof(Double_t));
+ Double_t trinMax[mdim]; memcpy(trinMax, fgkMax, kNdim*sizeof(Double_t));
+ trinNbins[kSpeciesChgRC] = Int_t(kNcharge)*AliPID::kSPECIES+1; trinMin[kSpeciesChgRC] = -AliPID::kSPECIES-0.5; trinMax[kSpeciesChgRC] = AliPID::kSPECIES+0.5;
+ trinTitle[kNdim]=StrDup("detector"); trinNbins[kNdim] = 540; trinMin[kNdim] = -0.5; trinMax[kNdim] = 539.5;
+ trinTitle[kNdim+1]=StrDup("dx [cm]"); trinNbins[kNdim+1]=48; trinMin[kNdim+1]=-2.4; trinMax[kNdim+1]=2.4;
+ trinTitle[kNdim+2]=StrDup("Fill Bunch"); trinNbins[kNdim+2]=3500; trinMin[kNdim+2]=-0.5; trinMax[kNdim+2]=3499.5;
+ st = "r-#phi/z/angular residuals @ TRD entry;";
+ // define minimum info to be saved in non debug mode
+ Int_t ndim=DebugLevel()>=1?mdim:kNdimTrkIn;
+ for(Int_t idim(0); idim<ndim; idim++){st+=trinTitle[idim]; st+=";";}
+ H = new THnSparseI(hn, st.Data(), ndim, trinNbins, trinMin, trinMax);
+ } else H->Reset();
+ fContainer->AddAt(H, kTrackIn);
// tracklet to TRDout
- fContainer->AddAt(BuildMonitorContainerTracklet("TrkOUT"), kTrackOut);
+// fContainer->AddAt(BuildMonitorContainerTracklet("TrkOUT"), kTrackOut);
// Resolution histos
if(!HasMCdata()) return fContainer;
- // cluster resolution
- fContainer->AddAt(BuildMonitorContainerCluster("MCcl"), kMCcluster);
-
- // tracklet resolution
- fContainer->AddAt(BuildMonitorContainerTracklet("MCtracklet"), kMCtracklet);
-
- // track resolution
- fContainer->AddAt(arr = new TObjArray(AliTRDgeometry::kNlayer), kMCtrack);
- arr->SetName("MCtrk");
- for(Int_t il(0); il<AliTRDgeometry::kNlayer; il++) arr->AddAt(BuildMonitorContainerTrack(Form("MCtrk_Ly%d", il)), il);
-
- // TRDin TRACK RESOLUTION
- fContainer->AddAt(BuildMonitorContainerTrack("MCtrkIN"), kMCtrackIn);
-
- // TRDout TRACK RESOLUTION
- fContainer->AddAt(BuildMonitorContainerTrack("MCtrkOUT"), kMCtrackOut);
+ //++++++++++++++++++++++
+ // cluster to TrackRef residuals/pulls
+ snprintf(hn, nhn, "h%s", fgPerformanceName[kMCcluster]);
+ if(!(H = (THnSparseI*)gROOT->FindObject(hn))){
+ const Char_t *clTitle[kNdim] = {"layer", fgkTitle[kPhi], fgkTitle[kEta], fgkTitle[kYrez], "#Deltax [cm]", "Q</Q", fgkTitle[kSpeciesChgRC], "#Phi [deg]"};
+ const Int_t clNbins[kNdim] = {AliTRDgeometry::kNlayer, fgkNbins[kPhi], fgkNbins[kEta], fgkNbins[kYrez], 20, 10, Int_t(kNcharge)*AliPID::kSPECIES+1, 15};
+ const Double_t clMin[kNdim] = {-0.5, fgkMin[kPhi], fgkMin[kEta], fgkMin[kYrez]/10., 0., 0.1, -AliPID::kSPECIES-0.5, -45},
+ clMax[kNdim] = {AliTRDgeometry::kNlayer-0.5, fgkMax[kPhi], fgkMax[kEta], fgkMax[kYrez]/10., 4., 2.1, AliPID::kSPECIES+0.5, 45};
+ st = "MC cluster spatial resolution;";
+ // define minimum info to be saved in non debug mode
+ Int_t ndim=DebugLevel()>=1?kNdim:4;
+ for(Int_t idim(0); idim<ndim; idim++){ st += clTitle[idim]; st+=";";}
+ H = new THnSparseI(hn, st.Data(), ndim, clNbins, clMin, clMax);
+ } else H->Reset();
+ fContainer->AddAt(H, kMCcluster);
+ //++++++++++++++++++++++
+ // tracklet to TrackRef
+ snprintf(hn, nhn, "h%s", fgPerformanceName[kMCtracklet]);
+ if(!(H = (THnSparseI*)gROOT->FindObject(hn))){
+ Char_t *trTitle[kNdim]; memcpy(trTitle, fgkTitle, kNdim*sizeof(Char_t*));
+ Int_t trNbins[kNdim]; memcpy(trNbins, fgkNbins, kNdim*sizeof(Int_t));
+ Double_t trMin[kNdim]; memcpy(trMin, fgkMin, kNdim*sizeof(Double_t));
+ Double_t trMax[kNdim]; memcpy(trMax, fgkMax, kNdim*sizeof(Double_t));
+ // set specific fields
+ trTitle[kBC]=StrDup("layer"); trNbins[kBC] = AliTRDgeometry::kNlayer; trMin[kBC] = -0.5; trMax[kBC] = AliTRDgeometry::kNlayer-0.5;
+ trMin[kYrez] = -0.54; trMax[kYrez] = -trMin[kYrez];
+ trMin[kPrez] = -4.5; trMax[kPrez] = -trMin[kPrez];
+ trMin[kZrez] = -1.5; trMax[kZrez] = -trMin[kZrez];
+ trNbins[kSpeciesChgRC] = Int_t(kNcharge)*AliPID::kSPECIES+1;trMin[kSpeciesChgRC] = -AliPID::kSPECIES-0.5; trMax[kSpeciesChgRC] = AliPID::kSPECIES+0.5;
+
+ st = "MC tracklet spatial resolution;";
+ // define minimum info to be saved in non debug mode
+ Int_t ndim=DebugLevel()>=1?kNdim:4;
+ for(Int_t idim(0); idim<ndim; idim++){ st += trTitle[idim]; st+=";";}
+ H = new THnSparseI(hn, st.Data(), ndim, trNbins, trMin, trMax);
+ } else H->Reset();
+ fContainer->AddAt(H, kMCtracklet);
+ //++++++++++++++++++++++
+ // TRDin to TrackRef
+ snprintf(hn, nhn, "h%s", fgPerformanceName[kMCtrackIn]);
+ if(!(H = (THnSparseI*)gROOT->FindObject(hn))){
+ st = "MC r-#phi/z/angular residuals @ TRD entry;";
+ // set specific fields
+ Int_t trNbins[kNdim]; memcpy(trNbins, fgkNbins, kNdim*sizeof(Int_t));
+ Double_t trMin[kNdim]; memcpy(trMin, fgkMin, kNdim*sizeof(Double_t));
+ Double_t trMax[kNdim]; memcpy(trMax, fgkMax, kNdim*sizeof(Double_t));
+ trMin[kYrez] = -0.54; trMax[kYrez] = -trMin[kYrez];
+ trMin[kPrez] = -2.4; trMax[kPrez] = -trMin[kPrez];
+ trMin[kZrez] = -0.9; trMax[kZrez] = -trMin[kZrez];
+ trNbins[kSpeciesChgRC] = Int_t(kNcharge)*AliPID::kSPECIES+1;trMin[kSpeciesChgRC] = -AliPID::kSPECIES-0.5; trMax[kSpeciesChgRC] = AliPID::kSPECIES+0.5;
+ // define minimum info to be saved in non debug mode
+ Int_t ndim=DebugLevel()>=1?kNdim:7;
+ for(Int_t idim(0); idim<ndim; idim++){ st += fgkTitle[idim]; st+=";";}
+ H = new THnSparseI(hn, st.Data(), ndim, trNbins, trMin, trMax);
+ } else H->Reset();
+ fContainer->AddAt(H, kMCtrackIn);
+ //++++++++++++++++++++++
+ // track to TrackRef
+ snprintf(hn, nhn, "h%s", fgPerformanceName[kMCtrack]);
+ if(!(H = (THnSparseI*)gROOT->FindObject(hn))){
+ Char_t *trTitle[kNdim+1]; memcpy(trTitle, fgkTitle, kNdim*sizeof(Char_t*));
+ Int_t trNbins[kNdim+1]; memcpy(trNbins, fgkNbins, kNdim*sizeof(Int_t));
+ Double_t trMin[kNdim+1]; memcpy(trMin, fgkMin, kNdim*sizeof(Double_t));
+ Double_t trMax[kNdim+1]; memcpy(trMax, fgkMax, kNdim*sizeof(Double_t));
+ // set specific fields
+ trTitle[kBC]=StrDup("layer"); trNbins[kBC] = AliTRDgeometry::kNlayer; trMin[kBC] = -0.5; trMax[kBC] = AliTRDgeometry::kNlayer-0.5;
+ trMin[kYrez] = -0.9; trMax[kYrez] = -trMin[kYrez];
+ trMin[kPrez] = -1.5; trMax[kPrez] = -trMin[kPrez];
+ trMin[kZrez] = -0.9; trMax[kZrez] = -trMin[kZrez];
+ trNbins[kSpeciesChgRC] = Int_t(kNcharge)*AliPID::kSPECIES+1;trMin[kSpeciesChgRC] = -AliPID::kSPECIES-0.5; trMax[kSpeciesChgRC] = AliPID::kSPECIES+0.5;
+ trTitle[kNdim]=StrDup("#Deltap_{t}/p_{t} [%]"); trNbins[kNdim] = 25; trMin[kNdim] = -4.5; trMax[kNdim] = 20.5;
+
+ st = "MC track spatial&p_{t} resolution;";
+ // define minimum info to be saved in non debug mode
+ Int_t ndim=DebugLevel()>=1?(kNdim+1):4;
+ for(Int_t idim(0); idim<ndim; idim++){ st += trTitle[idim]; st+=";";}
+ H = new THnSparseI(hn, st.Data(), ndim, trNbins, trMin, trMax);
+ } else H->Reset();
+ fContainer->AddAt(H, kMCtrack);
return fContainer;
}
//________________________________________________________
-Bool_t AliTRDresolution::Load(const Char_t *file, const Char_t *dir)
+Bool_t AliTRDresolution::Process(TH2* const h2, TGraphErrors **g, Int_t stat)
{
-// Custom load function. Used to guess the segmentation level of the data.
+// Robust function to process sigma/mean for 2D plot dy(x)
+// For each x bin a gauss fit is performed on the y projection and the range
+// with the minimum chi2/ndf is choosen
- if(!AliTRDrecoTask::Load(file, dir)) return kFALSE;
-
- // look for cluster residual plot - always available
- TH3S* h3((TH3S*)((TObjArray*)fContainer->At(kClToTrk))->At(0));
- Int_t segmentation(h3->GetNbinsZ()/2);
- if(segmentation==fgkNresYsegm[0]){ // default segmentation. Nothing to do
- return kTRUE;
- } else if(segmentation==fgkNresYsegm[1]){ // stack segmentation.
- SetSegmentationLevel(1);
- } else if(segmentation==fgkNresYsegm[2]){ // detector segmentation.
- SetSegmentationLevel(2);
- } else {
- AliError(Form("Unknown segmentation [%d].", h3->GetNbinsZ()));
+ if(!h2) {
+ if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>0) printf("D-AliTRDresolution::Process() : NULL pointer input container.\n");
+ return kFALSE;
+ }
+ if(!Int_t(h2->GetEntries())){
+ if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>0) printf("D-AliTRDresolution::Process() : Empty h[%s - %s].\n", h2->GetName(), h2->GetTitle());
+ return kFALSE;
+ }
+ if(!g || !g[0]|| !g[1]) {
+ if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>0) printf("D-AliTRDresolution::Process() : NULL pointer output container.\n");
return kFALSE;
}
+ // prepare
+ TAxis *ax(h2->GetXaxis()), *ay(h2->GetYaxis());
+ Float_t ymin(ay->GetXmin()), ymax(ay->GetXmax()), dy(ay->GetBinWidth(1)), y0(0.), y1(0.);
+ TF1 f("f", "gaus", ymin, ymax);
+ Int_t n(0);
+ if((n=g[0]->GetN())) for(;n--;) g[0]->RemovePoint(n);
+ if((n=g[1]->GetN())) for(;n--;) g[1]->RemovePoint(n);
+ TH1D *h(NULL);
+ if((h=(TH1D*)gROOT->FindObject("py"))) delete h;
+ Double_t x(0.), y(0.), ex(0.), ey(0.), sy(0.), esy(0.);
+
- AliDebug(2, Form("Segmentation set to level \"%s\"", fgkResYsegmName[fSegmentLevel]));
+ // do actual loop
+ Float_t chi2OverNdf(0.);
+ for(Int_t ix = 1, np=0; ix<=ax->GetNbins(); ix++){
+ x = ax->GetBinCenter(ix); ex= ax->GetBinWidth(ix)*0.288; // w/sqrt(12)
+ ymin = ay->GetXmin(); ymax = ay->GetXmax();
+
+ h = h2->ProjectionY("py", ix, ix);
+ if((n=(Int_t)h->GetEntries())<stat){
+ if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>1) printf("I-AliTRDresolution::Process() : Low statistics @ x[%f] stat[%d]=%d [%d].\n", x, ix, n, stat);
+ continue;
+ }
+ // looking for a first order mean value
+ f.SetParameter(1, 0.); f.SetParameter(2, 3.e-2);
+ h->Fit(&f, "QNW");
+ chi2OverNdf = f.GetChisquare()/f.GetNDF();
+ printf("x[%f] range[%f %f] chi2[%f] ndf[%d] chi2/ndf[%f]\n", x, ymin, ymax, f.GetChisquare(),f.GetNDF(),chi2OverNdf);
+ y = f.GetParameter(1); y0 = y-4*dy; y1 = y+4*dy;
+ ey = f.GetParError(1);
+ sy = f.GetParameter(2); esy = f.GetParError(2);
+// // looking for the best chi2/ndf value
+// while(ymin<y0 && ymax>y1){
+// f.SetParameter(1, y);
+// f.SetParameter(2, sy);
+// h->Fit(&f, "QNW", "", y0, y1);
+// printf(" range[%f %f] chi2[%f] ndf[%d] chi2/ndf[%f]\n", y0, y1, f.GetChisquare(),f.GetNDF(),f.GetChisquare()/f.GetNDF());
+// if(f.GetChisquare()/f.GetNDF() < Chi2OverNdf){
+// chi2OverNdf = f.GetChisquare()/f.GetNDF();
+// y = f.GetParameter(1); ey = f.GetParError(1);
+// sy = f.GetParameter(2); esy = f.GetParError(2);
+// printf(" set y[%f] sy[%f] chi2/ndf[%f]\n", y, sy, chi2OverNdf);
+// }
+// y0-=dy; y1+=dy;
+// }
+ g[0]->SetPoint(np, x, y);
+ g[0]->SetPointError(np, ex, ey);
+ g[1]->SetPoint(np, x, sy);
+ g[1]->SetPointError(np, ex, esy);
+ np++;
+ }
return kTRUE;
}
// Do the processing
//
- Char_t pn[10]; sprintf(pn, "p%03d", fIdxPlot);
+ Char_t pn[10]; snprintf(pn, 10, "p%03d", fIdxPlot);
Int_t n = 0;
if((n=g[0]->GetN())) for(;n--;) g[0]->RemovePoint(n);
if((n=g[1]->GetN())) for(;n--;) g[1]->RemovePoint(n);
- if(Int_t(h2->GetEntries())){
+ if(Int_t(h2->GetEntries())){
AliDebug(4, Form("%s: g[%s %s]", pn, g[0]->GetName(), g[0]->GetTitle()));
} else {
AliDebug(2, Form("%s: g[%s %s]: Missing entries.", pn, g[0]->GetName(), g[0]->GetTitle()));
Int_t abin(ibin*kINTEGRAL+1),bbin(abin+kINTEGRAL-1),mbin(abin+Int_t(kINTEGRAL/2));
Double_t x = h2->GetXaxis()->GetBinCenter(mbin);
TH1D *h = h2->ProjectionY(pn, abin, bbin);
- if((n=(Int_t)h->GetEntries())<150){
+ if((n=(Int_t)h->GetEntries())<150){
AliDebug(4, Form(" x[%f] range[%d %d] stat[%d] low statistics !", x, abin, bbin, n));
continue;
}
g[0]->SetPointError(ip, 0., k*f->GetParError(1));
g[1]->SetPoint(ip, x, k*f->GetParameter(2));
g[1]->SetPointError(ip, 0., k*f->GetParError(2));
-/*
+/*
g[0]->SetPoint(ip, x, k*h->GetMean());
g[0]->SetPointError(ip, 0., k*h->GetMeanError());
g[1]->SetPoint(ip, x, k*h->GetRMS());
return kTRUE;
}
-//________________________________________________________
-Bool_t AliTRDresolution::Process2D(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k, Int_t gidx)
-{
- //
- // Do the processing
- //
-
- if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
-
- // retrive containers
- TH2I *h2(NULL);
- if(idx<0){
- if(!(h2= (TH2I*)(fContainer->At(plot)))) return kFALSE;
- } else{
- TObjArray *a0(NULL);
- if(!(a0=(TObjArray*)(fContainer->At(plot)))) return kFALSE;
- if(!(h2=(TH2I*)a0->At(idx))) return kFALSE;
- }
- if(Int_t(h2->GetEntries())){
- AliDebug(2, Form("p[%d] idx[%d] : h[%s] %s", plot, idx, h2->GetName(), h2->GetTitle()));
- } else {
- AliDebug(2, Form("p[%d] idx[%d] : Missing entries.", plot, idx));
- return kFALSE;
- }
-
- TGraphErrors *g[2];
- if(gidx<0) gidx=idx;
- if(!(g[0] = gidx<0 ? (TGraphErrors*)fGraphM->At(plot) : (TGraphErrors*)((TObjArray*)(fGraphM->At(plot)))->At(gidx))) return kFALSE;
-
- if(!(g[1] = gidx<0 ? (TGraphErrors*)fGraphS->At(plot) : (TGraphErrors*)((TObjArray*)(fGraphS->At(plot)))->At(gidx))) return kFALSE;
-
- return Process(h2, f, k, g);
-}
-
-//________________________________________________________
-Bool_t AliTRDresolution::Process3D(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
-{
- //
- // Do the processing
- //
-
- if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
-
- // retrive containers
- TH3S *h3(NULL);
- if(idx<0){
- if(!(h3= (TH3S*)(fContainer->At(plot)))) return kFALSE;
- } else{
- TObjArray *a0(NULL);
- if(!(a0=(TObjArray*)(fContainer->At(plot)))) return kFALSE;
- if(!(h3=(TH3S*)a0->At(idx))) return kFALSE;
- }
- if(Int_t(h3->GetEntries())){
- AliDebug(2, Form("p[%d] idx[%d] h[%s] %s", plot, idx, h3->GetName(), h3->GetTitle()));
- } else {
- AliDebug(2, Form("p[%d] idx[%d] : Missing entries.", plot, idx));
- return kFALSE;
- }
-
- TObjArray *gm, *gs;
- if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
- if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
- TGraphErrors *g[2];
-
- TAxis *az = h3->GetZaxis();
- for(Int_t iz(0); iz<gm->GetEntriesFast(); iz++){
- if(!(g[0] = (TGraphErrors*)gm->At(iz))) return kFALSE;
- if(!(g[1] = (TGraphErrors*)gs->At(iz))) return kFALSE;
- az->SetRange(iz+1, iz+1);
- if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
- }
-
- return kTRUE;
-}
-
-
-//________________________________________________________
-Bool_t AliTRDresolution::Process3Dlinked(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
-{
- //
- // Do the processing
- //
-
- if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
-
- // retrive containers
- TH3S *h3(NULL);
- if(idx<0){
- if(!(h3= (TH3S*)(fContainer->At(plot)))) return kFALSE;
- } else{
- TObjArray *a0(NULL);
- if(!(a0=(TObjArray*)(fContainer->At(plot)))) return kFALSE;
- if(!(h3=(TH3S*)a0->At(idx))) return kFALSE;
- }
- if(Int_t(h3->GetEntries())){
- AliDebug(2, Form("p[%d] idx[%d] h[%s] %s", plot, idx, h3->GetName(), h3->GetTitle()));
- } else {
- AliDebug(2, Form("p[%d] idx[%d] : Missing entries.", plot, idx));
- return kFALSE;
- }
-
- TObjArray *gm, *gs;
- if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
- if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
- TGraphErrors *g[2];
-
- if(!(g[0] = (TGraphErrors*)gm->At(0))) return kFALSE;
- if(!(g[1] = (TGraphErrors*)gs->At(0))) return kFALSE;
- if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
-
- if(!(g[0] = (TGraphErrors*)gm->At(1))) return kFALSE;
- if(!(g[1] = (TGraphErrors*)gs->At(1))) return kFALSE;
- if(!Process((TH2*)h3->Project3D("zx"), f, k, g)) return kFALSE;
-
- return kTRUE;
-}
-
-
-//________________________________________________________
-Bool_t AliTRDresolution::Process3DL(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
-{
- //
- // Do the processing
- //
-
- if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
-
- // retrive containers
- TH3S *h3 = (TH3S*)((TObjArray*)fContainer->At(plot))->At(idx);
- if(!h3) return kFALSE;
- AliDebug(2, Form("p[%d] idx[%d] h[%s] %s", plot, idx, h3->GetName(), h3->GetTitle()));
-
- TGraphAsymmErrors *gm;
- TGraphErrors *gs;
- if(!(gm = (TGraphAsymmErrors*)((TObjArray*)fGraphM->At(plot))->At(0))) return kFALSE;
- if(!(gs = (TGraphErrors*)((TObjArray*)fGraphS->At(plot)))) return kFALSE;
-
- Float_t x, r, mpv, xM, xm;
- TAxis *ay = h3->GetYaxis();
- for(Int_t iy=1; iy<=h3->GetNbinsY(); iy++){
- ay->SetRange(iy, iy);
- x = ay->GetBinCenter(iy);
- TH2F *h2=(TH2F*)h3->Project3D("zx");
- TAxis *ax = h2->GetXaxis();
- for(Int_t ix=1; ix<=h2->GetNbinsX(); ix++){
- r = ax->GetBinCenter(ix);
- TH1D *h1 = h2->ProjectionY("py", ix, ix);
- if(h1->Integral()<50) continue;
- h1->Fit(f, "QN");
-
- GetLandauMpvFwhm(f, mpv, xm, xM);
- Int_t ip = gm->GetN();
- gm->SetPoint(ip, x, k*mpv);
- gm->SetPointError(ip, 0., 0., k*xm, k*xM);
- gs->SetPoint(ip, r, k*(xM-xm)/mpv);
- gs->SetPointError(ip, 0., 0.);
- }
- }
-
- return kTRUE;
-}
-
-//________________________________________________________
-Bool_t AliTRDresolution::Process2Darray(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
-{
- //
- // Do the processing
- //
-
- if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
-
- // retrive containers
- TObjArray *arr = (TObjArray*)(fContainer->At(plot));
- if(!arr) return kFALSE;
- AliDebug(2, Form("p[%d] idx[%d] arr[%s]", plot, idx, arr->GetName()));
-
- TObjArray *gm, *gs;
- if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
- if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
-
- TGraphErrors *g[2]; TH2I *h2(NULL); TObjArray *a0(NULL);
- for(Int_t ia(0); ia<arr->GetEntriesFast(); ia++){
- if(!(a0 = (TObjArray*)arr->At(ia))) continue;
-
- if(!(h2 = (TH2I*)a0->At(idx))) return kFALSE;
- if(Int_t(h2->GetEntries())){
- AliDebug(4, Form(" idx[%d] h[%s] %s", ia, h2->GetName(), h2->GetTitle()));
- } else {
- AliDebug(2, Form(" idx[%d] : Missing entries.", ia));
- continue;
- }
-
- if(!(g[0] = (TGraphErrors*)gm->At(ia))) return kFALSE;
- if(!(g[1] = (TGraphErrors*)gs->At(ia))) return kFALSE;
- if(!Process(h2, f, k, g)) return kFALSE;
- }
-
- return kTRUE;
-}
-
-//________________________________________________________
-Bool_t AliTRDresolution::Process3Darray(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
-{
- //
- // Do the processing
- //
-
- if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
- //printf("Process4D : processing plot[%d] idx[%d]\n", plot, idx);
-
- // retrive containers
- TObjArray *arr = (TObjArray*)(fContainer->At(plot));
- if(!arr) return kFALSE;
- AliDebug(2, Form("p[%d] idx[%d] arr[%s]", plot, idx, arr->GetName()));
-
- TObjArray *gm, *gs;
- if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
- if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
-
- TGraphErrors *g[2]; TH3S *h3(NULL); TObjArray *a0(NULL);
- Int_t in(0);
- for(Int_t ia(0); ia<arr->GetEntriesFast(); ia++){
- if(!(a0 = (TObjArray*)arr->At(ia))) continue;
-
- if(!(h3 = (TH3S*)a0->At(idx))) return kFALSE;
- if(Int_t(h3->GetEntries())){
- AliDebug(4, Form(" idx[%d] h[%s] %s", ia, h3->GetName(), h3->GetTitle()));
- } else {
- AliDebug(2, Form(" idx[%d] : Missing entries.", ia));
- continue;
- }
- TAxis *az = h3->GetZaxis();
- for(Int_t iz=1; iz<=az->GetNbins(); iz++, in++){
- if(in >= gm->GetEntriesFast()) break;
- if(!(g[0] = (TGraphErrors*)gm->At(in))) return kFALSE;
- if(!(g[1] = (TGraphErrors*)gs->At(in))) return kFALSE;
- az->SetRange(iz, iz);
- if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
- }
- }
- AliDebug(2, Form("Projections [%d] from [%d]", in, gs->GetEntriesFast()));
-
- return kTRUE;
-}
-
-//________________________________________________________
-Bool_t AliTRDresolution::Process3DlinkedArray(ETRDresolutionPlot plot, Int_t idx, TF1 *f, Float_t k)
-{
- //
- // Do the processing
- //
-
- if(!fContainer || !fGraphS || !fGraphM) return kFALSE;
- //printf("Process4D : processing plot[%d] idx[%d]\n", plot, idx);
-
- // retrive containers
- TObjArray *arr = (TObjArray*)(fContainer->At(plot));
- if(!arr) return kFALSE;
- AliDebug(2, Form("p[%d] idx[%d] arr[%s]", plot, idx, arr->GetName()));
-
- TObjArray *gm, *gs;
- if(!(gm = (TObjArray*)((TObjArray*)(fGraphM->At(plot)))->At(idx))) return kFALSE;
- if(!(gs = (TObjArray*)((TObjArray*)(fGraphS->At(plot)))->At(idx))) return kFALSE;
-
- TGraphErrors *g[2]; TH3S *h3(NULL); TObjArray *a0(NULL);
- Int_t in(0);
- for(Int_t ia(0); ia<arr->GetEntriesFast(); ia++){
- if(!(a0 = (TObjArray*)arr->At(ia))) continue;
- if(!(h3 = (TH3S*)a0->At(idx))) return kFALSE;
- if(Int_t(h3->GetEntries())){
- AliDebug(4, Form(" idx[%d] h[%s] %s", ia, h3->GetName(), h3->GetTitle()));
- } else {
- AliDebug(2, Form(" idx[%d] : Missing entries.", ia));
- continue;
- }
- if(!(g[0] = (TGraphErrors*)gm->At(in))) return kFALSE;
- if(!(g[1] = (TGraphErrors*)gs->At(in))) return kFALSE;
- if(!Process((TH2*)h3->Project3D("yx"), f, k, g)) return kFALSE;
- in++;
-
- if(!(g[0] = (TGraphErrors*)gm->At(in))) return kFALSE;
- if(!(g[1] = (TGraphErrors*)gs->At(in))) return kFALSE;
- if(!Process((TH2*)h3->Project3D("zx"), f, k, g)) return kFALSE;
- in++;
- }
- AliDebug(2, Form("Projections [%d] from [%d]", in, gs->GetEntriesFast()));
-
- return kTRUE;
-}
-
-//________________________________________________________
-Bool_t AliTRDresolution::GetGraph(Float_t *bb, ETRDresolutionPlot ip, Int_t idx, Bool_t kLEG, const Char_t *explain)
-{
- //
- // Get the graphs
- //
-
- if(!fGraphS || !fGraphM) return kFALSE;
- // axis titles look up
- Int_t nref = 0;
- for(Int_t jp=0; jp<(Int_t)ip; jp++) nref+=fgNproj[jp];
- UChar_t jdx = idx<0?0:idx;
- for(Int_t jc=0; jc<TMath::Min(jdx,fgNproj[ip]-1); jc++) nref++;
- Char_t **at = fAxTitle[nref];
-
- // build legends if requiered
- TLegend *leg(NULL);
- if(kLEG){
- leg=new TLegend(.65, .6, .95, .9);
- leg->SetBorderSize(0);
- leg->SetFillStyle(0);
- }
- // build frame
- TH1S *h1(NULL);
- h1 = new TH1S(Form("h1TF_%02d", fIdxFrame++), Form("%s %s;%s;%s", at[0], explain?explain:"", at[1], at[2]), 2, bb[0], bb[2]);
- h1->SetMinimum(bb[1]);h1->SetMaximum(bb[3]);
- h1->SetLineColor(kBlack); h1->SetLineWidth(1);h1->SetLineStyle(2);
- // axis range
- TAxis *ax = h1->GetXaxis();
- ax->CenterTitle();ax->SetMoreLogLabels();ax->SetTitleOffset(1.2);
- ax = h1->GetYaxis();
- ax->SetRangeUser(bb[1], bb[3]);
- ax->CenterTitle(); ax->SetTitleOffset(1.4);
- h1->Draw();
- // bounding box
- TBox *b = new TBox(-.15, bb[1], .15, bb[3]);
- b->SetFillStyle(3002);b->SetLineColor(0);
- b->SetFillColor(ip<=Int_t(kMCcluster)?kGreen:kBlue);
- b->Draw();
-
- TGraphErrors *gm = idx<0 ? (TGraphErrors*)fGraphM->At(ip) : (TGraphErrors*)((TObjArray*)(fGraphM->At(ip)))->At(idx);
- if(!gm) return kFALSE;
- TGraphErrors *gs = idx<0 ? (TGraphErrors*)fGraphS->At(ip) : (TGraphErrors*)((TObjArray*)(fGraphS->At(ip)))->At(idx);
- if(!gs) return kFALSE;
-
- Int_t n(0), nPlots(0);
- if((n=gm->GetN())) {
- nPlots++;
- gm->Draw("pl"); if(leg) leg->AddEntry(gm, gm->GetTitle(), "pl");
- PutTrendValue(Form("%s_%s", fgPerformanceName[ip], at[0]), gm->GetMean(2));
- PutTrendValue(Form("%s_%sRMS", fgPerformanceName[ip], at[0]), gm->GetRMS(2));
- }
-
- if((n=gs->GetN())){
- nPlots++;
- gs->Draw("pl"); if(leg) leg->AddEntry(gs, gs->GetTitle(), "pl");
- gs->Sort(&TGraph::CompareY);
- PutTrendValue(Form("%s_%sSigMin", fgPerformanceName[ip], at[0]), gs->GetY()[0]);
- PutTrendValue(Form("%s_%sSigMax", fgPerformanceName[ip], at[0]), gs->GetY()[n-1]);
- gs->Sort(&TGraph::CompareX);
- }
- if(!nPlots) return kFALSE;
- if(leg) leg->Draw();
- return kTRUE;
-}
-
-//________________________________________________________
-Bool_t AliTRDresolution::GetGraphArray(Float_t *bb, ETRDresolutionPlot ip, Int_t idx, Bool_t kLEG, Int_t n, Int_t *sel, const Char_t *explain)
-{
- //
- // Get the graphs
- //
-
- if(!fGraphS || !fGraphM) return kFALSE;
-
- // axis titles look up
- Int_t nref(0);
- for(Int_t jp(0); jp<ip; jp++) nref+=fgNproj[jp];
- nref+=idx;
- Char_t **at = fAxTitle[nref];
-
- // build legends if requiered
- TLegend *legM(NULL), *legS(NULL);
- if(kLEG){
- legM=new TLegend(.35, .6, .65, .9);
- legM->SetHeader("Mean");
- legM->SetBorderSize(0);
- legM->SetFillStyle(0);
- legS=new TLegend(.65, .6, .95, .9);
- legS->SetHeader("Sigma");
- legS->SetBorderSize(0);
- legS->SetFillStyle(0);
- }
- // build frame
- TH1S *h1(NULL);
- h1 = new TH1S(Form("h1TF_%02d", fIdxFrame++), Form("%s %s;%s;%s", at[0], explain?explain:"", at[1], at[2]), 2, bb[0], bb[2]);
- h1->SetMinimum(bb[1]);h1->SetMaximum(bb[3]);
- h1->SetLineColor(kBlack); h1->SetLineWidth(1);h1->SetLineStyle(2);
- // axis range
- TAxis *ax = h1->GetXaxis();
- ax->CenterTitle();ax->SetMoreLogLabels();ax->SetTitleOffset(1.2);
- ax = h1->GetYaxis();
- ax->SetRangeUser(bb[1], bb[3]);
- ax->CenterTitle(); ax->SetTitleOffset(1.4);
- h1->Draw();
-
- TGraphErrors *gm(NULL), *gs(NULL);
- TObjArray *a0(NULL), *a1(NULL);
- a0 = (TObjArray*)((TObjArray*)fGraphM->At(ip))->At(idx);
- a1 = (TObjArray*)((TObjArray*)fGraphS->At(ip))->At(idx);
- if(!n) n=a0->GetEntriesFast();
- AliDebug(4, Form("Graph : Ref[%d] Title[%s] Limits{x[%f %f] y[%f %f]} Comp[%d] Selection[%c]", nref, at[0], bb[0], bb[2], bb[1], bb[3], n, sel ? 'y' : 'n'));
- Int_t nn(0), nPlots(0);
- for(Int_t is(0), is0(0); is<n; is++){
- is0 = sel ? sel[is] : is;
- if(!(gs = (TGraphErrors*)a1->At(is0))) return kFALSE;
- if(!(gm = (TGraphErrors*)a0->At(is0))) return kFALSE;
-
- if((nn=gs->GetN())){
- nPlots++;
- gs->Draw("pc");
- if(legS){
- //printf("LegEntry %s [%s]%s\n", at[0], gs->GetName(), gs->GetTitle());
- legS->AddEntry(gs, gs->GetTitle(), "pl");
- }
- gs->Sort(&TGraph::CompareY);
- PutTrendValue(Form("%s_%sSigMin", fgPerformanceName[kMCtrack], at[0]), gs->GetY()[0]);
- PutTrendValue(Form("%s_%sSigMax", fgPerformanceName[kMCtrack], at[0]), gs->GetY()[nn-1]);
- gs->Sort(&TGraph::CompareX);
- }
- if(gm->GetN()){
- nPlots++;
- gm->Draw("pc");
- if(legM){
- //printf("LegEntry %s [%s]%s\n", at[0], gm->GetName(), gm->GetTitle());
- legM->AddEntry(gm, gm->GetTitle(), "pl");
- }
- PutTrendValue(Form("%s_%s", fgPerformanceName[kMCtrack], at[0]), gm->GetMean(2));
- PutTrendValue(Form("%s_%sRMS", fgPerformanceName[kMCtrack], at[0]), gm->GetRMS(2));
- }
- }
- if(!nPlots) return kFALSE;
- if(kLEG){
- legM->Draw();
- legS->Draw();
- }
- return kTRUE;
-}
//____________________________________________________________________
Bool_t AliTRDresolution::FitTrack(const Int_t np, AliTrackPoint *points, Float_t param[10])
//
if(np<40){
- if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>1) printf("D-AliTRDresolution::FitTrack: Not enough clusters to fit a track [%d].", np);
+ if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>1) printf("D-AliTRDresolution::FitTrack: Not enough clusters to fit a track [%d].\n", np);
return kFALSE;
}
TLinearFitter yfitter(2, "pol1"), zfitter(2, "pol1");
Double_t dydx = yfitter.GetParameter(1);
param[0] = x0; param[1] = y0; param[2] = z0; param[3] = dydx; param[4] = dzdx;
- if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>3) printf("D-AliTRDresolution::FitTrack: x0[%f] y0[%f] z0[%f] dydx[%f] dzdx[%f]\n", x0, y0, z0, dydx, dzdx);
+ if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>3) printf("D-AliTRDresolution::FitTrack: x0[%f] y0[%f] z0[%f] dydx[%f] dzdx[%f].\n", x0, y0, z0, dydx, dzdx);
return kTRUE;
}
//____________________________________________________________________
-Bool_t AliTRDresolution::FitTracklet(const Int_t ly, const Int_t np, AliTrackPoint *points, const Float_t param[10], Float_t par[3])
+Bool_t AliTRDresolution::FitTracklet(const Int_t ly, const Int_t np, const AliTrackPoint *points, const Float_t param[10], Float_t par[3])
{
//
// Fit tracklet with a staight line using the coresponding subset of clusters out of the total "np" clusters stored in the array "points".
nly++;
}
if(nly<10){
- if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>1) printf("D-AliTRDresolution::FitTracklet: Not enough clusters to fit a tracklet [%d].", nly);
+ if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>1) printf("D-AliTRDresolution::FitTracklet: Not enough clusters to fit a tracklet [%d].\n", nly);
return kFALSE;
}
// set radial reference for fit
}
//____________________________________________________________________
-Bool_t AliTRDresolution::UseTrack(const Int_t np, AliTrackPoint *points, Float_t param[10])
+Bool_t AliTRDresolution::UseTrack(const Int_t np, const AliTrackPoint *points, Float_t param[10])
{
//
// Global selection mechanism of tracksbased on cluster to fit residuals
void AliTRDresolution::GetLandauMpvFwhm(TF1 * const f, Float_t &mpv, Float_t &xm, Float_t &xM)
{
//
- // Get the most probable value and the full width half mean
+ // Get the most probable value and the full width half mean
// of a Landau distribution
//
xm = mpv - dx;
while((fx = f->Eval(xm))>.5*max){
- if(fx>max){
+ if(fx>max){
max = fx;
mpv = xm;
}
}
+// #include "TFile.h"
+// //________________________________________________________
+// Bool_t AliTRDresolution::LoadCorrection(const Char_t *file)
+// {
+// if(!file){
+// AliWarning("Use cluster position as in reconstruction.");
+// SetLoadCorrection();
+// return kTRUE;
+// }
+// TDirectory *cwd(gDirectory);
+// TString fileList;
+// FILE *filePtr = fopen(file, "rt");
+// if(!filePtr){
+// AliWarning(Form("Couldn't open correction list \"%s\". Use cluster position as in reconstruction.", file));
+// SetLoadCorrection();
+// return kFALSE;
+// }
+// TH2 *h2 = new TH2F("h2", ";time [time bins];detector;dx [#mum]", 30, -0.5, 29.5, AliTRDgeometry::kNdet, -0.5, AliTRDgeometry::kNdet-0.5);
+// while(fileList.Gets(filePtr)){
+// if(!TFile::Open(fileList.Data())) {
+// AliWarning(Form("Couldn't open \"%s\"", fileList.Data()));
+// continue;
+// } else AliInfo(Form("\"%s\"", fileList.Data()));
+//
+// TTree *tSys = (TTree*)gFile->Get("tSys");
+// h2->SetDirectory(gDirectory); h2->Reset("ICE");
+// tSys->Draw("det:t>>h2", "dx", "goff");
+// for(Int_t idet(0); idet<AliTRDgeometry::kNdet; idet++){
+// for(Int_t it(0); it<30; it++) fXcorr[idet][it]+=(1.e-4*h2->GetBinContent(it+1, idet+1));
+// }
+// h2->SetDirectory(cwd);
+// gFile->Close();
+// }
+// cwd->cd();
+//
+// if(AliLog::GetDebugLevel("PWG1", "AliTRDresolution")>=2){
+// for(Int_t il(0); il<184; il++) printf("-"); printf("\n");
+// printf("DET|");for(Int_t it(0); it<30; it++) printf(" tb%02d|", it); printf("\n");
+// for(Int_t il(0); il<184; il++) printf("-"); printf("\n");
+// FILE *fout = fopen("TRD.ClusterCorrection.txt", "at");
+// fprintf(fout, " static const Double_t dx[AliTRDgeometry::kNdet][30]={\n");
+// for(Int_t idet(0); idet<AliTRDgeometry::kNdet; idet++){
+// printf("%03d|", idet);
+// fprintf(fout, " {");
+// for(Int_t it(0); it<30; it++){
+// printf("%+5.0f|", 1.e4*fXcorr[idet][it]);
+// fprintf(fout, "%+6.4f%c", fXcorr[idet][it], it==29?' ':',');
+// }
+// printf("\n");
+// fprintf(fout, "}%c\n", idet==AliTRDgeometry::kNdet-1?' ':',');
+// }
+// fprintf(fout, " };\n");
+// }
+// SetLoadCorrection();
+// return kTRUE;
+// }
+
//________________________________________________________
-void AliTRDresolution::SetSegmentationLevel(Int_t l)
+AliTRDresolution::AliTRDresolutionProjection::AliTRDresolutionProjection()
+ :TNamed()
+ ,fH(NULL)
+ ,fNrebin(0)
+ ,fRebinX(NULL)
+ ,fRebinY(NULL)
{
-// Setting the segmentation level to "l"
- fSegmentLevel = l;
-
- UShort_t const lNcomp[kNprojs] = {
- 1, 1, //2,
- fgkNresYsegm[fSegmentLevel], 2, //2,
- 2*fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, //5,
- 2*fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, //5,
- 2*fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, //5,
- // MC
- fgkNresYsegm[fSegmentLevel], 2, //2,
- fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, //5,
- fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, 1, 1, 1, 11, 11, 11, //11
- fgkNresYsegm[fSegmentLevel], 2, 2, 2, 1, 1, 1, 1, 11, 11, 11, //11
- 6*fgkNresYsegm[fSegmentLevel], 6*2, 6*2, 6*2, 6, 6, 6, 6, 6*11, 6*11, 6*11 //11
- };
- memcpy(fNcomp, lNcomp, kNprojs*sizeof(UShort_t));
-
- Char_t const *lAxTitle[kNprojs][4] = {
- // Charge
- {"Impv", "x [cm]", "I_{mpv}", "x/x_{0}"}
- ,{"dI/Impv", "x/x_{0}", "#delta I/I_{mpv}", "x[cm]"}
- // Clusters to Kalman
- ,{"Cluster2Track residuals", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
- ,{"Cluster2Track YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
- // TRD tracklet to Kalman fit
- ,{"Tracklet2Track Y residuals", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
- ,{"Tracklet2Track YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
- ,{"Tracklet2Track Z residuals", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
- ,{"Tracklet2Track Z pulls", "tg(#theta)", "z", "#sigma_{z}"}
- ,{"Tracklet2Track Phi residuals", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
- // TRDin 2 first TRD tracklet
- ,{"Tracklet2Track Y residuals @ TRDin", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
- ,{"Tracklet2Track YZ pulls @ TRDin", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
- ,{"Tracklet2Track Z residuals @ TRDin", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
- ,{"Tracklet2Track Z pulls @ TRDin", "tg(#theta)", "z", "#sigma_{z}"}
- ,{"Tracklet2Track Phi residuals @ TRDin", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
- // TRDout 2 first TRD tracklet
- ,{"Tracklet2Track Y residuals @ TRDout", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
- ,{"Tracklet2Track YZ pulls @ TRDout", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
- ,{"Tracklet2Track Z residuals @ TRDout", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
- ,{"Tracklet2Track Z pulls @ TRDout", "tg(#theta)", "z", "#sigma_{z}"}
- ,{"Tracklet2Track Phi residuals @ TRDout", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
- // MC cluster
- ,{"MC Cluster Y resolution", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
- ,{"MC Cluster YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
- // MC tracklet
- ,{"MC Tracklet Y resolution", "tg(#phi)", "y [#mum]", "#sigma_{y}[#mum]"}
- ,{"MC Tracklet YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
- ,{"MC Tracklet Z resolution", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
- ,{"MC Tracklet Z pulls", "tg(#theta)", "z", "#sigma_{z}"}
- ,{"MC Tracklet Phi resolution", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
- // MC track TRDin
- ,{"MC Y resolution @ TRDin", "tg(#phi)", "y [#mum]", "#sigma_{y}[#mum]"}
- ,{"MC YZ pulls @ TRDin", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
- ,{"MC Z resolution @ TRDin", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
- ,{"MC Z pulls @ TRDin", "tg(#theta)", "z", "#sigma_{z}"}
- ,{"MC #Phi resolution @ TRDin", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
- ,{"MC SNP pulls @ TRDin", "tg(#phi)", "SNP", "#sigma_{snp}"}
- ,{"MC #Theta resolution @ TRDin", "tg(#theta)", "#theta [mrad]", "#sigma_{#theta} [mrad]"}
- ,{"MC TGL pulls @ TRDin", "tg(#theta)", "TGL", "#sigma_{tgl}"}
- ,{"MC P_{t} resolution @ TRDin", "p_{t}^{MC} [GeV/c]", "(p_{t}^{REC}-p_{t}^{MC})/p_{t}^{MC} [%]", "MC: #sigma^{TPC}(#Deltap_{t}/p_{t}^{MC}) [%]"}
- ,{"MC 1/P_{t} pulls @ TRDin", "1/p_{t}^{MC} [c/GeV]", "1/p_{t}^{REC}-1/p_{t}^{MC}", "MC PULL: #sigma_{1/p_{t}}^{TPC}"}
- ,{"MC P resolution @ TRDin", "p^{MC} [GeV/c]", "(p^{REC}-p^{MC})/p^{MC} [%]", "MC: #sigma^{TPC}(#Deltap/p^{MC}) [%]"}
- // MC track TRDout
- ,{"MC Y resolution @ TRDout", "tg(#phi)", "y [#mum]", "#sigma_{y}[#mum]"}
- ,{"MC YZ pulls @ TRDout", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
- ,{"MC Z resolution @ TRDout", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
- ,{"MC Z pulls @ TRDout", "tg(#theta)", "z", "#sigma_{z}"}
- ,{"MC #Phi resolution @ TRDout", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
- ,{"MC SNP pulls @ TRDout", "tg(#phi)", "SNP", "#sigma_{snp}"}
- ,{"MC #Theta resolution @ TRDout", "tg(#theta)", "#theta [mrad]", "#sigma_{#theta} [mrad]"}
- ,{"MC TGL pulls @ TRDout", "tg(#theta)", "TGL", "#sigma_{tgl}"}
- ,{"MC P_{t} resolution @ TRDout", "p_{t}^{MC} [GeV/c]", "(p_{t}^{REC}-p_{t}^{MC})/p_{t}^{MC} [%]", "MC: #sigma^{TPC}(#Deltap_{t}/p_{t}^{MC}) [%]"}
- ,{"MC 1/P_{t} pulls @ TRDout", "1/p_{t}^{MC} [c/GeV]", "1/p_{t}^{REC}-1/p_{t}^{MC}", "MC PULL: #sigma_{1/p_{t}}^{TPC}"}
- ,{"MC P resolution @ TRDout", "p^{MC} [GeV/c]", "(p^{REC}-p^{MC})/p^{MC} [%]", "MC: #sigma^{TPC}(#Deltap/p^{MC}) [%]"}
- // MC track in TRD
- ,{"MC Track Y resolution", "tg(#phi)", "y [#mum]", "#sigma_{y} [#mum]"}
- ,{"MC Track YZ pulls", fgkResYsegmName[fSegmentLevel], "y / z", "#sigma_{y}"}
- ,{"MC Track Z resolution", "tg(#theta)", "z [#mum]", "#sigma_{z} [#mum]"}
- ,{"MC Track Z pulls", "tg(#theta)", "z", "#sigma_{z}"}
- ,{"MC Track #Phi resolution", "tg(#phi)", "#phi [mrad]", "#sigma_{#phi} [mrad]"}
- ,{"MC Track SNP pulls", "tg(#phi)", "SNP", "#sigma_{snp}"}
- ,{"MC Track #Theta resolution", "tg(#theta)", "#theta [mrad]", "#sigma_{#theta} [mrad]"}
- ,{"MC Track TGL pulls", "tg(#theta)", "TGL", "#sigma_{tgl}"}
- ,{"MC P_{t} resolution", "p_{t} [GeV/c]", "(p_{t}^{REC}-p_{t}^{MC})/p_{t}^{MC} [%]", "#sigma(#Deltap_{t}/p_{t}^{MC}) [%]"}
- ,{"MC 1/P_{t} pulls", "1/p_{t}^{MC} [c/GeV]", "1/p_{t}^{REC} - 1/p_{t}^{MC}", "#sigma_{1/p_{t}}"}
- ,{"MC P resolution", "p [GeV/c]", "(p^{REC}-p^{MC})/p^{MC} [%]", "#sigma(#Deltap/p^{MC}) [%]"}
- };
- memcpy(fAxTitle, lAxTitle, 4*kNprojs*sizeof(Char_t*));
+ // constructor
+ memset(fAx, 0, 3*sizeof(Int_t));
+ memset(fRange, 0, 4*sizeof(Float_t));
+}
+
+//________________________________________________________
+AliTRDresolution::AliTRDresolutionProjection::~AliTRDresolutionProjection()
+{
+ // destructor
+ if(fH) delete fH;
+}
+
+//________________________________________________________
+void AliTRDresolution::AliTRDresolutionProjection::Build(const Char_t *n, const Char_t *t, Int_t ix, Int_t iy, Int_t iz, TAxis *aa[])
+{
+// check and build (if neccessary) projection determined by axis "ix", "iy" and "iz"
+ if(!aa[ix] || !aa[iy] || !aa[iz]) return;
+ TAxis *ax(aa[ix]), *ay(aa[iy]), *az(aa[iz]);
+ // check ax definiton to protect against older versions of the data
+ if(ax->GetNbins()<=0 || (ax->GetXmax()-ax->GetXmin())<=0.){
+ AliWarning(Form("Wrong definition of axis[%d] \"%s\"[%d](%f %f).", ix, ax->GetTitle(), ax->GetNbins(), ax->GetXmin(), ax->GetXmax()));
+ return;
+ }
+ if(ay->GetNbins()<=0 || (ay->GetXmax()-ay->GetXmin())<=0.){
+ AliWarning(Form("Wrong definition of axis[%d] \"%s\"[%d](%f %f).", ix, ay->GetTitle(), ay->GetNbins(), ay->GetXmin(), ay->GetXmax()));
+ return;
+ }
+ if(az->GetNbins()<=0 || (az->GetXmax()-az->GetXmin())<=0.){
+ AliWarning(Form("Wrong definition of axis[%d] \"%s\"[%d](%f %f).", ix, az->GetTitle(), az->GetNbins(), az->GetXmin(), az->GetXmax()));
+ return;
+ }
+ SetNameTitle(n,t);
+ fH = new TH3I(n, Form("%s;%s;%s;%s", t, ax->GetTitle(), ay->GetTitle(), az->GetTitle()),
+ ax->GetNbins(), ax->GetXmin(), ax->GetXmax(),
+ ay->GetNbins(), ay->GetXmin(), ay->GetXmax(),
+ az->GetNbins(), az->GetXmin(), az->GetXmax());
+ fAx[0] = ix; fAx[1] = iy; fAx[2] = iz;
+ fRange[0] = az->GetXmin()/3.; fRange[1] = az->GetXmax()/3.;
+}
+
+//________________________________________________________
+AliTRDresolution::AliTRDresolutionProjection& AliTRDresolution::AliTRDresolutionProjection::operator=(const AliTRDresolutionProjection& rhs)
+{
+// copy projections
+ if(this == &rhs) return *this;
+
+ TNamed::operator=(rhs);
+ if(fNrebin){fNrebin=0; delete [] fRebinX; delete [] fRebinY;}
+ if(rhs.fNrebin) SetRebinStrategy(rhs.fNrebin, rhs.fRebinX, rhs.fRebinY);
+ memcpy(fAx, rhs.fAx, 3*sizeof(Int_t));
+ memcpy(fRange, rhs.fRange, 4*sizeof(Float_t));
+ if(fH) delete fH;
+ if(rhs.fH) fH=(TH3I*)rhs.fH->Clone(Form("%s_CLONE", rhs.fH->GetName()));
+ return *this;
+}
+
+//________________________________________________________
+AliTRDresolution::AliTRDresolutionProjection& AliTRDresolution::AliTRDresolutionProjection::operator+=(const AliTRDresolutionProjection& other)
+{
+// increment projections
+ if(!fH || !other.fH) return *this;
+ AliDebug(2, Form("%s+=%s [%s+=%s]", GetName(), other.GetName(), fH->GetName(), (other.fH)->GetName()));
+ fH->Add(other.fH);
+ return *this;
+}
+
+//________________________________________________________
+void AliTRDresolution::AliTRDresolutionProjection::Increment(Int_t bin[], Double_t v)
+{
+// increment bin with value "v" pointed by general coord in "bin"
+ if(!fH) return;
+ AliDebug(4, Form(" %s", fH->GetName()));
+ fH->AddBinContent(fH->GetBin(bin[fAx[0]],bin[fAx[1]],bin[fAx[2]]), Int_t(v));
+}
+
+//________________________________________________________
+TH2* AliTRDresolution::AliTRDresolutionProjection::Projection2D(const Int_t nstat, const Int_t ncol, const Int_t mid, Bool_t del)
+{
+// build the 2D projection and adjust binning
+
+ const Char_t *title[] = {"Mean", "#mu", "MPV"};
+ if(!fH) return NULL;
+ TAxis *ax(fH->GetXaxis()), *ay(fH->GetYaxis()), *az(fH->GetZaxis());
+ TH2 *h2s(NULL);
+ if(!(h2s = (TH2*)fH->Project3D("yx"))) return NULL;
+ Int_t irebin(0), dxBin(1), dyBin(1);
+ while(irebin<fNrebin && (AliTRDresolution::GetMeanStat(h2s, .5, ">")<nstat)){
+ h2s->Rebin2D(fRebinX[irebin], fRebinY[irebin]);
+ dxBin*=fRebinX[irebin];dyBin*=fRebinY[irebin];
+ irebin++;
+ }
+ Int_t nx(h2s->GetNbinsX()), ny(h2s->GetNbinsY());
+ if(h2s && del) delete h2s;
+
+ // start projection
+ TH1 *h(NULL); Int_t n(0);
+ Float_t dz=(fRange[1]-fRange[1])/ncol;
+ TString titlez(az->GetTitle()); TObjArray *tokenTitle(titlez.Tokenize(" "));
+ TH2 *h2 = new TH2F(Form("%s_2D", fH->GetName()),
+ Form("%s;%s;%s;%s(%s) %s", fH->GetTitle(), ax->GetTitle(), ay->GetTitle(), title[mid], (*tokenTitle)[0]->GetName(), tokenTitle->GetEntriesFast()>1?(*tokenTitle)[1]->GetName():""),
+ nx, ax->GetXmin(), ax->GetXmax(), ny, ay->GetXmin(), ay->GetXmax());
+ h2->SetContour(ncol);
+ h2->GetZaxis()->CenterTitle();
+ h2->GetZaxis()->SetTitleOffset(1.4);
+ h2->GetZaxis()->SetRangeUser(fRange[0], fRange[1]);
+ //printf("%s[%s] nx[%d] ny[%d]\n", h2->GetName(), h2->GetTitle(), nx, ny);
+ for(Int_t iy(0); iy<ny; iy++){
+ for(Int_t ix(0); ix<nx; ix++){
+ h = fH->ProjectionZ(Form("%s_z", h2->GetName()), ix*dxBin+1, (ix+1)*dxBin+1, iy*dyBin+1, (iy+1)*dyBin+1);
+ Int_t ne((Int_t)h->Integral());
+ if(ne<nstat/2){
+ h2->SetBinContent(ix+1, iy+1, -999);
+ h2->SetBinError(ix+1, iy+1, 1.);
+ n++;
+ }else{
+ Float_t v(h->GetMean()), ve(h->GetRMS());
+ if(mid==1){
+ TF1 fg("fg", "gaus", az->GetXmin(), az->GetXmax());
+ fg.SetParameter(0, Float_t(ne)); fg.SetParameter(1, v); fg.SetParameter(2, ve);
+ h->Fit(&fg, "WQ");
+ v = fg.GetParameter(1); ve = fg.GetParameter(2);
+ } else if (mid==2) {
+ TF1 fl("fl", "landau", az->GetXmin(), az->GetXmax());
+ fl.SetParameter(0, Float_t(ne)); fl.SetParameter(1, v); fl.SetParameter(2, ve);
+ h->Fit(&fl, "WQ");
+ v = fl.GetMaximumX(); ve = fl.GetParameter(2);
+/* TF1 fgle("gle", "[0]*TMath::Landau(x, [1], [2], 1)*TMath::Exp(-[3]*x/[1])", az->GetXmin(), az->GetXmax());
+ fgle.SetParameter(0, fl.GetParameter(0));
+ fgle.SetParameter(1, fl.GetParameter(1));
+ fgle.SetParameter(2, fl.GetParameter(2));
+ fgle.SetParameter(3, 1.);fgle.SetParLimits(3, 0., 5.);
+ h->Fit(&fgle, "WQ");
+ v = fgle.GetMaximumX(); ve = fgle.GetParameter(2);*/
+ }
+ if(v<fRange[0]) h2->SetBinContent(ix+1, iy+1, fRange[0]+0.1*dz);
+ else h2->SetBinContent(ix+1, iy+1, v);
+ h2->SetBinError(ix+1, iy+1, ve);
+ }
+ }
+ }
+ if(h) delete h;
+ if(n==nx*ny){delete h2; h2=NULL;} // clean empty projections
+ return h2;
+}
+
+//________________________________________________________
+void AliTRDresolution::SetRangeZ(TH2 *h2, Float_t min, Float_t max)
+{
+// Set range on Z axis such to avoid outliers
+
+ Float_t c(0.), dz(1.e-3*(max-min));
+ for(Int_t ix(1); ix<=h2->GetXaxis()->GetNbins(); ix++){
+ for(Int_t iy(1); iy<=h2->GetYaxis()->GetNbins(); iy++){
+ if((c = h2->GetBinContent(ix, iy))<10) continue;
+ if(c<=min) h2->SetBinContent(ix, iy, min+dz);
+ }
+ }
+ h2->GetZaxis()->SetRangeUser(min, max);
+}
+
+//________________________________________________________
+void AliTRDresolution::AliTRDresolutionProjection::SetRebinStrategy(Int_t n, Int_t rebx[], Int_t reby[])
+{
+// define rebinning strategy for this projection
+ fNrebin = n;
+ fRebinX = new Int_t[n]; memcpy(fRebinX, rebx, n*sizeof(Int_t));
+ fRebinY = new Int_t[n]; memcpy(fRebinY, reby, n*sizeof(Int_t));
}
+
+