]>
Commit | Line | Data |
---|---|---|
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" | |
2fbc0b17 | 26 | #include "AliMCEvent.h" |
107a3100 | 27 | #include "TBits.h" |
28 | #include "AliLog.h" | |
2fbc0b17 | 29 | |
30 | ClassImp(AliCFPairAcceptanceCuts) | |
31 | ||
32 | //______________________________ | |
33 | AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts() : | |
29a4c1fe | 34 | AliCFCutBase(), |
35 | fMCInfo(0x0), | |
36 | fCutNeg(new AliCFAcceptanceCuts()), | |
107a3100 | 37 | fCutPos(new AliCFAcceptanceCuts()), |
38 | fBitmap(new TBits(0)) | |
2fbc0b17 | 39 | { |
40 | // | |
29a4c1fe | 41 | //Default Constructor |
2fbc0b17 | 42 | // |
2fbc0b17 | 43 | } |
44 | ||
45 | //______________________________ | |
46 | AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts(const Char_t* name, const Char_t* title) : | |
29a4c1fe | 47 | AliCFCutBase(name,title), |
48 | fMCInfo(0x0), | |
49 | fCutNeg(new AliCFAcceptanceCuts(name,title)), | |
107a3100 | 50 | fCutPos(new AliCFAcceptanceCuts(name,title)), |
51 | fBitmap(new TBits(0)) | |
2fbc0b17 | 52 | { |
53 | // | |
29a4c1fe | 54 | //Named Constructor |
2fbc0b17 | 55 | // |
2fbc0b17 | 56 | } |
57 | ||
58 | //______________________________ | |
59 | AliCFPairAcceptanceCuts::AliCFPairAcceptanceCuts(const AliCFPairAcceptanceCuts& c) : | |
60 | AliCFCutBase(c), | |
29a4c1fe | 61 | fMCInfo(c.fMCInfo), |
2fbc0b17 | 62 | fCutNeg(c.fCutNeg), |
107a3100 | 63 | fCutPos(c.fCutPos), |
64 | fBitmap(c.fBitmap) | |
2fbc0b17 | 65 | { |
66 | // | |
29a4c1fe | 67 | //Copy Constructor |
2fbc0b17 | 68 | // |
69 | } | |
70 | ||
71 | //______________________________ | |
72 | AliCFPairAcceptanceCuts& AliCFPairAcceptanceCuts::operator=(const AliCFPairAcceptanceCuts& c) | |
73 | { | |
74 | // | |
75 | // Assignment operator | |
76 | // | |
77 | if (this != &c) { | |
78 | AliCFCutBase::operator=(c) ; | |
29a4c1fe | 79 | fMCInfo = c.fMCInfo ; |
2fbc0b17 | 80 | fCutNeg = c.fCutNeg ; |
81 | fCutPos = c.fCutPos ; | |
107a3100 | 82 | fBitmap = c.fBitmap ; |
2fbc0b17 | 83 | } |
84 | return *this ; | |
85 | } | |
86 | ||
107a3100 | 87 | //__________________________________________________________ |
9eeae5d5 | 88 | Bool_t AliCFPairAcceptanceCuts::IsSelected(TObject* obj) { |
2fbc0b17 | 89 | // |
90 | // checks the number of track references associated to 'obj' | |
91 | // 'obj' must be an AliMCParticle | |
92 | // | |
107a3100 | 93 | // |
94 | // check if selections on 'obj' are passed | |
95 | // 'obj' must be an AliMCParticle | |
96 | // | |
97 | ||
98 | SelectionBitMap(obj); | |
99 | ||
100 | // if (fIsQAOn) FillHistograms(obj,kFALSE); | |
101 | Bool_t isSelected = kTRUE; | |
102 | ||
103 | for (UInt_t icut=0; icut<fBitmap->GetNbits(); icut++) { | |
104 | if (!fBitmap->TestBitNumber(icut)) { | |
105 | isSelected = kFALSE; | |
106 | break; | |
107 | } | |
108 | } | |
109 | ||
110 | if (!isSelected) return kFALSE ; | |
111 | // if (fIsQAOn) FillHistograms(obj,kTRUE); | |
112 | return kTRUE; | |
113 | } | |
114 | ||
115 | //__________________________________________________________ | |
116 | void AliCFPairAcceptanceCuts::SelectionBitMap(TObject* obj) | |
117 | { | |
118 | // | |
119 | // test if the track passes the single cuts | |
120 | // and store the information in a bitmap | |
121 | // | |
122 | ||
123 | for (UInt_t i=0; i<kNCuts; i++) fBitmap->SetBitNumber(i,kFALSE); | |
2fbc0b17 | 124 | |
107a3100 | 125 | if (!obj) return; |
2fbc0b17 | 126 | TString className(obj->ClassName()); |
127 | if (className.CompareTo("AliMCParticle") != 0) { | |
107a3100 | 128 | AliError("obj must point to an AliMCParticle !"); |
129 | return ; | |
2fbc0b17 | 130 | } |
131 | ||
107a3100 | 132 | TParticle* part = (dynamic_cast<AliMCParticle*>(obj))->Particle() ; |
133 | if (!part || part->GetNDaughters() !=2) return ; | |
134 | ||
2fbc0b17 | 135 | Int_t lab0 = part->GetDaughter(0); |
136 | Int_t lab1 = part->GetDaughter(1); | |
3d5b63ca | 137 | AliMCParticle* negDaughter = (AliMCParticle*) fMCInfo->GetTrack(lab0) ; |
138 | AliMCParticle* posDaughter = (AliMCParticle*) fMCInfo->GetTrack(lab1) ; | |
2fbc0b17 | 139 | |
107a3100 | 140 | Int_t iCutBit = 0; |
2fbc0b17 | 141 | |
107a3100 | 142 | if (fCutNeg->IsSelected(negDaughter)) fBitmap->SetBitNumber(iCutBit,kTRUE); |
143 | iCutBit++; | |
144 | ||
145 | if (fCutPos->IsSelected(posDaughter)) fBitmap->SetBitNumber(iCutBit,kTRUE); | |
2fbc0b17 | 146 | } |
147 | ||
148 | //______________________________ | |
ab3d89b6 | 149 | void AliCFPairAcceptanceCuts::SetMCEventInfo(const TObject* mcInfo) { |
2fbc0b17 | 150 | // |
107a3100 | 151 | // Sets pointer to MC event information (AliMCEvent) |
2fbc0b17 | 152 | // |
153 | ||
154 | if (!mcInfo) { | |
0c01ae65 | 155 | Error("SetMCEventInfo","Pointer to MC Event is null !"); |
2fbc0b17 | 156 | return; |
157 | } | |
158 | ||
159 | TString className(mcInfo->ClassName()); | |
107a3100 | 160 | if (className.CompareTo("AliMCEvent") != 0) { |
0c01ae65 | 161 | Error("SetMCEventInfo","argument must point to an AliMCEvent !"); |
2fbc0b17 | 162 | return ; |
163 | } | |
164 | ||
107a3100 | 165 | fMCInfo = (AliMCEvent*) mcInfo ; |
2fbc0b17 | 166 | } |