2 // Class AliRsnCutPrimaryVertex
4 // This cut implementation checks the quality of event primary vertex.
5 // It currently works only with ESD events (not AOD).
7 // authors: Martin Vala (martin.vala@cern.ch)
8 // Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
11 #include "AliRsnCutPrimaryVertex.h"
13 ClassImp(AliRsnCutPrimaryVertex)
15 //_________________________________________________________________________________________________
16 AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex
17 (const char *name, Double_t maxVz, Int_t nContributors, Bool_t acceptTPC) :
18 AliRsnCut(name, AliRsnCut::kEvent, 0, nContributors - 1, -maxVz, maxVz + 1E-6),
19 fAcceptTPC(acceptTPC),
24 // Defines the cut range between 0 and
25 // the minimum required number of contributors.
26 // The cut will be passed when if the event has a
27 // primary vertex with number of contributors outside this interval.
29 // If the 'acceptTPC' argument is true, events with TPC
30 // primary vertex will be checked, otherwise they will be
31 // rejected by default.
33 // Since the range check uses the '>=' and '<=', the high edge
34 // must be decreased by 1 to get the right behaviour, since this is integer.
38 //_________________________________________________________________________________________________
39 Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *object)
46 // which also fills data member objects
47 if (!TargetOK(object)) return kFALSE;
50 AliESDEvent *esd = dynamic_cast<AliESDEvent *>(fEvent->GetRef());
51 AliAODEvent *aod = dynamic_cast<AliAODEvent *>(fEvent->GetRef());
56 if (esd->IsPileupFromSPD()) return kFALSE;
59 // get the best primary vertex:
60 // first try the one with tracks
61 const AliESDVertex *vTrk = esd->GetPrimaryVertexTracks();
62 const AliESDVertex *vSPD = esd->GetPrimaryVertexSPD();
63 const AliESDVertex *vTPC = esd->GetPrimaryVertexTPC();
67 Double_t vzTrk = 1000000.0;
68 Double_t vzSPD = 1000000.0;
69 Double_t vzTPC = 1000000.0;
70 if (vTrk) vzTrk = TMath::Abs(vTrk->GetZv());
71 if (vSPD) vzSPD = TMath::Abs(vSPD->GetZv());
72 if (vTPC) vzTPC = TMath::Abs(vTPC->GetZv());
73 if (vTrk) ncTrk = (Int_t)vTrk->GetNContributors();
74 if (vSPD) ncSPD = (Int_t)vSPD->GetNContributors();
75 if (vTPC) ncTPC = (Int_t)vTPC->GetNContributors();
76 if (vTrk && ncTrk > 0) {
79 } else if (vSPD && ncSPD > 0) {
82 } else if (vTPC && ncTPC > 0) {
92 // in this case, as suggested by Andrea Dainese,
93 // we first check if the SPD primary vertex is there
94 // if it is not, then the only available is the TPC
95 // stand-alone primary vertex, which is rejected
96 AliAODVertex *aodv = aod->GetPrimaryVertexSPD();
98 AliDebugClass(1, "Not found SPD vertex --> TPC only available, skipped");
101 // now check primary vertex
102 aodv = (AliAODVertex *)aod->GetPrimaryVertex();
103 if (CheckVertex(aodv)) {
104 AliDebugClass(1, "Vertex TRK is OK");
105 fCutValueD = aodv->GetZ();
106 fCutValueI = aodv->GetNDaughters(); //aodv->GetNContributors();
109 aodv = aod->GetPrimaryVertexSPD();
110 if (CheckVertex(aodv)) {
111 AliDebugClass(1, "Vertex TRK is BAD, but vertex SPD is OK");
112 fCutValueD = aodv->GetZ();
113 fCutValueI = aodv->GetNDaughters(); //aodv->GetNContributors();
115 AliDebugClass(1, "Vertex TRK is BAD, and vertex SPD is BAD");
123 Bool_t result = ((!OkRangeI()) && OkRangeD());
127 //_________________________________________________________________________________________________
128 void AliRsnCutPrimaryVertex::Print(const Option_t *) const
131 // Print information on this cut
134 AliInfo(Form("Cut name : %s", GetName()));
135 AliInfo(Form("Accepting TPC primary vertex : %s", (fAcceptTPC ? "YES" : "NO")));
136 AliInfo(Form("Contributors range (outside) : %d - %d", fMinI, fMaxI));
137 AliInfo(Form("Z-vertex range (inside) : %f - %f", fMinD, fMaxD));