#include "AliESDtrackCuts.h"
#include <AliESDtrack.h>
+#include <AliESDVertex.h>
#include <AliESDEvent.h>
#include <AliLog.h>
#include <TTree.h>
#include <TCanvas.h>
#include <TDirectory.h>
+#include <TH2F.h>
+#include <TF1.h>
//____________________________________________________________________
ClassImp(AliESDtrackCuts)
"require ITS refit",
"n clusters TPC",
"n clusters ITS",
- "#Chi^{2}/clusters TPC",
- "#Chi^{2}/clusters ITS",
+ "#Chi^{2}/cluster TPC",
+ "#Chi^{2}/cluster ITS",
"cov 11",
"cov 22",
"cov 33",
"p_{x}",
"p_{y}",
"p_{z}",
- "y",
"eta",
- "trk-to-vtx dca absolute"
+ "y",
+ "trk-to-vtx max dca 2D absolute",
+ "trk-to-vtx max dca xy absolute",
+ "trk-to-vtx max dca z absolute",
+ "trk-to-vtx min dca 2D absolute",
+ "trk-to-vtx min dca xy absolute",
+ "trk-to-vtx min dca z absolute",
+ "SPD cluster requirement",
+ "SDD cluster requirement",
+ "SSD cluster requirement",
+ "require ITS stand-alone"
};
//____________________________________________________________________
fCutAcceptKinkDaughters(0),
fCutRequireTPCRefit(0),
fCutRequireITSRefit(0),
+ fCutRequireITSStandAlone(0),
fCutNsigmaToVertex(0),
fCutSigmaToVertexRequired(0),
- fCutDCAToVertex(0),
+ fCutMaxDCAToVertexXY(0),
+ fCutMaxDCAToVertexZ(0),
+ fCutMinDCAToVertexXY(0),
+ fCutMinDCAToVertexZ(0),
+ fCutDCAToVertex2D(0),
fPMin(0),
fPMax(0),
fPtMin(0),
SetMaxCovDiagonalElements();
SetRequireTPCRefit();
SetRequireITSRefit();
- SetAcceptKingDaughters();
- SetMinNsigmaToVertex();
- SetRequireSigmaToVertex();
- SetDCAToVertex();
+ SetRequireITSStandAlone(kFALSE);
+ SetAcceptKinkDaughters();
+ SetMaxNsigmaToVertex();
+ SetMaxDCAToVertexXY();
+ SetMaxDCAToVertexZ();
+ SetDCAToVertex2D();
+ SetMinDCAToVertexXY();
+ SetMinDCAToVertexZ();
SetPRange();
SetPtRange();
SetPxRange();
SetPzRange();
SetEtaRange();
SetRapRange();
+ SetClusterRequirementITS(kSPD);
+ SetClusterRequirementITS(kSDD);
+ SetClusterRequirementITS(kSSD);
SetHistogramsOn();
}
fCutAcceptKinkDaughters(0),
fCutRequireTPCRefit(0),
fCutRequireITSRefit(0),
+ fCutRequireITSStandAlone(0),
fCutNsigmaToVertex(0),
fCutSigmaToVertexRequired(0),
- fCutDCAToVertex(0),
+ fCutMaxDCAToVertexXY(0),
+ fCutMaxDCAToVertexZ(0),
+ fCutMinDCAToVertexXY(0),
+ fCutMinDCAToVertexZ(0),
+ fCutDCAToVertex2D(0),
fPMin(0),
fPMax(0),
fPtMin(0),
fCutMaxChi2PerClusterTPC = 0;
fCutMaxChi2PerClusterITS = 0;
+
+ for (Int_t i = 0; i < 3; i++)
+ fCutClusterRequirementITS[i] = kOff;
fCutMaxC11 = 0;
fCutMaxC22 = 0;
fCutAcceptKinkDaughters = 0;
fCutRequireTPCRefit = 0;
fCutRequireITSRefit = 0;
+ fCutRequireITSStandAlone = 0;
fCutNsigmaToVertex = 0;
fCutSigmaToVertexRequired = 0;
- fCutDCAToVertex = 0;
+ fCutMaxDCAToVertexXY = 0;
+ fCutMaxDCAToVertexZ = 0;
+ fCutDCAToVertex2D = 0;
+ fCutMinDCAToVertexXY = 0;
+ fCutMinDCAToVertexZ = 0;
+
fPMin = 0;
fPMax = 0;
fPtMin = 0;
target.fCutMaxChi2PerClusterTPC = fCutMaxChi2PerClusterTPC;
target.fCutMaxChi2PerClusterITS = fCutMaxChi2PerClusterITS;
+ for (Int_t i = 0; i < 3; i++)
+ target.fCutClusterRequirementITS[i] = fCutClusterRequirementITS[i];
+
target.fCutMaxC11 = fCutMaxC11;
target.fCutMaxC22 = fCutMaxC22;
target.fCutMaxC33 = fCutMaxC33;
target.fCutAcceptKinkDaughters = fCutAcceptKinkDaughters;
target.fCutRequireTPCRefit = fCutRequireTPCRefit;
target.fCutRequireITSRefit = fCutRequireITSRefit;
+ target.fCutRequireITSStandAlone = fCutRequireITSStandAlone;
target.fCutNsigmaToVertex = fCutNsigmaToVertex;
target.fCutSigmaToVertexRequired = fCutSigmaToVertexRequired;
- target.fCutDCAToVertex = fCutDCAToVertex;
+ target.fCutMaxDCAToVertexXY = fCutMaxDCAToVertexXY;
+ target.fCutMaxDCAToVertexZ = fCutMaxDCAToVertexZ;
+ target.fCutDCAToVertex2D = fCutDCAToVertex2D;
+ target.fCutMinDCAToVertexXY = fCutMinDCAToVertexXY;
+ target.fCutMinDCAToVertexZ = fCutMinDCAToVertexZ;
target.fPMin = fPMin;
target.fPMax = fPMax;
esdTrack->GetImpactParameters(b,bCov);
if (bCov[0]<=0 || bCov[2]<=0) {
- AliDebug(1, "Estimated b resolution lower or equal zero!");
+ AliDebugClass(1, "Estimated b resolution lower or equal zero!");
bCov[0]=0; bCov[2]=0;
}
bRes[0] = TMath::Sqrt(bCov[0]);
// -> Erf(d/Sqrt(2)) for a 1-dim gauss (d = n_sigma)
// -> 1 - Exp(-d**2) for a 2-dim gauss (d*d = dx*dx + dy*dy != n_sigma)
//
- // It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-x**2)/2)
+ // It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-d**2)/2)
// Can this be expressed in a different way?
if (bRes[0] == 0 || bRes[1] ==0)
Float_t d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
- // stupid rounding problem screws up everything:
+ // work around precision problem
// if d is too big, TMath::Exp(...) gets 0, and TMath::ErfInverse(1) that should be infinite, gets 0 :(
- if (TMath::Exp(-d * d / 2) < 1e-10)
+ // 1e-15 corresponds to nsigma ~ 7.7
+ if (TMath::Exp(-d * d / 2) < 1e-15)
return 1000;
- d = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
- return d;
+ Float_t nSigma = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
+ return nSigma;
}
void AliESDtrackCuts::EnableNeededBranches(TTree* tree)
}
//____________________________________________________________________
-Bool_t
-AliESDtrackCuts::AcceptTrack(AliESDtrack* esdTrack) {
+Bool_t AliESDtrackCuts::AcceptTrack(AliESDtrack* esdTrack)
+{
//
// figure out if the tracks survives all the track cuts defined
//
// fTracks.fP //GetMass
// fTracks.fKinkIndexes
-
UInt_t status = esdTrack->GetStatus();
// getting quality parameters from the ESD track
AliDebug(1, "Estimated b resolution lower or equal zero!");
bCov[0]=0; bCov[2]=0;
}
- Float_t dcaToVertex = TMath::Sqrt(b[0]*b[0] + b[1]*b[1]);
-
+
+ Float_t dcaToVertexXY = b[0];
+ Float_t dcaToVertexZ = b[1];
+
+ Float_t dcaToVertex = -1;
+
+ if (fCutDCAToVertex2D)
+ {
+ dcaToVertex = TMath::Sqrt(dcaToVertexXY*dcaToVertexXY/fCutMaxDCAToVertexXY/fCutMaxDCAToVertexXY + dcaToVertexZ*dcaToVertexZ/fCutMaxDCAToVertexZ/fCutMaxDCAToVertexZ);
+ }
+ else
+ dcaToVertex = TMath::Sqrt(dcaToVertexXY*dcaToVertexXY + dcaToVertexZ*dcaToVertexZ);
+
// getting the kinematic variables of the track
// (assuming the mass is known)
Double_t p[3];
cuts[17] = kTRUE;
if((p[2] < fPzMin) || (p[2] > fPzMax))
cuts[18] = kTRUE;
- if((eta < fEtaMin) || (eta > fEtaMax))
+ if((eta < fEtaMin) || (eta > fEtaMax))
cuts[19] = kTRUE;
if((y < fRapMin) || (y > fRapMax))
cuts[20] = kTRUE;
- if (dcaToVertex > fCutDCAToVertex)
+ if (fCutDCAToVertex2D && dcaToVertex > 1)
cuts[21] = kTRUE;
-
+ if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexXY) > fCutMaxDCAToVertexXY)
+ cuts[22] = kTRUE;
+ if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexZ) > fCutMaxDCAToVertexZ)
+ cuts[23] = kTRUE;
+ if (fCutDCAToVertex2D && fCutMinDCAToVertexXY > 0 && fCutMinDCAToVertexZ > 0 && dcaToVertexXY*dcaToVertexXY/fCutMinDCAToVertexXY/fCutMinDCAToVertexXY + dcaToVertexZ*dcaToVertexZ/fCutMinDCAToVertexZ/fCutMinDCAToVertexZ < 1)
+ cuts[24] = kTRUE;
+ if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexXY) < fCutMinDCAToVertexXY)
+ cuts[25] = kTRUE;
+ if (!fCutDCAToVertex2D && TMath::Abs(dcaToVertexZ) < fCutMinDCAToVertexZ)
+ cuts[26] = kTRUE;
+
+ for (Int_t i = 0; i < 3; i++)
+ cuts[27+i] = !CheckITSClusterRequirement(fCutClusterRequirementITS[i], esdTrack->HasPointOnITSLayer(i*2), esdTrack->HasPointOnITSLayer(i*2+1));
+
+ if (fCutRequireITSStandAlone && (status & AliESDtrack::kITSin == 0 || status & AliESDtrack::kTPCin))
+ cuts[30]=kTRUE;
+
Bool_t cut=kFALSE;
for (Int_t i=0; i<kNCuts; i++)
- if (cuts[i]) cut = kTRUE;
+ if (cuts[i]) {cut = kTRUE;}
return kTRUE;
}
+//____________________________________________________________________
+Bool_t AliESDtrackCuts::CheckITSClusterRequirement(ITSClusterRequirement req, Bool_t clusterL1, Bool_t clusterL2)
+{
+ // checks if the cluster requirement is fullfilled (in this case: return kTRUE)
+
+ switch (req)
+ {
+ case kOff: return kTRUE;
+ case kNone: return !clusterL1 && !clusterL2;
+ case kAny: return clusterL1 || clusterL2;
+ case kFirst: return clusterL1;
+ case kOnlyFirst: return clusterL1 && !clusterL2;
+ case kSecond: return clusterL2;
+ case kOnlySecond: return clusterL2 && !clusterL1;
+ case kBoth: return clusterL1 && clusterL2;
+ }
+
+ return kFALSE;
+}
+
//____________________________________________________________________
AliESDtrack* AliESDtrackCuts::GetTPCOnlyTrack(AliESDEvent* esd, Int_t iTrack)
{
if (!esd->GetPrimaryVertexTPC())
return 0; // No TPC vertex no TPC tracks
+ if(!esd->GetPrimaryVertexTPC()->GetStatus())
+ return 0; // TPC Vertex is created by default in AliESDEvent, do not use in this case
+
AliESDtrack* track = esd->GetTrack(iTrack);
if (!track)
return 0;
for (Int_t iTrack = 0; iTrack < esd->GetNumberOfTracks(); iTrack++) {
if(bTPC){
if(!esd->GetPrimaryVertexTPC())return acceptedTracks; // No TPC vertex no TPC tracks
+ if(!esd->GetPrimaryVertexTPC()->GetStatus())return acceptedTracks; // No proper TPC vertex, only the default
AliESDtrack *tpcTrack = GetTPCOnlyTrack(esd, iTrack);
if (!tpcTrack)
fhCutStatistics->GetXaxis()->SetBinLabel(i+4,fgkCutNames[i]);
fhCutCorrelation->GetXaxis()->SetBinLabel(i+1,fgkCutNames[i]);
fhCutCorrelation->GetYaxis()->SetBinLabel(i+1,fgkCutNames[i]);
- }
+ }
fhCutStatistics ->SetLineColor(color);
fhCutCorrelation ->SetLineColor(color);
fhC11[i] = new TH1F("covMatrixDiagonal11","",2000,0,20);
fhC22[i] = new TH1F("covMatrixDiagonal22","",2000,0,20);
- fhC33[i] = new TH1F("covMatrixDiagonal33","",1000,0,1);
- fhC44[i] = new TH1F("covMatrixDiagonal44","",1000,0,5);
+ fhC33[i] = new TH1F("covMatrixDiagonal33","",1000,0,0.1);
+ fhC44[i] = new TH1F("covMatrixDiagonal44","",1000,0,0.1);
fhC55[i] = new TH1F("covMatrixDiagonal55","",1000,0,5);
fhDXY[i] = new TH1F("dXY" ,"",500,-10,10);
fhNSigmaToVertex[i] = new TH1F("nSigmaToVertex","",500,0,10);
- fhPt[i] = new TH1F("pt" ,"p_{T} distribution;p_{T} (GeV/c)",500,0.0,100.0);
+ fhPt[i] = new TH1F("pt" ,"p_{T} distribution;p_{T} (GeV/c)", 800, 0.0, 10.0);
fhEta[i] = new TH1F("eta" ,"#eta distribution;#eta",40,-2.0,2.0);
fhNClustersITS[i]->SetTitle("n ITS clusters");
fhC44[i]->SetTitle("cov 44 : #sigma_{tan(#theta_{dip})}^{2}");
fhC55[i]->SetTitle("cov 55 : #sigma_{1/p_{T}}^{2} [(c/GeV)^2]");
- fhDXY[i]->SetTitle("transverse impact parameter");
- fhDZ[i]->SetTitle("longitudinal impact parameter");
- fhDXYDZ[i]->SetTitle("absolute impact parameter;sqrt(dXY**2 + dZ**2) in cm");
- fhDXYvsDZ[i]->SetXTitle("longitudinal impact parameter");
- fhDXYvsDZ[i]->SetYTitle("transverse impact parameter");
+ fhDXY[i]->SetXTitle("transverse impact parameter (cm)");
+ fhDZ[i]->SetXTitle("longitudinal impact parameter (cm)");
+ fhDXYDZ[i]->SetTitle("absolute impact parameter;sqrt(dXY**2 + dZ**2) (cm)");
+ fhDXYvsDZ[i]->SetXTitle("longitudinal impact parameter (cm)");
+ fhDXYvsDZ[i]->SetYTitle("transverse impact parameter (cm)");
- fhDXYNormalized[i]->SetTitle("normalized trans impact par");
- fhDZNormalized[i]->SetTitle("normalized long impact par");
- fhDXYvsDZNormalized[i]->SetTitle("normalized long impact par");
- fhDXYvsDZNormalized[i]->SetYTitle("normalized trans impact par");
+ fhDXYNormalized[i]->SetTitle("normalized trans impact par (n#sigma)");
+ fhDZNormalized[i]->SetTitle("normalized long impact par (n#sigma)");
+ fhDXYvsDZNormalized[i]->SetTitle("normalized long impact par (n#sigma)");
+ fhDXYvsDZNormalized[i]->SetYTitle("normalized trans impact par (n#sigma)");
fhNSigmaToVertex[i]->SetTitle("n #sigma to vertex");
fhNClustersITS[i]->SetLineColor(color); fhNClustersITS[i]->SetLineWidth(2);
fhChi2PerClusterTPC[1]->DrawCopy("SAME");*/
}
+Float_t AliESDtrackCuts::GetMinNsigmaToVertex() const
+{
+ // deprecated, please use GetMaxNsigmaToVertex
+
+ Printf("WARNING: AliESDtrackCuts::GetMinNsigmaToVertex is DEPRECATED and will be removed in the next release. Please use GetMaxNsigmaToVertex instead. Renaming was done to improve code readability.");
+
+ return GetMaxNsigmaToVertex();
+}
+
+void AliESDtrackCuts::SetMinNsigmaToVertex(Float_t sigma)
+{
+ // deprecated, will be removed in next release
+
+ Printf("WARNING: AliESDtrackCuts::SetMinNsigmaToVertex is DEPRECATED and will be removed in the next release. Please use SetMaxNsigmaToVertex instead. Renaming was done to improve code readability.");
+
+ SetMaxNsigmaToVertex(sigma);
+}
+
+void AliESDtrackCuts::SetAcceptKingDaughters(Bool_t b)
+{
+ // deprecated, will be removed in next release
+
+ Printf("WARNING: AliESDtrackCuts::SetAcceptKingDaughters is DEPRECATED and will be removed in the next release. Please use SetAcceptKinkDaughters instead. Renaming was done to improve code readability.");
+
+ SetAcceptKinkDaughters(b);
+}
+
+Bool_t AliESDtrackCuts::GetAcceptKingDaughters() const
+{
+ // deprecated, will be removed in next release
+
+ Printf("WARNING: AliESDtrackCuts::GetAcceptKingDaughters is DEPRECATED and will be removed in the next release. Please use GetAcceptKinkDaughters instead. Renaming was done to improve code readability.");
+
+ return GetAcceptKinkDaughters();
+}