Compilation on Windoiws/Cygwin
[u/mrichter/AliRoot.git] / CORRFW / AliCFV0TopoCuts.cxx
CommitLineData
2fbc0b17 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16
17///////////////////////////////////////////////////////////////////////////
18// ---- CORRECTION FRAMEWORK ----
19// Class to cut on V0 topology
20// -> support for :
21// DCA between V0 daughters
22// V0 daughter impact parameters wrt primary vertex
23// cosine of V0 pointing angle
24//
25///////////////////////////////////////////////////////////////////////////
26// author : R. Vernet (renaud.vernet@cern.ch)
27///////////////////////////////////////////////////////////////////////////
28
29#include "AliCFV0TopoCuts.h"
30#include "AliESDv0.h"
31#include "AliESDtrack.h"
32#include "AliCFPair.h"
10d9a8a6 33#include "AliAODv0.h"
34#include "AliVEvent.h"
35#include "AliAODEvent.h"
2fbc0b17 36
37ClassImp(AliCFV0TopoCuts)
38
39//______________________________________________________________
40AliCFV0TopoCuts::AliCFV0TopoCuts() :
41 AliCFCutBase(),
42 fMaxDcaDaughters(1.e99),
43 fMinDcaNeg(0),
44 fMinDcaPos(0),
10d9a8a6 45 fMinCosP(0),
46 fEvent(0x0)
2fbc0b17 47{
48 //
49 //default constructor
50 //
51}
52
53//______________________________________________________________
54AliCFV0TopoCuts::AliCFV0TopoCuts(const Char_t* name, const Char_t* title) :
55 AliCFCutBase(name,title),
56 fMaxDcaDaughters(1.e99),
57 fMinDcaNeg(0),
58 fMinDcaPos(0),
10d9a8a6 59 fMinCosP(0),
60 fEvent(0x0)
2fbc0b17 61{
62 //
63}
64
65//______________________________________________________________
66AliCFV0TopoCuts::AliCFV0TopoCuts(const AliCFV0TopoCuts& c) :
67 AliCFCutBase(c),
68 fMaxDcaDaughters(c.fMaxDcaDaughters),
69 fMinDcaNeg(c.fMinDcaNeg),
70 fMinDcaPos(c.fMinDcaPos),
10d9a8a6 71 fMinCosP(c.fMinCosP),
72 fEvent(c.fEvent)
2fbc0b17 73{
74 //
75 // copy constructor
76 //
77}
78
79//______________________________________________________________
80AliCFV0TopoCuts& AliCFV0TopoCuts::operator=(const AliCFV0TopoCuts& c)
81{
82 //
83 // assignment operator
84 //
85
86 if (this != &c) {
87 AliCFCutBase::operator=(c) ;
88 fMaxDcaDaughters = c.fMaxDcaDaughters ;
89 fMinDcaNeg = c.fMinDcaNeg ;
90 fMinDcaPos = c.fMinDcaPos ;
91 fMinCosP = c.fMinCosP ;
10d9a8a6 92 fEvent = c.fEvent ;
2fbc0b17 93 }
94 return *this ;
95}
96
97//______________________________________________________________
98Bool_t AliCFV0TopoCuts::IsSelected(TObject *obj) {
99 //
100 // computes V0 topological variables to cut on and return true
101 // in case the V0 is accepted
102 //
103
104 if (!obj) return kFALSE ;
105
106 TString className(obj->ClassName());
107 if (className.CompareTo("AliCFPair") != 0) {
108 Error("IsSelected","obj must point to an AliCFPair !");
109 return kFALSE ;
110 }
111
10d9a8a6 112 AliCFPair * pair = dynamic_cast<AliCFPair*>(obj);
113 AliESDv0 * esdV0 = pair->GetESDV0();
114 AliAODv0 * aodV0 = pair->GetAODV0();
115 AliVParticle * negDaughter = pair->GetNeg();
116 AliVParticle * posDaughter = pair->GetPos();
117
118 Double32_t dcaDaughters = 0. ;
119 Double32_t cosP = 0. ;
120 Double32_t negDca = 0. ;
121 Double32_t posDca = 0. ;
122
123 if (esdV0) {
124 dcaDaughters = esdV0->GetDcaV0Daughters() ;
125 cosP = esdV0->GetV0CosineOfPointingAngle() ;
126
127 Float_t tDca[2];
128 if (negDaughter) ((AliESDtrack*)negDaughter)->GetImpactParameters(tDca[0],tDca[1]);
129 else { tDca[0]=1.e99; tDca[1]=1.e99;}
130 negDca = TMath::Sqrt(tDca[0]*tDca[0]+tDca[1]*tDca[1]);
131 if (posDaughter) ((AliESDtrack*)posDaughter)->GetImpactParameters(tDca[0],tDca[1]);
132 else { tDca[0]=1.e99; tDca[1]=1.e99;}
133 posDca = TMath::Sqrt(tDca[0]*tDca[0]+tDca[1]*tDca[1]);
134 }
135 else if (aodV0) {
136 dcaDaughters = aodV0->DcaV0Daughters() ;
137 negDca = aodV0->DcaNegToPrimVertex() ;
138 posDca = aodV0->DcaPosToPrimVertex() ;
139 cosP = aodV0->CosPointingAngle(((AliAODEvent*)fEvent)->GetPrimaryVertex()) ;
140 }
141 else Error("IsSelected","No V0 pointer available");
2fbc0b17 142
10d9a8a6 143 if (dcaDaughters > fMaxDcaDaughters) return kFALSE ;
144 if (cosP < fMinCosP ) return kFALSE ;
145 if (negDca < fMinDcaNeg ) return kFALSE ;
146 if (posDca < fMinDcaPos ) return kFALSE ;
2fbc0b17 147
148 return kTRUE ;
149}
150