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