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.
8 #include <TEntryList.h>
12 #include "AliRsnEvent.h"
13 #include "AliRsnDaughterDef.h"
14 #include "AliRsnDaughterSelector.h"
16 #include "AliRsnLoopDaughter.h"
18 ClassImp(AliRsnLoopDaughter)
20 //_____________________________________________________________________________
21 AliRsnLoopDaughter::AliRsnLoopDaughter(const char *name, Int_t listID, AliRsnDaughterDef *def) :
28 // Default constructor
32 //_____________________________________________________________________________
33 AliRsnLoopDaughter::AliRsnLoopDaughter(const AliRsnLoopDaughter& copy) :
35 fListID(copy.fListID),
37 fDaughter(copy.fDaughter)
44 //_____________________________________________________________________________
45 AliRsnLoopDaughter& AliRsnLoopDaughter::operator=(const AliRsnLoopDaughter& copy)
48 // Assignment operator
51 AliRsnLoop::operator=(copy);
52 fListID = copy.fListID;
53 fDaughter = copy.fDaughter;
59 //_____________________________________________________________________________
60 AliRsnLoopDaughter::~AliRsnLoopDaughter()
67 //_____________________________________________________________________________
68 void AliRsnLoopDaughter::Print(Option_t* /*option*/) const
71 // Prints info about pair
75 //_____________________________________________________________________________
76 Bool_t AliRsnLoopDaughter::Init(const char *prefix, TList *list)
79 // Initialization function.
80 // Loops on all functions and eventual the ntuple, to initialize output objects.
83 return AliRsnLoop::Init(Form("%s_%s", prefix, GetName()), list);
86 //_____________________________________________________________________________
87 Int_t AliRsnLoopDaughter::DoLoop
88 (AliRsnEvent *evMain, AliRsnDaughterSelector *selMain, AliRsnEvent *, AliRsnDaughterSelector *)
92 // Computes what is needed from passed events.
93 // Returns the number of pairs successfully processed.
96 if (!OkEvent(evMain)) return 0;
98 Int_t i, il, nadd = 0, nlist = 0;
99 TEntryList *list[2] = {0, 0};
101 if (fDef->IsChargeDefined()) {
102 list[0] = selMain->GetSelected(fListID, fDef->GetChargeC());
106 list[0] = selMain->GetSelected(fListID, '+');
108 list[1] = selMain->GetSelected(fListID, '-');
111 list[0] = selMain->GetSelected(fListID, '0');
117 TObjArrayIter next(&fOutputs);
118 AliRsnListOutput *out = 0x0;
120 for (il = 0; il < nlist; il++) {
122 AliError(Form("List #%d is null", il));
125 for (i = 0; i < list[il]->GetN(); i++) {
126 evMain->SetDaughterAbs(fDaughter, (Int_t)list[il]->GetEntry(i));
128 if (!fDef->MatchesDaughter(&fDaughter)) continue;
132 while ( (out = (AliRsnListOutput*)next()) ) {
133 out->Fill(&fDaughter);