Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
TwoTrackAna.cxx
1/*
2 * TwoTrackAna.cxx
3 *
4 * Created on: 27-08-2013
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "TwoTrackAna.h"
11
12#include "Cout.h"
13#include "CutCollection.h"
14#include "CutContainer.h"
15#include "MemoryMapManager.h"
16#include "Parameter.h"
17#include "TrackVirtualCut.h"
18#include "TwoTrack.h"
19#include "TwoTrackVirtualCut.h"
20
21#include <TString.h>
22
23
24namespace Hal {
25 TwoTrackAna::TwoTrackAna(Bool_t use_background) :
26 MultiTrackAna((use_background ? ECutUpdate::kTwoTrackBackground : ECutUpdate::kTwoTrackBackground)),
27 fNonIdIsSet(kFALSE),
28 fSignedBoth(kTRUE),
29 fIdentical(kTRUE),
30 fSwapPair(kTRUE),
31 fSkipEmpty(kTRUE),
32 fCurrentTrack2CollectionNo(0),
33 fCurrentTrack1CollectionNo(0),
34 fCurrentTrack1(NULL),
35 fCurrentTrack2(NULL),
36 fBackgroundMode(kNoBackground),
37 fCurrentPairCollectionID(0),
38 fTwoTrackCollectionsNo(0),
39 fTwoTrackCollectionsNoBackground(0),
40 fCurrentSignalPair(NULL),
41 fCurrentBackgroundPair(NULL) {
42 fMixSize = 1;
43 AddTags("twotrack");
44 }
45
47 Package* pack = TrackAna::Report();
48 AddToAnaMetadata(pack, new ParameterInt("MixSize", fMixSize));
49 TString id;
50 switch (fBackgroundMode) {
51 case kPerfectPairsID: id = "Perfect"; break;
52 case kPerfectPairsNID: id = "Perfect"; break;
53 case kMixedPairsID: id = "Mixed"; break;
54 case kMixedPairsNID: id = "Mixed"; break;
55 case kRotatedPairsID: id = "Rotated"; break;
56 case kRotatedPairsNID: id = "Rotated"; break;
57 case kHemispherePairsID: id = "Hemisphere"; break;
58 case kHemispherePairsNID: id = "Hemisphere"; break;
59 case kNoBackgroundID: id = "No"; break;
60 case kNoBackgroundNID: id = "No"; break;
61 case kChargedID2: id = "Opposite charges 0/0+"; break;
62 case kChargedID3: id = "Opposite charges 0/+-"; break;
63 case kChargedNID2:
64 if (fSignedBoth)
65 id = "Opposite charges +-/++ --";
66 else
67 id = "Opposite charges +-/++";
68 break;
69 case kChargedNID3: id = "Opposite charges +-/0"; break;
70 default: id = "Unknown"; break;
71 }
72 AddToAnaMetadata(pack, new ParameterString("Background", id));
73 if (fIdentical)
74 AddToAnaMetadata(pack, new ParameterString("Signal", "Identical"));
75 else
76 AddToAnaMetadata(pack, new ParameterString("Signal", "Non-identical"));
77 return pack;
78 }
79
81 switch (fBackgroundMode) {
82 case kPerfectPairsID: AddTags("pefect_background"); break;
83 case kPerfectPairsNID: AddTags("pefect_background"); break;
84 case kMixedPairsID: AddTags("mixed_background"); break;
85 case kMixedPairsNID: AddTags("mixed_background"); break;
86 case kRotatedPairsID: AddTags("rotated_background"); break;
87 case kRotatedPairsNID: AddTags("rotated_background"); break;
88 case kHemispherePairsID: AddTags("hemisphere_background"); break;
89 case kHemispherePairsNID: AddTags("hemishpere_background"); break;
90 case kNoBackgroundID: AddTags("no_background"); break;
91 case kNoBackgroundNID: AddTags("no_background"); break;
92 case kChargedID2: AddTags("charged_background"); break;
93 case kChargedID3: AddTags("charged_background"); break;
94 case kChargedNID2: AddTags("charged_background"); break;
95 case kChargedNID3: AddTags("charged_background"); break;
96 default: break;
97 }
98 if (fIdentical) {
99 AddTags("id identical");
100 } else {
101 AddTags("nonid nonidentical");
102 }
103 }
104
105 Task::EInitFlag TwoTrackAna::Init() {
106 Task::EInitFlag in = MultiTrackAna::Init();
107 SetTags();
110 fCurrentSignalPair->SetPairType(TwoTrack::kSignal);
114 switch (fBackgroundMode) {
115 case kChargedID2: fCurrentBackgroundPair->SetSame(kFALSE); break;
116 case kChargedID3: fCurrentBackgroundPair->SetSame(kTRUE); break;
117 case kChargedNID2: fCurrentBackgroundPair->SetSame(kTRUE); break;
118 case kChargedNID3: fCurrentBackgroundPair->SetSame(kTRUE); break;
119 default: break;
120 }
122 if (fIdentical) {
123 Cout::PrintInfo("IDENTICAL two track analysis enabled", EInfo::kDebugInfo);
124 } else {
125 Cout::PrintInfo("NON-IDENTICAL two track analysis enabled", EInfo::kDebugInfo);
126 }
127 return in;
128 }
129
131
132 void TwoTrackAna::SetOption(Option_t* option) {
133 TString opt = option;
134 if (opt.EqualTo("nonid")) {
135 fIdentical = kFALSE;
136 fNonIdIsSet = kTRUE;
137 } else if (opt.EqualTo("id")) {
138 fIdentical = kTRUE;
139 fNonIdIsSet = kTRUE;
140 } else if (opt.EqualTo(TwoTrackAna::BackgroundOptionMixed())) {
142 } else if (opt.EqualTo(TwoTrackAna::BackgroundOptionPerfect())) {
144 } else if (opt.EqualTo(TwoTrackAna::BackgroundOptionRotated())) {
146 } else if (opt.EqualTo(TwoTrackAna::BackgroundOptionHemisphere())) {
148 } else if (opt.EqualTo(TwoTrackAna::BackgroundOptionNoBackground())) {
150 } else if (opt.EqualTo(TwoTrackAna::BackgroundOptionCharge())) {
152 } else if (opt.EqualTo("disable:signs_sum")) {
153 fSignedBoth = kFALSE;
154 } else {
156 }
157 }
158
159 void TwoTrackAna::SetMixSize(Int_t mixsize) {
160 if (mixsize > 0) fMixSize = mixsize;
161 if (mixsize > 10) {
162#ifdef HAL_DEBUG
163 Cout::PrintInfo("Mix size >10", EInfo::kDebugInfo);
164#endif
165 }
166 }
167
169
172 if (fCutContainer->GetTwoTrackCollectionsNo() == 0) { AddCut(TwoTrackVirtualCut(), "fast+sig"); }
175 }
178 Int_t trackTrig = fCutContainer->GetTrackCollectionsNo();
180 Cout::PrintInfo("Not enough track collections i nonid analysis", EInfo::kCriticalError);
181 }
182 switch (fBackgroundMode) {
183 case kCharged: {
184 if (trackTrig < 2) {
185 Cout::PrintInfo("Not enough track collections", EInfo::kLowWarning);
186 } else if (trackTrig > 3) {
187 Cout::PrintInfo("Too much track collections (>3) fixing ...", EInfo::kLowWarning);
188 for (int i = 3; i < trackTrig; i++)
189 fCutContainer->RemoveCollection(ECutUpdate::kTrack, i);
191 }
192 if (fIdentical) {
193 if (trackTrig == 2) fBackgroundMode = kChargedID2;
194 if (trackTrig == 3) fBackgroundMode = kChargedID3;
195 } else {
196 if (trackTrig == 2) fBackgroundMode = kChargedNID2;
197 if (trackTrig == 3) fBackgroundMode = kChargedNID3;
198 }
199 } break;
200 default: {
201 if (IdenticalParticles()) {
202 if (trackTrig > 1) {
203 Cout::PrintInfo("Too much track collections (>1), fixing ..", EInfo::kLowWarning);
204 for (int i = 1; i < trackTrig; i++)
205 fCutContainer->RemoveCollection(ECutUpdate::kTrack, i);
206 trackTrig = 1;
207 }
208 switch (fBackgroundMode) {
213 default: fBackgroundMode = kNoBackgroundID; break;
214 }
215 } else {
216 if (trackTrig > 2) {
217 Cout::PrintInfo("To much track collections (more than 1) fixing", EInfo::kLowWarning);
218 for (int i = 2; i < trackTrig; i++)
219 fCutContainer->RemoveCollection(ECutUpdate::kTrack, i);
220 trackTrig = 2;
221 }
222 switch (fBackgroundMode) {
227 default: fBackgroundMode = kNoBackgroundNID; break;
228 }
229 }
230 } break;
231 }
232 }
233
235 Int_t eventTrig = fCutContainer->GetEventCollectionsNo();
236 Int_t trackTrig = fCutContainer->GetTrackCollectionsNo();
237 Int_t twotrackT = fCutContainer->GetTwoTrackCollectionsNo();
239 for (int i = 0; i < eventTrig; i++) {
240 for (int j = 0; j < trackTrig; j++) {
241 fCutContainer->LinkCollections(ECutUpdate::kEvent, i, ECutUpdate::kTrack, j);
242 }
243 }
244 switch (fBackgroundMode) {
245 case kChargedID2: {
246 for (int j = 0; j < twotrackT; j++) { // AA / AB
247 fCutContainer->LinkCollections(ECutUpdate::kTrack, 0, ECutUpdate::kTwoTrack,
248 j); // A -> All
249 }
250 for (int j = 0; j < twoTrackB; j++) {
251 fCutContainer->LinkCollections(ECutUpdate::kTrack, 0, ECutUpdate::kTwoTrackBackground, j); // A -> All
252 fCutContainer->LinkCollections(ECutUpdate::kTrack, 1, ECutUpdate::kTwoTrackBackground, j); // B -> All
253 }
254
255 } break;
256 case kChargedID3: { // AA BC
257 for (int j = 0; j < twotrackT; j++) {
258 fCutContainer->LinkCollections(ECutUpdate::kTrack, 0, ECutUpdate::kTwoTrack,
259 j); // A - >All
260 }
261 for (int j = 0; j < twoTrackB; j++) {
262 fCutContainer->LinkCollections(ECutUpdate::kTrack, 1, ECutUpdate::kTwoTrackBackground, j); // B - > All
263 fCutContainer->LinkCollections(ECutUpdate::kTrack, 2, ECutUpdate::kTwoTrackBackground, j); // C- > All
264 }
265 } break;
266 case kChargedNID2: { // AB AA+ BB
267 for (int j = 0; j < twotrackT; j++) {
268 fCutContainer->LinkCollections(ECutUpdate::kTrack, 0, ECutUpdate::kTwoTrack,
269 j); // A - >All
270 fCutContainer->LinkCollections(ECutUpdate::kTrack, 1, ECutUpdate::kTwoTrack,
271 j); // B - >All
272 }
273 for (int j = 0; j < twoTrackB; j++) {
274 fCutContainer->LinkCollections(ECutUpdate::kTrack, 0, ECutUpdate::kTwoTrackBackground, j); // A - >All
275 fCutContainer->LinkCollections(ECutUpdate::kTrack, 1, ECutUpdate::kTwoTrackBackground, j); // B - >All
276 }
277 } break;
278 case kChargedNID3: { // AB CC
279 for (int j = 0; j < twotrackT; j++) {
280 fCutContainer->LinkCollections(ECutUpdate::kTrack, 0, ECutUpdate::kTwoTrack,
281 j); // A -> All
282 fCutContainer->LinkCollections(ECutUpdate::kTrack, 1, ECutUpdate::kTwoTrack,
283 j); // B - >All
284 }
285 for (int j = 0; j < twoTrackB; j++) {
286 fCutContainer->LinkCollections(ECutUpdate::kTrack, 2, ECutUpdate::kTwoTrackBackground, j); // C - >All
287 }
288 } break;
289 default: {
290 for (int i = 0; i < trackTrig; i++) {
291 for (int j = 0; j < twotrackT; j++) {
292 fCutContainer->LinkCollections(ECutUpdate::kTrack, i, ECutUpdate::kTwoTrack, j);
294 fCutContainer->LinkCollections(ECutUpdate::kTrack,
295 i,
296 ECutUpdate::kTwoTrackBackground,
297 j); // second layer is for background
298 }
299 }
300 } break;
301 }
302 }
303
305 if (fSkipEmpty) {
308 return;
309 }
310 }
311 switch (fBackgroundMode) {
312 case kPerfectPairsID: {
313 MakePairs();
314 MakePairs_Perfect();
315 } break;
316 case kMixedPairsID: {
317 MakePairs();
318 if (fMemoryMap->IsReadyToMixing(fCurrentEventCollectionID)) { MakePairs_Mixed(); }
319 } break;
320 case kRotatedPairsID: {
321 MakePairs();
322 MakePairs_Rotated();
323 } break;
324 case kHemispherePairsID: {
325 MakePairs();
326 MakePairs_Hemisphere();
327 } break;
328 case kNoBackgroundID: {
329 MakePairs();
330 } break;
331 case kChargedID2: {
332 MakePairs();
333 // AA AB
334 fCurrentTrack1CollectionNo = fCurrentTrackCollectionID;
335 fCurrentTrack2CollectionNo = fCurrentTrackCollectionID + 1;
336 if (fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo) == 0) return;
337 if (fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo) == 0) return;
338 MakePairs_Charged2();
339 } break;
340 case kChargedID3: {
341 MakePairs();
342 // AA BC
343 fCurrentTrack1CollectionNo = fCurrentTrackCollectionID + 1;
344 fCurrentTrack2CollectionNo = fCurrentTrackCollectionID + 2;
345 if (fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo) == 0) return;
346 if (fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo) == 0) return;
347 MakePairs_Charged3();
348 } break;
349 default: Cout::PrintInfo("Unknown Background mode", EInfo::kWarning); break;
350 }
351 }
352
354 fCurrentTrack1CollectionNo = fCurrentTrackCollectionID;
355 fCurrentTrack2CollectionNo = fCurrentTrackCollectionID + 1;
356 Int_t tr1 = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo);
357 Int_t tr2 = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo);
358 if (fSkipEmpty) {
359 if (tr1 == 0 || tr2 == 0) {
361 return;
362 }
363 }
364 switch (fBackgroundMode) {
365 case kPerfectPairsNID: {
366 MakePairs2();
367 MakePairs2_Perfect();
368 } break;
369 case kMixedPairsNID: {
370 MakePairs2();
371 if (fMemoryMap->IsReadyToMixing(fCurrentEventCollectionID)) { MakePairs2_Mixed(); }
372 } break;
373 case kRotatedPairsNID: {
374 MakePairs2();
375 MakePairs2_Rotated();
376 } break;
377 case kHemispherePairsNID: {
378 MakePairs2();
379 MakePairs2_Hemisphere();
380 } break;
381 case kNoBackgroundNID: {
382 MakePairs2();
383 } break;
384 case kChargedNID2: {
385 MakePairs2();
386 // AB AA + BB
387 MakePairs2_Charged2();
388 } break;
389 case kChargedNID3: {
390 MakePairs2();
391 // AB // CC
394 MakePairs2_Charged3();
395 } break;
396
397 default: Cout::PrintInfo("Unknown Background mode", EInfo::kWarning); break;
398 }
399 }
400
401 void TwoTrackAna::BuildPair(TwoTrack* pair) { pair->FastBuild(fCurrentTrack1, fCurrentTrack2); }
402
403 void TwoTrackAna::BuildPairSwapped(TwoTrack* pair) {
404#ifdef DISABLE_TWO_TRACK_SWAPPING
405 pair->FastBuild(fCurrentTrack1, fCurrentTrack2);
406#else
407 if (fSwapPair) {
408 fSwapPair = kFALSE;
409 pair->FastBuild(fCurrentTrack1, fCurrentTrack2);
410 } else {
411 fSwapPair = kTRUE;
412 pair->FastBuild(fCurrentTrack2, fCurrentTrack1);
413 }
414#endif
415 }
416
420 if (fIdentical) {
421#ifdef HAL_DEBUG
422 Cout::PrintInfo(Form("Finish identical event with %i tracks",
424 EInfo::kDebugInfo);
425#endif
427 } else {
428#ifdef HAL_DEBUG
429 Cout::PrintInfo(Form("Finish non-identical event with %i %i tracks",
432 EInfo::kDebugInfo);
433#endif
435 }
436 }
437
438 void TwoTrackAna::MakePairs_Charged2() {
439 // process signed background if main function is from identical tracks
440 // background is made from non-identical tracks
441 Int_t nTrackA = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo);
442 Int_t nTrackB = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo);
444 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
445 for (int i = 0; i < nTrackA; i++) {
446 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, i);
447 for (int j = 0; j < nTrackB; j++) {
448 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, j);
449 BuildPair(fCurrentBackgroundPair);
450 for (int k = 0; k < tt_cut_no; k++) {
453 }
454 }
455 }
456 }
457
458 void TwoTrackAna::MakePairs2_Charged2() {
459 // process signed background if main function is from non-identical tracks
460 // background is made from identical tracks
461 fCurrentTrackCollectionID = fCurrentTrack1CollectionNo;
462 Int_t nTrack = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo);
463 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrack1CollectionNo); //
464 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
465 for (int i = 0; i < nTrack; i++) {
466 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, i);
467 for (int j = i + 1; j < nTrack; j++) {
468 // if(j>=i)break;
469 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, j);
470 BuildPairSwapped(fCurrentBackgroundPair);
471 for (int k = 0; k < tt_cut_no; k++) {
472 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
473 if (fCutContainer->PassBackgroundPair(fCurrentBackgroundPair, track_cuts->GetNextAddrBackround(k))) {
475 }
476 }
477 }
478 }
479 if (fSignedBoth) {
480 fCurrentTrackCollectionID = fCurrentTrack2CollectionNo;
481 nTrack = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo);
482 for (int i = 0; i < nTrack; i++) {
483 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, i);
484 for (int j = i + 1; j < nTrack; j++) {
485 // if(j>=i)break;
486 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, j);
487 BuildPairSwapped(fCurrentBackgroundPair);
488 for (int k = 0; k < tt_cut_no; k++) {
489 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
490 if (fCutContainer->PassBackgroundPair(fCurrentBackgroundPair, track_cuts->GetNextAddrBackround(k))) {
492 }
493 }
494 }
495 }
496 }
497 }
498
499 void TwoTrackAna::MakePairs_Charged3() {
500 Int_t nTrackA = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo);
501 Int_t nTrackB = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo);
502 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrack1CollectionNo);
503 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
504 for (int i = 0; i < nTrackA; i++) {
505 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, i);
506 for (int j = 0; j < nTrackB; j++) {
507 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, j);
508 BuildPair(fCurrentBackgroundPair);
509 for (int k = 0; k < tt_cut_no; k++) {
510 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
512 }
513 }
514 }
515 }
516
517 void TwoTrackAna::MakePairs2_Charged3() {
519 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrackCollectionID); //
520 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
521 for (int i = 0; i < nTrack; i++) {
523 for (int j = i + 1; j < nTrack; j++) {
524 // if(j>=i)break;
526 BuildPairSwapped(fCurrentBackgroundPair);
527 for (int k = 0; k < tt_cut_no; k++) {
528 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
530 }
531 }
532 }
533 }
534
535 TwoTrackAna::~TwoTrackAna() {
539 }
540 //----- PROCES Event Mixing
541
542 //--------- ANALISE IDENTICAL EVENTS DIFFERENT PARTICLES
543
544 void TwoTrackAna::MakePairs() {
546 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrackCollectionID); //
547 Int_t tt_cut_no = track_cuts->GetNextNo();
548#ifdef HAL_DEBUG
549 Cout::PrintInfo("Making pairs", EInfo::kDebugInfo);
550#endif
551 for (int i = 0; i < nTrack; i++) {
553 for (int j = i + 1; j < nTrack; j++) {
555 BuildPairSwapped(fCurrentSignalPair);
556 for (int k = 0; k < tt_cut_no; k++) {
557 fCurrentPairCollectionID = track_cuts->GetNextAddr(k);
558 if (fCutContainer->PassSignalPair(fCurrentSignalPair, track_cuts->GetNextAddr(k))) { ProcessPair(); }
559 }
560 }
561 }
562 }
563 //---------- ANALISE NON IDENTICAL PARTICLES
564
565 void TwoTrackAna::MakePairs2() {
566 Int_t nTrackA = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo);
567 Int_t nTrackB = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo);
568 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrack1CollectionNo);
569 Int_t tt_cut_no = track_cuts->GetNextNo();
570 for (int i = 0; i < nTrackA; i++) {
571 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, i);
572 for (int j = 0; j < nTrackB; j++) {
573 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, j);
574 BuildPair(fCurrentSignalPair);
575 for (int k = 0; k < tt_cut_no; k++) {
576 fCurrentPairCollectionID = track_cuts->GetNextAddr(k);
578 }
579 }
580 }
581 }
582
583 //--------- MIX IDENTICAL PARTICLES
584
585 void TwoTrackAna::MakePairs_Mixed() {
586 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrackCollectionID);
587 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
589#ifdef HAL_DEBUG
590 Cout::PrintInfo("Mixing event", EInfo::kDebugInfo);
591#endif
592 for (int l = 0; l < fMixSize; l++) {
593 if (l == fMemoryMap->GetCounter(fCurrentEventCollectionID)) continue;
595 for (int i = 0; i < nTrackA; i++) {
597 for (int j = 0; j < nTrackB; j++) {
599 BuildPairSwapped(fCurrentBackgroundPair);
600 for (int m = 0; m < tt_cut_no; m++) {
601 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(m);
603 }
604 }
605 }
606 }
607 }
608
609 void TwoTrackAna::MakePairs2_Mixed() {
610 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrack1CollectionNo);
611 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
612 Int_t nTrackA = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo);
613 for (int l = 0; l < fMixSize; l++) {
614 if (l == fMemoryMap->GetCounter(fCurrentEventCollectionID)) continue;
615 Int_t nTrackB = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, l);
616 for (int i = 0; i < nTrackA; i++) {
617 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, i);
618 for (int j = 0; j < nTrackB; j++) {
619 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, l, j);
620 BuildPair(fCurrentBackgroundPair);
621 for (int m = 0; m < tt_cut_no; m++) {
622 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(m);
624 }
625 }
626 }
627 }
628 nTrackA = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo);
629 for (int l = 0; l < fMixSize; l++) {
630 if (l == fMemoryMap->GetCounter(fCurrentEventCollectionID)) continue;
631 Int_t nTrackB = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, l);
632 for (int i = 0; i < nTrackA; i++) {
633 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, i);
634 for (int j = 0; j < nTrackB; j++) {
635 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, l, j);
636 BuildPair(fCurrentBackgroundPair);
637 for (int m = 0; m < tt_cut_no; m++) {
638 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(m);
640 }
641 }
642 }
643 }
644 }
645
646 void TwoTrackAna::MakePairs_Perfect() {
648 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrackCollectionID); //
649 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
650 // fMemoryMap->PrintMap(collection_no);
651 for (int i = 0; i < nTrack; i++) {
653 for (int j = i + 1; j < nTrack; j++) {
655 BuildPairSwapped(fCurrentBackgroundPair);
656 for (int k = 0; k < tt_cut_no; k++) {
657 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
659 }
660 }
661 }
662 }
663
664 void TwoTrackAna::MakePairs2_Perfect() {
665 Int_t nTrackA = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo);
666 Int_t nTrackB = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo);
667 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrack1CollectionNo);
668 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
669 for (int i = 0; i < nTrackA; i++) {
670 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, i);
671 for (int j = 0; j < nTrackB; j++) {
672 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, j);
673 BuildPair(fCurrentBackgroundPair);
674 for (int k = 0; k < tt_cut_no; k++) {
675 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
677 }
678 }
679 }
680 }
681
682 void TwoTrackAna::MakePairs_Rotated() {
684 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrackCollectionID); //
685 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
686 // fMemoryMap->PrintMap(collection_no);
687 for (int i = 0; i < nTrack; i++) {
689 for (int j = i + 1; j < nTrack; j++) {
691 BuildPairSwapped(fCurrentBackgroundPair);
692 for (int k = 0; k < tt_cut_no; k++) {
693 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
695 }
696 }
697 }
698 }
699
700 void TwoTrackAna::MakePairs2_Rotated() {
701 Int_t nTrackA = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo);
702 Int_t nTrackB = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo);
703 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrack1CollectionNo);
704 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
705 for (int i = 0; i < nTrackA; i++) {
706 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, i);
707 for (int j = 0; j < nTrackB; j++) {
708 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, j);
709 BuildPair(fCurrentBackgroundPair);
710 for (int k = 0; k < tt_cut_no; k++) {
711 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
713 }
714 }
715 }
716 }
717
718 void TwoTrackAna::MakePairs_Hemisphere() {
720 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrackCollectionID); //
721 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
722 for (int i = 0; i < nTrack; i++) {
724 for (int j = i + 1; j < nTrack; j++) {
726 BuildPairSwapped(fCurrentBackgroundPair);
727 for (int k = 0; k < tt_cut_no; k++) {
728 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
730 }
731 }
732 }
733 }
734
735 void TwoTrackAna::MakePairs2_Hemisphere() {
736 Int_t nTrackA = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack1CollectionNo);
737 Int_t nTrackB = fMemoryMap->GetTracksNo(fCurrentEventCollectionID, fCurrentTrack2CollectionNo);
738 CutCollection* track_cuts = fCutContainer->GetTrackCollection(fCurrentTrack1CollectionNo);
739 Int_t tt_cut_no = track_cuts->GetNextNoBackround();
740 for (int i = 0; i < nTrackA; i++) {
741 fCurrentTrack1 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack1CollectionNo, i);
742 for (int j = 0; j < nTrackB; j++) {
743 fCurrentTrack2 = fMemoryMap->GetTrack(fCurrentEventCollectionID, fCurrentTrack2CollectionNo, j);
744 BuildPair(fCurrentBackgroundPair);
745 for (int k = 0; k < tt_cut_no; k++) {
746 fCurrentPairCollectionID = track_cuts->GetNextAddrBackround(k);
748 }
749 }
750 }
751 }
752
754 MultiTrackAna(ana),
755 fNonIdIsSet(ana.fNonIdIsSet),
756 fSignedBoth(ana.fSignedBoth),
757 fIdentical(ana.fIdentical),
758 fSwapPair(ana.fSwapPair),
759 fSkipEmpty(ana.fSkipEmpty),
760 fCurrentTrack2CollectionNo(0),
761 fCurrentTrack1CollectionNo(0),
762 fCurrentTrack1(nullptr),
763 fCurrentTrack2(nullptr),
764 fBackgroundMode(ana.fBackgroundMode),
765 fCurrentPairCollectionID(0),
766 fTwoTrackCollectionsNo(0),
767 fTwoTrackCollectionsNoBackground(0),
768 fCurrentSignalPair(nullptr),
769 fCurrentBackgroundPair(nullptr) {}
770
771 TwoTrack::PairType TwoTrackAna::GetPairType(EAnaMode mode) {
772 switch (mode) {
773 case kPerfectPairs: return TwoTrack::kBackground; break;
774 case kPerfectPairsID: return TwoTrack::kBackground; break;
775 case kPerfectPairsNID: return TwoTrack::kBackground; break;
776 case kMixedPairs: return TwoTrack::kMixed; break;
777 case kMixedPairsID: return TwoTrack::kMixed; break;
778
779 case kMixedPairsNID: return TwoTrack::kMixed; break;
780 case kRotatedPairs: return TwoTrack::kRotated; break;
781 case kRotatedPairsID: return TwoTrack::kRotated; break;
782 case kRotatedPairsNID: return TwoTrack::kRotated; break;
783 case kHemispherePairs: return TwoTrack::kHemishpere; break;
784
785 case kHemispherePairsID: return TwoTrack::kHemishpere; break;
786 case kHemispherePairsNID: return TwoTrack::kHemishpere; break;
787 default: return TwoTrack::kOther; break;
788 }
789 return TwoTrack::kOther;
790 }
791
793 if (this != &other) {
794 MultiTrackAna::operator =(other);
795 fNonIdIsSet = other.fNonIdIsSet;
796 fSignedBoth = other.fSignedBoth;
797 fIdentical = other.fIdentical;
798 fSwapPair = other.fSwapPair;
799 fSkipEmpty = other.fSkipEmpty;
800 fCurrentTrack1CollectionNo = other.fCurrentTrack1CollectionNo;
801 fCurrentTrack2CollectionNo = other.fCurrentTrack2CollectionNo;
802 if (other.fCurrentTrack) { fCurrentTrack1 = other.fCurrentTrack1; }
803 if (other.fCurrentTrack2) { fCurrentTrack2 = other.fCurrentTrack2; }
804 }
805 return *this;
806 }
807
820
821} // namespace Hal
822//---------------------------------------------------------------------------------------
static void PrintInfo(TString text, Hal::EInfo status)
Definition Cout.cxx:370
Int_t GetNextNo() const
Int_t GetNextAddrBackround(Int_t index) const
Int_t GetNextNoBackround() const
Bool_t PassSignalPair(TwoTrack *pair, const Int_t collection)
Int_t GetTwoTrackCollectionsBackgroundNo() const
void LinkCollections(ECutUpdate opt_low, Int_t in_low, ECutUpdate opt_high, Int_t in_high)
void RemoveCollection(ECutUpdate update, Int_t collection)
Int_t GetTwoTrackCollectionsNo() const
Int_t GetEventCollectionsNo() const
CutCollection * GetTrackCollection(Int_t collection) const
Bool_t PassBackgroundPair(TwoTrack *pair, const Int_t collection)
Int_t GetTrackCollectionsNo() const
CutContainer * fCutContainer
Definition EventAna.h:78
Int_t fMixSize
Definition EventAna.h:57
void AddToAnaMetadata(Package *main_pack, TObject *obj) const
Definition EventAna.cxx:239
MemoryMapManager * fMemoryMap
Definition EventAna.h:82
virtual void AddCut(const Cut &cut, Option_t *opt="")
Definition EventAna.cxx:322
Int_t fCurrentEventCollectionID
Definition EventAna.h:65
virtual void AddTags(TString tag)
Definition EventAna.cxx:304
Int_t GetTracksNo(Int_t event_collection, Int_t track_collection) const
void RejectLastEvent(Int_t event_collection)
Bool_t IsReadyToMixing(Int_t collection) const
Track * GetTrack(Int_t event_collection, Int_t track_collection, Int_t index) const
virtual Task::EInitFlag Init()
virtual void InitNewCutContainer()
virtual void SetOption(Option_t *option)
virtual void ProcessEvent()
Track * fCurrentTrack
Definition TrackAna.h:42
Int_t fCurrentTrackCollectionID
Definition TrackAna.h:34
virtual Package * Report() const
Definition TrackAna.cxx:94
virtual void FinishTask()
Definition TrackAna.cxx:99
Int_t fTrackCollectionsNo
Definition TrackAna.h:30
virtual void CheckCutContainerCollections()
Definition TrackAna.cxx:78
TwoTrack * fCurrentSignalPair
virtual void ProcessPair2_Charged2()
virtual void CheckCutContainerCollections()
virtual void ProcessPair2_Charged3()
virtual void InitNewCutContainer()
TwoTrack * fCurrentBackgroundPair
Int_t fTwoTrackCollectionsNo
TwoTrackAna & operator=(const TwoTrackAna &other)
virtual Package * Report() const
virtual void ProcessEvent()
virtual void ProcessPair_Charged2()
static TString BackgroundOptionPerfect()
static TString BackgroundOptionCharge()
virtual void ProcessPair2_Perfect()
Int_t fTwoTrackCollectionsNoBackground
static TString BackgroundOptionNoBackground()
virtual void SetOption(Option_t *option)
EAnaMode fBackgroundMode
virtual void ProcessPair_Perfect()
virtual void ProcessPair2()
virtual void ProcessPair2_Hemisphere()
Int_t fCurrentPairCollectionID
virtual void SetPairHiddenInfo()
virtual void FinishEventIdentical()
@ kHemispherePairsID
kHemispherePairsID
Definition TwoTrackAna.h:45
@ kChargedID2
kChargedID2
Definition TwoTrackAna.h:51
@ kRotatedPairsID
kRotatedPairsID
Definition TwoTrackAna.h:42
@ kRotatedPairs
kRotatedPairs
Definition TwoTrackAna.h:41
@ kNoBackgroundNID
kNoBackgroundNID
Definition TwoTrackAna.h:48
@ kHemispherePairsNID
kHemispherePairsNID
Definition TwoTrackAna.h:46
@ kNoBackgroundID
kNoBackgroundID
Definition TwoTrackAna.h:47
@ kHemispherePairs
kHemispherePairs
Definition TwoTrackAna.h:44
@ kCharged
kCharged
Definition TwoTrackAna.h:50
@ kRotatedPairsNID
kRotatedPairsNID
Definition TwoTrackAna.h:43
@ kMixedPairs
kMixedPairs
Definition TwoTrackAna.h:38
@ kChargedNID2
kChargedNID2
Definition TwoTrackAna.h:53
@ kMixedPairsNID
kMixedPairsNID
Definition TwoTrackAna.h:40
@ kPerfectPairsID
kPerfectPairsID
Definition TwoTrackAna.h:36
@ kNoBackground
kNoBackground
Definition TwoTrackAna.h:49
@ kChargedID3
kChargedID3
Definition TwoTrackAna.h:52
@ kPerfectPairsNID
kPerfectPairsNID
Definition TwoTrackAna.h:37
@ kPerfectPairs
kPerfectPairs
Definition TwoTrackAna.h:35
@ kMixedPairsID
kMixedPairsID
Definition TwoTrackAna.h:39
@ kChargedNID3
kChargedNID3
Definition TwoTrackAna.h:54
virtual void ProcessPair_Mixed()
TwoTrackAna(Bool_t use_background=kFALSE)
virtual void ProcessPair2_Mixed()
virtual void ProcessPair2_Rotated()
virtual void ProcessPair_Hemisphere()
virtual void LinkCollections()
static TString BackgroundOptionHemisphere()
static TwoTrack::PairType GetPairType(EAnaMode mode)
virtual void FinishTask()
static TString BackgroundOptionRotated()
virtual void ProcessPair_Charged3()
virtual void DeleteHiddenPairInfo()
virtual void FinishEventNonIdentical()
static TString BackgroundOptionMixed()
virtual void ProcessPair_Rotated()
Bool_t IdenticalParticles() const
virtual void SetTags()
virtual void ProcessPair()
void SetMixSize(Int_t mixsize)
virtual Task::EInitFlag Init()
HiddenInfo * GetHiddenInfo() const
Definition TwoTrack.h:85
void SetHiddenInfo(HiddenInfo *info)
Definition TwoTrack.h:95
void FastBuild(Track *track1, Track *track2)
Definition TwoTrack.h:39
void SetSame(Bool_t same)
Definition TwoTrack.h:90
void SetPairType(PairType type)
Definition TwoTrack.h:65