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