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