]>
Commit | Line | Data |
---|---|---|
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 | ||
29 | ClassImp(AliCFPairAcceptanceCuts) | |
30 | ||
31 | //______________________________ | |
32 | AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts() : | |
33 | AliCFCutBase(), | |
34 | fMCInfo(0x0), | |
35 | fCutNeg(new AliCFAcceptanceCuts()), | |
36 | fCutPos(new AliCFAcceptanceCuts()) | |
37 | { | |
38 | // | |
39 | //Default Constructor | |
40 | // | |
41 | } | |
42 | ||
43 | //______________________________ | |
44 | AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts(const Char_t* name, const Char_t* title) : | |
45 | AliCFCutBase(name,title), | |
46 | fMCInfo(0x0), | |
47 | fCutNeg(new AliCFAcceptanceCuts(name,title)), | |
48 | fCutPos(new AliCFAcceptanceCuts(name,title)) | |
49 | { | |
50 | // | |
51 | //Named Constructor | |
52 | // | |
53 | } | |
54 | ||
55 | //______________________________ | |
56 | AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts(const AliCFPairAcceptanceCuts& c) : | |
57 | AliCFCutBase(c), | |
58 | fMCInfo(c.fMCInfo), | |
59 | fCutNeg(c.fCutNeg), | |
60 | fCutPos(c.fCutPos) | |
61 | { | |
62 | // | |
63 | //Copy Constructor | |
64 | // | |
65 | } | |
66 | ||
67 | //______________________________ | |
68 | AliCFPairAcceptanceCuts& AliCFPairAcceptanceCuts::operator=(const AliCFPairAcceptanceCuts& c) | |
69 | { | |
70 | // | |
71 | // Assignment operator | |
72 | // | |
73 | if (this != &c) { | |
74 | AliCFCutBase::operator=(c) ; | |
75 | fMCInfo = c.fMCInfo ; | |
76 | fCutNeg = c.fCutNeg ; | |
77 | fCutPos = c.fCutPos ; | |
78 | } | |
79 | return *this ; | |
80 | } | |
81 | ||
82 | //______________________________ | |
83 | Bool_t AliCFPairAcceptanceCuts::IsSelected(TObject* obj) { | |
84 | // | |
85 | // checks the number of track references associated to 'obj' | |
86 | // 'obj' must be an AliMCParticle | |
87 | // | |
88 | ||
89 | if (!obj) return kFALSE ; | |
90 | TString className(obj->ClassName()); | |
91 | if (className.CompareTo("AliMCParticle") != 0) { | |
92 | Error("IsSelected","obj must point to a AliMCParticle !"); | |
93 | return kFALSE ; | |
94 | } | |
95 | ||
96 | TParticle* part = ((AliMCParticle*)obj)->Particle() ; | |
97 | if (!part || part->GetNDaughters()!=2) return kFALSE ; | |
98 | Int_t lab0 = part->GetDaughter(0); | |
99 | Int_t lab1 = part->GetDaughter(1); | |
100 | ||
101 | AliMCParticle* negDaughter = fMCInfo->MCEvent()->GetTrack(lab0) ; | |
102 | AliMCParticle* posDaughter = fMCInfo->MCEvent()->GetTrack(lab1) ; | |
103 | ||
104 | if (!fCutNeg->IsSelected(negDaughter)) return kFALSE; | |
105 | if (!fCutPos->IsSelected(posDaughter)) return kFALSE; | |
106 | ||
107 | return kTRUE ; | |
108 | } | |
109 | ||
110 | //______________________________ | |
111 | void AliCFPairAcceptanceCuts::SetEvtInfo(TObject* mcInfo) { | |
112 | // | |
113 | // Sets pointer to MC event information (AliMCEventHandler) | |
114 | // | |
115 | ||
116 | if (!mcInfo) { | |
117 | Error("SetEvtInfo","Pointer to MC Event Handler is null !"); | |
118 | return; | |
119 | } | |
120 | ||
121 | TString className(mcInfo->ClassName()); | |
122 | if (className.CompareTo("AliMCEventHandler") != 0) { | |
123 | Error("SetEvtInfo","argument must point to an AliMCEventHandler !"); | |
124 | return ; | |
125 | } | |
126 | ||
127 | fMCInfo = (AliMCEventHandler*) mcInfo ; | |
128 | } |