Fixes to track selection for embedding in cluster task (Bastian), Do no select events...
[u/mrichter/AliRoot.git] / JETAN / AliJetFillUnitArray.cxx
... / ...
CommitLineData
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//======================================================================
18// ***July 2009
19// Fill Unit Array class
20// Base class used by AliJetESDReader to fill a UnitArray from the information extracted
21// from the particle tracks or emcal cells
22// Author: magali.estienne@subatech.in2p3.fr
23//======================================================================
24
25
26#include "AliJetFillUnitArray.h"
27
28// --- ROOT system ---
29class TSystem;
30class TLorentzVector;
31class TVector3;
32class TGeoManager;
33class TProcessID;
34
35// --- AliRoot header files ---
36class AliJetFinder;
37class AliJetReader;
38class AliJetESDReader;
39class AliJetESDReaderHeader;
40class AliJetUnitArray;
41
42ClassImp(AliJetFillUnitArray)
43
44//_____________________________________________________________________________
45AliJetFillUnitArray::AliJetFillUnitArray()
46 : TTask("AliJetFillUnitArray","Fill Unit Array with tpc/its and emcal information"),
47 fNTracks(0),
48 fNTracksCut(0),
49 fOpt(0),
50 fDZ(0),
51 fDebug(0),
52 fReaderHeader(0x0),
53 fMomentumArray(0x0),
54 fUnitArray(0x0),
55 fRefArray(0x0),
56 fRef(0x0),
57 fSignalFlag(0),
58 fCutFlag(0),
59 fProcId(kFALSE),
60 fTPCGrid(0x0),
61 fEMCalGrid(0x0),
62 fGeom(0x0),
63 fNphi(0),
64 fNeta(0),
65 fGrid(0),
66 fPhi2(0),
67 fEta2(0),
68 fIndex(0x0),
69 fParams(0x0),
70 fPhiMin(0),
71 fPhiMax(0),
72 fEtaMin(0),
73 fEtaMax(0),
74 fEtaBinInTPCAcc(0),
75 fPhiBinInTPCAcc(0),
76 fEtaBinInEMCalAcc(0),
77 fPhiBinInEMCalAcc(0),
78 fNbinPhi(0)
79{
80 // constructor
81}
82
83AliJetFillUnitArray::AliJetFillUnitArray(const AliJetFillUnitArray& cpfrom)
84 : TTask("AliJetFillUnitArray","Fill Unit Array with tpc/its and emcal information"),
85 fNTracks(0),
86 fNTracksCut(0),
87 fOpt(0),
88 fDZ(0),
89 fDebug(0),
90 fReaderHeader(0x0),
91 fMomentumArray(0x0),
92 fUnitArray(0x0),
93 fRefArray(0x0),
94 fRef(0x0),
95 fSignalFlag(0),
96 fCutFlag(0),
97 fProcId(kFALSE),
98 fTPCGrid(0x0),
99 fEMCalGrid(0x0),
100 fGeom(0x0),
101 fNphi(0),
102 fNeta(0),
103 fGrid(0),
104 fPhi2(0),
105 fEta2(0),
106 fIndex(0x0),
107 fParams(0x0),
108 fPhiMin(0),
109 fPhiMax(0),
110 fEtaMin(0),
111 fEtaMax(0),
112 fEtaBinInTPCAcc(0),
113 fPhiBinInTPCAcc(0),
114 fEtaBinInEMCalAcc(0),
115 fPhiBinInEMCalAcc(0),
116 fNbinPhi(0)
117{
118 //
119 // Copy constructor
120 //
121 fNTracks = cpfrom.fNTracks;
122 fNTracksCut = cpfrom.fNTracksCut;
123 fOpt = cpfrom.fOpt;
124 fDZ = cpfrom.fDZ;
125 fDebug = cpfrom.fDebug;
126 fReaderHeader = cpfrom.fReaderHeader;
127 fMomentumArray = cpfrom.fMomentumArray;
128 fUnitArray = cpfrom.fUnitArray;
129 fRefArray = cpfrom.fRefArray;
130 fRef = cpfrom.fRef;
131 fSignalFlag = cpfrom.fSignalFlag;
132 fCutFlag = cpfrom.fCutFlag;
133 fProcId = cpfrom.fProcId;
134 fTPCGrid = cpfrom.fTPCGrid;
135 fEMCalGrid = cpfrom.fEMCalGrid;
136 fGeom = cpfrom.fGeom;
137 fNphi = cpfrom.fNphi;
138 fNeta = cpfrom.fNeta;
139 fGrid = cpfrom.fGrid;
140 fPhi2 = cpfrom.fPhi2;
141 fEta2 = cpfrom.fEta2;
142 fIndex = cpfrom.fIndex;
143 fParams = cpfrom.fParams;
144 fPhiMin = cpfrom.fPhiMin;
145 fPhiMax = cpfrom.fPhiMax;
146 fEtaMin = cpfrom.fEtaMin;
147 fEtaMax = cpfrom.fEtaMax;
148 fEtaBinInTPCAcc = cpfrom.fEtaBinInTPCAcc;
149 fPhiBinInTPCAcc = cpfrom.fPhiBinInTPCAcc;
150 fEtaBinInEMCalAcc = cpfrom.fEtaBinInEMCalAcc;
151 fPhiBinInEMCalAcc = cpfrom.fPhiBinInEMCalAcc;
152 fNbinPhi = cpfrom.fNbinPhi;
153}
154
155AliJetFillUnitArray& AliJetFillUnitArray::operator=(const AliJetFillUnitArray& rhs)
156{
157 //
158 // Assignment operator
159 //
160 fNTracks = rhs.fNTracks;
161 fNTracksCut = rhs.fNTracksCut;
162 fOpt = rhs.fOpt;
163 fDZ = rhs.fDZ;
164 fDebug = rhs.fDebug;
165 fReaderHeader = rhs.fReaderHeader;
166 fMomentumArray = rhs.fMomentumArray;
167 fUnitArray = rhs.fUnitArray;
168 fRefArray = rhs.fRefArray;
169 fRef = rhs.fRef;
170 fSignalFlag = rhs.fSignalFlag;
171 fCutFlag = rhs.fCutFlag;
172 fProcId = rhs.fProcId;
173 fTPCGrid = rhs.fTPCGrid;
174 fEMCalGrid = rhs.fEMCalGrid;
175 fGeom = rhs.fGeom;
176 fNphi = rhs.fNphi;
177 fNeta = rhs.fNeta;
178 fGrid = rhs.fGrid;
179 fPhi2 = rhs.fPhi2;
180 fEta2 = rhs.fEta2;
181 fIndex = rhs.fIndex;
182 fParams = rhs.fParams;
183 fPhiMin = rhs.fPhiMin;
184 fPhiMax = rhs.fPhiMax;
185 fEtaMin = rhs.fEtaMin;
186 fEtaMax = rhs.fEtaMax;
187 fEtaBinInTPCAcc = rhs.fEtaBinInTPCAcc;
188 fPhiBinInTPCAcc = rhs.fPhiBinInTPCAcc;
189 fEtaBinInEMCalAcc = rhs.fEtaBinInEMCalAcc;
190 fPhiBinInEMCalAcc = rhs.fPhiBinInEMCalAcc;
191 fNbinPhi = rhs.fNbinPhi;
192 return *this;
193
194}
195
196//_____________________________________________________________________________
197AliJetFillUnitArray::~AliJetFillUnitArray()
198{
199 // destructor
200}
201
202//_____________________________________________________________________________
203void AliJetFillUnitArray::GetEtaPhiFromIndex(Int_t index, Float_t &eta, Float_t &phi)
204{
205 // Get the eta,phi position from the index
206
207 for(Int_t j=0; j<fNphi+1; j++) {
208 for(Int_t i=0; i<fNeta+1; i++) {
209
210 // TPC grid only
211 //-------------------------------------
212 if(fGrid==0) {
213 if(j*(fNeta+1)+i == index) {
214 eta = fEta2->At(i);
215 phi = fPhi2->At(j);
216 }
217 }
218
219 // TPC-EMCAL grid
220 //-------------------------------------
221 Int_t ii = 0;
222 if(i==0) ii = 0;
223 if(i>0 && i<(fEtaBinInTPCAcc-fEtaBinInEMCalAcc)/2) ii = i;
224 if(i>=(fEtaBinInTPCAcc+fEtaBinInEMCalAcc)/2 && i<fNeta+1) ii = i-fEtaBinInEMCalAcc;
225
226 if(fGrid==1) {
227 if(j<(fNbinPhi+1) && j*(fNeta+1)+i == index) {
228 eta = fEta2->At(i);
229 phi = fPhi2->At(j);
230 }
231
232 if((j>=(fNbinPhi+1) && j<(fNbinPhi+1+fPhiBinInEMCalAcc)) &&
233 ((fNbinPhi+1)*(fNeta+1) + (j-fNbinPhi-1)*(fEtaBinInTPCAcc-fEtaBinInEMCalAcc) + ii)== index ) {
234 if(ii==0) {Int_t ind = 0; eta = fEta2->At(ind);}
235 else eta = fEta2->At(i);
236 phi = fPhi2->At(j);
237 }
238
239 if(j>=(fNbinPhi+1+fPhiBinInEMCalAcc) && ((fNbinPhi+1)*(fNeta+1)+fPhiBinInEMCalAcc*((fEtaBinInTPCAcc-fEtaBinInEMCalAcc))+(j-(fNbinPhi+1+fPhiBinInEMCalAcc))*(fNeta+1)+i == index)) {
240 eta = fEta2->At(i);
241 phi = fPhi2->At(j);
242 }
243 }
244 }
245 }
246}
247
248//_____________________________________________________________________________
249Float_t AliJetFillUnitArray::EtaToTheta(Float_t arg)
250{
251 return 2.*atan(exp(-arg));
252}
253
254
255
256
257
258
259