]>
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 | |
4bc0c5f9 | 125 | AliMCParticle* mcpart = dynamic_cast<AliMCParticle*>(obj) ; |
126 | ||
127 | if (!mcpart) return; | |
128 | TString className(mcpart->ClassName()); | |
2fbc0b17 | 129 | if (className.CompareTo("AliMCParticle") != 0) { |
107a3100 | 130 | AliError("obj must point to an AliMCParticle !"); |
131 | return ; | |
2fbc0b17 | 132 | } |
133 | ||
4bc0c5f9 | 134 | TParticle* part = mcpart->Particle() ; |
107a3100 | 135 | if (!part || part->GetNDaughters() !=2) return ; |
136 | ||
2fbc0b17 | 137 | Int_t lab0 = part->GetDaughter(0); |
138 | Int_t lab1 = part->GetDaughter(1); | |
3d5b63ca | 139 | AliMCParticle* negDaughter = (AliMCParticle*) fMCInfo->GetTrack(lab0) ; |
140 | AliMCParticle* posDaughter = (AliMCParticle*) fMCInfo->GetTrack(lab1) ; | |
2fbc0b17 | 141 | |
107a3100 | 142 | Int_t iCutBit = 0; |
2fbc0b17 | 143 | |
107a3100 | 144 | if (fCutNeg->IsSelected(negDaughter)) fBitmap->SetBitNumber(iCutBit,kTRUE); |
145 | iCutBit++; | |
146 | ||
147 | if (fCutPos->IsSelected(posDaughter)) fBitmap->SetBitNumber(iCutBit,kTRUE); | |
2fbc0b17 | 148 | } |
149 | ||
150 | //______________________________ | |
ab3d89b6 | 151 | void AliCFPairAcceptanceCuts::SetMCEventInfo(const TObject* mcInfo) { |
2fbc0b17 | 152 | // |
107a3100 | 153 | // Sets pointer to MC event information (AliMCEvent) |
2fbc0b17 | 154 | // |
155 | ||
156 | if (!mcInfo) { | |
0c01ae65 | 157 | Error("SetMCEventInfo","Pointer to MC Event is null !"); |
2fbc0b17 | 158 | return; |
159 | } | |
160 | ||
161 | TString className(mcInfo->ClassName()); | |
107a3100 | 162 | if (className.CompareTo("AliMCEvent") != 0) { |
0c01ae65 | 163 | Error("SetMCEventInfo","argument must point to an AliMCEvent !"); |
2fbc0b17 | 164 | return ; |
165 | } | |
166 | ||
107a3100 | 167 | fMCInfo = (AliMCEvent*) mcInfo ; |
2fbc0b17 | 168 | } |