]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CORRFW/AliCFV0TopoCuts.cxx
Fixing the AddTask
[u/mrichter/AliRoot.git] / CORRFW / AliCFV0TopoCuts.cxx
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"
33 #include "AliAODv0.h"
34 #include "AliVEvent.h"
35 #include "AliAODEvent.h"
36
37 ClassImp(AliCFV0TopoCuts)
38
39 //______________________________________________________________
40 AliCFV0TopoCuts::AliCFV0TopoCuts() : 
41   AliCFCutBase(),
42   fMaxDcaDaughters(1.e99),
43   fMinDcaNeg(0),
44   fMinDcaPos(0),
45   fMinCosP(0),
46   fEvent(0x0)
47 {
48   //
49   //default constructor
50   //
51 }
52
53 //______________________________________________________________
54 AliCFV0TopoCuts::AliCFV0TopoCuts(const Char_t* name, const Char_t* title) : 
55   AliCFCutBase(name,title),
56   fMaxDcaDaughters(1.e99),
57   fMinDcaNeg(0),
58   fMinDcaPos(0),
59   fMinCosP(0),
60   fEvent(0x0)
61 {
62   //
63 }
64
65 //______________________________________________________________
66 AliCFV0TopoCuts::AliCFV0TopoCuts(const AliCFV0TopoCuts& c) : 
67   AliCFCutBase(c),
68   fMaxDcaDaughters(c.fMaxDcaDaughters),
69   fMinDcaNeg(c.fMinDcaNeg),
70   fMinDcaPos(c.fMinDcaPos),
71   fMinCosP(c.fMinCosP),
72   fEvent(c.fEvent)
73 {
74   //
75   // copy constructor
76   //
77 }
78
79 //______________________________________________________________
80 AliCFV0TopoCuts& 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 ;
92     fEvent           = c.fEvent ;
93   }
94   return *this ;
95 }
96
97 //______________________________________________________________
98 Bool_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
105   AliCFPair* pair = dynamic_cast<AliCFPair*>(obj);
106   if (!pair) return kFALSE ;
107
108   TString className(pair->ClassName());
109   if (className.CompareTo("AliCFPair") != 0) {
110     Error("IsSelected","obj must point to an AliCFPair !");
111     return kFALSE ;
112   }
113
114   AliESDv0     * esdV0       = pair->GetESDV0();
115   AliAODv0     * aodV0       = pair->GetAODV0();
116   AliVParticle * negDaughter = pair->GetNeg();
117   AliVParticle * posDaughter = pair->GetPos();
118
119   Double32_t dcaDaughters = 0. ;
120   Double32_t cosP   = 0. ;
121   Double32_t negDca = 0. ;
122   Double32_t posDca = 0. ;
123
124   if (esdV0) {
125     dcaDaughters = esdV0->GetDcaV0Daughters() ;
126     cosP         = esdV0->GetV0CosineOfPointingAngle() ;
127
128     Float_t tDca[2];
129     if (negDaughter) ((AliESDtrack*)negDaughter)->GetImpactParameters(tDca[0],tDca[1]);
130     else { tDca[0]=1.e+09;  tDca[1]=1.e+09;}
131     negDca = TMath::Sqrt(tDca[0]*tDca[0]+tDca[1]*tDca[1]);
132     if (posDaughter) ((AliESDtrack*)posDaughter)->GetImpactParameters(tDca[0],tDca[1]);
133     else { tDca[0]=1.e+09;  tDca[1]=1.e+09;}
134     posDca = TMath::Sqrt(tDca[0]*tDca[0]+tDca[1]*tDca[1]);
135   }
136   else if (aodV0) {
137     dcaDaughters = aodV0->DcaV0Daughters() ;
138     negDca       = aodV0->DcaNegToPrimVertex() ;
139     posDca       = aodV0->DcaPosToPrimVertex() ;
140     cosP         = aodV0->CosPointingAngle(((AliAODEvent*)fEvent)->GetPrimaryVertex()) ;
141   }
142   else Error("IsSelected","No V0 pointer available");
143
144   if (dcaDaughters > fMaxDcaDaughters) return kFALSE ;
145   if (cosP         < fMinCosP        ) return kFALSE ;
146   if (negDca       < fMinDcaNeg      ) return kFALSE ;
147   if (posDca       < fMinDcaPos      ) return kFALSE ; 
148
149   return kTRUE ;
150 }
151