]>
Commit | Line | Data |
---|---|---|
ee7de0dd | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //--------------------------------------------------------------------- | |
8838ab7a | 19 | // UA1 Cone Algorithm Jet finder for charged + neutral jet studies |
20 | // manages the search for jets using charged particle momentum and | |
21 | // neutral cell energy information | |
22 | // Based on UA1 V1 (from R. Diaz) | |
23 | // Author: magali.estienne@subatech.in2p3.fr | |
ee7de0dd | 24 | //--------------------------------------------------------------------- |
25 | ||
ee7de0dd | 26 | #include <TClonesArray.h> |
ee7de0dd | 27 | #include <TH1F.h> |
28 | #include <TH2F.h> | |
29 | #include <TLorentzVector.h> | |
30 | #include <TMath.h> | |
31 | #include <TRefArray.h> | |
be6e5811 | 32 | #include "TFile.h" |
ee7de0dd | 33 | |
34 | #include "AliUA1JetFinderV2.h" | |
35 | #include "AliUA1JetHeaderV1.h" | |
36 | #include "AliJetUnitArray.h" | |
ee7de0dd | 37 | |
be6e5811 | 38 | class TArrayF; |
39 | class TFile; | |
40 | class AliJetReader; | |
41 | class AliAODJet; | |
ee7de0dd | 42 | |
43 | ClassImp(AliUA1JetFinderV2) | |
44 | ||
ee7de0dd | 45 | |
8838ab7a | 46 | //////////////////////////////////////////////////////////////////////// |
9e4cc50d | 47 | AliUA1JetFinderV2::AliUA1JetFinderV2() : |
8838ab7a | 48 | AliJetFinder(), |
49 | fLego(0), | |
50 | fDebug(0), | |
51 | fOpt(0) | |
ee7de0dd | 52 | { |
8838ab7a | 53 | // |
ee7de0dd | 54 | // Constructor |
8838ab7a | 55 | // |
ee7de0dd | 56 | } |
57 | ||
58 | //////////////////////////////////////////////////////////////////////// | |
ee7de0dd | 59 | AliUA1JetFinderV2::~AliUA1JetFinderV2() |
ee7de0dd | 60 | { |
8838ab7a | 61 | // |
62 | // Destructor | |
63 | // | |
ee7de0dd | 64 | } |
65 | ||
66 | //////////////////////////////////////////////////////////////////////// | |
8838ab7a | 67 | void AliUA1JetFinderV2::FindJetsC() |
68 | { | |
69 | // | |
70 | // Used to find jets using charged particle momentum information | |
71 | // | |
72 | // 1) Fill cell map array | |
73 | // 2) calculate total energy and fluctuation level | |
74 | // 3) Run algorithm | |
75 | // 3.1) look centroides in cell map | |
76 | // 3.2) calculate total energy in cones | |
77 | // 3.3) flag as a possible jet | |
78 | // 3.4) reorder cones by energy | |
79 | // 4) subtract backg in accepted jets | |
80 | // 5) fill AliJet list | |
81 | ||
82 | // Transform input to pt,eta,phi plus lego | |
83 | ||
84 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; | |
85 | TClonesArray* lvArray = fReader->GetMomentumArray(); | |
86 | Int_t nIn = lvArray->GetEntries(); | |
87 | ||
88 | if (nIn == 0) return; | |
89 | ||
90 | // local arrays for input | |
91 | Float_t* ptT = new Float_t[nIn]; | |
92 | Float_t* etaT = new Float_t[nIn]; | |
93 | Float_t* phiT = new Float_t[nIn]; | |
94 | Float_t* cFlagT = new Float_t[nIn]; // Temporarily added | |
95 | Float_t* sFlagT = new Float_t[nIn]; // Temporarily added | |
96 | Int_t* injet = new Int_t[nIn]; | |
97 | ||
98 | //total energy in array | |
99 | Float_t etbgTotal = 0.0; | |
100 | TH1F* hPtTotal = new TH1F("hPt","Pt distribution of all particles ",100,0.0,15.0); | |
101 | ||
102 | // load input vectors and calculate total energy in array | |
103 | for (Int_t i = 0; i < nIn; i++){ | |
104 | TLorentzVector *lv = (TLorentzVector*) lvArray->At(i); | |
105 | ptT[i] = lv->Pt(); | |
106 | etaT[i] = lv->Eta(); | |
107 | phiT[i] = ((lv->Phi() < 0) ? (lv->Phi()) + 2 * TMath::Pi() : lv->Phi()); | |
be6e5811 | 108 | cFlagT[i] = fReader->GetCutFlag(i); |
109 | sFlagT[i] = fReader->GetSignalFlag(i); | |
8838ab7a | 110 | |
111 | if (fReader->GetCutFlag(i) != 1) continue; | |
112 | fLego->Fill(etaT[i], phiT[i], ptT[i]); | |
113 | hPtTotal->Fill(ptT[i]); | |
114 | etbgTotal+= ptT[i]; | |
115 | } | |
116 | ||
8838ab7a | 117 | |
118 | // calculate total energy and fluctuation in map | |
119 | Double_t meanpt = hPtTotal->GetMean(); | |
120 | Double_t ptRMS = hPtTotal->GetRMS(); | |
121 | Double_t npart = hPtTotal->GetEntries(); | |
122 | Double_t dEtTotal = (TMath::Sqrt(npart))*TMath::Sqrt(meanpt * meanpt + ptRMS*ptRMS); | |
123 | ||
124 | // arrays to hold jets | |
be6e5811 | 125 | Float_t* etaJet = new Float_t[30]; // eta jet |
126 | Float_t* phiJet = new Float_t[30]; // phi jet | |
127 | Float_t* etJet = new Float_t[30]; // et jet | |
128 | Float_t* etsigJet = new Float_t[30]; // signal et in jet | |
8838ab7a | 129 | Float_t* etallJet = new Float_t[30]; // total et in jet (tmp variable) |
130 | Int_t* ncellsJet = new Int_t[30]; | |
131 | Int_t* multJet = new Int_t[30]; | |
132 | //--- Added for jet reordering at the end of the jet finding procedure | |
133 | Float_t* etaJetOk = new Float_t[30]; | |
134 | Float_t* phiJetOk = new Float_t[30]; | |
135 | Float_t* etJetOk = new Float_t[30]; | |
be6e5811 | 136 | Float_t* etsigJetOk = new Float_t[30]; // signal et in jet |
8838ab7a | 137 | Float_t* etallJetOk = new Float_t[30]; // total et in jet (tmp variable) |
138 | Int_t* ncellsJetOk = new Int_t[30]; | |
139 | Int_t* multJetOk = new Int_t[30]; | |
140 | //-------------------------- | |
141 | Int_t nJets; // to hold number of jets found by algorithm | |
142 | Int_t nj; // number of jets accepted | |
143 | Float_t prec = header->GetPrecBg(); | |
144 | Float_t bgprec = 1; | |
145 | while(bgprec > prec){ | |
146 | //reset jet arrays in memory | |
147 | memset(etaJet,0,sizeof(Float_t)*30); | |
148 | memset(phiJet,0,sizeof(Float_t)*30); | |
149 | memset(etJet,0,sizeof(Float_t)*30); | |
150 | memset(etallJet,0,sizeof(Float_t)*30); | |
151 | memset(etsigJet,0,sizeof(Float_t)*30); | |
152 | memset(ncellsJet,0,sizeof(Int_t)*30); | |
153 | memset(multJet,0,sizeof(Int_t)*30); | |
154 | //--- Added for jet reordering at the end of the jet finding procedure | |
155 | memset(etaJetOk,0,sizeof(Float_t)*30); | |
156 | memset(phiJetOk,0,sizeof(Float_t)*30); | |
157 | memset(etJetOk,0,sizeof(Float_t)*30); | |
158 | memset(etallJetOk,0,sizeof(Float_t)*30); | |
159 | memset(etsigJetOk,0,sizeof(Float_t)*30); | |
160 | memset(ncellsJetOk,0,sizeof(Int_t)*30); | |
161 | memset(multJetOk,0,sizeof(Int_t)*30); | |
162 | //-------------------------- | |
163 | nJets = 0; | |
164 | nj = 0; | |
165 | ||
166 | // reset particles-jet array in memory | |
167 | memset(injet,-1,sizeof(Int_t)*nIn); | |
168 | //run cone algorithm finder | |
169 | RunAlgoritmC(etbgTotal,dEtTotal,nJets,etJet,etaJet,phiJet,etallJet,ncellsJet); | |
170 | ||
171 | //run background subtraction | |
172 | if(nJets > header->GetNAcceptJets()) // limited number of accepted jets per event | |
173 | nj = header->GetNAcceptJets(); | |
174 | else | |
175 | nj = nJets; | |
176 | //subtract background | |
177 | Float_t etbgTotalN = 0.0; //new background | |
178 | if(header->GetBackgMode() == 1) // standard | |
8838ab7a | 179 | SubtractBackgC(nIn,nj,etbgTotalN,ptT,etaT,phiT,etJet,etaJet,phiJet,etsigJet,multJet,injet); |
180 | if(header->GetBackgMode() == 2) //cone | |
181 | SubtractBackgCone(nIn,nj,etbgTotalN,ptT,etaT,phiT,cFlagT,sFlagT,etJet,etaJet,phiJet,etsigJet,multJet,injet); | |
182 | if(header->GetBackgMode() == 3) //ratio | |
183 | SubtractBackgRatio(nIn,nj,etbgTotalN,ptT,etaT,phiT,cFlagT,sFlagT,etJet,etaJet,phiJet,etsigJet,multJet,injet); | |
184 | if(header->GetBackgMode() == 4) //statistic | |
185 | SubtractBackgStat(nIn,nj,etbgTotalN,ptT,etaT,phiT,cFlagT,sFlagT,etJet,etaJet,phiJet,etsigJet,multJet,injet); | |
186 | //calc precision | |
187 | if(etbgTotalN != 0.0) | |
188 | bgprec = (etbgTotal - etbgTotalN)/etbgTotalN; | |
189 | else | |
190 | bgprec = 0; | |
191 | etbgTotal = etbgTotalN; // update with new background estimation | |
192 | } //end while | |
193 | ||
194 | // add jets to list | |
195 | Int_t* idxjets = new Int_t[nj]; | |
196 | Int_t nselectj = 0; | |
197 | printf("Found %d jets \n", nj); | |
ee7de0dd | 198 | |
8838ab7a | 199 | // Reorder jets by et in cone |
200 | Int_t * idx = new Int_t[nJets]; | |
201 | TMath::Sort(nJets, etJet, idx); | |
202 | for(Int_t p = 0; p < nJets; p++){ | |
203 | etaJetOk[p] = etaJet[idx[p]]; | |
204 | phiJetOk[p] = phiJet[idx[p]]; | |
205 | etJetOk[p] = etJet[idx[p]]; | |
206 | etallJetOk[p] = etJet[idx[p]]; | |
be6e5811 | 207 | etsigJetOk[p] = etsigJet[idx[p]]; |
8838ab7a | 208 | ncellsJetOk[p] = ncellsJet[idx[p]]; |
209 | multJetOk[p] = multJet[idx[p]]; | |
210 | } | |
211 | ||
212 | for(Int_t kj=0; kj<nj; kj++) | |
213 | { | |
214 | if ((etaJetOk[kj] > (header->GetJetEtaMax())) || | |
215 | (etaJetOk[kj] < (header->GetJetEtaMin())) || | |
216 | (etJetOk[kj] < header->GetMinJetEt())) continue; // acceptance eta range and etmin | |
217 | Float_t px, py,pz,en; // convert to 4-vector | |
218 | px = etJetOk[kj] * TMath::Cos(phiJetOk[kj]); | |
219 | py = etJetOk[kj] * TMath::Sin(phiJetOk[kj]); | |
220 | pz = etJetOk[kj] / TMath::Tan(2.0 * TMath::ATan(TMath::Exp(-etaJetOk[kj]))); | |
221 | en = TMath::Sqrt(px * px + py * py + pz * pz); | |
8838ab7a | 222 | |
223 | AliAODJet jet(px, py, pz, en); | |
224 | jet.Print(""); | |
225 | ||
226 | AddJet(jet); | |
227 | ||
228 | idxjets[nselectj] = kj; | |
229 | nselectj++; | |
230 | } | |
ee7de0dd | 231 | |
8838ab7a | 232 | //add signal percentage and total signal in AliJets for analysis tool |
233 | Float_t* percentage = new Float_t[nselectj]; | |
234 | Int_t* ncells = new Int_t[nselectj]; | |
235 | Int_t* mult = new Int_t[nselectj]; | |
236 | for(Int_t i = 0; i< nselectj; i++) | |
237 | { | |
238 | percentage[i] = etsigJetOk[idxjets[i]]/etJetOk[idxjets[i]]; | |
239 | ncells[i] = ncellsJetOk[idxjets[i]]; | |
240 | mult[i] = multJetOk[idxjets[i]]; | |
241 | } | |
242 | ||
243 | //add particle-injet relationship /// | |
244 | for(Int_t bj = 0; bj < nIn; bj++) | |
245 | { | |
246 | if(injet[bj] == -1) continue; //background particle | |
247 | Int_t bflag = 0; | |
248 | for(Int_t ci = 0; ci< nselectj; ci++){ | |
249 | if(injet[bj] == idxjets[ci]){ | |
250 | injet[bj]= ci; | |
251 | bflag++; | |
252 | break; | |
253 | } | |
254 | } | |
255 | if(bflag == 0) injet[bj] = -1; // set as background particle | |
256 | } | |
257 | ||
8838ab7a | 258 | |
259 | //delete | |
260 | delete[] ptT; | |
261 | delete[] etaT; | |
262 | delete[] phiT; | |
263 | delete[] cFlagT; | |
264 | delete[] sFlagT; | |
265 | delete[] injet; | |
266 | delete[] hPtTotal; | |
267 | delete[] etaJet; | |
268 | delete[] phiJet; | |
269 | delete[] etJet; | |
270 | delete[] etsigJet; | |
271 | delete[] etallJet; | |
272 | delete[] ncellsJet; | |
273 | delete[] multJet; | |
274 | delete[] idxjets; | |
275 | delete[] percentage; | |
276 | delete[] ncells; | |
277 | delete[] mult; | |
278 | //--- Added for jet reordering | |
279 | delete etaJetOk; | |
280 | delete phiJetOk; | |
281 | delete etJetOk; | |
282 | delete etsigJetOk; | |
283 | delete etallJetOk; | |
284 | delete ncellsJetOk; | |
285 | delete multJetOk; | |
286 | //-------------------------- | |
287 | ||
288 | } | |
ee7de0dd | 289 | |
8838ab7a | 290 | //////////////////////////////////////////////////////////////////////// |
291 | void AliUA1JetFinderV2::FindJets() | |
ee7de0dd | 292 | { |
8838ab7a | 293 | // |
294 | // Used to find jets using charged particle momentum information | |
295 | // & neutral energy from calo cells | |
296 | // | |
297 | // 1) Fill cell map array | |
298 | // 2) calculate total energy and fluctuation level | |
299 | // 3) Run algorithm | |
300 | // 3.1) look centroides in cell map | |
301 | // 3.2) calculate total energy in cones | |
302 | // 3.3) flag as a possible jet | |
303 | // 3.4) reorder cones by energy | |
304 | // 4) subtract backg in accepted jets | |
305 | // 5) fill AliJet list | |
ee7de0dd | 306 | |
307 | // transform input to pt,eta,phi plus lego | |
308 | ||
8838ab7a | 309 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; |
310 | TClonesArray* fUnit = fReader->GetUnitArray(); | |
311 | Int_t nCand = fReader->GetNumCandidate(); | |
312 | Int_t nCandCut = fReader->GetNumCandidateCut(); | |
313 | Int_t nIn = fUnit->GetEntries(); | |
be6e5811 | 314 | Float_t ptMin = fReader->GetReaderHeader()->GetPtCut(); |
ee7de0dd | 315 | |
be6e5811 | 316 | fDebug = fReader->GetReaderHeader()->GetDebug(); |
ee7de0dd | 317 | if (nIn == 0) return; |
318 | ||
8838ab7a | 319 | Int_t nCandidateCut = 0; |
320 | Int_t nCandidate = 0; | |
321 | ||
322 | nCandidate = nCand; | |
323 | nCandidateCut = nCandCut; | |
324 | ||
ee7de0dd | 325 | // local arrays for input No Cuts |
326 | // Both pt < ptMin and pt > ptMin | |
be6e5811 | 327 | Float_t* ptT = new Float_t[nCandidate]; |
328 | Float_t* en2T = new Float_t[nCandidate]; | |
329 | Float_t* pt2T = new Float_t[nCandidate]; | |
330 | Int_t* detT = new Int_t[nCandidate]; | |
331 | Float_t* etaT = new Float_t[nCandidate]; | |
332 | Float_t* phiT = new Float_t[nCandidate]; | |
333 | Float_t* cFlagT = new Float_t[nCandidate]; | |
334 | Float_t* cFlag2T = new Float_t[nCandidate]; | |
335 | Float_t* sFlagT = new Float_t[nCandidate]; | |
336 | Float_t* cClusterT = new Float_t[nCandidate]; | |
337 | Int_t* vectT = new Int_t[nCandidate]; | |
338 | Int_t loop1 = 0; | |
339 | Int_t* injet = new Int_t[nCandidate]; | |
340 | Int_t* sflag = new Int_t[nCandidate]; | |
341 | TRefArray* trackRef = new TRefArray(); | |
ee7de0dd | 342 | |
343 | //total energy in array | |
344 | Float_t etbgTotal = 0.0; | |
be6e5811 | 345 | TH1F* hPtTotal = new TH1F("hPt","Pt distribution of all particles ",100,0.0,15.0); |
ee7de0dd | 346 | |
347 | // Input cell info | |
be6e5811 | 348 | Float_t *etCell = new Float_t[nIn]; //! Cell Energy - Extracted from UnitArray |
349 | Float_t *etaCell = new Float_t[nIn]; //! Cell eta - Extracted from UnitArray | |
350 | Float_t *phiCell = new Float_t[nIn]; //! Cell phi - Extracted from UnitArray | |
351 | Int_t *flagCell = new Int_t[nIn]; //! Cell phi - Extracted from UnitArray | |
352 | Float_t *etCell2 = new Float_t[nIn]; //! Cell Energy - Extracted from UnitArray | |
353 | Float_t *etaCell2 = new Float_t[nIn]; //! Cell eta - Extracted from UnitArray | |
354 | Float_t *phiCell2 = new Float_t[nIn]; //! Cell phi - Extracted from UnitArray | |
8838ab7a | 355 | Int_t *flagCell2 = new Int_t[nIn]; //! Cell phi - Extracted from UnitArray |
356 | ||
ee7de0dd | 357 | // Information extracted from fUnitArray |
8838ab7a | 358 | // Load input vectors and calculate total energy in array |
ee7de0dd | 359 | for(Int_t i=0; i<nIn; i++) |
360 | { | |
8838ab7a | 361 | // Recover particle information from UnitArray |
362 | ||
ee7de0dd | 363 | AliJetUnitArray *uArray = (AliJetUnitArray*)fUnit->At(i); |
be6e5811 | 364 | TRefArray* ref = uArray->GetUnitTrackRef(); |
365 | Int_t nRef = ref->GetEntries(); | |
366 | ||
ee7de0dd | 367 | if(uArray->GetUnitEnergy()>0.){ |
be6e5811 | 368 | |
369 | for(Int_t jpart=0; jpart<nRef;jpart++) | |
370 | trackRef->Add((AliVTrack*)ref->At(jpart)); | |
ee7de0dd | 371 | ptT[loop1] = uArray->GetUnitEnergy(); |
8838ab7a | 372 | detT[loop1] = uArray->GetUnitDetectorFlag(); |
ee7de0dd | 373 | etaT[loop1] = uArray->GetUnitEta(); |
374 | phiT[loop1] = uArray->GetUnitPhi(); | |
8838ab7a | 375 | cFlagT[loop1]= uArray->GetUnitCutFlag(); // pt cut tpc |
376 | cFlag2T[loop1]= uArray->GetUnitCutFlag2(); // pt cut emcal | |
377 | sFlagT[loop1]= uArray->GetUnitSignalFlag(); | |
be6e5811 | 378 | vectT[loop1] = nRef; |
8838ab7a | 379 | if(cFlagT[loop1] == 1 || cFlag2T[loop1] == 1) { |
380 | pt2T[loop1] = 0.; | |
381 | en2T[loop1] = 0.; | |
382 | if(detT[loop1]==1){ | |
383 | en2T[loop1] = ptT[loop1] - header->GetMinCellEt(); | |
384 | if(en2T[loop1] < 0) en2T[loop1]=0; | |
385 | hPtTotal->Fill(en2T[loop1]); | |
386 | etbgTotal += en2T[loop1]; | |
387 | } | |
388 | if(detT[loop1]==0){ // TPC+ITS | |
389 | Float_t pt = 0.; | |
be6e5811 | 390 | for(Int_t j=0; j<nRef;j++){ |
8838ab7a | 391 | Float_t x=0.; Float_t y=0.; Float_t z=0.; |
be6e5811 | 392 | x = ((AliVTrack*)ref->At(j))->Px(); |
393 | y = ((AliVTrack*)ref->At(j))->Py(); | |
394 | z = ((AliVTrack*)ref->At(j))->Pz(); | |
8838ab7a | 395 | pt = TMath::Sqrt(x*x+y*y); |
be6e5811 | 396 | if(pt>ptMin) { |
8838ab7a | 397 | pt2T[loop1] += pt; |
398 | en2T[loop1] += pt; | |
399 | hPtTotal->Fill(pt); | |
400 | etbgTotal+= pt; | |
401 | } | |
402 | } | |
403 | } | |
404 | if(detT[loop1]==2) { // EMCal | |
405 | Float_t ptCTot = 0.; | |
406 | Float_t pt = 0.; | |
407 | Float_t enC = 0.; | |
be6e5811 | 408 | for(Int_t j=0; j<nRef;j++){ |
8838ab7a | 409 | Float_t x=0.; Float_t y=0.; Float_t z=0.; |
be6e5811 | 410 | x = ((AliVTrack*)ref->At(j))->Px(); |
411 | y = ((AliVTrack*)ref->At(j))->Py(); | |
412 | z = ((AliVTrack*)ref->At(j))->Pz(); | |
8838ab7a | 413 | pt = TMath::Sqrt(x*x+y*y); |
be6e5811 | 414 | if(pt>ptMin) { |
8838ab7a | 415 | pt2T[loop1]+=pt; |
416 | en2T[loop1]+=pt; | |
417 | hPtTotal->Fill(pt); | |
418 | etbgTotal+= pt; | |
419 | } | |
420 | ptCTot += pt; | |
421 | } | |
422 | enC = ptT[loop1] - ptCTot - header->GetMinCellEt(); | |
423 | if(enC < 0.) enC=0.; | |
424 | en2T[loop1] += enC; | |
425 | hPtTotal->Fill(enC); | |
426 | etbgTotal+= enC; | |
427 | } | |
ee7de0dd | 428 | } |
429 | loop1++; | |
430 | } | |
ee7de0dd | 431 | |
8838ab7a | 432 | if(uArray->GetUnitCutFlag()==1) { |
433 | if(uArray->GetUnitDetectorFlag()==1){ // EMCal case | |
434 | etCell[i] = uArray->GetUnitEnergy() - header->GetMinCellEt(); | |
435 | if ((uArray->GetUnitEnergy() - header->GetMinCellEt()) < 0.0) etCell[i]=0.; | |
436 | etaCell[i] = uArray->GetUnitEta(); | |
437 | phiCell[i] = uArray->GetUnitPhi(); | |
438 | flagCell[i] = 0; // default | |
439 | etCell2[i] = etCell[i]; | |
440 | etaCell2[i] = uArray->GetUnitEta(); | |
441 | phiCell2[i] = uArray->GetUnitPhi(); | |
442 | flagCell2[i] = 0; // default | |
443 | } | |
444 | if(uArray->GetUnitDetectorFlag()==0){ // TPC case | |
445 | Float_t pt = 0.; Float_t et1 = 0.; Float_t et2 = 0.; | |
be6e5811 | 446 | for(Int_t j=0; j<nRef;j++) |
8838ab7a | 447 | { |
448 | Float_t x=0.; Float_t y=0.; Float_t z=0.; | |
be6e5811 | 449 | x = ((AliVTrack*)ref->At(j))->Px(); |
450 | y = ((AliVTrack*)ref->At(j))->Py(); | |
451 | z = ((AliVTrack*)ref->At(j))->Pz(); | |
8838ab7a | 452 | pt = TMath::Sqrt(x*x+y*y); |
be6e5811 | 453 | if(pt>ptMin) { |
8838ab7a | 454 | et1 += pt; |
455 | et2 += pt; | |
456 | } | |
457 | } | |
458 | etCell[i] = et1; | |
459 | etCell2[i] = et2; | |
460 | if(et1 < 0.) etCell[i] = etCell2[i] = 0.; | |
461 | etaCell[i] = uArray->GetUnitEta(); | |
462 | phiCell[i] = uArray->GetUnitPhi(); | |
463 | flagCell[i] = 0; // default | |
464 | etaCell2[i] = uArray->GetUnitEta(); | |
465 | phiCell2[i] = uArray->GetUnitPhi(); | |
466 | flagCell2[i] = 0; // default | |
467 | } | |
468 | if(uArray->GetUnitDetectorFlag()==2){ // TPC + EMCal case | |
469 | Float_t ptCTot = 0.; | |
470 | Float_t pt = 0.; Float_t et1 = 0.; Float_t et2 = 0.; | |
471 | Float_t enC = 0.; | |
be6e5811 | 472 | for(Int_t j=0; j<nRef;j++) |
8838ab7a | 473 | { |
474 | Float_t x=0.; Float_t y=0.; Float_t z=0.; | |
be6e5811 | 475 | x = ((AliVTrack*)ref->At(j))->Px(); |
476 | y = ((AliVTrack*)ref->At(j))->Py(); | |
477 | z = ((AliVTrack*)ref->At(j))->Pz(); | |
8838ab7a | 478 | pt = TMath::Sqrt(x*x+y*y); |
be6e5811 | 479 | if(pt>ptMin) { |
8838ab7a | 480 | et1 += pt; |
481 | et2 += pt; | |
482 | } | |
483 | ptCTot += pt; | |
484 | } | |
485 | enC = uArray->GetUnitEnergy() - ptCTot; | |
486 | etCell[i] = et1 + enC - header->GetMinCellEt(); | |
487 | etCell2[i] = et2 + enC - header->GetMinCellEt(); | |
488 | if((enC + et1 - header->GetMinCellEt()) < 0.) etCell[i] = etCell2[i] = 0.; | |
489 | etaCell[i] = uArray->GetUnitEta(); | |
490 | phiCell[i] = uArray->GetUnitPhi(); | |
491 | flagCell[i] = 0; // default | |
492 | etaCell2[i] = uArray->GetUnitEta(); | |
493 | phiCell2[i] = uArray->GetUnitPhi(); | |
494 | flagCell2[i] = 0; // default | |
495 | } | |
496 | } | |
497 | else { | |
498 | etCell[i] = 0.; | |
499 | etaCell[i] = uArray->GetUnitEta(); | |
500 | phiCell[i] = uArray->GetUnitPhi(); | |
501 | flagCell[i] = 0; | |
502 | etCell2[i] = 0.; | |
503 | etaCell2[i] = uArray->GetUnitEta(); | |
504 | phiCell2[i] = uArray->GetUnitPhi(); | |
505 | flagCell2[i] = 0; | |
506 | } | |
507 | } // end loop on nCandidate | |
508 | ||
ee7de0dd | 509 | |
510 | // calculate total energy and fluctuation in map | |
511 | Double_t meanpt = hPtTotal->GetMean(); | |
512 | Double_t ptRMS = hPtTotal->GetRMS(); | |
513 | Double_t npart = hPtTotal->GetEntries(); | |
514 | Double_t dEtTotal = (TMath::Sqrt(npart))*TMath::Sqrt(meanpt * meanpt + ptRMS*ptRMS); | |
515 | ||
516 | // arrays to hold jets | |
8838ab7a | 517 | Float_t* etaJet = new Float_t[30]; |
518 | Float_t* phiJet = new Float_t[30]; | |
519 | Float_t* etJet = new Float_t[30]; | |
ee7de0dd | 520 | Float_t* etsigJet = new Float_t[30]; //signal et in jet |
8838ab7a | 521 | Float_t* etallJet = new Float_t[30]; // total et in jet (tmp variable) |
522 | Int_t* ncellsJet = new Int_t[30]; | |
523 | Int_t* multJet = new Int_t[30]; | |
524 | //--- Added by me for jet reordering at the end of the jet finding procedure | |
525 | Float_t* etaJetOk = new Float_t[30]; | |
526 | Float_t* phiJetOk = new Float_t[30]; | |
527 | Float_t* etJetOk = new Float_t[30]; | |
528 | Float_t* etsigJetOk = new Float_t[30]; //signal et in jet | |
529 | Float_t* etallJetOk = new Float_t[30]; // total et in jet (tmp variable) | |
530 | Int_t* ncellsJetOk = new Int_t[30]; | |
531 | Int_t* multJetOk = new Int_t[30]; | |
532 | //-------------------------- | |
533 | Int_t nJets; // to hold number of jets found by algorithm | |
534 | Int_t nj; // number of jets accepted | |
535 | Float_t prec = header->GetPrecBg(); | |
536 | Float_t bgprec = 1; | |
537 | ||
ee7de0dd | 538 | while(bgprec > prec){ |
ee7de0dd | 539 | |
8838ab7a | 540 | //reset jet arrays in memory |
541 | memset(etaJet,0,sizeof(Float_t)*30); | |
542 | memset(phiJet,0,sizeof(Float_t)*30); | |
543 | memset(etJet,0,sizeof(Float_t)*30); | |
544 | memset(etallJet,0,sizeof(Float_t)*30); | |
545 | memset(etsigJet,0,sizeof(Float_t)*30); | |
546 | memset(ncellsJet,0,sizeof(Int_t)*30); | |
547 | memset(multJet,0,sizeof(Int_t)*30); | |
548 | //--- Added by me for jet reordering at the end of the jet finding procedure | |
549 | memset(etaJetOk,0,sizeof(Float_t)*30); | |
550 | memset(phiJetOk,0,sizeof(Float_t)*30); | |
551 | memset(etJetOk,0,sizeof(Float_t)*30); | |
552 | memset(etallJetOk,0,sizeof(Float_t)*30); | |
553 | memset(etsigJetOk,0,sizeof(Float_t)*30); | |
554 | memset(ncellsJetOk,0,sizeof(Int_t)*30); | |
555 | memset(multJetOk,0,sizeof(Int_t)*30); | |
556 | ||
557 | nJets = 0; | |
558 | nj = 0; | |
559 | ||
560 | // reset particles-jet array in memory | |
561 | memset(injet,-1,sizeof(Int_t)*nCandidate); | |
562 | //run cone algorithm finder | |
563 | RunAlgoritm(nIn,etCell,etaCell,phiCell,flagCell,etCell2,etaCell2,phiCell2, | |
564 | flagCell2,etbgTotal,dEtTotal,nJets,etJet,etaJet,phiJet, | |
565 | etallJet,ncellsJet); | |
566 | ||
567 | //run background subtraction | |
568 | if(nJets > header->GetNAcceptJets()) // limited number of accepted jets per event | |
569 | nj = header->GetNAcceptJets(); | |
570 | else | |
571 | nj = nJets; | |
572 | ||
573 | //subtract background | |
574 | Float_t etbgTotalN = 0.0; //new background | |
575 | if(header->GetBackgMode() == 1) // standard | |
576 | SubtractBackg(nCandidate,nj,etbgTotalN,en2T,vectT,etaT,phiT,cFlagT,cFlag2T,sFlagT,etJet,etaJet,phiJet,etsigJet,multJet,injet); | |
577 | // To be modified ------------------------ | |
578 | if(header->GetBackgMode() == 2) //cone | |
579 | SubtractBackgCone(nCandidate,nj,etbgTotalN,ptT,etaT,phiT,cFlagT,sFlagT,etJet,etaJet,phiJet,etsigJet,multJet,injet); | |
580 | if(header->GetBackgMode() == 3) //ratio | |
581 | SubtractBackgRatio(nCandidate,nj,etbgTotalN,ptT,etaT,phiT,cFlagT,sFlagT,etJet,etaJet,phiJet,etsigJet,multJet,injet); | |
582 | if(header->GetBackgMode() == 4) //statistic | |
583 | SubtractBackgStat(nCandidate,nj,etbgTotalN,ptT,etaT,phiT,cFlagT,sFlagT,etJet,etaJet,phiJet,etsigJet,multJet,injet); | |
584 | //---------------------------------------- | |
585 | //calc precision | |
586 | if(etbgTotalN != 0.0) | |
587 | bgprec = (etbgTotal - etbgTotalN)/etbgTotalN; | |
588 | else | |
589 | bgprec = 0; | |
590 | etbgTotal = etbgTotalN; // update with new background estimation | |
591 | } //end while | |
592 | ||
ee7de0dd | 593 | // add jets to list |
594 | Int_t* idxjets = new Int_t[nj]; | |
595 | Int_t nselectj = 0; | |
596 | printf("Found %d jets \n", nj); | |
597 | ||
8838ab7a | 598 | // Reorder jets by et in cone |
599 | // Sort jets by energy | |
600 | Int_t * idx = new Int_t[nJets]; | |
601 | TMath::Sort(nJets, etJet, idx); | |
602 | for(Int_t p = 0; p < nJets; p++) | |
603 | { | |
604 | etaJetOk[p] = etaJet[idx[p]]; | |
605 | phiJetOk[p] = phiJet[idx[p]]; | |
606 | etJetOk[p] = etJet[idx[p]]; | |
607 | etallJetOk[p] = etJet[idx[p]]; | |
be6e5811 | 608 | etsigJetOk[p] = etsigJet[idx[p]]; |
8838ab7a | 609 | ncellsJetOk[p] = ncellsJet[idx[p]]; |
610 | multJetOk[p] = multJet[idx[p]]; | |
611 | } | |
612 | ||
613 | for(Int_t kj=0; kj<nj; kj++) | |
614 | { | |
615 | if ((etaJetOk[kj] > (header->GetJetEtaMax())) || | |
616 | (etaJetOk[kj] < (header->GetJetEtaMin())) || | |
617 | (etJetOk[kj] < header->GetMinJetEt())) continue; // acceptance eta range and etmin | |
ee7de0dd | 618 | Float_t px, py,pz,en; // convert to 4-vector |
8838ab7a | 619 | px = etJetOk[kj] * TMath::Cos(phiJetOk[kj]); |
620 | py = etJetOk[kj] * TMath::Sin(phiJetOk[kj]); | |
621 | pz = etJetOk[kj] / TMath::Tan(2.0 * TMath::ATan(TMath::Exp(-etaJetOk[kj]))); | |
ee7de0dd | 622 | en = TMath::Sqrt(px * px + py * py + pz * pz); |
42b0ac89 | 623 | |
ee7de0dd | 624 | AliAODJet jet(px, py, pz, en); |
625 | jet.Print(""); | |
626 | ||
627 | AddJet(jet); | |
628 | ||
629 | idxjets[nselectj] = kj; | |
630 | nselectj++; | |
8838ab7a | 631 | } |
632 | ||
ee7de0dd | 633 | //add signal percentage and total signal in AliJets for analysis tool |
634 | Float_t* percentage = new Float_t[nselectj]; | |
635 | Int_t* ncells = new Int_t[nselectj]; | |
636 | Int_t* mult = new Int_t[nselectj]; | |
8838ab7a | 637 | for(Int_t i = 0; i< nselectj; i++) |
638 | { | |
639 | percentage[i] = etsigJetOk[idxjets[i]]/etJetOk[idxjets[i]]; | |
640 | ncells[i] = ncellsJetOk[idxjets[i]]; | |
641 | mult[i] = multJetOk[idxjets[i]]; | |
642 | } | |
643 | ||
644 | //add particle-injet relationship /// | |
645 | for(Int_t bj = 0; bj < nCandidate; bj++) | |
646 | { | |
647 | if(injet[bj] == -1) continue; //background particle | |
648 | Int_t bflag = 0; | |
649 | for(Int_t ci = 0; ci< nselectj; ci++){ | |
650 | if(injet[bj] == idxjets[ci]){ | |
651 | injet[bj]= ci; | |
652 | bflag++; | |
653 | break; | |
654 | } | |
655 | } | |
656 | if(bflag == 0) injet[bj] = -1; // set as background particle | |
ee7de0dd | 657 | } |
8838ab7a | 658 | |
ee7de0dd | 659 | |
660 | //delete | |
ee7de0dd | 661 | delete ptT; |
8838ab7a | 662 | delete en2T; |
663 | delete pt2T; | |
ee7de0dd | 664 | delete etaT; |
665 | delete phiT; | |
be6e5811 | 666 | trackRef->Delete(); |
667 | delete trackRef; | |
8838ab7a | 668 | delete detT; |
ee7de0dd | 669 | delete cFlagT; |
8838ab7a | 670 | delete cFlag2T; |
671 | delete sFlagT; | |
ee7de0dd | 672 | delete cClusterT; |
8838ab7a | 673 | delete vectT; |
ee7de0dd | 674 | delete injet; |
675 | delete sflag; | |
676 | delete hPtTotal; | |
677 | delete etCell; | |
678 | delete etaCell; | |
679 | delete phiCell; | |
680 | delete flagCell; | |
8838ab7a | 681 | delete etCell2; |
682 | delete etaCell2; | |
683 | delete phiCell2; | |
684 | delete flagCell2; | |
ee7de0dd | 685 | delete etaJet; |
686 | delete phiJet; | |
687 | delete etJet; | |
688 | delete etsigJet; | |
689 | delete etallJet; | |
690 | delete ncellsJet; | |
691 | delete multJet; | |
8838ab7a | 692 | //--- Added for jet reordering |
693 | delete etaJetOk; | |
694 | delete phiJetOk; | |
695 | delete etJetOk; | |
696 | delete etsigJetOk; | |
697 | delete etallJetOk; | |
698 | delete ncellsJetOk; | |
699 | delete multJetOk; | |
700 | //-------------------------- | |
ee7de0dd | 701 | delete idxjets; |
702 | delete percentage; | |
703 | delete ncells; | |
704 | delete mult; | |
705 | ||
ee7de0dd | 706 | } |
707 | ||
708 | //////////////////////////////////////////////////////////////////////// | |
ee7de0dd | 709 | void AliUA1JetFinderV2::RunAlgoritm(Int_t nIn, Float_t* etCell, Float_t* etaCell, Float_t* phiCell, |
be6e5811 | 710 | Int_t* flagCell, const Float_t* etCell2, const Float_t* etaCell2, |
711 | const Float_t* phiCell2, const Int_t* flagCell2, Float_t etbgTotal, | |
712 | Double_t dEtTotal, Int_t& nJets, Float_t* etJet,Float_t* etaJet, | |
713 | Float_t* phiJet, Float_t* etallJet, Int_t* ncellsJet) | |
ee7de0dd | 714 | { |
be6e5811 | 715 | // |
716 | // Main method for jet finding | |
717 | // UA1 base cone finder | |
718 | // | |
719 | ||
8838ab7a | 720 | Int_t nCell = nIn; |
be6e5811 | 721 | fDebug = fReader->GetReaderHeader()->GetDebug(); |
ee7de0dd | 722 | |
8838ab7a | 723 | // Dump lego |
724 | // Check enough space! *to be done* | |
ee7de0dd | 725 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; |
8838ab7a | 726 | for(Int_t i=0; i<nCell; i++){ |
727 | etCell[i] = etCell2[i]; | |
728 | etaCell[i] = etaCell2[i]; | |
729 | phiCell[i] = phiCell2[i]; | |
730 | flagCell[i] = flagCell2[i]; | |
731 | } | |
ee7de0dd | 732 | |
733 | // Parameters from header | |
734 | Float_t minmove = header->GetMinMove(); | |
735 | Float_t maxmove = header->GetMaxMove(); | |
736 | Float_t rc = header->GetRadius(); | |
737 | Float_t etseed = header->GetEtSeed(); | |
738 | ||
8838ab7a | 739 | // Tmp array of jets form algoritm |
ee7de0dd | 740 | Float_t etaAlgoJet[30]; |
741 | Float_t phiAlgoJet[30]; | |
742 | Float_t etAlgoJet[30]; | |
743 | Int_t ncellsAlgoJet[30]; | |
744 | ||
8838ab7a | 745 | // Run algorithm// |
ee7de0dd | 746 | |
8838ab7a | 747 | // Sort cells by et |
ee7de0dd | 748 | Int_t * index = new Int_t[nCell]; |
749 | TMath::Sort(nCell, etCell, index); | |
750 | ||
8838ab7a | 751 | // Variable used in centroide loop |
9dda5307 | 752 | Float_t eta = 0.0; |
753 | Float_t phi = 0.0; | |
754 | Float_t eta0 = 0.0; | |
755 | Float_t phi0 = 0.0; | |
756 | Float_t etab = 0.0; | |
757 | Float_t phib = 0.0; | |
758 | Float_t etas = 0.0; | |
759 | Float_t phis = 0.0; | |
760 | Float_t ets = 0.0; | |
761 | Float_t deta = 0.0; | |
762 | Float_t dphi = 0.0; | |
763 | Float_t dr = 0.0; | |
764 | Float_t etsb = 0.0; | |
ee7de0dd | 765 | Float_t etasb = 0.0; |
766 | Float_t phisb = 0.0; | |
9dda5307 | 767 | Float_t dphib = 0.0; |
ee7de0dd | 768 | |
8838ab7a | 769 | for(Int_t icell = 0; icell < nCell; icell++) |
770 | { | |
9dda5307 | 771 | Int_t jcell = index[icell]; |
772 | if(etCell[jcell] <= etseed) continue; // if cell energy is low et seed | |
773 | if(flagCell[jcell] != 0) continue; // if cell was used before | |
8838ab7a | 774 | |
9dda5307 | 775 | eta = etaCell[jcell]; |
776 | phi = phiCell[jcell]; | |
777 | eta0 = eta; | |
778 | phi0 = phi; | |
779 | etab = eta; | |
780 | phib = phi; | |
781 | ets = etCell[jcell]; | |
782 | etas = 0.0; | |
783 | phis = 0.0; | |
784 | etsb = ets; | |
785 | etasb = 0.0; | |
786 | phisb = 0.0; | |
8838ab7a | 787 | for(Int_t kcell =0; kcell < nCell; kcell++) |
788 | { | |
9dda5307 | 789 | Int_t lcell = index[kcell]; |
790 | if(lcell == jcell) continue; // cell itself | |
791 | if(flagCell[lcell] != 0) continue; // cell used before | |
8838ab7a | 792 | if(etCell[lcell] > etCell[jcell]) continue; // can this happen |
9dda5307 | 793 | //calculate dr |
794 | deta = etaCell[lcell] - eta; | |
8838ab7a | 795 | dphi = TMath::Abs(phiCell[lcell] - phi); |
9dda5307 | 796 | if (dphi > TMath::Pi()) dphi = 2.0 * TMath::Pi() - dphi; |
797 | dr = TMath::Sqrt(deta * deta + dphi * dphi); | |
798 | if(dr <= rc){ | |
8838ab7a | 799 | // calculate offset from initiate cell |
800 | deta = etaCell[lcell] - eta0; | |
801 | dphi = phiCell[lcell] - phi0; | |
802 | if (dphi < -TMath::Pi()) dphi= dphi + 2.0 * TMath::Pi(); | |
803 | if (dphi > TMath::Pi()) dphi = dphi - 2.0 * TMath::Pi(); | |
804 | etas = etas + etCell[lcell]*deta; | |
805 | phis = phis + etCell[lcell]*dphi; | |
806 | ets = ets + etCell[lcell]; | |
807 | //new weighted eta and phi including this cell | |
808 | eta = eta0 + etas/ets; | |
809 | phi = phi0 + phis/ets; | |
810 | // if cone does not move much, just go to next step | |
811 | dphib = TMath::Abs(phi - phib); | |
812 | if (dphib > TMath::Pi()) dphib = 2. * TMath::Pi() - dphib; | |
813 | dr = TMath::Sqrt((eta-etab)*(eta-etab) + dphib * dphib); | |
814 | if(dr <= minmove) break; | |
815 | // cone should not move more than max_mov | |
816 | dr = TMath::Sqrt((etas/ets)*(etas/ets) + (phis/ets)*(phis/ets)); | |
817 | if(dr > maxmove){ | |
818 | eta = etab; | |
819 | phi = phib; | |
820 | ets = etsb; | |
821 | etas = etasb; | |
822 | phis = phisb; | |
823 | } else { // store this loop information | |
824 | etab = eta; | |
825 | phib = phi; | |
826 | etsb = ets; | |
827 | etasb = etas; | |
828 | phisb = phis; | |
829 | } | |
830 | } // inside cone | |
ee7de0dd | 831 | }//end of cells loop looking centroide |
832 | ||
833 | //avoid cones overloap (to be implemented in the future) | |
834 | ||
835 | //flag cells in Rc, estimate total energy in cone | |
8838ab7a | 836 | Float_t etCone = 0.0; |
837 | Int_t nCellIn = 0; | |
838 | Int_t nCellOut = 0; | |
839 | rc = header->GetRadius(); | |
840 | ||
841 | for(Int_t ncell =0; ncell < nCell; ncell++) | |
842 | { | |
843 | if(flagCell[ncell] != 0) continue; // cell used before | |
844 | //calculate dr | |
845 | deta = etaCell[ncell] - eta; | |
846 | // if(deta <= rc){ // Added to improve velocity -> to be tested | |
847 | dphi = phiCell[ncell] - phi; | |
848 | if (dphi < -TMath::Pi()) dphi= -dphi - 2.0 * TMath::Pi(); | |
849 | if (dphi > TMath::Pi()) dphi = 2.0 * TMath::Pi() - dphi; | |
850 | // if(dphi <= rc){ // Added to improve velocity -> to be tested | |
851 | dr = TMath::Sqrt(deta * deta + dphi * dphi); | |
852 | if(dr <= rc){ // cell in cone | |
853 | flagCell[ncell] = -1; | |
854 | etCone+=etCell[ncell]; | |
855 | nCellIn++; | |
856 | } | |
857 | else nCellOut++; | |
858 | // } // end deta <= rc | |
859 | // } // end dphi <= rc | |
ee7de0dd | 860 | } |
861 | ||
8838ab7a | 862 | // select jets with et > background |
863 | // estimate max fluctuation of background in cone | |
864 | Double_t ncellin = (Double_t)nCellIn; | |
865 | Double_t ntcell = (Double_t)nCell; | |
866 | Double_t etbmax = (etbgTotal + dEtTotal )*(ncellin/(ntcell)); | |
867 | // min cone et | |
868 | Double_t etcmin = etCone ; // could be used etCone - etmin !! | |
869 | //decisions !! etbmax < etcmin | |
870 | ||
871 | for(Int_t mcell =0; mcell < nCell; mcell++) | |
872 | { | |
873 | if(flagCell[mcell] == -1){ | |
874 | if(etbmax < etcmin) | |
875 | flagCell[mcell] = 1; //flag cell as used | |
876 | else | |
877 | flagCell[mcell] = 0; // leave it free | |
878 | } | |
ee7de0dd | 879 | } |
8838ab7a | 880 | //store tmp jet info !!! |
881 | if(etbmax < etcmin) | |
882 | { | |
883 | etaAlgoJet[nJets] = eta; | |
884 | phiAlgoJet[nJets] = phi; | |
885 | etAlgoJet[nJets] = etCone; | |
886 | ncellsAlgoJet[nJets] = nCellIn; | |
887 | nJets++; | |
888 | } | |
889 | ||
890 | } // end of cells loop | |
891 | ||
892 | for(Int_t p = 0; p < nJets; p++) | |
893 | { | |
894 | etaJet[p] = etaAlgoJet[p]; | |
895 | phiJet[p] = phiAlgoJet[p]; | |
896 | etJet[p] = etAlgoJet[p]; | |
897 | etallJet[p] = etAlgoJet[p]; | |
898 | ncellsJet[p] = ncellsAlgoJet[p]; | |
899 | } | |
900 | ||
901 | //delete | |
902 | delete index; | |
903 | ||
904 | } | |
905 | ||
906 | //////////////////////////////////////////////////////////////////////// | |
907 | void AliUA1JetFinderV2::RunAlgoritmC(Float_t etbgTotal, Double_t dEtTotal, Int_t& nJets, | |
908 | Float_t* etJet,Float_t* etaJet, Float_t* phiJet, | |
909 | Float_t* etallJet, Int_t* ncellsJet) | |
910 | { | |
911 | // Dump lego | |
912 | // Check enough space! *to be done* | |
913 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; | |
914 | Float_t etCell[60000]; //! Cell Energy | |
915 | Float_t etaCell[60000]; //! Cell eta | |
916 | Float_t phiCell[60000]; //! Cell phi | |
917 | Int_t flagCell[60000]; //! Cell flag | |
918 | ||
919 | Int_t nCell = 0; | |
920 | TAxis* xaxis = fLego->GetXaxis(); | |
921 | TAxis* yaxis = fLego->GetYaxis(); | |
922 | Float_t e = 0.0; | |
923 | for (Int_t i = 1; i <= header->GetLegoNbinEta(); i++) | |
924 | { | |
925 | for (Int_t j = 1; j <= header->GetLegoNbinPhi(); j++) | |
926 | { | |
927 | e = fLego->GetBinContent(i,j); | |
928 | if (e < 0.0) continue; // don't include this cells | |
929 | Float_t eta = xaxis->GetBinCenter(i); | |
930 | Float_t phi = yaxis->GetBinCenter(j); | |
931 | etCell[nCell] = e; | |
932 | etaCell[nCell] = eta; | |
933 | phiCell[nCell] = phi; | |
934 | flagCell[nCell] = 0; //default | |
935 | nCell++; | |
936 | } | |
937 | } | |
938 | ||
939 | // Parameters from header | |
940 | Float_t minmove = header->GetMinMove(); | |
941 | Float_t maxmove = header->GetMaxMove(); | |
942 | Float_t rc = header->GetRadius(); | |
943 | Float_t etseed = header->GetEtSeed(); | |
944 | ||
945 | // Tmp array of jets form algoritm | |
946 | Float_t etaAlgoJet[30]; | |
947 | Float_t phiAlgoJet[30]; | |
948 | Float_t etAlgoJet[30]; | |
949 | Int_t ncellsAlgoJet[30]; | |
950 | ||
951 | // Run algorithm// | |
952 | ||
953 | // Sort cells by et | |
954 | Int_t * index = new Int_t[nCell]; | |
955 | TMath::Sort(nCell, etCell, index); | |
956 | // variable used in centroide loop | |
957 | Float_t eta = 0.0; | |
958 | Float_t phi = 0.0; | |
959 | Float_t eta0 = 0.0; | |
960 | Float_t phi0 = 0.0; | |
961 | Float_t etab = 0.0; | |
962 | Float_t phib = 0.0; | |
963 | Float_t etas = 0.0; | |
964 | Float_t phis = 0.0; | |
965 | Float_t ets = 0.0; | |
966 | Float_t deta = 0.0; | |
967 | Float_t dphi = 0.0; | |
968 | Float_t dr = 0.0; | |
969 | Float_t etsb = 0.0; | |
970 | Float_t etasb = 0.0; | |
971 | Float_t phisb = 0.0; | |
972 | Float_t dphib = 0.0; | |
ee7de0dd | 973 | |
8838ab7a | 974 | for(Int_t icell = 0; icell < nCell; icell++) |
975 | { | |
976 | Int_t jcell = index[icell]; | |
977 | if(etCell[jcell] <= etseed) continue; // if cell energy is low et seed | |
978 | if(flagCell[jcell] != 0) continue; // if cell was used before | |
979 | ||
980 | eta = etaCell[jcell]; | |
981 | phi = phiCell[jcell]; | |
982 | eta0 = eta; | |
983 | phi0 = phi; | |
984 | etab = eta; | |
985 | phib = phi; | |
986 | ets = etCell[jcell]; | |
987 | etas = 0.0; | |
988 | phis = 0.0; | |
989 | etsb = ets; | |
990 | etasb = 0.0; | |
991 | phisb = 0.0; | |
992 | for(Int_t kcell =0; kcell < nCell; kcell++) | |
993 | { | |
994 | Int_t lcell = index[kcell]; | |
995 | if(lcell == jcell) continue; // cell itself | |
996 | if(flagCell[lcell] != 0) continue; // cell used before | |
997 | if(etCell[lcell] > etCell[jcell]) continue; // can this happen | |
998 | //calculate dr | |
999 | deta = etaCell[lcell] - eta; | |
1000 | dphi = TMath::Abs(phiCell[lcell] - phi); | |
1001 | if (dphi > TMath::Pi()) dphi = 2.0 * TMath::Pi() - dphi; | |
1002 | dr = TMath::Sqrt(deta * deta + dphi * dphi); | |
1003 | if(dr <= rc) | |
1004 | { | |
1005 | // calculate offset from initiate cell | |
1006 | deta = etaCell[lcell] - eta0; | |
1007 | dphi = phiCell[lcell] - phi0; | |
1008 | if (dphi < -TMath::Pi()) dphi= dphi + 2.0 * TMath::Pi(); | |
1009 | if (dphi > TMath::Pi()) dphi = dphi - 2.0 * TMath::Pi(); | |
1010 | etas = etas + etCell[lcell]*deta; | |
1011 | phis = phis + etCell[lcell]*dphi; | |
1012 | ets = ets + etCell[lcell]; | |
1013 | //new weighted eta and phi including this cell | |
1014 | eta = eta0 + etas/ets; | |
1015 | phi = phi0 + phis/ets; | |
1016 | // if cone does not move much, just go to next step | |
1017 | dphib = TMath::Abs(phi - phib); | |
1018 | if (dphib > TMath::Pi()) dphib = 2. * TMath::Pi() - dphib; | |
1019 | dr = TMath::Sqrt((eta-etab)*(eta-etab) + dphib * dphib); | |
1020 | if(dr <= minmove) break; | |
1021 | // cone should not move more than max_mov | |
1022 | dr = TMath::Sqrt((etas/ets)*(etas/ets) + (phis/ets)*(phis/ets)); | |
1023 | if(dr > maxmove){ | |
1024 | eta = etab; | |
1025 | phi = phib; | |
1026 | ets = etsb; | |
1027 | etas = etasb; | |
1028 | phis = phisb; | |
1029 | } else { // store this loop information | |
1030 | etab=eta; | |
1031 | phib=phi; | |
1032 | etsb = ets; | |
1033 | etasb = etas; | |
1034 | phisb = phis; | |
1035 | } | |
1036 | } // inside cone | |
1037 | }//end of cells loop looking centroide | |
1038 | ||
1039 | // Avoid cones overloap (to be implemented in the future) | |
1040 | ||
1041 | // Flag cells in Rc, estimate total energy in cone | |
1042 | Float_t etCone = 0.0; | |
1043 | Int_t nCellIn = 0; | |
1044 | Int_t nCellOut = 0; | |
1045 | rc = header->GetRadius(); | |
1046 | for(Int_t ncell =0; ncell < nCell; ncell++) | |
1047 | { | |
1048 | if(flagCell[ncell] != 0) continue; // cell used before | |
1049 | //calculate dr | |
1050 | deta = etaCell[ncell] - eta; | |
1051 | dphi = phiCell[ncell] - phi; | |
1052 | if (dphi < -TMath::Pi()) dphi= -dphi - 2.0 * TMath::Pi(); | |
1053 | if (dphi > TMath::Pi()) dphi = 2.0 * TMath::Pi() - dphi; | |
1054 | dr = TMath::Sqrt(deta * deta + dphi * dphi); | |
1055 | if(dr <= rc){ // cell in cone | |
1056 | flagCell[ncell] = -1; | |
1057 | etCone+=etCell[ncell]; | |
1058 | nCellIn++; | |
1059 | } | |
1060 | else nCellOut++; | |
1061 | } | |
1062 | ||
1063 | // Select jets with et > background | |
1064 | // estimate max fluctuation of background in cone | |
1065 | Double_t ncellin = (Double_t)nCellIn; | |
1066 | Double_t ntcell = (Double_t)nCell; | |
1067 | Double_t etbmax = (etbgTotal + dEtTotal )*(ncellin/ntcell); | |
1068 | // min cone et | |
1069 | Double_t etcmin = etCone ; // could be used etCone - etmin !! | |
1070 | //decisions !! etbmax < etcmin | |
1071 | ||
1072 | for(Int_t mcell =0; mcell < nCell; mcell++){ | |
1073 | if(flagCell[mcell] == -1){ | |
1074 | if(etbmax < etcmin) | |
1075 | flagCell[mcell] = 1; //flag cell as used | |
1076 | else | |
1077 | flagCell[mcell] = 0; // leave it free | |
1078 | } | |
1079 | } | |
1080 | //store tmp jet info !!! | |
1081 | ||
1082 | if(etbmax < etcmin) { | |
1083 | etaAlgoJet[nJets] = eta; | |
1084 | phiAlgoJet[nJets] = phi; | |
1085 | etAlgoJet[nJets] = etCone; | |
1086 | ncellsAlgoJet[nJets] = nCellIn; | |
1087 | nJets++; | |
1088 | } | |
1089 | ||
1090 | } // end of cells loop | |
ee7de0dd | 1091 | |
1092 | //reorder jets by et in cone | |
1093 | //sort jets by energy | |
1094 | Int_t * idx = new Int_t[nJets]; | |
1095 | TMath::Sort(nJets, etAlgoJet, idx); | |
8838ab7a | 1096 | for(Int_t p = 0; p < nJets; p++) |
1097 | { | |
1098 | etaJet[p] = etaAlgoJet[idx[p]]; | |
1099 | phiJet[p] = phiAlgoJet[idx[p]]; | |
1100 | etJet[p] = etAlgoJet[idx[p]]; | |
1101 | etallJet[p] = etAlgoJet[idx[p]]; | |
1102 | ncellsJet[p] = ncellsAlgoJet[idx[p]]; | |
1103 | } | |
1104 | ||
ee7de0dd | 1105 | //delete |
1106 | delete index; | |
1107 | delete idx; | |
1108 | ||
1109 | } | |
ee7de0dd | 1110 | |
8838ab7a | 1111 | //////////////////////////////////////////////////////////////////////// |
be6e5811 | 1112 | void AliUA1JetFinderV2::SubtractBackg(const Int_t& nIn, const Int_t&nJ, Float_t&etbgTotalN, const Float_t* ptT, |
1113 | const Int_t*vectT, const Float_t* etaT, const Float_t* phiT, const Float_t* cFlagT, | |
1114 | const Float_t* cFlag2T, const Float_t* sFlagT, Float_t* etJet, const Float_t* etaJet, | |
1115 | const Float_t* phiJet, Float_t* etsigJet, Int_t* multJet, Int_t* injet) | |
ee7de0dd | 1116 | { |
8838ab7a | 1117 | // |
1118 | // Background subtraction using cone method but without correction in dE/deta distribution | |
1119 | // Cases to take into account the EMCal geometry are included | |
1120 | // | |
1121 | ||
ee7de0dd | 1122 | //calculate energy inside and outside cones |
1123 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; | |
be6e5811 | 1124 | Int_t fOpt = fReader->GetReaderHeader()->GetDetector(); |
1125 | fDebug = fReader->GetReaderHeader()->GetDebug(); | |
ee7de0dd | 1126 | Float_t rc= header->GetRadius(); |
1127 | Float_t etIn[30]; | |
1128 | Float_t etOut = 0; | |
8838ab7a | 1129 | |
1130 | for(Int_t j=0;j<30;j++){etIn[j]=0.;} | |
1131 | ||
ee7de0dd | 1132 | for(Int_t jpart = 0; jpart < nIn; jpart++){ // loop for all particles in array |
8838ab7a | 1133 | |
1134 | for(Int_t ijet=0; ijet<nJ; ijet++){ | |
1135 | ||
1136 | Float_t deta = etaT[jpart] - etaJet[ijet]; | |
1137 | Float_t dphi = phiT[jpart] - phiJet[ijet]; | |
1138 | if (dphi < -TMath::Pi()) dphi= -dphi - 2.0 * TMath::Pi(); | |
1139 | if (dphi > TMath::Pi()) dphi = 2.0 * TMath::Pi() - dphi; | |
1140 | ||
1141 | Float_t dr = TMath::Sqrt(deta * deta + dphi * dphi); | |
1142 | if(dr <= rc){ // particles inside this cone | |
1143 | multJet[ijet]+=vectT[jpart]; | |
1144 | injet[jpart] = ijet; | |
1145 | ||
1146 | if(cFlagT[jpart] == 1 || cFlag2T[jpart] == 1){ // pt cut | |
1147 | etIn[ijet] += ptT[jpart]; | |
1148 | if(sFlagT[jpart] == 1) etsigJet[ijet]+= ptT[jpart]; | |
1149 | } | |
1150 | break; | |
1151 | } | |
1152 | }// end jets loop | |
1153 | ||
1154 | if(injet[jpart] == -1 && (cFlagT[jpart] == 1 || cFlag2T[jpart] == 1)){ | |
1155 | etOut += ptT[jpart]; // particle outside cones and pt cut | |
1156 | } | |
ee7de0dd | 1157 | } //end particle loop |
1158 | ||
1159 | //estimate jets and background areas | |
8838ab7a | 1160 | // TPC case |
1161 | if(fOpt == 0 || fOpt == 1){ | |
1162 | Float_t areaJet[30]; | |
1163 | Float_t areaOut = 4*(header->GetLegoEtaMax())*TMath::Pi(); | |
1164 | ||
1165 | for(Int_t k=0; k<nJ; k++){ | |
ee7de0dd | 1166 | Float_t detamax = etaJet[k] + rc; |
1167 | Float_t detamin = etaJet[k] - rc; | |
1168 | Float_t accmax = 0.0; Float_t accmin = 0.0; | |
1169 | if(detamax > header->GetLegoEtaMax()){ // sector outside etamax | |
8838ab7a | 1170 | Float_t h = header->GetLegoEtaMax() - etaJet[k]; |
1171 | accmax = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
ee7de0dd | 1172 | } |
1173 | if(detamin < header->GetLegoEtaMin()){ // sector outside etamin | |
8838ab7a | 1174 | Float_t h = header->GetLegoEtaMax() + etaJet[k]; |
1175 | accmin = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
ee7de0dd | 1176 | } |
1177 | areaJet[k] = rc*rc*TMath::Pi() - accmax - accmin; | |
1178 | areaOut = areaOut - areaJet[k]; | |
8838ab7a | 1179 | } |
1180 | //subtract background using area method | |
1181 | for(Int_t ljet=0; ljet<nJ; ljet++){ | |
1182 | Float_t areaRatio = areaJet[ljet]/areaOut; | |
1183 | etJet[ljet] = etIn[ljet]-etOut*areaRatio; // subtraction | |
1184 | } | |
1185 | ||
1186 | // estimate new total background | |
1187 | Float_t areaT = 4*(header->GetLegoEtaMax())*TMath::Pi(); | |
1188 | etbgTotalN = etOut*areaT/areaOut; | |
1189 | } | |
1190 | else { // If EMCal included | |
1191 | Float_t areaJet[30]; | |
1192 | Float_t areaOut = 2*(header->GetLegoEtaMax())*(header->GetLegoPhiMax() - header->GetLegoPhiMin()); | |
1193 | for(Int_t k=0; k<nJ; k++){ | |
1194 | Float_t detamax = etaJet[k] + rc; | |
1195 | Float_t detamin = etaJet[k] - rc; | |
1196 | Float_t dphimax = phiJet[k] + rc; | |
1197 | Float_t dphimin = phiJet[k] - rc; | |
1198 | Float_t eMax = header->GetLegoEtaMax(); | |
1199 | Float_t eMin = header->GetLegoEtaMin(); | |
1200 | Float_t pMax = header->GetLegoPhiMax(); | |
1201 | Float_t pMin = header->GetLegoPhiMin(); | |
1202 | Float_t accetamax = 0.0; Float_t accetamin = 0.0; | |
1203 | Float_t accphimax = 0.0; Float_t accphimin = 0.0; | |
1204 | if((detamax > eMax && dphimax >= (pMin+2*rc) && dphimax <= pMax )|| | |
1205 | (detamax > eMax && dphimin <= (pMax-2*rc) && dphimin >= pMin )){ | |
1206 | Float_t h = eMax - etaJet[k]; | |
1207 | accetamax = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
1208 | } | |
1209 | if((detamin < eMin && dphimax >= (pMin+2*rc) && dphimax <= pMax )|| | |
1210 | (detamin < eMin && dphimin <= (pMax-2*rc) && dphimin >= pMin )){ | |
1211 | Float_t h = eMax + etaJet[k]; | |
1212 | accetamin = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
1213 | } | |
1214 | if((dphimax > pMax && detamax >= (eMin+2*rc) && detamax <= eMax )|| | |
1215 | (dphimax > pMax && detamin <= (eMax-2*rc) && detamin >= eMin )){ | |
1216 | Float_t h = pMax - phiJet[k]; | |
1217 | accphimax = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
1218 | } | |
1219 | if((dphimin < eMin && detamax >= (eMin+2*rc) && detamax <= eMax )|| | |
1220 | (dphimin < eMin && detamin <= (eMax-2*rc) && detamin >= eMin )){ | |
1221 | Float_t h = phiJet[k] - pMin; | |
1222 | accphimin = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
1223 | } | |
1224 | ||
1225 | if(detamax > eMax && dphimax > pMax ){ | |
1226 | Float_t he = eMax - etaJet[k]; | |
1227 | Float_t hp = pMax - phiJet[k]; | |
1228 | Float_t rlim = TMath::Sqrt(pow(he,2)+pow(hp,2)); | |
1229 | Float_t alphae = TMath::ACos(he/rc); | |
1230 | Float_t alphap = TMath::ACos(hp/rc); | |
1231 | Float_t alphad = (alphae+alphap)/2-TMath::Pi()/4; | |
1232 | if(rlim <= rc){ | |
1233 | accetamax = rc*rc*alphae - he*TMath::Sqrt(rc*rc - he*he); | |
1234 | accphimax = rc*rc*alphap - hp*TMath::Sqrt(rc*rc - hp*hp); | |
1235 | } | |
1236 | if(rlim > rc){ | |
1237 | accetamax = rc*rc*alphae - he*TMath::Sqrt(rc*rc - he*he); | |
1238 | accphimax = rc*rc*alphap - hp*TMath::Sqrt(rc*rc - hp*hp)- | |
1239 | ((TMath::Sqrt(pow(rc,2)-pow(he,2))-hp)*(TMath::Sqrt(pow(rc,2)-pow(hp,2))-he))/2+ | |
1240 | rc*rc*alphad - rc*rc*TMath::Sin(alphad)*TMath::Cos(alphad); | |
1241 | } | |
1242 | } | |
1243 | ||
1244 | if(detamax > eMax && dphimin < pMin ){ | |
1245 | Float_t he = eMax - etaJet[k]; | |
1246 | Float_t hp = phiJet[k] - pMin; | |
1247 | Float_t rlim = TMath::Sqrt(pow(he,2)+pow(hp,2)); | |
1248 | Float_t alphae = TMath::ACos(he/rc); | |
1249 | Float_t alphap = TMath::ACos(hp/rc); | |
1250 | Float_t alphad = (alphae+alphap)/2-TMath::Pi()/4; | |
1251 | if(rlim <= rc){ | |
1252 | accetamax = rc*rc*alphae - he*TMath::Sqrt(rc*rc - he*he); | |
1253 | accphimin = rc*rc*alphap - hp*TMath::Sqrt(rc*rc - hp*hp); | |
1254 | } | |
1255 | if(rlim > rc){ | |
1256 | accetamax = rc*rc*alphae - he*TMath::Sqrt(rc*rc - he*he); | |
1257 | accphimin = rc*rc*alphap - hp*TMath::Sqrt(rc*rc - hp*hp)- | |
1258 | ((TMath::Sqrt(pow(rc,2)-pow(he,2))-hp)*(TMath::Sqrt(pow(rc,2)-pow(hp,2))-he))/2+ | |
1259 | rc*rc*alphad - rc*rc*TMath::Sin(alphad)*TMath::Cos(alphad); | |
1260 | } | |
1261 | } | |
1262 | ||
1263 | if(detamin < eMin && dphimax > pMax ){ | |
1264 | Float_t he = eMax + etaJet[k]; | |
1265 | Float_t hp = pMax - phiJet[k]; | |
1266 | Float_t rlim = TMath::Sqrt(pow(he,2)+pow(hp,2)); | |
1267 | Float_t alphae = TMath::ACos(he/rc); | |
1268 | Float_t alphap = TMath::ACos(hp/rc); | |
1269 | Float_t alphad = (alphae+alphap)/2-TMath::Pi()/4; | |
1270 | if(rlim <= rc){ | |
1271 | accetamin = rc*rc*alphae - he*TMath::Sqrt(rc*rc - he*he); | |
1272 | accphimax = rc*rc*alphap - hp*TMath::Sqrt(rc*rc - hp*hp); | |
1273 | } | |
1274 | if(rlim > rc){ | |
1275 | accetamin = rc*rc*alphae - he*TMath::Sqrt(rc*rc - he*he); | |
1276 | accphimax = rc*rc*alphap - hp*TMath::Sqrt(rc*rc - hp*hp)- | |
1277 | ((TMath::Sqrt(pow(rc,2)-pow(he,2))-hp)*(TMath::Sqrt(pow(rc,2)-pow(hp,2))-he))/2+ | |
1278 | rc*rc*alphad - rc*rc*TMath::Sin(alphad)*TMath::Cos(alphad); | |
1279 | } | |
1280 | } | |
1281 | ||
1282 | if(detamin < eMin && dphimin < pMin ){ | |
1283 | Float_t he = eMax + etaJet[k]; | |
1284 | Float_t hp = phiJet[k] - pMin; | |
1285 | Float_t rlim = TMath::Sqrt(pow(he,2)+pow(hp,2)); | |
1286 | Float_t alphae = TMath::ACos(he/rc); | |
1287 | Float_t alphap = TMath::ACos(hp/rc); | |
1288 | Float_t alphad = (alphae+alphap)/2-TMath::Pi()/4; | |
1289 | if(rlim <= rc){ | |
1290 | accetamin = rc*rc*alphae - he*TMath::Sqrt(rc*rc - he*he); | |
1291 | accphimin = rc*rc*alphap - hp*TMath::Sqrt(rc*rc - hp*hp); | |
1292 | } | |
1293 | if(rlim > rc){ | |
1294 | accetamin = rc*rc*alphae - he*TMath::Sqrt(rc*rc - he*he); | |
1295 | accphimin = rc*rc*alphap - hp*TMath::Sqrt(rc*rc - hp*hp)- | |
1296 | ((TMath::Sqrt(pow(rc,2)-pow(he,2))-hp)*(TMath::Sqrt(pow(rc,2)-pow(hp,2))-he))/2+ | |
1297 | rc*rc*alphad - rc*rc*TMath::Sin(alphad)*TMath::Cos(alphad); | |
1298 | } | |
1299 | } | |
1300 | areaJet[k] = rc*rc*TMath::Pi() - accetamax - accetamin - accphimax - accphimin; | |
1301 | areaOut = areaOut - areaJet[k]; | |
1302 | } // end loop on jets | |
1303 | ||
1304 | //subtract background using area method | |
1305 | for(Int_t ljet=0; ljet<nJ; ljet++){ | |
1306 | Float_t areaRatio = areaJet[ljet]/areaOut; | |
1307 | etJet[ljet] = etIn[ljet]-etOut*areaRatio; // subtraction | |
1308 | } | |
1309 | ||
1310 | // estimate new total background | |
1311 | Float_t areaT = 2*(header->GetLegoEtaMax()*header->GetLegoPhiMax()); | |
1312 | etbgTotalN = etOut*areaT/areaOut; | |
1313 | } | |
1314 | ||
1315 | } | |
1316 | ||
1317 | //////////////////////////////////////////////////////////////////////// | |
be6e5811 | 1318 | void AliUA1JetFinderV2::SubtractBackgC(const Int_t& nIn, const Int_t&nJ, Float_t&etbgTotalN, |
1319 | const Float_t* ptT, const Float_t* etaT, const Float_t* phiT, | |
1320 | Float_t* etJet, const Float_t* etaJet, const Float_t* phiJet, Float_t* etsigJet, | |
8838ab7a | 1321 | Int_t* multJet, Int_t* injet) |
1322 | { | |
1323 | //background subtraction using cone method but without correction in dE/deta distribution | |
1324 | ||
1325 | //calculate energy inside and outside cones | |
1326 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; | |
1327 | Float_t rc= header->GetRadius(); | |
1328 | Float_t etIn[30]; | |
1329 | Float_t etOut = 0; | |
1330 | for(Int_t jpart = 0; jpart < nIn; jpart++){ // loop for all particles in array | |
1331 | // if((fReader->GetCutFlag(jpart)) != 1) continue; // pt cut | |
1332 | for(Int_t ijet=0; ijet<nJ; ijet++){ | |
1333 | Float_t deta = etaT[jpart] - etaJet[ijet]; | |
1334 | Float_t dphi = phiT[jpart] - phiJet[ijet]; | |
1335 | if (dphi < -TMath::Pi()) dphi= -dphi - 2.0 * TMath::Pi(); | |
1336 | if (dphi > TMath::Pi()) dphi = 2.0 * TMath::Pi() - dphi; | |
1337 | Float_t dr = TMath::Sqrt(deta * deta + dphi * dphi); | |
1338 | if(dr <= rc){ // particles inside this cone | |
1339 | multJet[ijet]++; | |
1340 | injet[jpart] = ijet; | |
1341 | if((fReader->GetCutFlag(jpart)) == 1){ // pt cut | |
1342 | etIn[ijet] += ptT[jpart]; | |
1343 | if(fReader->GetSignalFlag(jpart) == 1) etsigJet[ijet]+= ptT[jpart]; | |
1344 | } | |
1345 | break; | |
1346 | } | |
1347 | }// end jets loop | |
1348 | if(injet[jpart] == -1 && fReader->GetCutFlag(jpart) == 1) | |
1349 | etOut += ptT[jpart]; // particle outside cones and pt cut | |
1350 | } //end particle loop | |
1351 | ||
1352 | //estimate jets and background areas | |
1353 | Float_t areaJet[30]; | |
1354 | Float_t areaOut = 4*(header->GetLegoEtaMax())*TMath::Pi(); | |
1355 | for(Int_t k=0; k<nJ; k++){ | |
1356 | Float_t detamax = etaJet[k] + rc; | |
1357 | Float_t detamin = etaJet[k] - rc; | |
1358 | Float_t accmax = 0.0; Float_t accmin = 0.0; | |
1359 | if(detamax > header->GetLegoEtaMax()){ // sector outside etamax | |
1360 | Float_t h = header->GetLegoEtaMax() - etaJet[k]; | |
1361 | accmax = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
1362 | } | |
1363 | if(detamin < header->GetLegoEtaMin()){ // sector outside etamin | |
1364 | Float_t h = header->GetLegoEtaMax() + etaJet[k]; | |
1365 | accmin = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
1366 | } | |
1367 | areaJet[k] = rc*rc*TMath::Pi() - accmax - accmin; | |
1368 | areaOut = areaOut - areaJet[k]; | |
ee7de0dd | 1369 | } |
1370 | //subtract background using area method | |
1371 | for(Int_t ljet=0; ljet<nJ; ljet++){ | |
8838ab7a | 1372 | Float_t areaRatio = areaJet[ljet]/areaOut; |
1373 | etJet[ljet] = etIn[ljet]-etOut*areaRatio; // subtraction | |
ee7de0dd | 1374 | } |
8838ab7a | 1375 | |
ee7de0dd | 1376 | // estimate new total background |
1377 | Float_t areaT = 4*(header->GetLegoEtaMax())*TMath::Pi(); | |
1378 | etbgTotalN = etOut*areaT/areaOut; | |
8838ab7a | 1379 | |
ee7de0dd | 1380 | } |
1381 | ||
ee7de0dd | 1382 | |
8838ab7a | 1383 | //////////////////////////////////////////////////////////////////////// |
be6e5811 | 1384 | void AliUA1JetFinderV2::SubtractBackgStat(const Int_t& nIn, const Int_t&nJ,Float_t&etbgTotalN, |
1385 | const Float_t* ptT, const Float_t* etaT, const Float_t* phiT, const Float_t* cFlagT, | |
1386 | const Float_t* sFlagT, Float_t* etJet, const Float_t* etaJet, const Float_t* phiJet, | |
1387 | Float_t* etsigJet, Int_t* multJet, Int_t* injet) | |
ee7de0dd | 1388 | { |
1389 | ||
1390 | //background subtraction using statistical method | |
1391 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; | |
1392 | Float_t etbgStat = header->GetBackgStat(); // pre-calculated background | |
8838ab7a | 1393 | |
ee7de0dd | 1394 | //calculate energy inside |
1395 | Float_t rc= header->GetRadius(); | |
1396 | Float_t etIn[30]; | |
8838ab7a | 1397 | |
1398 | for(Int_t jpart = 0; jpart < nIn; jpart++) | |
1399 | { // loop for all particles in array | |
1400 | ||
1401 | for(Int_t ijet=0; ijet<nJ; ijet++) | |
1402 | { | |
1403 | Float_t deta = etaT[jpart] - etaJet[ijet]; | |
1404 | Float_t dphi = phiT[jpart] - phiJet[ijet]; | |
1405 | if (dphi < -TMath::Pi()) dphi= -dphi - 2.0 * TMath::Pi(); | |
1406 | if (dphi > TMath::Pi()) dphi = 2.0 * TMath::Pi() - dphi; | |
1407 | Float_t dr = TMath::Sqrt(deta * deta + dphi * dphi); | |
1408 | if(dr <= rc){ // particles inside this cone | |
1409 | multJet[ijet]++; | |
1410 | injet[jpart] = ijet; | |
1411 | if(cFlagT[jpart] == 1){ // pt cut | |
1412 | etIn[ijet]+= ptT[jpart]; | |
1413 | if(sFlagT[jpart] == 1) etsigJet[ijet] += ptT[jpart]; | |
1414 | } | |
1415 | break; | |
1416 | } | |
1417 | }// end jets loop | |
1418 | } //end particle loop | |
1419 | ||
ee7de0dd | 1420 | //calc jets areas |
1421 | Float_t areaJet[30]; | |
1422 | Float_t areaOut = 4*(header->GetLegoEtaMax())*TMath::Pi(); | |
8838ab7a | 1423 | for(Int_t k=0; k<nJ; k++) |
1424 | { | |
ee7de0dd | 1425 | Float_t detamax = etaJet[k] + rc; |
1426 | Float_t detamin = etaJet[k] - rc; | |
1427 | Float_t accmax = 0.0; Float_t accmin = 0.0; | |
1428 | if(detamax > header->GetLegoEtaMax()){ // sector outside etamax | |
8838ab7a | 1429 | Float_t h = header->GetLegoEtaMax() - etaJet[k]; |
1430 | accmax = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
ee7de0dd | 1431 | } |
1432 | if(detamin < header->GetLegoEtaMin()){ // sector outside etamin | |
8838ab7a | 1433 | Float_t h = header->GetLegoEtaMax() + etaJet[k]; |
1434 | accmin = rc*rc*TMath::ACos(h/rc) - h*TMath::Sqrt(rc*rc - h*h); | |
ee7de0dd | 1435 | } |
1436 | areaJet[k] = rc*rc*TMath::Pi() - accmax - accmin; | |
8838ab7a | 1437 | } |
ee7de0dd | 1438 | |
1439 | //subtract background using area method | |
1440 | for(Int_t ljet=0; ljet<nJ; ljet++){ | |
8838ab7a | 1441 | Float_t areaRatio = areaJet[ljet]/areaOut; |
1442 | etJet[ljet] = etIn[ljet]-etbgStat*areaRatio; // subtraction | |
ee7de0dd | 1443 | } |
8838ab7a | 1444 | |
ee7de0dd | 1445 | etbgTotalN = etbgStat; |
ee7de0dd | 1446 | } |
1447 | ||
1448 | //////////////////////////////////////////////////////////////////////// | |
be6e5811 | 1449 | void AliUA1JetFinderV2::SubtractBackgCone(const Int_t& nIn, const Int_t&nJ,Float_t& etbgTotalN, Float_t* ptT, |
1450 | Float_t* etaT, const Float_t* phiT, const Float_t* cFlagT, const Float_t* sFlagT, | |
1451 | Float_t* etJet, const Float_t* etaJet, const Float_t* phiJet, Float_t* etsigJet, | |
8838ab7a | 1452 | Int_t* multJet, Int_t* injet) |
ee7de0dd | 1453 | { |
8838ab7a | 1454 | // Cone background subtraction method taking into acount dEt/deta distribution |
1455 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; | |
1456 | //general | |
1457 | Float_t rc= header->GetRadius(); | |
1458 | Float_t etamax = header->GetLegoEtaMax(); | |
1459 | Float_t etamin = header->GetLegoEtaMin(); | |
1460 | Int_t ndiv = 100; | |
1461 | ||
1462 | // jet energy and area arrays | |
1463 | TH1F* hEtJet[30]; | |
1464 | TH1F* hAreaJet[30]; | |
1465 | for(Int_t mjet=0; mjet<nJ; mjet++){ | |
1466 | char hEtname[256]; char hAreaname[256]; | |
1467 | sprintf(hEtname, "hEtJet%d", mjet); sprintf(hAreaname, "hAreaJet%d", mjet); | |
1468 | hEtJet[mjet] = new TH1F(hEtname,"et dist in eta ",ndiv,etamin,etamax); | |
1469 | hAreaJet[mjet] = new TH1F(hAreaname,"area dist in eta ",ndiv,etamin,etamax); | |
ee7de0dd | 1470 | } |
8838ab7a | 1471 | // background energy and area |
1472 | TH1F* hEtBackg = new TH1F("hEtBackg"," backg et dist in eta ",ndiv,etamin,etamax); | |
1473 | TH1F* hAreaBackg = new TH1F("hAreaBackg","backg area dist in eta ",ndiv,etamin,etamax); | |
1474 | ||
1475 | //fill energies | |
1476 | for(Int_t jpart = 0; jpart < nIn; jpart++){ // loop for all particles in array | |
1477 | for(Int_t ijet=0; ijet<nJ; ijet++){ // loop for all jets | |
1478 | Float_t deta = etaT[jpart] - etaJet[ijet]; | |
1479 | Float_t dphi = phiT[jpart] - phiJet[ijet]; | |
1480 | if (dphi < -TMath::Pi()) dphi= -dphi - 2.0 * TMath::Pi(); | |
1481 | if (dphi > TMath::Pi()) dphi = 2.0 * TMath::Pi() - dphi; | |
1482 | Float_t dr = TMath::Sqrt(deta * deta + dphi * dphi); | |
1483 | if(dr <= rc){ // particles inside this cone | |
1484 | injet[jpart] = ijet; | |
1485 | multJet[ijet]++; | |
1486 | if(cFlagT[jpart] == 1){// pt cut | |
1487 | hEtJet[ijet]->Fill(etaT[jpart],ptT[jpart]); //particle inside cone | |
1488 | if(sFlagT[jpart] == 1) etsigJet[ijet] += ptT[jpart]; | |
1489 | } | |
1490 | break; | |
1491 | } | |
1492 | }// end jets loop | |
1493 | ||
1494 | if(injet[jpart] == -1 && cFlagT[jpart] == 1) | |
1495 | hEtBackg->Fill(etaT[jpart],ptT[jpart]); // particle outside cones | |
ee7de0dd | 1496 | } //end particle loop |
1497 | ||
8838ab7a | 1498 | //calc areas |
1499 | Float_t eta0 = etamin; | |
1500 | Float_t etaw = (etamax - etamin)/((Float_t)ndiv); | |
1501 | Float_t eta1 = eta0 + etaw; | |
1502 | for(Int_t etabin = 0; etabin< ndiv; etabin++){ // loop for all eta bins | |
1503 | Float_t etac = eta0 + etaw/2.0; | |
1504 | Float_t areabg = etaw*2.0*TMath::Pi(); | |
1505 | for(Int_t ijet=0; ijet<nJ; ijet++){ // loop for all jets | |
1506 | Float_t deta0 = TMath::Abs(eta0 - etaJet[ijet]); | |
1507 | Float_t deta1 = TMath::Abs(eta1 - etaJet[ijet]); | |
1508 | Float_t acc0 = 0.0; Float_t acc1 = 0.0; | |
1509 | Float_t areaj = 0.0; | |
1510 | if(deta0 > rc && deta1 < rc){ | |
1511 | acc1 = rc*rc*TMath::ACos(deta1/rc) - deta1*TMath::Sqrt(rc*rc - deta1*deta1); | |
1512 | areaj = acc1; | |
1513 | } | |
1514 | if(deta0 < rc && deta1 > rc){ | |
1515 | acc0 = rc*rc*TMath::ACos(deta0/rc) - deta0*TMath::Sqrt(rc*rc - deta0*deta0); | |
1516 | areaj = acc0; | |
1517 | } | |
1518 | if(deta0 < rc && deta1 < rc){ | |
1519 | acc0 = rc*rc*TMath::ACos(deta0/rc) - deta0*TMath::Sqrt(rc*rc - deta0*deta0); | |
1520 | acc1 = rc*rc*TMath::ACos(deta1/rc) - deta1*TMath::Sqrt(rc*rc - deta1*deta1); | |
1521 | if(eta1<etaJet[ijet]) areaj = acc1-acc0; // case 1 | |
1522 | if((eta0 < etaJet[ijet]) && (etaJet[ijet]<eta1)) areaj = rc*rc*TMath::Pi() - acc1 -acc0; // case 2 | |
1523 | if(etaJet[ijet] < eta0) areaj = acc0 -acc1; // case 3 | |
1524 | } | |
1525 | hAreaJet[ijet]->Fill(etac,areaj); | |
1526 | areabg = areabg - areaj; | |
1527 | } // end jets loop | |
1528 | hAreaBackg->Fill(etac,areabg); | |
1529 | eta0 = eta1; | |
1530 | eta1 = eta1 + etaw; | |
1531 | } // end loop for all eta bins | |
1532 | ||
1533 | //subtract background | |
1534 | for(Int_t kjet=0; kjet<nJ; kjet++){ | |
1535 | etJet[kjet] = 0.0; // first clear etJet for this jet | |
1536 | for(Int_t bin = 0; bin< ndiv; bin++){ | |
1537 | if(hAreaJet[kjet]->GetBinContent(bin)){ | |
1538 | Float_t areab = hAreaBackg->GetBinContent(bin); | |
1539 | Float_t etb = hEtBackg->GetBinContent(bin); | |
1540 | Float_t areaR = (hAreaJet[kjet]->GetBinContent(bin))/areab; | |
1541 | etJet[kjet] = etJet[kjet] + ((hEtJet[kjet]->GetBinContent(bin)) - etb*areaR); //subtraction | |
1542 | } | |
1543 | } | |
1544 | } | |
ee7de0dd | 1545 | |
8838ab7a | 1546 | // calc background total |
1547 | Double_t etOut = hEtBackg->Integral(); | |
1548 | Double_t areaOut = hAreaBackg->Integral(); | |
1549 | Float_t areaT = 4*(header->GetLegoEtaMax())*TMath::Pi(); | |
1550 | etbgTotalN = etOut*areaT/areaOut; | |
1551 | ||
1552 | //delete | |
1553 | for(Int_t ljet=0; ljet<nJ; ljet++){ // loop for all jets | |
1554 | delete hEtJet[ljet]; | |
1555 | delete hAreaJet[ljet]; | |
1556 | } | |
ee7de0dd | 1557 | |
8838ab7a | 1558 | delete hEtBackg; |
1559 | delete hAreaBackg; | |
1560 | } | |
ee7de0dd | 1561 | |
8838ab7a | 1562 | //////////////////////////////////////////////////////////////////////// |
be6e5811 | 1563 | void AliUA1JetFinderV2::SubtractBackgRatio(const Int_t& nIn, const Int_t&nJ,Float_t& etbgTotalN, |
1564 | Float_t* ptT, Float_t* etaT, const Float_t* phiT, const Float_t* cFlagT, const Float_t* sFlagT, | |
1565 | Float_t* etJet, const Float_t* etaJet, const Float_t* phiJet, Float_t* etsigJet, | |
8838ab7a | 1566 | Int_t* multJet, Int_t* injet) |
ee7de0dd | 1567 | { |
8838ab7a | 1568 | // Ratio background subtraction method taking into acount dEt/deta distribution |
1569 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; | |
1570 | //factor F calc before | |
1571 | Float_t bgRatioCut = header->GetBackgCutRatio(); | |
1572 | ||
1573 | //general | |
1574 | Float_t rc= header->GetRadius(); | |
1575 | Float_t etamax = header->GetLegoEtaMax(); | |
1576 | Float_t etamin = header->GetLegoEtaMin(); | |
1577 | Int_t ndiv = 100; | |
1578 | ||
1579 | // jet energy and area arrays | |
1580 | TH1F* hEtJet[30]; | |
1581 | TH1F* hAreaJet[30]; | |
1582 | for(Int_t mjet=0; mjet<nJ; mjet++){ | |
1583 | char hEtname[256]; char hAreaname[256]; | |
1584 | sprintf(hEtname, "hEtJet%d", mjet); sprintf(hAreaname, "hAreaJet%d", mjet); | |
1585 | hEtJet[mjet] = new TH1F(hEtname,"et dist in eta ",ndiv,etamin,etamax); // change range | |
1586 | hAreaJet[mjet] = new TH1F(hAreaname,"area dist in eta ",ndiv,etamin,etamax); // change range | |
ee7de0dd | 1587 | } |
8838ab7a | 1588 | // background energy and area |
1589 | TH1F* hEtBackg = new TH1F("hEtBackg"," backg et dist in eta ",ndiv,etamin,etamax); // change range | |
1590 | TH1F* hAreaBackg = new TH1F("hAreaBackg","backg area dist in eta ",ndiv,etamin,etamax); // change range | |
1591 | ||
1592 | //fill energies | |
1593 | for(Int_t jpart = 0; jpart < nIn; jpart++){ // loop for all particles in array | |
1594 | for(Int_t ijet=0; ijet<nJ; ijet++){ // loop for all jets | |
1595 | Float_t deta = etaT[jpart] - etaJet[ijet]; | |
1596 | Float_t dphi = phiT[jpart] - phiJet[ijet]; | |
1597 | if (dphi < -TMath::Pi()) dphi= -dphi - 2.0 * TMath::Pi(); | |
1598 | if (dphi > TMath::Pi()) dphi = 2.0 * TMath::Pi() - dphi; | |
1599 | Float_t dr = TMath::Sqrt(deta * deta + dphi * dphi); | |
1600 | if(dr <= rc){ // particles inside this cone | |
1601 | multJet[ijet]++; | |
1602 | injet[jpart] = ijet; | |
1603 | if(cFlagT[jpart] == 1){ //pt cut | |
1604 | hEtJet[ijet]->Fill(etaT[jpart],ptT[jpart]); //particle inside cone and pt cut | |
1605 | if(sFlagT[jpart] == 1) etsigJet[ijet] += ptT[jpart]; | |
1606 | } | |
1607 | break; | |
1608 | } | |
1609 | }// end jets loop | |
1610 | if(injet[jpart] == -1) hEtBackg->Fill(etaT[jpart],ptT[jpart]); // particle outside cones | |
ee7de0dd | 1611 | } //end particle loop |
1612 | ||
8838ab7a | 1613 | //calc areas |
1614 | Float_t eta0 = etamin; | |
1615 | Float_t etaw = (etamax - etamin)/((Float_t)ndiv); | |
1616 | Float_t eta1 = eta0 + etaw; | |
1617 | for(Int_t etabin = 0; etabin< ndiv; etabin++){ // loop for all eta bins | |
1618 | Float_t etac = eta0 + etaw/2.0; | |
1619 | Float_t areabg = etaw*2.0*TMath::Pi(); | |
1620 | for(Int_t ijet=0; ijet<nJ; ijet++){ // loop for all jets | |
1621 | Float_t deta0 = TMath::Abs(eta0 - etaJet[ijet]); | |
1622 | Float_t deta1 = TMath::Abs(eta1 - etaJet[ijet]); | |
1623 | Float_t acc0 = 0.0; Float_t acc1 = 0.0; | |
1624 | Float_t areaj = 0.0; | |
1625 | if(deta0 > rc && deta1 < rc){ | |
1626 | acc1 = rc*rc*TMath::ACos(deta1/rc) - deta1*TMath::Sqrt(rc*rc - deta1*deta1); | |
1627 | areaj = acc1; | |
1628 | } | |
1629 | if(deta0 < rc && deta1 > rc){ | |
1630 | acc0 = rc*rc*TMath::ACos(deta0/rc) - deta0*TMath::Sqrt(rc*rc - deta0*deta0); | |
1631 | areaj = acc0; | |
1632 | } | |
1633 | if(deta0 < rc && deta1 < rc){ | |
1634 | acc0 = rc*rc*TMath::ACos(deta0/rc) - deta0*TMath::Sqrt(rc*rc - deta0*deta0); | |
1635 | acc1 = rc*rc*TMath::ACos(deta1/rc) - deta1*TMath::Sqrt(rc*rc - deta1*deta1); | |
1636 | if(eta1<etaJet[ijet]) areaj = acc1-acc0; // case 1 | |
1637 | if((eta0 < etaJet[ijet]) && (etaJet[ijet]<eta1)) areaj = rc*rc*TMath::Pi() - acc1 -acc0; // case 2 | |
1638 | if(etaJet[ijet] < eta0) areaj = acc0 -acc1; // case 3 | |
1639 | } | |
1640 | hAreaJet[ijet]->Fill(etac,areaj); | |
1641 | areabg = areabg - areaj; | |
1642 | } // end jets loop | |
1643 | hAreaBackg->Fill(etac,areabg); | |
1644 | eta0 = eta1; | |
1645 | eta1 = eta1 + etaw; | |
1646 | } // end loop for all eta bins | |
1647 | ||
1648 | //subtract background | |
1649 | for(Int_t kjet=0; kjet<nJ; kjet++){ | |
1650 | etJet[kjet] = 0.0; // first clear etJet for this jet | |
1651 | for(Int_t bin = 0; bin< ndiv; bin++){ | |
1652 | if(hAreaJet[kjet]->GetBinContent(bin)){ | |
1653 | Float_t areab = hAreaBackg->GetBinContent(bin); | |
1654 | Float_t etb = hEtBackg->GetBinContent(bin); | |
1655 | Float_t areaR = (hAreaJet[kjet]->GetBinContent(bin))/areab; | |
1656 | etJet[kjet] = etJet[kjet] + ((hEtJet[kjet]->GetBinContent(bin)) - etb*areaR*bgRatioCut); //subtraction | |
1657 | } | |
1658 | } | |
1659 | } | |
1660 | ||
1661 | // calc background total | |
1662 | Double_t etOut = hEtBackg->Integral(); | |
1663 | Double_t areaOut = hAreaBackg->Integral(); | |
1664 | Float_t areaT = 4*(header->GetLegoEtaMax())*TMath::Pi(); | |
1665 | etbgTotalN = etOut*areaT/areaOut; | |
1666 | ||
1667 | //delete | |
1668 | for(Int_t ljet=0; ljet<nJ; ljet++){ // loop for all jets | |
1669 | delete hEtJet[ljet]; | |
1670 | delete hAreaJet[ljet]; | |
1671 | } | |
1672 | ||
1673 | delete hEtBackg; | |
1674 | delete hAreaBackg; | |
ee7de0dd | 1675 | } |
1676 | ||
1677 | //////////////////////////////////////////////////////////////////////// | |
ee7de0dd | 1678 | void AliUA1JetFinderV2::Reset() |
1679 | { | |
1680 | fLego->Reset(); | |
ee7de0dd | 1681 | AliJetFinder::Reset(); |
1682 | } | |
1683 | ||
1684 | //////////////////////////////////////////////////////////////////////// | |
ee7de0dd | 1685 | void AliUA1JetFinderV2::WriteJHeaderToFile() |
1686 | { | |
1687 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; | |
1688 | header->Write(); | |
1689 | } | |
1690 | ||
1691 | //////////////////////////////////////////////////////////////////////// | |
8838ab7a | 1692 | void AliUA1JetFinderV2::InitTask(TChain* tree) |
ee7de0dd | 1693 | { |
8838ab7a | 1694 | |
ee7de0dd | 1695 | // initializes some variables |
1696 | AliUA1JetHeaderV1* header = (AliUA1JetHeaderV1*) fHeader; | |
8838ab7a | 1697 | // book lego |
1698 | fLego = new TH2F("legoH","eta-phi", | |
1699 | header->GetLegoNbinEta(), header->GetLegoEtaMin(), | |
1700 | header->GetLegoEtaMax(), header->GetLegoNbinPhi(), | |
1701 | header->GetLegoPhiMin(), header->GetLegoPhiMax()); | |
1702 | ||
ee7de0dd | 1703 | fDebug = fReader->GetReaderHeader()->GetDebug(); |
1704 | fOpt = fReader->GetReaderHeader()->GetDetector(); | |
8838ab7a | 1705 | |
1706 | // Tasks initialization | |
ee7de0dd | 1707 | if(fOpt>0) |
8838ab7a | 1708 | fReader->CreateTasks(tree); |
ee7de0dd | 1709 | |
1710 | } |