]>
Commit | Line | Data |
---|---|---|
563113d0 | 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 | // AliCFAcceptanceCuts implementation | |
19 | // Class to cut on the number of AliTrackReference's | |
20 | // for each detector | |
21 | /////////////////////////////////////////////////////////////////////////// | |
22 | // author : R. Vernet (renaud.vernet@cern.ch) | |
23 | /////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #include "AliLog.h" | |
26 | #include "AliMCParticle.h" | |
27 | #include "AliCFAcceptanceCuts.h" | |
28 | ||
29 | ClassImp(AliCFAcceptanceCuts) | |
30 | ||
31 | //______________________________ | |
32 | AliCFAcceptanceCuts::AliCFAcceptanceCuts() : | |
33 | AliCFCutBase(), | |
34 | fMCInfo(0x0), | |
35 | fMinNHitITS(0), | |
36 | fMinNHitTPC(0), | |
37 | fMinNHitTRD(0), | |
38 | fMinNHitTOF(0), | |
39 | fMinNHitMUON(0) | |
40 | ||
41 | { | |
42 | // | |
43 | //ctor | |
44 | // | |
45 | } | |
46 | ||
47 | //______________________________ | |
48 | AliCFAcceptanceCuts::AliCFAcceptanceCuts(const Char_t* name, const Char_t* title) : | |
49 | AliCFCutBase(name,title), | |
50 | fMCInfo(0x0), | |
51 | fMinNHitITS(0), | |
52 | fMinNHitTPC(0), | |
53 | fMinNHitTRD(0), | |
54 | fMinNHitTOF(0), | |
55 | fMinNHitMUON(0) | |
56 | { | |
57 | // | |
58 | //ctor | |
59 | // | |
60 | } | |
61 | ||
62 | //______________________________ | |
63 | AliCFAcceptanceCuts::AliCFAcceptanceCuts(const AliCFAcceptanceCuts& c) : | |
64 | AliCFCutBase(c), | |
65 | fMCInfo(c.fMCInfo), | |
66 | fMinNHitITS(c.fMinNHitITS), | |
67 | fMinNHitTPC(c.fMinNHitTPC), | |
68 | fMinNHitTRD(c.fMinNHitTRD), | |
69 | fMinNHitTOF(c.fMinNHitTOF), | |
70 | fMinNHitMUON(c.fMinNHitMUON) | |
71 | { | |
72 | // | |
73 | //copy ctor | |
74 | // | |
75 | } | |
76 | ||
77 | //______________________________ | |
78 | AliCFAcceptanceCuts& AliCFAcceptanceCuts::operator=(const AliCFAcceptanceCuts& c) | |
79 | { | |
80 | // | |
81 | // Assignment operator | |
82 | // | |
83 | if (this != &c) { | |
84 | AliCFCutBase::operator=(c) ; | |
85 | fMCInfo=c.fMCInfo; | |
86 | fMinNHitITS=c.fMinNHitITS; | |
87 | fMinNHitTPC=c.fMinNHitTPC; | |
88 | fMinNHitTRD=c.fMinNHitTRD; | |
89 | fMinNHitTOF=c.fMinNHitTOF; | |
90 | fMinNHitMUON=c.fMinNHitMUON; | |
91 | } | |
92 | return *this ; | |
93 | } | |
94 | ||
95 | //______________________________ | |
96 | Bool_t AliCFAcceptanceCuts::IsSelected(TObject* obj) { | |
97 | // | |
98 | // checks the number of track references associated to 'obj' | |
99 | // 'obj' must be an AliMCParticle | |
100 | // | |
101 | ||
102 | if (!obj) return kFALSE ; | |
103 | ||
104 | TString className(obj->ClassName()); | |
105 | if (className.CompareTo("AliMCParticle") != 0) { | |
106 | AliError("obj must point to a AliMCParticle !"); | |
107 | return kFALSE ; | |
108 | } | |
109 | ||
110 | AliMCParticle* part = (AliMCParticle*) obj ; | |
111 | if(!part) return kFALSE; | |
112 | ||
113 | Int_t nHitsITS=0, nHitsTPC=0, nHitsTRD=0, nHitsTOF=0, nHitsMUON=0 ; | |
114 | for (Int_t iTrackRef=0; iTrackRef<part->GetNumberOfTrackReferences(); iTrackRef++) { | |
115 | AliTrackReference * trackRef = part->GetTrackReference(iTrackRef); | |
116 | if(trackRef){ | |
117 | Int_t detectorId = trackRef->DetectorId(); | |
118 | switch(detectorId) { | |
119 | case AliTrackReference::kITS : nHitsITS++ ; break ; | |
120 | case AliTrackReference::kTPC : nHitsTPC++ ; break ; | |
121 | case AliTrackReference::kTRD : nHitsTRD++ ; break ; | |
122 | case AliTrackReference::kTOF : nHitsTOF++ ; break ; | |
123 | case AliTrackReference::kMUON : nHitsMUON++ ; break ; | |
124 | default : break ; | |
125 | } | |
126 | } | |
127 | } | |
128 | ||
129 | if (nHitsITS < fMinNHitITS ) return kFALSE; | |
130 | if (nHitsTPC < fMinNHitTPC ) return kFALSE; | |
131 | if (nHitsTRD < fMinNHitTRD ) return kFALSE; | |
132 | if (nHitsTOF < fMinNHitTOF ) return kFALSE; | |
133 | if (nHitsMUON < fMinNHitMUON ) return kFALSE; | |
134 | ||
135 | ||
136 | return kTRUE ; | |
137 | } | |
138 | ||
139 | ||
140 | void AliCFAcceptanceCuts::SetEvtInfo(TObject* mcInfo) { | |
141 | // | |
142 | // Sets pointer to MC event information (AliMCEventHandler) | |
143 | // | |
144 | ||
145 | if (!mcInfo) { | |
146 | AliError("Pointer to MC Event Handler is null !"); | |
147 | return; | |
148 | } | |
149 | ||
150 | TString className(mcInfo->ClassName()); | |
151 | if (className.CompareTo("AliMCEventHandler") != 0) { | |
152 | AliError("argument must point to an AliMCEventHandler !"); | |
153 | return ; | |
154 | } | |
155 | ||
156 | fMCInfo = (AliMCEventHandler*) mcInfo ; | |
157 | } |