]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnCutPrimaryVertex.cxx
Modifications in the balance function code + addition of the very first version of...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnCutPrimaryVertex.cxx
CommitLineData
96ab9736 1//
2// Class AliRsnCutPrimaryVertex
3//
4// General implementation of a single cut strategy, which can be:
5// - a value contained in a given interval [--> IsBetween() ]
6// - a value equal to a given reference [--> MatchesValue()]
7//
8// In all cases, the reference value(s) is (are) given as data members
9// and each kind of cut requires a given value type (Int, UInt, Double),
10// but the cut check procedure is then automatized and chosen thanks to
11// an enumeration of the implemented cut types.
12// At the end, the user (or any other point which uses this object) has
13// to use the method IsSelected() to check if this cut has been passed.
14//
15// authors: Martin Vala (martin.vala@cern.ch)
16// Alberto Pulvirenti (alberto.pulvirenti@ct.infn.it)
17//
18#include "Riostream.h"
19#include "TMath.h"
20
21#include "AliLog.h"
22#include "AliESDEvent.h"
23#include "AliESDVertex.h"
24
25#include "AliRsnEvent.h"
26#include "AliRsnCutPrimaryVertex.h"
27
28ClassImp(AliRsnCutPrimaryVertex)
29
30//_________________________________________________________________________________________________
31AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex() :
32 AliRsnCut()
33{
34//
35// Default constructor.
36//
37}
38
39//_________________________________________________________________________________________________
40AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex
41(const char *name, Int_t nContributors) :
42 AliRsnCut(name, 0, nContributors)
43{
44//
45// Main constructor.
46// the cut range is outside the interval 0 - min number of contributors.
47//
48}
49
50//_________________________________________________________________________________________________
51Bool_t AliRsnCutPrimaryVertex::IsSelected(ETarget tgt, AliRsnDaughter *track)
52{
53//
54// Cut checker.
55//
56
57 AliWarning("Cannot apply this cut to particles");
58 return kTRUE;
59}
60
61//_________________________________________________________________________________________________
62Bool_t AliRsnCutPrimaryVertex::IsSelected(ETarget /*tgt*/, AliRsnPairParticle* /*pair*/)
63{
64//
65// Cut checker
66//
67
68 AliWarning("Cannot apply this cut to pairs");
69 return kTRUE;
70}
71
72//_________________________________________________________________________________________________
73Bool_t AliRsnCutPrimaryVertex::IsSelected(ETarget /*tgt*/, AliRsnEvent *event)
74{
75//
76// Cut checker
77//
78
79 // retrieve ESD event
80 AliESDEvent *esd = dynamic_cast<AliESDEvent*>(event->GetRef());
81 if (!esd) {
82 AliDebug(AliLog::kDebug+2, "NO ESD");
83 return kTRUE;
84 }
85
86 // check primary vertex and eventually fill step 1
87 // if a vertex with tracks was successfully reconstructed,
88 // it is used for computing DCA;
89 // otherwise, the one computed with SPD is used.
90 // This is known from the "Status" parameter of the vertex itself.
91 const AliESDVertex *v = esd->GetPrimaryVertex();
92 if (!v->GetStatus()) v = esd->GetPrimaryVertexSPD();
93 if (!v->GetStatus()) {
94 AliDebug(AliLog::kDebug+2, "Bad vertex status");
95 return kFALSE;
96 }
97
98 fCutValueI = v->GetNContributors();
99
100 return !OkRange();
101}
102
103//_________________________________________________________________________________________________
104Bool_t AliRsnCutPrimaryVertex::IsSelected(ETarget /*tgt*/, AliRsnEvent* /*ev1*/, AliRsnEvent* /*ev2*/)
105{
106//
107// Cut checker
108//
109
110 AliWarning("Cannot apply this cut to event mixing");
111 return kTRUE;
112}