]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CORRFW/AliCFPairPidCut.cxx
d18bfd51f996e75ffeac1bca166c0812df40fed9
[u/mrichter/AliRoot.git] / CORRFW / AliCFPairPidCut.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 // Class to define PID cuts on a pair of tracks
18 // The track pair object to use is AliCFPair
19 // author : renaud.vernet@cern.ch
20 ////////////////////////////////////////////////
21
22 #include "AliCFPairPidCut.h"
23 #include "AliCFPair.h"
24
25 ClassImp(AliCFPairPidCut)
26
27 //__________________________________________________________________________________
28 AliCFPairPidCut::AliCFPairPidCut() :
29   AliCFCutBase(),
30   fCutNeg(new AliCFTrackCutPid()),
31   fCutPos(new AliCFTrackCutPid())
32 {
33   //
34   // Default constructor
35   //
36 }
37 //__________________________________________________________________________________
38 AliCFPairPidCut::AliCFPairPidCut(const Char_t* name, const Char_t* title) :
39   AliCFCutBase(name,title),
40   fCutNeg(new AliCFTrackCutPid(name,title)),
41   fCutPos(new AliCFTrackCutPid(name,title))
42 {
43   //
44   // Constructor
45   //
46 }
47 //__________________________________________________________________________________
48 AliCFPairPidCut::AliCFPairPidCut(const AliCFPairPidCut& c) :
49   AliCFCutBase(c),
50   fCutNeg(c.fCutNeg),
51   fCutPos(c.fCutPos)
52 {
53   //
54   // copy constructor
55   //
56 }
57 //__________________________________________________________________________________
58 AliCFPairPidCut& AliCFPairPidCut::operator=(const AliCFPairPidCut& c)
59 {
60   //
61   // Assignment operator
62   //
63   if (this != &c) {
64     AliCFCutBase::operator=(c) ;
65     fCutNeg = c.fCutNeg ;
66     fCutPos = c.fCutPos ;
67   }
68   return *this;
69 }
70
71 //__________________________________________________________________________________
72 Bool_t AliCFPairPidCut::IsSelected(TObject* obj) {
73   //
74   // loops over decisions of single cuts and returns if the track is accepted
75   //
76
77   if (!obj) return kFALSE ;
78   TString className(obj->ClassName());
79   if (className.CompareTo("AliCFPair") != 0) {
80     Error("IsSelected","obj must point to a AliCFPair !");
81     return kFALSE ;
82   }
83
84   AliCFPair* pair = dynamic_cast<AliCFPair*>(obj);
85
86   AliVParticle* tneg = pair->GetNeg();
87   AliVParticle* tpos = pair->GetPos();
88
89   if (!tneg || !tpos) return kFALSE ;
90   if ( ! fCutNeg->IsSelected(tneg) || ! fCutPos->IsSelected(tpos) ) return kFALSE ;
91   return kTRUE ;
92 }