]>
Commit | Line | Data |
---|---|---|
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 | ||
13 | ClassImp(AliRsnCutPrimaryVertex) | |
14 | ||
96ab9736 | 15 | //_________________________________________________________________________________________________ |
16 | AliRsnCutPrimaryVertex::AliRsnCutPrimaryVertex | |
02e8aa99 | 17 | (const char *name, Double_t maxVz, Int_t nContributors, Bool_t acceptTPC) : |
2a1c7696 | 18 | AliRsnCut(name, AliRsnCut::kEvent, 0, nContributors - 1, 0.0, maxVz), |
19 | fAcceptTPC(acceptTPC), | |
20 | fCheckPileUp(kFALSE) | |
96ab9736 | 21 | { |
22 | // | |
23 | // Main constructor. | |
ceaa78d3 | 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. | |
28 | // --- | |
29 | // If the 'acceptTPC' argument is true, events with TPC | |
30 | // primary vertex will be checked, otherwise they will be | |
31 | // rejected by default. | |
32 | // --- | |
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. | |
96ab9736 | 35 | // |
02e8aa99 | 36 | |
2a1c7696 | 37 | fMinD = 0.0; |
38 | fMaxD = maxVz + 1E-6; | |
96ab9736 | 39 | } |
40 | ||
41 | //_________________________________________________________________________________________________ | |
32992791 | 42 | Bool_t AliRsnCutPrimaryVertex::IsSelected(TObject *object) |
96ab9736 | 43 | { |
44 | // | |
45 | // Cut checker | |
46 | // | |
2a1c7696 | 47 | |
48 | // retrieve ESD event | |
49 | AliRsnEvent *rsn = dynamic_cast<AliRsnEvent*>(object); | |
50 | if (!rsn) return kFALSE; | |
51 | AliESDEvent *esd = rsn->GetRefESD(); | |
52 | AliAODEvent *aod = rsn->GetRefAOD(); | |
53 | ||
54 | if (esd) { | |
55 | // pile-up check | |
56 | if (fCheckPileUp) { | |
57 | if (esd->IsPileupFromSPD()) return kFALSE; | |
5faf5a07 | 58 | } |
2a1c7696 | 59 | |
60 | // get the best primary vertex: | |
61 | // first try the one with tracks | |
62 | const AliESDVertex *vTrk = esd->GetPrimaryVertexTracks(); | |
63 | const AliESDVertex *vSPD = esd->GetPrimaryVertexSPD(); | |
64 | const AliESDVertex *vTPC = esd->GetPrimaryVertexTPC(); | |
65 | Int_t ncTrk = -1; | |
66 | Int_t ncSPD = -1; | |
67 | Int_t ncTPC = -1; | |
68 | Double_t vzTrk = 1000000.0; | |
69 | Double_t vzSPD = 1000000.0; | |
70 | Double_t vzTPC = 1000000.0; | |
71 | if (vTrk) vzTrk = TMath::Abs(vTrk->GetZv()); | |
72 | if (vSPD) vzSPD = TMath::Abs(vSPD->GetZv()); | |
73 | if (vTPC) vzTPC = TMath::Abs(vTPC->GetZv()); | |
74 | if (vTrk) ncTrk = (Int_t)vTrk->GetNContributors(); | |
75 | if (vSPD) ncSPD = (Int_t)vSPD->GetNContributors(); | |
76 | if (vTPC) ncTPC = (Int_t)vTPC->GetNContributors(); | |
77 | if (vTrk && ncTrk > 0) { | |
78 | fCutValueI = ncTrk; | |
79 | fCutValueD = vzTrk; | |
80 | } else if (vSPD && ncSPD > 0) { | |
81 | fCutValueI = ncSPD; | |
82 | fCutValueD = vzSPD; | |
83 | } else if (vTPC && ncTPC > 0) { | |
84 | if (!fAcceptTPC) | |
85 | return kFALSE; | |
86 | else { | |
87 | fCutValueI = ncTPC; | |
88 | fCutValueD = vzTPC; | |
89 | } | |
90 | } else | |
91 | return kFALSE; | |
92 | } else if (aod) { | |
93 | // pile-up check is not yet available for AODs | |
94 | ||
95 | // lines suggested by Andrea to reject TPC-only events | |
96 | if (!fAcceptTPC) { | |
97 | if (!aod->GetPrimaryVertexSPD()) return kFALSE; | |
98 | else if (aod->GetPrimaryVertexSPD()->GetNContributors() < 1) return kFALSE; | |
99 | } | |
100 | ||
101 | AliAODVertex *prim = (AliAODVertex*)aod->GetPrimaryVertex(); | |
102 | if (!prim) return kFALSE; | |
103 | ||
104 | fCutValueI = prim->GetNContributors(); | |
105 | fCutValueD = prim->GetZ(); | |
106 | } else | |
5faf5a07 | 107 | return kFALSE; |
a378358c | 108 | |
2a1c7696 | 109 | // output |
110 | Bool_t result = ((!OkRangeI()) && OkRangeD()); | |
111 | return result; | |
96ab9736 | 112 | } |
aa24e021 | 113 | |
114 | //_________________________________________________________________________________________________ | |
115 | void AliRsnCutPrimaryVertex::Print(const Option_t *) const | |
116 | { | |
117 | // | |
118 | // Print information on this cut | |
119 | // | |
120 | ||
2a1c7696 | 121 | AliInfo(Form("Cut name : %s", GetName())); |
122 | AliInfo(Form("Accepting TPC primary vertex : %s", (fAcceptTPC ? "YES" : "NO"))); | |
123 | AliInfo(Form("Contributors range (outside) : %d - %d", fMinI, fMaxI)); | |
124 | AliInfo(Form("Z-vertex range (inside) : %f - %f", fMinD, fMaxD)); | |
aa24e021 | 125 | } |