]>
Commit | Line | Data |
---|---|---|
c865cb1d | 1 | // |
2 | // Computator for single daughters. | |
3 | // Implements a simple loop on tracks from one of the entry lists | |
4 | // filled by the task AliRsnInputHandler, adding a check on their | |
5 | // definition specified in the daughter def. | |
6 | // | |
7 | ||
8 | #include <TEntryList.h> | |
9 | ||
10 | #include "AliLog.h" | |
11 | ||
12 | #include "AliRsnEvent.h" | |
13 | #include "AliRsnDaughterDef.h" | |
14 | #include "AliRsnDaughterSelector.h" | |
15 | ||
16 | #include "AliRsnLoopDaughter.h" | |
17 | ||
18 | ClassImp(AliRsnLoopDaughter) | |
19 | ||
20 | //_____________________________________________________________________________ | |
21 | AliRsnLoopDaughter::AliRsnLoopDaughter(const char *name, Int_t listID, AliRsnDaughterDef *def) : | |
22 | AliRsnLoop(name), | |
f34f960b | 23 | fOnlyTrue(kFALSE), |
c865cb1d | 24 | fListID(listID), |
25 | fDef(def), | |
26 | fDaughter() | |
27 | { | |
28 | // | |
29 | // Default constructor | |
30 | // | |
31 | } | |
32 | ||
33 | //_____________________________________________________________________________ | |
34 | AliRsnLoopDaughter::AliRsnLoopDaughter(const AliRsnLoopDaughter& copy) : | |
35 | AliRsnLoop(copy), | |
f34f960b | 36 | fOnlyTrue(copy.fOnlyTrue), |
c865cb1d | 37 | fListID(copy.fListID), |
38 | fDef(copy.fDef), | |
39 | fDaughter(copy.fDaughter) | |
40 | { | |
41 | // | |
42 | // Copy constructor | |
43 | // | |
44 | } | |
45 | ||
46 | //_____________________________________________________________________________ | |
47 | AliRsnLoopDaughter& AliRsnLoopDaughter::operator=(const AliRsnLoopDaughter& copy) | |
48 | { | |
49 | // | |
50 | // Assignment operator | |
51 | // | |
52 | ||
53 | AliRsnLoop::operator=(copy); | |
f34f960b | 54 | fOnlyTrue = copy.fOnlyTrue; |
c865cb1d | 55 | fListID = copy.fListID; |
56 | fDaughter = copy.fDaughter; | |
57 | fDef = copy.fDef; | |
58 | ||
59 | return (*this); | |
60 | } | |
61 | ||
62 | //_____________________________________________________________________________ | |
63 | AliRsnLoopDaughter::~AliRsnLoopDaughter() | |
64 | { | |
65 | // | |
66 | // Destructor | |
67 | // | |
68 | } | |
69 | ||
70 | //_____________________________________________________________________________ | |
71 | void AliRsnLoopDaughter::Print(Option_t* /*option*/) const | |
72 | { | |
73 | // | |
74 | // Prints info about pair | |
75 | // | |
76 | } | |
77 | ||
78 | //_____________________________________________________________________________ | |
79 | Bool_t AliRsnLoopDaughter::Init(const char *prefix, TList *list) | |
80 | { | |
81 | // | |
82 | // Initialization function. | |
83 | // Loops on all functions and eventual the ntuple, to initialize output objects. | |
84 | // | |
85 | ||
86 | return AliRsnLoop::Init(Form("%s_%s", prefix, GetName()), list); | |
87 | } | |
88 | ||
89 | //_____________________________________________________________________________ | |
90 | Int_t AliRsnLoopDaughter::DoLoop | |
91 | (AliRsnEvent *evMain, AliRsnDaughterSelector *selMain, AliRsnEvent *, AliRsnDaughterSelector *) | |
92 | { | |
93 | // | |
94 | // Loop function. | |
95 | // Computes what is needed from passed events. | |
96 | // Returns the number of pairs successfully processed. | |
97 | // | |
98 | ||
99 | if (!OkEvent(evMain)) return 0; | |
100 | ||
101 | Int_t i, il, nadd = 0, nlist = 0; | |
102 | TEntryList *list[2] = {0, 0}; | |
103 | ||
104 | if (fDef->IsChargeDefined()) { | |
105 | list[0] = selMain->GetSelected(fListID, fDef->GetChargeC()); | |
106 | list[1] = 0x0; | |
107 | nlist = 1; | |
108 | } else { | |
109 | list[0] = selMain->GetSelected(fListID, '+'); | |
110 | if (list[0]) { | |
111 | list[1] = selMain->GetSelected(fListID, '-'); | |
112 | nlist = 2; | |
113 | } else { | |
114 | list[0] = selMain->GetSelected(fListID, '0'); | |
115 | list[1] = 0x0; | |
116 | nlist = 1; | |
117 | } | |
118 | } | |
119 | ||
120 | TObjArrayIter next(&fOutputs); | |
121 | AliRsnListOutput *out = 0x0; | |
122 | ||
123 | for (il = 0; il < nlist; il++) { | |
124 | if (!list[il]) { | |
125 | AliError(Form("List #%d is null", il)); | |
126 | continue; | |
127 | } | |
128 | for (i = 0; i < list[il]->GetN(); i++) { | |
f34f960b | 129 | evMain->SetDaughter(fDaughter, (Int_t)list[il]->GetEntry(i)); |
c865cb1d | 130 | // check matching |
f34f960b | 131 | if (fOnlyTrue && !fDef->MatchesPID(&fDaughter)) continue; |
132 | if (!fDef->MatchesCharge(&fDaughter)) continue; | |
133 | if (!fDef->MatchesRefType(&fDaughter)) continue; | |
c865cb1d | 134 | // fill outputs |
135 | nadd++; | |
136 | next.Reset(); | |
137 | while ( (out = (AliRsnListOutput*)next()) ) { | |
138 | out->Fill(&fDaughter); | |
139 | } | |
140 | } | |
141 | } | |
142 | ||
143 | return nadd; | |
144 | } |