]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx
Adding the possibility to filter for events containing a jet above threshold set...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutPrimaryVertex.cxx
CommitLineData
96ab9736 1//
2// Class AliRsnCutPrimaryVertex
3//
ceaa78d3 4// This cut implementation checks the quality of event primary vertex.
5// It currently works only with ESD events (not AOD).
96ab9736 6//
7// authors: Martin Vala (martin.vala@cern.ch)
8// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
9//
96ab9736 10
96ab9736 11#include "AliRsnCutPrimaryVertex.h"
12
13ClassImp(AliRsnCutPrimaryVertex)
14
15//_________________________________________________________________________________________________
16AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex() :
2dab9030 17 AliRsnCut(AliRsnCut::kEvent),
18 fAcceptTPC(kFALSE)
96ab9736 19{
20//
21// Default constructor.
22//
23}
24
25//_________________________________________________________________________________________________
26AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex
ceaa78d3 27(const char *name, Int_t nContributors, Bool_t acceptTPC) :
2dab9030 28 AliRsnCut(name, AliRsnCut::kEvent, 0, nContributors - 1),
29 fAcceptTPC(acceptTPC)
96ab9736 30{
31//
32// Main constructor.
ceaa78d3 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.
37// ---
38// If the 'acceptTPC' argument is true, events with TPC
39// primary vertex will be checked, otherwise they will be
40// rejected by default.
41// ---
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.
96ab9736 44//
45}
46
47//_________________________________________________________________________________________________
2dab9030 48Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *obj1, TObject* /*obj2*/)
96ab9736 49{
50//
51// Cut checker
52//
53
54 // retrieve ESD event
2dab9030 55 AliRsnEvent *rsn = dynamic_cast<AliRsnEvent*>(obj1);
56 if (!rsn) return kFALSE;
57 AliESDEvent *esd = dynamic_cast<AliESDEvent*>(rsn->GetRef());
96ab9736 58 if (!esd) {
59 AliDebug(AliLog::kDebug+2, "NO ESD");
ceaa78d3 60 return kFALSE;
96ab9736 61 }
62
ceaa78d3 63 // get the three possible primary vertexes of the event:
64 // 0 = default one
65 // 1 = SPD
66 // 2 = TPC
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();
74
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");
96ab9736 78 return kFALSE;
79 }
80
ceaa78d3 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");
87 return kFALSE;
88 }
96ab9736 89
ceaa78d3 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();
96ab9736 95}
96