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