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 AliRsnCut(AliRsnCut::kEvent),
21 // Default constructor.
25 //_________________________________________________________________________________________________
26 AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex
27 (const char *name, Int_t nContributors, Bool_t acceptTPC) :
28 AliRsnCut(name, AliRsnCut::kEvent, 0, nContributors - 1),
33 // Defines the cut range between 0 and
34 // the minimum required number of contributors.
35 // The cut will be passed when if the event has a
36 // primary vertex with number of contributors outside this interval.
38 // If the 'acceptTPC' argument is true, events with TPC
39 // primary vertex will be checked, otherwise they will be
40 // rejected by default.
42 // Since the range check uses the '>=' and '<=', the high edge
43 // must be decreased by 1 to get the right behaviour, since this is integer.
47 //_________________________________________________________________________________________________
48 Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *obj1, TObject* /*obj2*/)
55 AliRsnEvent *rsn = dynamic_cast<AliRsnEvent*>(obj1);
56 if (!rsn) return kFALSE;
57 AliESDEvent *esd = dynamic_cast<AliESDEvent*>(rsn->GetRef());
59 AliDebug(AliLog::kDebug+2, "NO ESD");
63 // get the three possible primary vertexes of the event:
67 // then, if the default vertex is TPC, the event is rejected,
68 // otherwise, the event is rejected only if its vertex status is 'false'
69 // get primary vertexes
70 const AliESDVertex *vert[3];
71 vert[0] = esd->GetPrimaryVertex();
72 vert[1] = esd->GetPrimaryVertexSPD();
73 vert[2] = esd->GetPrimaryVertexTPC();
75 // if TPC vertexes are rejected by default do this now
76 if (!fAcceptTPC && (vert[0] == vert[2])) {
77 AliDebug(AliLog::kDebug+2, "Rejecting TPC vertex");
81 // if we are here, vert[0] contains the default primary vertex
82 // in case it is with tracks or SPD, its status must be OK
83 // because otherwise the ESD event returns the lower level vertex
84 // then, we can check just the first element in the array
85 if (!vert[0]->GetStatus()) {
86 AliDebug(AliLog::kDebug+2, "Bad vertex status");
90 // if we are here, the status of default vertex is OK
91 // and then we check the number of contributors:
92 // it must be *outside* the 'allowed' range
93 fCutValueI = vert[0]->GetNContributors();
94 return /*there is a NOT operator */!/*here*/OkRange();