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