]>
Commit | Line | Data |
---|---|---|
b2a297fa | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2009, 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 | /////////////////////////////////////////////////////////////////////////// | |
17 | // Dielectron Analysis Main class // | |
18 | // // | |
19 | /* | |
20 | Framework to perform event selectoin, single track selection and track pair | |
21 | selection. | |
22 | ||
23 | Convention for the signs of the pair in fPairCandidates: | |
24 | The names are available via the function PairClassName(Int_t i) | |
25 | ||
26 | 0: ev1+ ev1+ (same event like sign +) | |
27 | 1: ev1+ ev1- (same event unlike sign) | |
28 | 2: ev1- ev1- (same event like sign -) | |
29 | ||
30 | 3: ev1+ ev2+ (mixed event like sign +) | |
31 | 4: ev1- ev2+ (mixed event unlike sign -+) | |
32 | 6: ev1+ ev2- (mixed event unlike sign +-) | |
33 | 7: ev1- ev2- (mixed event like sign -) | |
34 | ||
35 | 5: ev2+ ev2+ (same event like sign +) | |
36 | 8: ev2+ ev2- (same event unlike sign) | |
37 | 9: ev2- ev2- (same event like sign -) | |
38 | ||
2a14a7b1 | 39 | 10: ev1+ ev1- (same event track rotation) |
b2a297fa | 40 | |
41 | */ | |
42 | // // | |
43 | /////////////////////////////////////////////////////////////////////////// | |
44 | ||
45 | #include <TString.h> | |
46 | #include <TList.h> | |
47 | #include <TMath.h> | |
48 | ||
49 | #include <AliESDEvent.h> | |
50 | #include <AliESDtrack.h> | |
51 | ||
52 | #include <AliVEvent.h> | |
53 | #include <AliVParticle.h> | |
54 | #include <AliVTrack.h> | |
55 | #include "AliDielectronPair.h" | |
56 | #include "AliDielectronHistos.h" | |
57 | #include "AliDielectronCF.h" | |
58 | #include "AliDielectronMC.h" | |
59 | #include "AliDielectronVarManager.h" | |
2a14a7b1 | 60 | #include "AliDielectronTrackRotator.h" |
572b0139 | 61 | #include "AliDielectronDebugTree.h" |
62 | ||
b2a297fa | 63 | #include "AliDielectron.h" |
64 | ||
65 | ClassImp(AliDielectron) | |
66 | ||
67 | const char* AliDielectron::fgkTrackClassNames[4] = { | |
68 | "ev1+", | |
69 | "ev1-", | |
70 | "ev2+", | |
71 | "ev2-" | |
72 | }; | |
73 | ||
2a14a7b1 | 74 | const char* AliDielectron::fgkPairClassNames[11] = { |
b2a297fa | 75 | "ev1+_ev1+", |
76 | "ev1+_ev1-", | |
77 | "ev1-_ev1-", | |
78 | "ev1+_ev2+", | |
79 | "ev1-_ev2+", | |
80 | "ev2+_ev2+", | |
81 | "ev1+_ev2-", | |
82 | "ev1-_ev2-", | |
83 | "ev2+_ev2-", | |
2a14a7b1 | 84 | "ev2-_ev2-", |
85 | "ev1+_ev1-_TR" | |
b2a297fa | 86 | }; |
87 | ||
88 | //________________________________________________________________ | |
89 | AliDielectron::AliDielectron() : | |
90 | TNamed("AliDielectron","AliDielectron"), | |
91 | fEventFilter("EventFilter"), | |
92 | fTrackFilter("TrackFilter"), | |
61d106d3 | 93 | fPairPreFilter("PairPreFilter"), |
94 | fPairPreFilterLegs("PairPreFilterLegs"), | |
b2a297fa | 95 | fPairFilter("PairFilter"), |
96 | fPdgMother(443), | |
8df8e382 | 97 | fPdgLeg1(11), |
98 | fPdgLeg2(11), | |
554e40f8 | 99 | fNoPairing(kFALSE), |
b2a297fa | 100 | fHistos(0x0), |
101 | fPairCandidates(new TObjArray(10)), | |
572b0139 | 102 | fCfManagerPair(0x0), |
2a14a7b1 | 103 | fTrackRotator(0x0), |
554e40f8 | 104 | fDebugTree(0x0), |
fb7d2d99 | 105 | fPreFilterUnlikeOnly(kFALSE), |
106 | fHasMC(kFALSE) | |
b2a297fa | 107 | { |
108 | // | |
109 | // Default constructor | |
110 | // | |
111 | ||
112 | } | |
113 | ||
114 | //________________________________________________________________ | |
115 | AliDielectron::AliDielectron(const char* name, const char* title) : | |
116 | TNamed(name,title), | |
117 | fEventFilter("EventFilter"), | |
118 | fTrackFilter("TrackFilter"), | |
61d106d3 | 119 | fPairPreFilter("PairPreFilter"), |
120 | fPairPreFilterLegs("PairPreFilterLegs"), | |
b2a297fa | 121 | fPairFilter("PairFilter"), |
122 | fPdgMother(443), | |
8df8e382 | 123 | fPdgLeg1(11), |
124 | fPdgLeg2(11), | |
554e40f8 | 125 | fNoPairing(kFALSE), |
b2a297fa | 126 | fHistos(0x0), |
127 | fPairCandidates(new TObjArray(10)), | |
572b0139 | 128 | fCfManagerPair(0x0), |
2a14a7b1 | 129 | fTrackRotator(0x0), |
554e40f8 | 130 | fDebugTree(0x0), |
fb7d2d99 | 131 | fPreFilterUnlikeOnly(kFALSE), |
132 | fHasMC(kFALSE) | |
b2a297fa | 133 | { |
134 | // | |
135 | // Named constructor | |
136 | // | |
137 | ||
138 | } | |
139 | ||
140 | //________________________________________________________________ | |
141 | AliDielectron::~AliDielectron() | |
142 | { | |
143 | // | |
144 | // Default destructor | |
145 | // | |
146 | if (fHistos) delete fHistos; | |
147 | if (fPairCandidates) delete fPairCandidates; | |
572b0139 | 148 | if (fDebugTree) delete fDebugTree; |
b2a297fa | 149 | } |
150 | ||
151 | //________________________________________________________________ | |
152 | void AliDielectron::Init() | |
153 | { | |
154 | // | |
155 | // Initialise objects | |
156 | // | |
fb7d2d99 | 157 | |
158 | if(GetHasMC()) AliDielectronMC::Instance()->SetHasMC(GetHasMC()); | |
159 | ||
b2a297fa | 160 | if (fCfManagerPair) fCfManagerPair->InitialiseContainer(fPairFilter); |
1201a1a9 | 161 | if (fTrackRotator) { |
162 | fTrackRotator->SetTrackArrays(&fTracks[0],&fTracks[1]); | |
163 | fTrackRotator->SetPdgLegs(fPdgLeg1,fPdgLeg2); | |
164 | } | |
8df8e382 | 165 | if (fDebugTree) fDebugTree->SetDielectron(this); |
572b0139 | 166 | } |
b2a297fa | 167 | |
168 | //________________________________________________________________ | |
169 | void AliDielectron::Process(AliVEvent *ev1, AliVEvent *ev2) | |
170 | { | |
171 | // | |
172 | // Process the events | |
173 | // | |
174 | ||
45b2b1b8 | 175 | //at least first event is needed! |
176 | if (!ev1){ | |
177 | AliError("At least first event must be set!"); | |
178 | return; | |
179 | } | |
180 | ||
572b0139 | 181 | AliDielectronVarManager::SetEvent(ev1); |
6551594b | 182 | |
b2a297fa | 183 | //in case we have MC load the MC event and process the MC particles |
572b0139 | 184 | if (AliDielectronMC::Instance()->HasMC()) { |
61d106d3 | 185 | if (!AliDielectronMC::Instance()->ConnectMCEvent()){ |
186 | AliError("Could not properly connect the MC event, skipping this event!"); | |
187 | return; | |
188 | } | |
572b0139 | 189 | ProcessMC(); |
190 | } | |
b2a297fa | 191 | |
192 | //if candidate array doesn't exist, create it | |
193 | if (!fPairCandidates->UncheckedAt(0)) { | |
194 | InitPairCandidateArrays(); | |
195 | } else { | |
196 | ClearArrays(); | |
197 | } | |
198 | ||
199 | //mask used to require that all cuts are fulfilled | |
200 | UInt_t selectedMask=(1<<fEventFilter.GetCuts()->GetEntries())-1; | |
201 | ||
202 | //apply event cuts | |
37e9382d | 203 | if ((ev1&&fEventFilter.IsSelected(ev1)!=selectedMask) || |
204 | (ev2&&fEventFilter.IsSelected(ev2)!=selectedMask)) return; | |
6551594b | 205 | |
206 | AliDielectronVarManager::SetEvent(ev1); | |
207 | ||
b2a297fa | 208 | //fill track arrays for the first event |
554e40f8 | 209 | if (ev1){ |
210 | FillTrackArrays(ev1); | |
211 | if ((fPreFilterUnlikeOnly) && ( fPairPreFilter.GetCuts()->GetEntries()>0 )) PairPreFilter(0, 1, fTracks[0], fTracks[1]); | |
212 | } | |
213 | ||
b2a297fa | 214 | |
215 | //fill track arrays for the second event | |
554e40f8 | 216 | if (ev2) { |
217 | FillTrackArrays(ev2,1); | |
218 | if ((fPreFilterUnlikeOnly) && ( fPairPreFilter.GetCuts()->GetEntries()>0 )) PairPreFilter(2, 3, fTracks[2], fTracks[3]); | |
219 | } | |
b2a297fa | 220 | |
554e40f8 | 221 | if (!fNoPairing){ |
222 | // create pairs and fill pair candidate arrays | |
223 | for (Int_t itrackArr1=0; itrackArr1<4; ++itrackArr1){ | |
224 | for (Int_t itrackArr2=itrackArr1; itrackArr2<4; ++itrackArr2){ | |
225 | FillPairArrays(itrackArr1, itrackArr2); | |
226 | } | |
b2a297fa | 227 | } |
6551594b | 228 | |
554e40f8 | 229 | //track rotation |
1201a1a9 | 230 | if (fTrackRotator) { |
231 | fTrackRotator->SetEvent(ev1); | |
232 | FillPairArrayTR(); | |
233 | } | |
554e40f8 | 234 | } |
2a14a7b1 | 235 | |
6551594b | 236 | //in case there is a histogram manager, fill the QA histograms |
237 | if (fHistos) FillHistograms(ev1); | |
572b0139 | 238 | |
239 | //fill debug tree if a manager is attached | |
240 | if (fDebugTree) FillDebugTree(); | |
b2a297fa | 241 | } |
242 | ||
243 | //________________________________________________________________ | |
244 | void AliDielectron::ProcessMC() | |
245 | { | |
246 | // | |
247 | // Process the MC data | |
248 | // | |
249 | ||
250 | //loop over all MC data and Fill the CF container if it exist | |
251 | if (!fCfManagerPair) return; | |
252 | fCfManagerPair->SetPdgMother(fPdgMother); | |
b2a297fa | 253 | AliDielectronMC *dieMC=AliDielectronMC::Instance(); |
254 | for (Int_t ipart=0; ipart<dieMC->GetNMCTracks();++ipart){ | |
255 | //TODO: MC truth cut properly!!! | |
256 | AliVParticle *mcPart=dieMC->GetMCTrackFromMCEvent(ipart); | |
37e9382d | 257 | if (!dieMC->IsMCMotherToEE(mcPart, fPdgMother)) continue; |
b2a297fa | 258 | fCfManagerPair->FillMC(mcPart); |
259 | } | |
260 | } | |
261 | ||
554e40f8 | 262 | //________________________________________________________________ |
263 | void AliDielectron::FillHistogramsTracks(TObjArray **tracks) | |
264 | { | |
265 | // | |
266 | // Fill Histogram information for tracks after prefilter | |
267 | // ignore mixed events - for prefilter, only single tracks +/- are relevant | |
268 | // | |
269 | ||
270 | TString className,className2; | |
271 | Double_t values[AliDielectronVarManager::kNMaxValues]; | |
272 | ||
273 | //Fill track information, separately for the track array candidates | |
274 | for (Int_t i=0; i<2; ++i){ | |
275 | className.Form("Pre_%s",fgkTrackClassNames[i]); | |
276 | if (!fHistos->GetHistogramList()->FindObject(className.Data())) continue; | |
277 | Int_t ntracks=tracks[i]->GetEntriesFast(); | |
278 | for (Int_t itrack=0; itrack<ntracks; ++itrack){ | |
279 | AliDielectronVarManager::Fill(tracks[i]->UncheckedAt(itrack), values); | |
280 | fHistos->FillClass(className, AliDielectronVarManager::kNMaxValues, values); | |
281 | } | |
282 | } | |
283 | } | |
b2a297fa | 284 | //________________________________________________________________ |
6551594b | 285 | void AliDielectron::FillHistograms(const AliVEvent *ev) |
b2a297fa | 286 | { |
287 | // | |
288 | // Fill Histogram information for tracks and pairs | |
289 | // | |
290 | ||
61d106d3 | 291 | TString className,className2; |
6551594b | 292 | Double_t values[AliDielectronVarManager::kNMaxValues]; |
293 | //Fill event information | |
294 | AliDielectronVarManager::Fill(ev, values); | |
61d106d3 | 295 | if (fHistos->GetHistogramList()->FindObject("Event")) |
296 | fHistos->FillClass("Event", AliDielectronVarManager::kNMaxValues, values); | |
6551594b | 297 | |
b2a297fa | 298 | //Fill track information, separately for the track array candidates |
b2a297fa | 299 | for (Int_t i=0; i<4; ++i){ |
300 | className.Form("Track_%s",fgkTrackClassNames[i]); | |
61d106d3 | 301 | if (!fHistos->GetHistogramList()->FindObject(className.Data())) continue; |
b2a297fa | 302 | Int_t ntracks=fTracks[i].GetEntriesFast(); |
303 | for (Int_t itrack=0; itrack<ntracks; ++itrack){ | |
6551594b | 304 | AliDielectronVarManager::Fill(fTracks[i].UncheckedAt(itrack), values); |
305 | fHistos->FillClass(className, AliDielectronVarManager::kNMaxValues, values); | |
b2a297fa | 306 | } |
307 | } | |
308 | ||
61d106d3 | 309 | //Fill Pair information, separately for all pair candidate arrays and the legs |
310 | TObjArray arrLegs(100); | |
b2a297fa | 311 | for (Int_t i=0; i<10; ++i){ |
312 | className.Form("Pair_%s",fgkPairClassNames[i]); | |
61d106d3 | 313 | className2.Form("Track_Legs_%s",fgkPairClassNames[i]); |
314 | Bool_t pairClass=fHistos->GetHistogramList()->FindObject(className.Data())!=0x0; | |
315 | Bool_t legClass=fHistos->GetHistogramList()->FindObject(className2.Data())!=0x0; | |
316 | if (!pairClass&&!legClass) continue; | |
b2a297fa | 317 | Int_t ntracks=PairArray(i)->GetEntriesFast(); |
318 | for (Int_t ipair=0; ipair<ntracks; ++ipair){ | |
61d106d3 | 319 | AliDielectronPair *pair=static_cast<AliDielectronPair*>(PairArray(i)->UncheckedAt(ipair)); |
320 | ||
321 | //fill pair information | |
322 | if (pairClass){ | |
323 | AliDielectronVarManager::Fill(pair, values); | |
324 | fHistos->FillClass(className, AliDielectronVarManager::kNMaxValues, values); | |
325 | } | |
326 | ||
327 | //fill leg information, don't fill the information twice | |
328 | if (legClass){ | |
329 | AliVParticle *d1=pair->GetFirstDaughter(); | |
330 | AliVParticle *d2=pair->GetSecondDaughter(); | |
331 | if (!arrLegs.FindObject(d1)){ | |
332 | AliDielectronVarManager::Fill(d1, values); | |
333 | fHistos->FillClass(className2, AliDielectronVarManager::kNMaxValues, values); | |
334 | arrLegs.Add(d1); | |
335 | } | |
336 | if (!arrLegs.FindObject(d2)){ | |
337 | AliDielectronVarManager::Fill(d2, values); | |
338 | fHistos->FillClass(className2, AliDielectronVarManager::kNMaxValues, values); | |
339 | arrLegs.Add(d2); | |
340 | } | |
341 | } | |
b2a297fa | 342 | } |
61d106d3 | 343 | if (legClass) arrLegs.Clear(); |
b2a297fa | 344 | } |
345 | ||
346 | } | |
2a14a7b1 | 347 | //________________________________________________________________ |
ffbede40 | 348 | void AliDielectron::FillHistogramsPair(AliDielectronPair *pair,Bool_t fromPreFilter/*=kFALSE*/) |
2a14a7b1 | 349 | { |
350 | // | |
351 | // Fill Histogram information for pairs and the track in the pair | |
352 | // NOTE: in this funtion the leg information may be filled multiple | |
353 | // times. This funtion is used in the track rotation pairing | |
354 | // and those legs are not saved! | |
ffbede40 | 355 | // |
2a14a7b1 | 356 | TString className,className2; |
357 | Double_t values[AliDielectronVarManager::kNMaxValues]; | |
358 | ||
359 | //Fill Pair information, separately for all pair candidate arrays and the legs | |
360 | TObjArray arrLegs(100); | |
361 | const Int_t type=pair->GetType(); | |
ffbede40 | 362 | if (fromPreFilter) { |
363 | className.Form("RejPair_%s",fgkPairClassNames[type]); | |
364 | className2.Form("RejTrack_%s",fgkPairClassNames[type]); | |
365 | } else { | |
366 | className.Form("Pair_%s",fgkPairClassNames[type]); | |
367 | className2.Form("Track_Legs_%s",fgkPairClassNames[type]); | |
368 | } | |
2a14a7b1 | 369 | |
370 | Bool_t pairClass=fHistos->GetHistogramList()->FindObject(className.Data())!=0x0; | |
371 | Bool_t legClass=fHistos->GetHistogramList()->FindObject(className2.Data())!=0x0; | |
372 | ||
373 | //fill pair information | |
374 | if (pairClass){ | |
375 | AliDielectronVarManager::Fill(pair, values); | |
376 | fHistos->FillClass(className, AliDielectronVarManager::kNMaxValues, values); | |
377 | } | |
378 | ||
379 | if (legClass){ | |
380 | AliVParticle *d1=pair->GetFirstDaughter(); | |
381 | AliDielectronVarManager::Fill(d1, values); | |
382 | fHistos->FillClass(className2, AliDielectronVarManager::kNMaxValues, values); | |
383 | ||
384 | AliVParticle *d2=pair->GetSecondDaughter(); | |
385 | AliDielectronVarManager::Fill(d2, values); | |
386 | fHistos->FillClass(className2, AliDielectronVarManager::kNMaxValues, values); | |
387 | } | |
388 | } | |
b2a297fa | 389 | |
390 | //________________________________________________________________ | |
391 | void AliDielectron::FillTrackArrays(AliVEvent * const ev, Int_t eventNr) | |
392 | { | |
393 | // | |
394 | // select tracks and fill track candidate arrays | |
395 | // eventNr = 0: First event, use track arrays 0 and 1 | |
396 | // eventNr = 1: Second event, use track arrays 2 and 3 | |
397 | // | |
398 | ||
399 | Int_t ntracks=ev->GetNumberOfTracks(); | |
400 | UInt_t selectedMask=(1<<fTrackFilter.GetCuts()->GetEntries())-1; | |
401 | for (Int_t itrack=0; itrack<ntracks; ++itrack){ | |
402 | //get particle | |
403 | AliVParticle *particle=ev->GetTrack(itrack); | |
404 | //TODO: temporary solution, perhaps think about a better implementation | |
405 | // This is needed to use AliESDpidCuts, which relies on the ESD event | |
406 | // is set as a AliESDtrack attribute... somehow ugly! | |
407 | if (ev->IsA()==AliESDEvent::Class()){ | |
408 | AliESDtrack *track=static_cast<AliESDtrack*>(particle); | |
409 | track->SetESDEvent(static_cast<AliESDEvent*>(ev)); //only in trunk... | |
410 | } | |
411 | ||
412 | //apply track cuts | |
413 | if (fTrackFilter.IsSelected(particle)!=selectedMask) continue; | |
414 | ||
415 | //fill selected particle into the corresponding track arrays | |
416 | Short_t charge=particle->Charge(); | |
417 | if (charge>0) fTracks[eventNr*2].Add(particle); | |
418 | else if (charge<0) fTracks[eventNr*2+1].Add(particle); | |
419 | } | |
420 | } | |
421 | ||
61d106d3 | 422 | //________________________________________________________________ |
2a14a7b1 | 423 | void AliDielectron::PairPreFilter(Int_t arr1, Int_t arr2, TObjArray &arrTracks1, TObjArray &arrTracks2) |
424 | { | |
61d106d3 | 425 | // |
426 | // Prefilter tracks from pairs | |
427 | // Needed for datlitz rejections | |
428 | // remove all tracks from the Single track arrays that pass the cuts in this filter | |
429 | // | |
430 | Int_t pairIndex=GetPairIndex(arr1,arr2); | |
431 | ||
432 | Int_t ntrack1=arrTracks1.GetEntriesFast(); | |
433 | Int_t ntrack2=arrTracks2.GetEntriesFast(); | |
434 | ||
435 | AliDielectronPair candidate; | |
436 | ||
437 | UInt_t selectedMask=(1<<fPairPreFilter.GetCuts()->GetEntries())-1; | |
554e40f8 | 438 | UInt_t selectedMaskPair=(1<<fPairFilter.GetCuts()->GetEntries())-1; |
61d106d3 | 439 | |
440 | for (Int_t itrack1=0; itrack1<ntrack1; ++itrack1){ | |
441 | Int_t end=ntrack2; | |
442 | if (arr1==arr2) end=itrack1; | |
443 | Bool_t accepted=kFALSE; | |
444 | for (Int_t itrack2=0; itrack2<end; ++itrack2){ | |
445 | AliVTrack *track1=static_cast<AliVTrack*>(arrTracks1.UncheckedAt(itrack1)); | |
446 | AliVTrack *track2=static_cast<AliVTrack*>(arrTracks2.UncheckedAt(itrack2)); | |
447 | if (!track1 || !track2) continue; | |
448 | //create the pair | |
449 | candidate.SetTracks(track1, fPdgLeg1, | |
450 | track2, fPdgLeg2); | |
451 | candidate.SetType(pairIndex); | |
452 | candidate.SetLabel(AliDielectronMC::Instance()->GetLabelMotherWithPdg(&candidate,fPdgMother)); | |
453 | ||
454 | //pair cuts | |
455 | UInt_t cutMask=fPairPreFilter.IsSelected(&candidate); | |
456 | ||
457 | //apply cut | |
458 | if (cutMask!=selectedMask) continue; | |
554e40f8 | 459 | if (fCfManagerPair) fCfManagerPair->Fill(selectedMaskPair+1 ,&candidate); |
61d106d3 | 460 | accepted=kTRUE; |
ffbede40 | 461 | FillHistogramsPair(&candidate,kTRUE); |
61d106d3 | 462 | //remove the tracks from the Track arrays |
463 | arrTracks2.AddAt(0x0,itrack2); | |
464 | //in case of like sign remove the track from both arrays! | |
465 | if (arr1==arr2) arrTracks1.AddAt(0x0, itrack2); | |
466 | } | |
467 | if ( accepted ) arrTracks1.AddAt(0x0,itrack1); | |
468 | } | |
469 | //compress the track arrays | |
554e40f8 | 470 | |
471 | ||
472 | ||
61d106d3 | 473 | arrTracks1.Compress(); |
474 | arrTracks2.Compress(); | |
475 | ||
476 | //apply leg cuts after the pre filter | |
477 | if ( fPairPreFilterLegs.GetCuts()->GetEntries()>0 ) { | |
478 | selectedMask=(1<<fPairPreFilterLegs.GetCuts()->GetEntries())-1; | |
479 | //loop over tracks from array 1 | |
480 | for (Int_t itrack=0; itrack<arrTracks1.GetEntriesFast();++itrack){ | |
481 | //test cuts | |
482 | UInt_t cutMask=fPairPreFilterLegs.IsSelected(arrTracks1.UncheckedAt(itrack)); | |
554e40f8 | 483 | |
61d106d3 | 484 | //apply cut |
485 | if (cutMask!=selectedMask) arrTracks1.AddAt(0x0,itrack);; | |
486 | } | |
487 | arrTracks1.Compress(); | |
488 | ||
489 | //in case of like sign don't loop over second array | |
490 | if (arr1==arr2) { | |
491 | arrTracks2=arrTracks1; | |
492 | } else { | |
493 | ||
494 | //loop over tracks from array 2 | |
495 | for (Int_t itrack=0; itrack<arrTracks2.GetEntriesFast();++itrack){ | |
496 | //test cuts | |
497 | UInt_t cutMask=fPairPreFilterLegs.IsSelected(arrTracks2.UncheckedAt(itrack)); | |
498 | //apply cut | |
499 | if (cutMask!=selectedMask) arrTracks2.AddAt(0x0,itrack); | |
500 | } | |
501 | arrTracks2.Compress(); | |
502 | ||
503 | } | |
504 | } | |
554e40f8 | 505 | //For unlike-sign monitor track-cuts: |
506 | if (arr1!=arr2) { | |
507 | TObjArray *unlikesignArray[2] = {&arrTracks1,&arrTracks2}; | |
508 | FillHistogramsTracks(unlikesignArray); | |
509 | } | |
61d106d3 | 510 | } |
511 | ||
b2a297fa | 512 | //________________________________________________________________ |
2a14a7b1 | 513 | void AliDielectron::FillPairArrays(Int_t arr1, Int_t arr2) |
514 | { | |
b2a297fa | 515 | // |
516 | // select pairs and fill pair candidate arrays | |
517 | // | |
61d106d3 | 518 | |
519 | TObjArray arrTracks1=fTracks[arr1]; | |
520 | TObjArray arrTracks2=fTracks[arr2]; | |
521 | ||
522 | //process pre filter if set | |
554e40f8 | 523 | if ((!fPreFilterUnlikeOnly) && ( fPairPreFilter.GetCuts()->GetEntries()>0 )) PairPreFilter(arr1, arr2, arrTracks1, arrTracks2); |
61d106d3 | 524 | |
b2a297fa | 525 | Int_t pairIndex=GetPairIndex(arr1,arr2); |
526 | ||
61d106d3 | 527 | Int_t ntrack1=arrTracks1.GetEntriesFast(); |
528 | Int_t ntrack2=arrTracks2.GetEntriesFast(); | |
b2a297fa | 529 | |
530 | AliDielectronPair *candidate=new AliDielectronPair; | |
531 | ||
532 | UInt_t selectedMask=(1<<fPairFilter.GetCuts()->GetEntries())-1; | |
533 | ||
534 | for (Int_t itrack1=0; itrack1<ntrack1; ++itrack1){ | |
535 | Int_t end=ntrack2; | |
536 | if (arr1==arr2) end=itrack1; | |
537 | for (Int_t itrack2=0; itrack2<end; ++itrack2){ | |
8df8e382 | 538 | //create the pair |
61d106d3 | 539 | candidate->SetTracks(static_cast<AliVTrack*>(arrTracks1.UncheckedAt(itrack1)), fPdgLeg1, |
540 | static_cast<AliVTrack*>(arrTracks2.UncheckedAt(itrack2)), fPdgLeg2); | |
b2a297fa | 541 | candidate->SetType(pairIndex); |
a655b716 | 542 | candidate->SetLabel(AliDielectronMC::Instance()->GetLabelMotherWithPdg(candidate,fPdgMother)); |
b2a297fa | 543 | |
544 | //pair cuts | |
545 | UInt_t cutMask=fPairFilter.IsSelected(candidate); | |
546 | ||
547 | //CF manager for the pair | |
548 | if (fCfManagerPair) fCfManagerPair->Fill(cutMask,candidate); | |
549 | ||
550 | //apply cut | |
551 | if (cutMask!=selectedMask) continue; | |
552 | ||
553 | //add the candidate to the candidate array | |
554 | PairArray(pairIndex)->Add(candidate); | |
555 | //get a new candidate | |
556 | candidate=new AliDielectronPair; | |
557 | } | |
558 | } | |
559 | //delete the surplus candidate | |
560 | delete candidate; | |
561 | } | |
562 | ||
2a14a7b1 | 563 | //________________________________________________________________ |
564 | void AliDielectron::FillPairArrayTR() | |
565 | { | |
566 | // | |
567 | // select pairs and fill pair candidate arrays | |
568 | // | |
569 | UInt_t selectedMask=(1<<fPairFilter.GetCuts()->GetEntries())-1; | |
570 | ||
571 | while ( fTrackRotator->NextCombination() ){ | |
572 | AliDielectronPair candidate; | |
1201a1a9 | 573 | candidate.SetTracks(&fTrackRotator->GetKFTrackP(), &fTrackRotator->GetKFTrackN(), |
574 | fTrackRotator->GetVTrackP(),fTrackRotator->GetVTrackN()); | |
ffbede40 | 575 | candidate.SetType(kEv1PMRot); |
2a14a7b1 | 576 | |
577 | //pair cuts | |
578 | UInt_t cutMask=fPairFilter.IsSelected(&candidate); | |
579 | ||
580 | //CF manager for the pair | |
581 | if (fCfManagerPair) fCfManagerPair->Fill(cutMask,&candidate); | |
582 | ||
583 | //apply cut | |
584 | if (cutMask==selectedMask&&fHistos) FillHistogramsPair(&candidate); | |
585 | } | |
586 | } | |
587 | ||
572b0139 | 588 | //________________________________________________________________ |
589 | void AliDielectron::FillDebugTree() | |
590 | { | |
591 | // | |
592 | // Fill Histogram information for tracks and pairs | |
593 | // | |
594 | ||
595 | //Fill Debug tree | |
596 | for (Int_t i=0; i<10; ++i){ | |
597 | Int_t ntracks=PairArray(i)->GetEntriesFast(); | |
598 | for (Int_t ipair=0; ipair<ntracks; ++ipair){ | |
599 | fDebugTree->Fill(static_cast<AliDielectronPair*>(PairArray(i)->UncheckedAt(ipair))); | |
600 | } | |
601 | } | |
602 | } | |
b2a297fa | 603 | |
572b0139 | 604 | //________________________________________________________________ |
605 | void AliDielectron::SaveDebugTree() | |
606 | { | |
607 | // | |
608 | // delete the debug tree, this will also write the tree | |
609 | // | |
610 | if (fDebugTree) fDebugTree->DeleteStreamer(); | |
611 | } | |
b2a297fa | 612 |