]>
Commit | Line | Data |
---|---|---|
99e5fe42 | 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 | **************************************************************************/ | |
1994c1b0 | 15 | |
16 | //------------------------------------------------------------------------- | |
99e5fe42 | 17 | // Jet ESD Reader |
18 | // ESD reader for jet analysis | |
b45b0c92 | 19 | // Authors: Mercedes Lopez Noriega (mercedes.lopez.noriega@cern.ch) |
8838ab7a | 20 | // Magali Estienne <magali.estienne@subatech.in2p3.fr> |
f45e6f72 | 21 | // |
22 | // **February 2011 | |
f445ed00 | 23 | // implemented standard geometry (AliEMCALGeometry) instead of dummy one (AliJetDummyGeo) |
f45e6f72 | 24 | // moved geometry definition in AliJetReader |
25 | // marco.bregant@subatech.in2p3.fr | |
1994c1b0 | 26 | //------------------------------------------------------------------------- |
27 | ||
ee7de0dd | 28 | // --- Standard library --- |
99e5fe42 | 29 | #include <Riostream.h> |
ee7de0dd | 30 | |
31 | // --- ROOT system --- | |
99e5fe42 | 32 | #include <TSystem.h> |
f45e6f72 | 33 | #include <TString.h> |
ee7de0dd | 34 | #include <TStopwatch.h> |
99e5fe42 | 35 | #include <TLorentzVector.h> |
83a444b1 | 36 | #include <TVector3.h> |
8838ab7a | 37 | #include "TTask.h" |
38 | #include "TTree.h" | |
39 | #include "TFile.h" | |
b45b0c92 | 40 | #include <TGeoManager.h> |
ee7de0dd | 41 | #include <assert.h> |
42 | #include <TRefArray.h> | |
43 | #include <TMath.h> | |
8838ab7a | 44 | #include <TProcessID.h> |
45 | #include <TRandom3.h> | |
ee7de0dd | 46 | |
47 | // --- AliRoot header files --- | |
99e5fe42 | 48 | #include "AliJetESDReader.h" |
49 | #include "AliJetESDReaderHeader.h" | |
1b307662 | 50 | #include "AliESDEvent.h" |
f45e6f72 | 51 | #include "AliVEvent.h" |
ac088e8a | 52 | #include "AliESD.h" |
99e5fe42 | 53 | #include "AliESDtrack.h" |
f445ed00 | 54 | #include "AliEMCALGeometry.h" |
f45e6f72 | 55 | #include "AliEMCALEMCGeometry.h" |
be6e5811 | 56 | #include "AliJetESDFillUnitArrayTracks.h" |
57 | #include "AliJetESDFillUnitArrayEMCalDigits.h" | |
e36a3f22 | 58 | #include "AliJetHadronCorrectionv1.h" |
b45b0c92 | 59 | #include "AliJetUnitArray.h" |
8838ab7a | 60 | #include "AliAnalysisTask.h" |
f45e6f72 | 61 | #include "AliOADBContainer.h" |
99e5fe42 | 62 | |
3a7af7bd | 63 | using std::cout; |
64 | using std::endl; | |
99e5fe42 | 65 | ClassImp(AliJetESDReader) |
66 | ||
1b7d5d7e | 67 | AliJetESDReader::AliJetESDReader(): |
f45e6f72 | 68 | AliJetReader(), |
ee7de0dd | 69 | fHadCorr(0x0), |
70 | fTpcGrid(0x0), | |
71 | fEmcalGrid(0x0), | |
72 | fGrid0(0), | |
73 | fGrid1(0), | |
74 | fGrid2(0), | |
75 | fGrid3(0), | |
76 | fGrid4(0), | |
be6e5811 | 77 | fApplyElectronCorrection(kFALSE), |
be6e5811 | 78 | fApplyMIPCorrection(kTRUE), |
79 | fApplyFractionHadronicCorrection(kFALSE), | |
80 | fFractionHadronicCorrection(0.3), | |
ee7de0dd | 81 | fNumUnits(0), |
82 | fDebug(0), | |
83 | fMass(0), | |
84 | fSign(0), | |
85 | fNIn(0), | |
86 | fOpt(0), | |
87 | fDZ(0), | |
88 | fNeta(0), | |
89 | fNphi(0), | |
8838ab7a | 90 | fRefArray(0x0), |
91 | fProcId(kFALSE) | |
99e5fe42 | 92 | { |
ee7de0dd | 93 | // Constructor |
99e5fe42 | 94 | } |
95 | ||
96 | //____________________________________________________________________________ | |
99e5fe42 | 97 | AliJetESDReader::~AliJetESDReader() |
98 | { | |
99 | // Destructor | |
b45b0c92 | 100 | delete fChain; |
8838ab7a | 101 | delete fTree; |
b45b0c92 | 102 | delete fESD; |
103 | delete fTpcGrid; | |
104 | delete fEmcalGrid; | |
ee7de0dd | 105 | if(fDZ) |
106 | { | |
107 | delete fGrid0; | |
108 | delete fGrid1; | |
109 | delete fGrid2; | |
110 | delete fGrid3; | |
111 | delete fGrid4; | |
112 | } | |
99e5fe42 | 113 | } |
114 | ||
115 | //____________________________________________________________________________ | |
99e5fe42 | 116 | void AliJetESDReader::OpenInputFiles() |
99e5fe42 | 117 | { |
118 | // chain for the ESDs | |
119 | fChain = new TChain("esdTree"); | |
99e5fe42 | 120 | |
121 | // get directory and pattern name from the header | |
7d0f353c | 122 | const char* dirName=fReaderHeader->GetDirectory(); |
123 | const char* pattern=fReaderHeader->GetPattern(); | |
99e5fe42 | 124 | |
ee7de0dd | 125 | // Add files matching patters to the chain |
7d0f353c | 126 | void *dir = gSystem->OpenDirectory(dirName); |
127 | const char *name = 0x0; | |
b45b0c92 | 128 | int nesd = ((AliJetESDReaderHeader*) fReaderHeader)->GetNesd(); |
7d0f353c | 129 | int a = 0; |
130 | while ((name = gSystem->GetDirEntry(dir))){ | |
131 | if (a>=nesd) continue; | |
132 | ||
133 | if (strstr(name,pattern)){ | |
ee7de0dd | 134 | printf("Adding %s\n",name); |
225f0094 | 135 | fChain->AddFile(Form("%s/%s/AliESDs.root",dirName,name)); |
ee7de0dd | 136 | a++; |
7d0f353c | 137 | } |
138 | } | |
1994c1b0 | 139 | |
140 | gSystem->FreeDirectory(dir); | |
7d0f353c | 141 | |
ee7de0dd | 142 | fESD = new AliESDEvent(); |
143 | fESD->ReadFromTree(fChain); | |
7d0f353c | 144 | |
99e5fe42 | 145 | int nMax = fChain->GetEntries(); |
7d0f353c | 146 | |
19e6695b | 147 | printf("\n AliJetESDReader: Total number of events in chain= %d \n",nMax); |
8838ab7a | 148 | |
99e5fe42 | 149 | // set number of events in header |
150 | if (fReaderHeader->GetLastEvent() == -1) | |
151 | fReaderHeader->SetLastEvent(nMax); | |
152 | else { | |
153 | Int_t nUsr = fReaderHeader->GetLastEvent(); | |
154 | fReaderHeader->SetLastEvent(TMath::Min(nMax,nUsr)); | |
155 | } | |
8838ab7a | 156 | |
99e5fe42 | 157 | } |
158 | ||
be6e5811 | 159 | //__________________________________________________________ |
160 | void AliJetESDReader::SetApplyMIPCorrection(Bool_t val) | |
161 | { | |
162 | // | |
163 | // Set flag to apply MIP correction fApplyMIPCorrection | |
164 | // - exclusive with fApplyFractionHadronicCorrection | |
165 | // | |
166 | ||
167 | fApplyMIPCorrection = val; | |
168 | if(fApplyMIPCorrection == kTRUE) | |
169 | { | |
170 | SetApplyFractionHadronicCorrection(kFALSE); | |
171 | printf("Enabling MIP Correction \n"); | |
172 | } | |
173 | else | |
174 | { | |
175 | printf("Disabling MIP Correction \n"); | |
176 | } | |
177 | } | |
178 | ||
179 | //__________________________________________________________ | |
180 | void AliJetESDReader::SetApplyFractionHadronicCorrection(Bool_t val) | |
181 | { | |
182 | // | |
183 | // Set flag to apply EMC hadronic correction fApplyFractionHadronicCorrection | |
184 | // - exclusive with fApplyMIPCorrection | |
185 | // | |
186 | ||
187 | fApplyFractionHadronicCorrection = val; | |
188 | if(fApplyFractionHadronicCorrection == kTRUE) | |
189 | { | |
190 | SetApplyMIPCorrection(kFALSE); | |
191 | printf("Enabling Fraction Hadronic Correction \n"); | |
192 | } | |
193 | else | |
194 | { | |
195 | printf("Disabling Fraction Hadronic Correction \n"); | |
196 | } | |
197 | } | |
198 | ||
199 | //__________________________________________________________ | |
200 | void AliJetESDReader::SetFractionHadronicCorrection(Double_t val) | |
201 | { | |
202 | // | |
203 | // Set value to fFractionHadronicCorrection (default is 0.3) | |
204 | // apply EMC hadronic correction fApplyFractionHadronicCorrection | |
205 | // - exclusive with fApplyMIPCorrection | |
206 | // | |
207 | ||
208 | fFractionHadronicCorrection = val; | |
209 | if(fFractionHadronicCorrection > 0.0 && fFractionHadronicCorrection <= 1.0) | |
210 | { | |
211 | SetApplyFractionHadronicCorrection(kTRUE); | |
212 | printf("Fraction Hadronic Correction %1.3f \n",fFractionHadronicCorrection); | |
213 | } | |
214 | else | |
215 | { | |
216 | SetApplyFractionHadronicCorrection(kFALSE); | |
217 | } | |
218 | } | |
219 | ||
220 | ||
ee7de0dd | 221 | //____________________________________________________________________________ |
f5c22dad | 222 | void AliJetESDReader::SetInputEvent(const TObject* esd, const TObject* /*aod*/, const TObject* /*mc*/) { |
b45b0c92 | 223 | // Connect the tree |
ac088e8a | 224 | fESD = (AliESDEvent*) esd; |
7d0f353c | 225 | } |
226 | ||
99e5fe42 | 227 | //____________________________________________________________________________ |
ae24a5a1 | 228 | Bool_t AliJetESDReader::FillMomentumArray() |
99e5fe42 | 229 | { |
1994c1b0 | 230 | // Fill momentum array |
231 | ||
99e5fe42 | 232 | Int_t goodTrack = 0; |
233 | Int_t nt = 0; | |
83a444b1 | 234 | Float_t pt, eta; |
235 | TVector3 p3; | |
1994c1b0 | 236 | |
99e5fe42 | 237 | // clear momentum array |
69b18641 | 238 | ClearArray(); |
239 | fDebug = fReaderHeader->GetDebug(); | |
ee7de0dd | 240 | fOpt = fReaderHeader->GetDetector(); |
241 | ||
7d0f353c | 242 | if (!fESD) { |
243 | return kFALSE; | |
244 | } | |
ac088e8a | 245 | |
99e5fe42 | 246 | // get number of tracks in event (for the loop) |
247 | nt = fESD->GetNumberOfTracks(); | |
ac088e8a | 248 | printf("Fill Momentum Array %5d \n", nt); |
8838ab7a | 249 | |
1994c1b0 | 250 | // temporary storage of signal and pt cut flag |
83a444b1 | 251 | Int_t* sflag = new Int_t[nt]; |
252 | Int_t* cflag = new Int_t[nt]; | |
1994c1b0 | 253 | |
99e5fe42 | 254 | // get cuts set by user |
7d0f353c | 255 | Float_t ptMin = fReaderHeader->GetPtCut(); |
83a444b1 | 256 | Float_t etaMin = fReaderHeader->GetFiducialEtaMin(); |
257 | Float_t etaMax = fReaderHeader->GetFiducialEtaMax(); | |
1994c1b0 | 258 | |
8838ab7a | 259 | //loop over tracks in ESD |
99e5fe42 | 260 | for (Int_t it = 0; it < nt; it++) { |
7d0f353c | 261 | AliESDtrack *track = fESD->GetTrack(it); |
262 | UInt_t status = track->GetStatus(); | |
263 | ||
264 | Double_t mom[3]; | |
265 | track->GetPxPyPz(mom); | |
266 | p3.SetXYZ(mom[0],mom[1],mom[2]); | |
267 | pt = p3.Pt(); | |
b45b0c92 | 268 | if ((status & AliESDtrack::kTPCrefit) == 0) continue; // quality check |
269 | if ((status & AliESDtrack::kITSrefit) == 0) continue; // quality check | |
7d0f353c | 270 | if (((AliJetESDReaderHeader*) fReaderHeader)->ReadSignalOnly() |
b45b0c92 | 271 | && TMath::Abs(track->GetLabel()) > 10000) continue; // quality check |
7d0f353c | 272 | if (((AliJetESDReaderHeader*) fReaderHeader)->ReadBkgdOnly() |
b45b0c92 | 273 | && TMath::Abs(track->GetLabel()) < 10000) continue; // quality check |
7d0f353c | 274 | eta = p3.Eta(); |
b45b0c92 | 275 | if ( (eta > etaMax) || (eta < etaMin)) continue; // checking eta cut |
7d0f353c | 276 | |
277 | new ((*fMomentumArray)[goodTrack]) TLorentzVector(p3,p3.Mag()); | |
278 | sflag[goodTrack]=0; | |
279 | if (TMath::Abs(track->GetLabel()) < 10000) sflag[goodTrack]=1; | |
280 | cflag[goodTrack]=0; | |
69b18641 | 281 | if (pt > ptMin) cflag[goodTrack]=1; // pt cut |
7d0f353c | 282 | goodTrack++; |
99e5fe42 | 283 | } |
8838ab7a | 284 | |
8011d399 | 285 | // set the signal flags |
83a444b1 | 286 | fSignalFlag.Set(goodTrack,sflag); |
287 | fCutFlag.Set(goodTrack,cflag); | |
b45b0c92 | 288 | |
58183058 | 289 | delete[] sflag; |
290 | delete[] cflag; | |
291 | ||
292 | return kTRUE; | |
8838ab7a | 293 | |
ee7de0dd | 294 | } |
295 | ||
296 | //____________________________________________________________________________ | |
8838ab7a | 297 | void AliJetESDReader::CreateTasks(TChain* tree) |
ee7de0dd | 298 | { |
8838ab7a | 299 | // |
300 | // For reader task initialization | |
301 | // | |
302 | ||
ee7de0dd | 303 | fDebug = fReaderHeader->GetDebug(); |
304 | fDZ = fReaderHeader->GetDZ(); | |
8838ab7a | 305 | fTree = tree; |
ee7de0dd | 306 | |
f45e6f72 | 307 | // Init EMCAL geometry, if needed |
308 | if(fGeom == 0) | |
309 | SetEMCALGeometry(); | |
310 | else Info(" SetEMCALGeometry","was already done.. it's called just once !!"); | |
311 | ||
8838ab7a | 312 | // Init parameters |
ee7de0dd | 313 | InitParameters(); |
8838ab7a | 314 | // Create and init unit array |
ee7de0dd | 315 | InitUnitArray(); |
316 | ||
8838ab7a | 317 | // Create global reader task for analysis |
ee7de0dd | 318 | fFillUnitArray = new TTask("fFillUnitArray","Fill unit array jet finder"); |
8838ab7a | 319 | // Create a task for to fill the charged particle information |
be6e5811 | 320 | fFillUAFromTracks = new AliJetESDFillUnitArrayTracks(); |
ee7de0dd | 321 | fFillUAFromTracks->SetReaderHeader(fReaderHeader); |
322 | fFillUAFromTracks->SetGeom(fGeom); | |
323 | fFillUAFromTracks->SetTPCGrid(fTpcGrid); | |
324 | fFillUAFromTracks->SetEMCalGrid(fEmcalGrid); | |
ee7de0dd | 325 | if(fDZ) |
8838ab7a | 326 | { // Calo dead zones inclusion |
ee7de0dd | 327 | fFillUAFromTracks->SetGrid0(fGrid0); |
328 | fFillUAFromTracks->SetGrid1(fGrid1); | |
329 | fFillUAFromTracks->SetGrid2(fGrid2); | |
330 | fFillUAFromTracks->SetGrid3(fGrid3); | |
331 | fFillUAFromTracks->SetGrid4(fGrid4); | |
332 | } | |
be6e5811 | 333 | fFillUAFromTracks->SetApplyMIPCorrection(fApplyMIPCorrection); |
ee7de0dd | 334 | fFillUAFromTracks->SetHadCorrector(fHadCorr); |
8838ab7a | 335 | // Create a task for to fill the neutral particle information |
be6e5811 | 336 | fFillUAFromEMCalDigits = new AliJetESDFillUnitArrayEMCalDigits(); |
ee7de0dd | 337 | fFillUAFromEMCalDigits->SetReaderHeader(fReaderHeader); |
338 | fFillUAFromEMCalDigits->SetGeom(fGeom); | |
339 | fFillUAFromEMCalDigits->SetTPCGrid(fTpcGrid); | |
340 | fFillUAFromEMCalDigits->SetEMCalGrid(fEmcalGrid); | |
be6e5811 | 341 | fFillUAFromEMCalDigits->SetApplyFractionHadronicCorrection(fApplyFractionHadronicCorrection); |
342 | fFillUAFromEMCalDigits->SetFractionHadronicCorrection(fFractionHadronicCorrection); | |
e36a3f22 | 343 | fFillUAFromEMCalDigits->SetApplyElectronCorrection(fApplyElectronCorrection); |
8838ab7a | 344 | // Add the task to global task |
345 | fFillUnitArray->Add(fFillUAFromTracks); | |
ee7de0dd | 346 | fFillUnitArray->Add(fFillUAFromEMCalDigits); |
347 | fFillUAFromTracks->SetActive(kFALSE); | |
348 | fFillUAFromEMCalDigits->SetActive(kFALSE); | |
349 | ||
350 | cout << "Tasks instantiated at that stage ! " << endl; | |
351 | cout << "You can loop over events now ! " << endl; | |
352 | ||
353 | } | |
354 | ||
355 | //____________________________________________________________________________ | |
8838ab7a | 356 | Bool_t AliJetESDReader::ExecTasks(Bool_t procid, TRefArray* refArray) |
ee7de0dd | 357 | { |
8838ab7a | 358 | // |
359 | // Reader task execussion | |
360 | // | |
361 | ||
362 | fProcId = procid; | |
363 | fRefArray = refArray; | |
ee7de0dd | 364 | |
8838ab7a | 365 | // clear momentum array |
ee7de0dd | 366 | ClearArray(); |
367 | ||
368 | fDebug = fReaderHeader->GetDebug(); | |
369 | fOpt = fReaderHeader->GetDetector(); | |
ee7de0dd | 370 | |
371 | if(!fESD) { | |
372 | return kFALSE; | |
373 | } | |
69b18641 | 374 | |
ee7de0dd | 375 | // TPC only or Digits+TPC or Clusters+TPC |
376 | if(fOpt%2==!0 && fOpt!=0){ | |
377 | fFillUAFromTracks->SetESD(fESD); | |
378 | fFillUAFromTracks->SetActive(kTRUE); | |
379 | fFillUAFromTracks->SetUnitArray(fUnitArray); | |
380 | fFillUAFromTracks->SetRefArray(fRefArray); | |
8838ab7a | 381 | fFillUAFromTracks->SetProcId(fProcId); |
382 | // fFillUAFromTracks->ExecuteTask("tpc"); // Temporarily changed | |
383 | fFillUAFromTracks->Exec("tpc"); // Temporarily added | |
ee7de0dd | 384 | if(fOpt==1){ |
385 | fNumCandidate = fFillUAFromTracks->GetMult(); | |
386 | fNumCandidateCut = fFillUAFromTracks->GetMultCut(); | |
387 | } | |
388 | } | |
389 | ||
390 | // Digits only or Digits+TPC | |
391 | if(fOpt>=2 && fOpt<=3){ | |
392 | fFillUAFromEMCalDigits->SetESD(fESD); | |
393 | fFillUAFromEMCalDigits->SetActive(kTRUE); | |
394 | fFillUAFromEMCalDigits->SetUnitArray(fUnitArray); | |
395 | fFillUAFromEMCalDigits->SetRefArray(fRefArray); | |
8838ab7a | 396 | fFillUAFromEMCalDigits->SetProcId(fFillUAFromTracks->GetProcId()); |
ee7de0dd | 397 | fFillUAFromEMCalDigits->SetInitMult(fFillUAFromTracks->GetMult()); |
398 | fFillUAFromEMCalDigits->SetInitMultCut(fFillUAFromTracks->GetMultCut()); | |
8838ab7a | 399 | fFillUAFromEMCalDigits->Exec("digits"); // Temporarily added |
ee7de0dd | 400 | fNumCandidate = fFillUAFromEMCalDigits->GetMult(); |
401 | fNumCandidateCut = fFillUAFromEMCalDigits->GetMultCut(); | |
b45b0c92 | 402 | } |
69b18641 | 403 | |
8838ab7a | 404 | // fFillUnitArray->ExecuteTask(); // Temporarily commented |
ee7de0dd | 405 | |
7d0f353c | 406 | return kTRUE; |
99e5fe42 | 407 | } |
408 | ||
ee7de0dd | 409 | |
410 | //____________________________________________________________________________ | |
b45b0c92 | 411 | void AliJetESDReader::InitParameters() |
412 | { | |
8838ab7a | 413 | // Initialise parameters |
414 | fOpt = fReaderHeader->GetDetector(); | |
e36a3f22 | 415 | // fHadCorr = 0; // For hadron correction |
8838ab7a | 416 | if(fEFlag==kFALSE){ |
417 | if(fOpt==0 || fOpt==1) | |
418 | fECorrection = 0; // For electron correction | |
419 | else fECorrection = 1; // For electron correction | |
420 | } | |
f45e6f72 | 421 | fNumUnits = fGeom->GetEMCGeometry()->GetNCells(); // Number of cells in EMCAL |
8838ab7a | 422 | if(fDebug>1) printf("\n EMCal parameters initiated ! \n"); |
b45b0c92 | 423 | } |
424 | ||
ee7de0dd | 425 | //____________________________________________________________________________ |
b45b0c92 | 426 | void AliJetESDReader::InitUnitArray() |
427 | { | |
8838ab7a | 428 | // |
429 | // Create and Initialise unit arrays | |
430 | // | |
431 | ||
ee7de0dd | 432 | Int_t nElements = fTpcGrid->GetNEntries(); |
433 | Float_t eta = 0., phi = 0., Deta = 0., Dphi = 0.; | |
434 | if(fArrayInitialised) fUnitArray->Delete(); | |
435 | ||
436 | if(fTpcGrid->GetGridType()==0) | |
437 | { // Fill the following quantities : | |
438 | // Good track ID, (Eta,Phi) position ID, eta, phi, energy, px, py, pz, Deta, Dphi, | |
439 | // detector flag, in/out jet, pt cut, mass, cluster ID) | |
440 | for(Int_t nBin = 1; nBin < nElements+1; nBin++) | |
441 | { | |
ee7de0dd | 442 | fTpcGrid->GetEtaPhiFromIndex2(nBin,phi,eta); |
443 | phi = ((phi < 0) ? phi + 2. * TMath::Pi() : phi); | |
444 | Deta = fTpcGrid->GetDeta(); | |
445 | Dphi = fTpcGrid->GetDphi(); | |
8838ab7a | 446 | new ((*fUnitArray)[nBin-1]) AliJetUnitArray(nBin-1,0,eta,phi,0.,Deta,Dphi,kTpc,kOutJet,kPtSmaller,kPtSmaller,kBad,0.,-1); |
ee7de0dd | 447 | } |
448 | } | |
449 | ||
450 | if(fTpcGrid->GetGridType()==1) | |
451 | { | |
452 | Int_t nGaps = 0; | |
453 | Int_t n0 = 0, n1 = 0, n2 = 0, n3 = 0, n4 = 0; | |
454 | ||
455 | if(fDZ) | |
456 | { | |
457 | // Define a grid of cell for the gaps between SM | |
458 | Double_t phimin0 = 0., phimin1 = 0., phimin2 = 0., phimin3 = 0., phimin4 = 0.; | |
459 | Double_t phimax0 = 0., phimax1 = 0., phimax2 = 0., phimax3 = 0., phimax4 = 0.; | |
f45e6f72 | 460 | fGeom->GetEMCGeometry()->GetPhiBoundariesOfSMGap(0,phimin0,phimax0); |
ee7de0dd | 461 | fGrid0 = new AliJetGrid(0,95,phimin0,phimax0,-0.7,0.7); // 0.015 x 0.015 |
462 | fGrid0->SetGridType(0); | |
463 | fGrid0->SetMatrixIndexes(); | |
464 | fGrid0->SetIndexIJ(); | |
465 | n0 = fGrid0->GetNEntries(); | |
f45e6f72 | 466 | fGeom->GetEMCGeometry()->GetPhiBoundariesOfSMGap(1,phimin1,phimax1); |
ee7de0dd | 467 | fGrid1 = new AliJetGrid(0,95,phimin1,phimax1,-0.7,0.7); // 0.015 x 0.015 |
468 | fGrid1->SetGridType(0); | |
469 | fGrid1->SetMatrixIndexes(); | |
470 | fGrid1->SetIndexIJ(); | |
471 | n1 = fGrid1->GetNEntries(); | |
f45e6f72 | 472 | fGeom->GetEMCGeometry()->GetPhiBoundariesOfSMGap(2,phimin2,phimax2); |
ee7de0dd | 473 | fGrid2 = new AliJetGrid(0,95,phimin2,phimax2,-0.7,0.7); // 0.015 x 0.015 |
474 | fGrid2->SetGridType(0); | |
475 | fGrid2->SetMatrixIndexes(); | |
476 | fGrid2->SetIndexIJ(); | |
477 | n2 = fGrid2->GetNEntries(); | |
f45e6f72 | 478 | fGeom->GetEMCGeometry()->GetPhiBoundariesOfSMGap(3,phimin3,phimax3); |
ee7de0dd | 479 | fGrid3 = new AliJetGrid(0,95,phimin3,phimax3,-0.7,0.7); // 0.015 x 0.015 |
480 | fGrid3->SetGridType(0); | |
481 | fGrid3->SetMatrixIndexes(); | |
482 | fGrid3->SetIndexIJ(); | |
483 | n3 = fGrid3->GetNEntries(); | |
f45e6f72 | 484 | fGeom->GetEMCGeometry()->GetPhiBoundariesOfSMGap(4,phimin4,phimax4); |
ee7de0dd | 485 | fGrid4 = new AliJetGrid(0,95,phimin4,phimax4,-0.7,0.7); // 0.015 x 0.015 |
486 | fGrid4->SetGridType(0); | |
487 | fGrid4->SetMatrixIndexes(); | |
488 | fGrid4->SetIndexIJ(); | |
489 | n4 = fGrid4->GetNEntries(); | |
490 | ||
ee7de0dd | 491 | nGaps = n0+n1+n2+n3+n4; |
492 | ||
493 | } | |
494 | ||
495 | for(Int_t nBin = 0; nBin < fNumUnits+nElements+nGaps; nBin++) | |
496 | { | |
497 | if(nBin<fNumUnits) | |
498 | { | |
499 | fGeom->EtaPhiFromIndex(nBin, eta, phi); // From EMCal geometry | |
500 | // fEmcalGrid->GetEtaPhiFromIndex2(nBin,phi,eta); // My function from Grid | |
501 | phi = ((phi < 0) ? phi + 2. * TMath::Pi() : phi); | |
502 | Deta = fEmcalGrid->GetDeta(); // Modify with the exact detector values | |
503 | Dphi = fEmcalGrid->GetDphi(); // Modify with the exact detector values | |
8838ab7a | 504 | new ((*fUnitArray)[nBin]) AliJetUnitArray(nBin,0,eta,phi,0.,Deta,Dphi,kTpc,kOutJet,kPtSmaller,kPtSmaller,kBad,0.,-1); |
ee7de0dd | 505 | } |
506 | else { | |
507 | if(nBin>=fNumUnits && nBin<fNumUnits+nElements){ | |
508 | fTpcGrid->GetEtaPhiFromIndex2(nBin+1-fNumUnits,phi,eta); | |
509 | phi = ((phi < 0) ? phi + 2. * TMath::Pi() : phi); | |
510 | Deta = fTpcGrid->GetDeta(); | |
511 | Dphi = fTpcGrid->GetDphi(); | |
8838ab7a | 512 | new ((*fUnitArray)[nBin]) AliJetUnitArray(nBin,0,eta,phi,0.,Deta,Dphi,kTpc,kOutJet,kPtSmaller,kPtSmaller,kBad,0.,-1); |
ee7de0dd | 513 | } |
514 | else { | |
515 | if(fDZ) { | |
516 | if(nBin>=fNumUnits+nElements && nBin<fNumUnits+nElements+nGaps){ | |
517 | if(nBin<fNumUnits+nElements+n0) | |
518 | { | |
0ceb4d78 | 519 | Float_t phi0 = eta = 0.; |
520 | fGrid0->GetEtaPhiFromIndex2(nBin+1-(fNumUnits+nElements),phi0,eta); | |
ee7de0dd | 521 | Deta = fGrid0->GetDeta(); |
522 | Dphi = fGrid0->GetDphi(); | |
0ceb4d78 | 523 | new ((*fUnitArray)[nBin]) AliJetUnitArray(nBin,0,eta,phi0,0.,Deta,Dphi,kTpc,kOutJet,kPtSmaller,kPtSmaller,kBad,0.,-1); |
ee7de0dd | 524 | } |
525 | else if(nBin>=fNumUnits+nElements+n0 && nBin<fNumUnits+nElements+n0+n1) | |
526 | { | |
673e7801 | 527 | Float_t phi0 = eta = 0.; |
528 | fGrid1->GetEtaPhiFromIndex2(nBin+1-(fNumUnits+nElements+n0),phi0,eta); | |
ee7de0dd | 529 | Deta = fGrid1->GetDeta(); |
530 | Dphi = fGrid1->GetDphi(); | |
673e7801 | 531 | new ((*fUnitArray)[nBin]) AliJetUnitArray(nBin,0,eta,phi0,0.,Deta,Dphi,kTpc,kOutJet,kPtSmaller,kPtSmaller,kBad,0.,-1); |
ee7de0dd | 532 | } |
533 | else if(nBin>=fNumUnits+nElements+n0+n1 && nBin<fNumUnits+nElements+n0+n1+n2) | |
534 | { | |
0ceb4d78 | 535 | Float_t phi0 = eta = 0.; |
536 | fGrid2->GetEtaPhiFromIndex2(nBin+1-(fNumUnits+nElements+n0+n1),phi0,eta); | |
ee7de0dd | 537 | Deta = fGrid2->GetDeta(); |
538 | Dphi = fGrid2->GetDphi(); | |
0ceb4d78 | 539 | new ((*fUnitArray)[nBin]) AliJetUnitArray(nBin,0,eta,phi0,0.,Deta,Dphi,kTpc,kOutJet,kPtSmaller,kPtSmaller,kBad,0.,-1); |
ee7de0dd | 540 | } |
541 | else if(nBin>=fNumUnits+nElements+n0+n1+n2 && nBin<fNumUnits+nElements+n0+n1+n2+n3) | |
542 | { | |
0ceb4d78 | 543 | Float_t phi0 = eta = 0.; |
544 | fGrid3->GetEtaPhiFromIndex2(nBin+1-(fNumUnits+nElements+n0+n1+n2),phi0,eta); | |
ee7de0dd | 545 | Deta = fGrid3->GetDeta(); |
546 | Dphi = fGrid3->GetDphi(); | |
0ceb4d78 | 547 | new ((*fUnitArray)[nBin]) AliJetUnitArray(nBin,0,eta,phi0,0.,Deta,Dphi,kTpc,kOutJet,kPtSmaller,kPtSmaller,kBad,0.,-1); |
ee7de0dd | 548 | } |
549 | else if(nBin>=fNumUnits+nElements+n0+n1+n2+n3 && nBin<fNumUnits+nElements+nGaps) | |
550 | { | |
0ceb4d78 | 551 | Float_t phi0 = eta = 0.; |
552 | fGrid4->GetEtaPhiFromIndex2(nBin+1-(fNumUnits+nElements+n0+n1+n2+n3),phi0,eta); | |
ee7de0dd | 553 | Deta = fGrid4->GetDeta(); |
554 | Dphi = fGrid4->GetDphi(); | |
0ceb4d78 | 555 | new ((*fUnitArray)[nBin]) AliJetUnitArray(nBin,0,eta,phi0,0.,Deta,Dphi,kTpc,kOutJet,kPtSmaller,kPtSmaller,kBad,0.,-1); |
ee7de0dd | 556 | } |
557 | } | |
558 | } // end if(fDZ) | |
559 | } // end else 2 | |
560 | } // end else 1 | |
561 | } // end loop on nBin | |
562 | } // end grid type == 1 | |
563 | fArrayInitialised = 1; | |
b45b0c92 | 564 | } |
7d0f353c | 565 | |
99e5fe42 | 566 | |
ee7de0dd | 567 |