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