]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CORRFW/AliCFPairPidCut.cxx
minor coverity defect: added protection for self-assignment
[u/mrichter/AliRoot.git] / CORRFW / AliCFPairPidCut.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// 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
25ClassImp(AliCFPairPidCut)
26
27//__________________________________________________________________________________
28AliCFPairPidCut::AliCFPairPidCut() :
29a4c1fe 29 AliCFCutBase(),
30 fCutNeg(new AliCFTrackCutPid()),
31 fCutPos(new AliCFTrackCutPid())
2fbc0b17 32{
33 //
34 // Default constructor
35 //
2fbc0b17 36}
37//__________________________________________________________________________________
38AliCFPairPidCut::AliCFPairPidCut(const Char_t* name, const Char_t* title) :
29a4c1fe 39 AliCFCutBase(name,title),
40 fCutNeg(new AliCFTrackCutPid(name,title)),
41 fCutPos(new AliCFTrackCutPid(name,title))
2fbc0b17 42{
43 //
44 // Constructor
45 //
2fbc0b17 46}
47//__________________________________________________________________________________
48AliCFPairPidCut::AliCFPairPidCut(const AliCFPairPidCut& c) :
49 AliCFCutBase(c),
50 fCutNeg(c.fCutNeg),
51 fCutPos(c.fCutPos)
52{
53 //
54 // copy constructor
55 //
56}
57//__________________________________________________________________________________
58AliCFPairPidCut& 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//__________________________________________________________________________________
9eeae5d5 72Bool_t AliCFPairPidCut::IsSelected(TObject* obj) {
2fbc0b17 73 //
74 // loops over decisions of single cuts and returns if the track is accepted
75 //
76
4bc0c5f9 77 AliCFPair* pair = dynamic_cast<AliCFPair*>(obj);
78 if (!pair) return kFALSE ;
79 TString className(pair->ClassName());
2fbc0b17 80 if (className.CompareTo("AliCFPair") != 0) {
81 Error("IsSelected","obj must point to a AliCFPair !");
82 return kFALSE ;
83 }
84
10d9a8a6 85 AliVParticle* tneg = pair->GetNeg();
86 AliVParticle* tpos = pair->GetPos();
2fbc0b17 87
88 if (!tneg || !tpos) return kFALSE ;
89 if ( ! fCutNeg->IsSelected(tneg) || ! fCutPos->IsSelected(tpos) ) return kFALSE ;
90 return kTRUE ;
91}