Add a protection to avoid crash in QA (Julian)
[u/mrichter/AliRoot.git] / JETAN / AliJetFillUnitArray.cxx
CommitLineData
be6e5811 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),
e36a3f22 56 fRef(0x0),
57 fSignalFlag(0),
58 fCutFlag(0),
be6e5811 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
1d49a5f4 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 //
c6265ffb 160 if (this != &rhs) {
161 fNTracks = rhs.fNTracks;
162 fNTracksCut = rhs.fNTracksCut;
163 fOpt = rhs.fOpt;
164 fDZ = rhs.fDZ;
165 fDebug = rhs.fDebug;
166 fReaderHeader = rhs.fReaderHeader;
167 fMomentumArray = rhs.fMomentumArray;
168 fUnitArray = rhs.fUnitArray;
169 fRefArray = rhs.fRefArray;
170 fRef = rhs.fRef;
171 fSignalFlag = rhs.fSignalFlag;
172 fCutFlag = rhs.fCutFlag;
173 fProcId = rhs.fProcId;
174 fTPCGrid = rhs.fTPCGrid;
175 fEMCalGrid = rhs.fEMCalGrid;
176 fGeom = rhs.fGeom;
177 fNphi = rhs.fNphi;
178 fNeta = rhs.fNeta;
179 fGrid = rhs.fGrid;
180 fPhi2 = rhs.fPhi2;
181 fEta2 = rhs.fEta2;
182 fIndex = rhs.fIndex;
183 fParams = rhs.fParams;
184 fPhiMin = rhs.fPhiMin;
185 fPhiMax = rhs.fPhiMax;
186 fEtaMin = rhs.fEtaMin;
187 fEtaMax = rhs.fEtaMax;
188 fEtaBinInTPCAcc = rhs.fEtaBinInTPCAcc;
189 fPhiBinInTPCAcc = rhs.fPhiBinInTPCAcc;
190 fEtaBinInEMCalAcc = rhs.fEtaBinInEMCalAcc;
191 fPhiBinInEMCalAcc = rhs.fPhiBinInEMCalAcc;
192 fNbinPhi = rhs.fNbinPhi;
193 }
194 return *this;
1d49a5f4 195}
196
be6e5811 197//_____________________________________________________________________________
198AliJetFillUnitArray::~AliJetFillUnitArray()
199{
200 // destructor
201}
202
203//_____________________________________________________________________________
204void AliJetFillUnitArray::GetEtaPhiFromIndex(Int_t index, Float_t &eta, Float_t &phi)
205{
206 // Get the eta,phi position from the index
207
208 for(Int_t j=0; j<fNphi+1; j++) {
209 for(Int_t i=0; i<fNeta+1; i++) {
210
211 // TPC grid only
212 //-------------------------------------
213 if(fGrid==0) {
214 if(j*(fNeta+1)+i == index) {
215 eta = fEta2->At(i);
216 phi = fPhi2->At(j);
217 }
218 }
219
220 // TPC-EMCAL grid
221 //-------------------------------------
222 Int_t ii = 0;
223 if(i==0) ii = 0;
224 if(i>0 && i<(fEtaBinInTPCAcc-fEtaBinInEMCalAcc)/2) ii = i;
225 if(i>=(fEtaBinInTPCAcc+fEtaBinInEMCalAcc)/2 && i<fNeta+1) ii = i-fEtaBinInEMCalAcc;
226
227 if(fGrid==1) {
228 if(j<(fNbinPhi+1) && j*(fNeta+1)+i == index) {
229 eta = fEta2->At(i);
230 phi = fPhi2->At(j);
231 }
232
233 if((j>=(fNbinPhi+1) && j<(fNbinPhi+1+fPhiBinInEMCalAcc)) &&
234 ((fNbinPhi+1)*(fNeta+1) + (j-fNbinPhi-1)*(fEtaBinInTPCAcc-fEtaBinInEMCalAcc) + ii)== index ) {
235 if(ii==0) {Int_t ind = 0; eta = fEta2->At(ind);}
236 else eta = fEta2->At(i);
237 phi = fPhi2->At(j);
238 }
239
240 if(j>=(fNbinPhi+1+fPhiBinInEMCalAcc) && ((fNbinPhi+1)*(fNeta+1)+fPhiBinInEMCalAcc*((fEtaBinInTPCAcc-fEtaBinInEMCalAcc))+(j-(fNbinPhi+1+fPhiBinInEMCalAcc))*(fNeta+1)+i == index)) {
241 eta = fEta2->At(i);
242 phi = fPhi2->At(j);
243 }
244 }
245 }
246 }
247}
248
249//_____________________________________________________________________________
250Float_t AliJetFillUnitArray::EtaToTheta(Float_t arg)
251{
252 return 2.*atan(exp(-arg));
253}
254
255
256
257
258
259
260