]>
Commit | Line | Data |
---|---|---|
d89b8229 | 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 | /* $Id$ */ | |
17 | ||
18 | //-------------------------------------------------- | |
19 | // Filling of CalTrkTrack objects in the reader task | |
20 | // | |
21 | // Author: magali.estienne@subatech.in2p3.fr | |
22 | // alexandre.shabetai@cern.ch | |
23 | //------------------------------------------------- | |
24 | ||
25 | // --- AliRoot header files --- | |
26 | #include "AliJetFillCalTrkTrack.h" | |
27 | #include "AliJetReaderHeader.h" | |
28 | #include "AliVEvent.h" | |
29 | #include "AliESDtrack.h" | |
30 | #include "AliAODTrack.h" | |
31 | ||
32 | ClassImp(AliJetFillCalTrkTrack) | |
33 | ||
34 | ///////////////////////////////////////////////////////////////////// | |
35 | ||
36 | AliJetFillCalTrkTrack::AliJetFillCalTrkTrack(): | |
37 | AliJetFillCalTrkEvent(), | |
38 | fHadCorr(0), | |
39 | fApplyMIPCorrection(kTRUE), | |
40 | fVEvt(0x0) | |
41 | { | |
42 | // constructor | |
43 | } | |
44 | ||
45 | //----------------------------------------------------------------------- | |
46 | AliJetFillCalTrkTrack::AliJetFillCalTrkTrack(AliVEvent* evt): | |
47 | AliJetFillCalTrkEvent(), | |
48 | fHadCorr(0), | |
49 | fApplyMIPCorrection(kTRUE), | |
50 | fVEvt(evt) | |
51 | { | |
52 | // constructor | |
53 | } | |
54 | ||
55 | //----------------------------------------------------------------------- | |
56 | AliJetFillCalTrkTrack::AliJetFillCalTrkTrack(const AliJetFillCalTrkTrack &det): | |
57 | AliJetFillCalTrkEvent(det), | |
58 | fHadCorr(det.fHadCorr), | |
59 | fApplyMIPCorrection(det.fApplyMIPCorrection), | |
60 | fVEvt(det.fVEvt) | |
61 | { | |
62 | // Copy constructor | |
63 | } | |
64 | ||
65 | //----------------------------------------------------------------------- | |
66 | AliJetFillCalTrkTrack& AliJetFillCalTrkTrack::operator=(const AliJetFillCalTrkTrack& other) | |
67 | { | |
68 | // Assignment | |
69 | if (this != &other) { | |
70 | fHadCorr = other.fHadCorr; | |
71 | fApplyMIPCorrection = other.fApplyMIPCorrection; | |
72 | fVEvt = other.fVEvt; | |
73 | } | |
74 | ||
75 | return (*this); | |
76 | ||
77 | } | |
78 | ||
79 | //----------------------------------------------------------------------- | |
80 | AliJetFillCalTrkTrack::~AliJetFillCalTrkTrack() | |
81 | { | |
82 | // destructor | |
83 | } | |
84 | ||
85 | //----------------------------------------------------------------------- | |
86 | void AliJetFillCalTrkTrack::Exec(Option_t* const /*option*/) | |
87 | { | |
88 | // Main method. | |
89 | // Fill AliJetFillCalTrkTrack the with the charged particle information | |
90 | ||
91 | fDebug = fReaderHeader->GetDebug(); | |
92 | fOpt = fReaderHeader->GetDetector(); | |
93 | TString datatype = fReaderHeader->GetDataType(); | |
94 | datatype.ToUpper(); | |
95 | ||
96 | Int_t type=0; | |
97 | ||
98 | if (datatype.Contains("AODEXTRAONLY")) { type=kTrackAODextraonly;} | |
99 | else if (datatype.Contains("AODEXTRA")) { type=kTrackAODextra; } | |
100 | else if (datatype.Contains("AOD")) { type=kTrackAOD; } | |
101 | else if (datatype.Contains("ESD")) { type=kTrackESD; } | |
102 | else { cout<< "Unknown Data type !" << endl; } | |
103 | ||
104 | // temporary storage of signal and pt cut flag | |
105 | Bool_t sflag = 0; | |
106 | Bool_t cflag = 0; | |
107 | ||
108 | // get cuts set by user | |
109 | Float_t ptMin = fReaderHeader->GetPtCut(); | |
110 | Float_t etaMin = fReaderHeader->GetFiducialEtaMin(); | |
111 | Float_t etaMax = fReaderHeader->GetFiducialEtaMax(); | |
112 | Float_t phiMin = fReaderHeader->GetFiducialPhiMin(); | |
113 | Float_t phiMax = fReaderHeader->GetFiducialPhiMax(); | |
114 | UInt_t filterMask = ((AliJetReaderHeader*)fReaderHeader)->GetTestFilterMask(); | |
115 | UInt_t filterType = ((AliJetReaderHeader*)fReaderHeader)->GetFilterType(); | |
116 | ||
117 | if(fDebug>2)Printf("%s:%d Selecting tracks with %d",(char*)__FILE__,__LINE__,type); | |
118 | ||
119 | Int_t goodTrackStd = 0; | |
120 | Int_t goodTrackNonStd = 0; | |
121 | if(type==kTrackESD || type==kTrackAOD || type==kTrackAODextra || type==kTrackAODextraonly){ | |
122 | if(type!=kTrackAODextraonly) { | |
123 | if(!fVEvt){ | |
124 | if(fDebug>2)Printf("%s:%d No AOD or ESD input event",(char*)__FILE__,__LINE__); | |
125 | return; | |
126 | } | |
127 | for(int it = 0;it < fVEvt->GetNumberOfTracks();++it){ | |
128 | AliVTrack *tr = (AliVTrack*)fVEvt->GetTrack(it); | |
129 | cflag=sflag=0; | |
130 | if(fVEvt->InheritsFrom("AliESDEvent")){ | |
131 | // ESD case .... | |
132 | if(tr->GetStatus()==0){ | |
133 | if(fDebug>10)Printf("%s:%d Not matching status %d/%d",(char*)__FILE__,__LINE__,it,fVEvt->GetNumberOfTracks()); | |
134 | continue; | |
135 | } | |
136 | if ((tr->GetStatus() & AliESDtrack::kTPCrefit) == 0) continue; // quality check | |
137 | if ((tr->GetStatus() & AliESDtrack::kITSrefit) == 0) continue; // quality check | |
138 | if (((AliJetReaderHeader*) fReaderHeader)->ReadSignalOnly() | |
139 | && TMath::Abs(tr->GetLabel()) > 10000) continue; // quality check | |
140 | if (((AliJetReaderHeader*) fReaderHeader)->ReadBkgdOnly() | |
141 | && TMath::Abs(tr->GetLabel()) < 10000) continue; // quality check | |
142 | } | |
143 | if((fVEvt->InheritsFrom("AliAODEvent"))){ | |
144 | // AOD case .... | |
145 | AliAODTrack *trAOD = dynamic_cast<AliAODTrack*> (tr); | |
146 | Bool_t bGood = false; | |
147 | if(filterType == 0)bGood = true; | |
148 | else if(filterType == 1)bGood = trAOD->IsHybridTPCConstrainedGlobal(); | |
149 | else if(filterType == 2)bGood = trAOD->IsHybridGlobalConstrainedGlobal(); | |
150 | if((filterMask>0)&&((!trAOD->TestFilterBit(filterMask)||(!bGood)))){ | |
151 | if(fDebug>10)Printf("%s:%d Not matching filter %d/%d %d/%d",(char*)__FILE__,__LINE__,it,fVEvt->GetNumberOfTracks(),filterMask,trAOD->GetFilterMap()); | |
152 | continue; | |
153 | } | |
154 | // Should we also check the GetStatus ? | |
155 | } | |
156 | if((tr->Eta()> etaMax) || (tr->Eta() < etaMin)){ | |
157 | if(fDebug>10)Printf("%s:%d Not matching eta %d/%d",(char*)__FILE__,__LINE__,it,fVEvt->GetNumberOfTracks()); | |
158 | continue; | |
159 | } | |
160 | Float_t phi = ( (tr->Phi()) < 0) ? (tr->Phi()) + 2. * TMath::Pi() : (tr->Phi()); | |
161 | if((phi > phiMax) || (phi < phiMin)){ | |
162 | if(fDebug>10)Printf("%s:%d Not matching eta %d/%d",(char*)__FILE__,__LINE__,it,fVEvt->GetNumberOfTracks()); | |
163 | continue; | |
164 | } | |
165 | if(tr->Pt() <= ptMin){ | |
166 | if(fDebug>10)Printf("%s:%d Not matching pt %d/%d",(char*)__FILE__,__LINE__,it,fVEvt->GetNumberOfTracks()); | |
167 | } | |
168 | else {cflag=1;} | |
169 | sflag=(TMath::Abs(tr->GetLabel()) < 10000) ? 1 : 0; | |
170 | ||
171 | if(fDebug>10)Printf("%s:%d MATCHED %d/%d",(char*)__FILE__,__LINE__,it,fVEvt->GetNumberOfTracks()); | |
172 | ||
173 | fCalTrkEvent->AddCalTrkTrack(tr,cflag,sflag); | |
174 | goodTrackStd++; | |
175 | } | |
176 | } | |
177 | if(type==kTrackAODextra || type==kTrackAODextraonly) { | |
178 | if(!fVEvt){ | |
179 | return; | |
180 | } | |
181 | TClonesArray *aodExtraTracks = dynamic_cast<TClonesArray*>(fVEvt->FindListObject("aodExtraTracks")); | |
182 | if(!aodExtraTracks) return; | |
183 | for(int it =0; it<aodExtraTracks->GetEntries(); it++) { | |
184 | cflag=sflag=0; | |
185 | AliVParticle *track = dynamic_cast<AliVParticle*> ((*aodExtraTracks)[it]); | |
186 | if (!track) continue; | |
187 | AliAODTrack *trackAOD = dynamic_cast<AliAODTrack*> (track); | |
188 | if(!trackAOD) continue; | |
189 | if (trackAOD->GetStatus() == 0) continue; | |
190 | Bool_t bGood = false; | |
191 | if(filterType == 0)bGood = true; | |
192 | else if(filterType == 1)bGood = trackAOD->IsHybridTPCConstrainedGlobal(); | |
193 | else if(filterType == 2)bGood = trackAOD->IsHybridGlobalConstrainedGlobal(); | |
194 | if((filterMask>0)&&((!trackAOD->TestFilterBit(filterMask)||(!bGood))))continue; | |
195 | if((trackAOD->Eta()> etaMax) || (trackAOD->Eta() < etaMin)){ | |
196 | if(fDebug>10)Printf("%s:%d Not matching eta %d/%d",(char*)__FILE__,__LINE__,it,fVEvt->GetNumberOfTracks()); | |
197 | continue; | |
198 | } | |
199 | Float_t phi = ( (trackAOD->Phi()) < 0) ? (trackAOD->Phi()) + 2. * TMath::Pi() : (trackAOD->Phi()); | |
200 | if((phi > phiMax) || (phi < phiMin)){ | |
201 | if(fDebug>10)Printf("%s:%d Not matching eta %d/%d",(char*)__FILE__,__LINE__,it,fVEvt->GetNumberOfTracks()); | |
202 | continue; | |
203 | } | |
204 | if(trackAOD->Pt() <= ptMin){ | |
205 | if(fDebug>10)Printf("%s:%d Not matching pt %d/%d",(char*)__FILE__,__LINE__,it,fVEvt->GetNumberOfTracks()); | |
206 | } | |
207 | else {cflag=1;} | |
208 | sflag=(TMath::Abs(trackAOD->GetLabel()) < 10000) ? 1 : 0; | |
209 | fCalTrkEvent->AddCalTrkTrack(trackAOD,cflag,sflag); | |
210 | goodTrackNonStd++; | |
211 | } | |
212 | } | |
213 | } | |
214 | ||
215 | if(fDebug>0)printf("Number of good tracks selected: %5d \n", goodTrackStd+goodTrackNonStd); | |
216 | ||
217 | } | |
218 | ||
219 | ||
220 | ||
221 | ||
222 | ||
223 | ||
224 | ||
225 | ||
226 | ||
227 | ||
228 | ||
229 | ||
230 |