]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CORRFW/AliCFPairAcceptanceCuts.cxx
new classes for resonance and V0 analysis (from R. Vernet)
[u/mrichter/AliRoot.git] / CORRFW / AliCFPairAcceptanceCuts.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// ---- CORRECTION FRAMEWORK ----
18// Class to cut on the number of AliTrackReference's
19// for each detector. Applies on pair of tracks (AliCFPair)
20///////////////////////////////////////////////////////////////////////////
21// author : R. Vernet (renaud.vernet@cern.ch)
22///////////////////////////////////////////////////////////////////////////
23
24#include "AliMCParticle.h"
25#include "AliCFPairAcceptanceCuts.h"
26#include "AliMCEventHandler.h"
27#include "AliMCEvent.h"
28
29ClassImp(AliCFPairAcceptanceCuts)
30
31//______________________________
32AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts() :
33 AliCFCutBase()
34{
35 //
36 //ctor
37 //
38 fCutNeg = new AliCFAcceptanceCuts();
39 fCutPos = new AliCFAcceptanceCuts();
40}
41
42//______________________________
43AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts(const Char_t* name, const Char_t* title) :
44 AliCFCutBase(name,title)
45{
46 //
47 //ctor
48 //
49 fCutNeg = new AliCFAcceptanceCuts(name,title);
50 fCutPos = new AliCFAcceptanceCuts(name,title);
51}
52
53//______________________________
54AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts(const AliCFPairAcceptanceCuts& c) :
55 AliCFCutBase(c),
56 fCutNeg(c.fCutNeg),
57 fCutPos(c.fCutPos)
58{
59 //
60 //copy ctor
61 //
62}
63
64//______________________________
65AliCFPairAcceptanceCuts& AliCFPairAcceptanceCuts::operator=(const AliCFPairAcceptanceCuts& c)
66{
67 //
68 // Assignment operator
69 //
70 if (this != &c) {
71 AliCFCutBase::operator=(c) ;
72 fCutNeg = c.fCutNeg ;
73 fCutPos = c.fCutPos ;
74 }
75 return *this ;
76}
77
78//______________________________
79Bool_t AliCFPairAcceptanceCuts::IsSelected(TObject* obj) {
80 //
81 // checks the number of track references associated to 'obj'
82 // 'obj' must be an AliMCParticle
83 //
84
85 if (!obj) return kFALSE ;
86 TString className(obj->ClassName());
87 if (className.CompareTo("AliMCParticle") != 0) {
88 Error("IsSelected","obj must point to a AliMCParticle !");
89 return kFALSE ;
90 }
91
92 TParticle* part = ((AliMCParticle*)obj)->Particle() ;
93 if (!part || part->GetNDaughters()!=2) return kFALSE ;
94 Int_t lab0 = part->GetDaughter(0);
95 Int_t lab1 = part->GetDaughter(1);
96
97 AliMCParticle* negDaughter = fMCInfo->MCEvent()->GetTrack(lab0) ;
98 AliMCParticle* posDaughter = fMCInfo->MCEvent()->GetTrack(lab1) ;
99
100 if (!fCutNeg->IsSelected(negDaughter)) return kFALSE;
101 if (!fCutPos->IsSelected(posDaughter)) return kFALSE;
102
103 return kTRUE ;
104}
105
106//______________________________
107void AliCFPairAcceptanceCuts::SetEvtInfo(TObject* mcInfo) {
108 //
109 // Sets pointer to MC event information (AliMCEventHandler)
110 //
111
112 if (!mcInfo) {
113 Error("SetEvtInfo","Pointer to MC Event Handler is null !");
114 return;
115 }
116
117 TString className(mcInfo->ClassName());
118 if (className.CompareTo("AliMCEventHandler") != 0) {
119 Error("SetEvtInfo","argument must point to an AliMCEventHandler !");
120 return ;
121 }
122
123 fMCInfo = (AliMCEventHandler*) mcInfo ;
124}