]>
Commit | Line | Data |
---|---|---|
c865cb1d | 1 | // |
2 | // *** Class AliRsnPair *** | |
3 | // | |
4 | // "Core" method for defining the work on a pari of particles. | |
5 | // For one analysis, one must setup one of this for each pair he wants to analyze, | |
6 | // adding to it all analysis which he desires to do. | |
7 | // Here he defines the cuts, and the particle types and charges, and can add | |
8 | // functions which do different operations on the same pair, and some binning | |
9 | // with respect to some kinematic variables (eta, momentum) | |
10 | // | |
11 | // authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it) | |
12 | // M. Vala (email: martin.vala@cern.ch) | |
13 | // | |
14 | ||
15 | #include "AliRsnLoopEff.h" | |
16 | ||
17 | ClassImp(AliRsnLoopEff) | |
18 | ||
19 | //_____________________________________________________________________________ | |
20 | AliRsnLoopEff::AliRsnLoopEff(const char *name, Int_t nSteps) : | |
21 | AliRsnLoop(name), | |
22 | fAddSteps(nSteps), | |
23 | fSteps(0) | |
24 | { | |
25 | // | |
26 | // Default constructor | |
27 | // | |
28 | } | |
29 | ||
30 | //_____________________________________________________________________________ | |
31 | AliRsnLoopEff::AliRsnLoopEff(const AliRsnLoopEff& copy) : | |
32 | AliRsnLoop(copy), | |
33 | fAddSteps(copy.fAddSteps), | |
34 | fSteps(copy.fSteps) | |
35 | { | |
36 | // | |
37 | // Copy constructor | |
38 | // | |
39 | } | |
40 | ||
41 | //_____________________________________________________________________________ | |
42 | AliRsnLoopEff& AliRsnLoopEff::operator=(const AliRsnLoopEff& copy) | |
43 | { | |
44 | AliRsnLoop::operator=(copy); | |
45 | ||
46 | fAddSteps = copy.fAddSteps; | |
47 | fSteps = copy.fSteps; | |
48 | ||
49 | return (*this); | |
50 | } | |
51 | ||
52 | //_____________________________________________________________________________ | |
53 | AliRsnLoopEff::~AliRsnLoopEff() | |
54 | { | |
55 | // | |
56 | // Destructor | |
57 | // | |
58 | ||
59 | fSteps.Delete(); | |
60 | } | |
61 | ||
62 | //_____________________________________________________________________________ | |
63 | void AliRsnLoopEff::CreateOutput() | |
64 | { | |
65 | // | |
66 | // Create the unique output object of this loop | |
67 | // | |
68 | ||
69 | if (!fOutputs.IsEmpty()) { | |
70 | AliInfo("Clearing container of this efficiency loop."); | |
71 | fOutputs.Delete(); | |
72 | } | |
73 | ||
74 | AliRsnListOutput out(Form("%s_out", GetName()), AliRsnListOutput::kCFContainer); | |
75 | out.SetSteps(NStepsAll()); | |
76 | ||
77 | AddOutput(&out); | |
78 | } | |
79 | ||
80 | //_____________________________________________________________________________ | |
81 | void AliRsnLoopEff::AddStep(TObject *cuts) | |
82 | { | |
83 | // | |
84 | // Add a step on reconstruction | |
85 | // | |
86 | ||
87 | fSteps.AddLast(cuts); | |
88 | } | |
89 | ||
90 | //_____________________________________________________________________________ | |
91 | Bool_t AliRsnLoopEff::Init(const char *prefix, TList *list) | |
92 | { | |
93 | // | |
94 | // Initialization function. | |
95 | // Loops on all functions and eventual the ntuple, to initialize output objects. | |
96 | // | |
97 | ||
98 | CreateOutput(); | |
99 | return AliRsnLoop::Init(Form("%s_%s", prefix, GetName()), list); | |
100 | } | |
101 | ||
102 | //_____________________________________________________________________________ | |
103 | Int_t AliRsnLoopEff::FindTrack(Int_t label, AliVEvent *event) | |
104 | { | |
105 | // | |
106 | // Loops an event and find all tracks which have a label | |
107 | // equal to that passed as first argument. | |
108 | // | |
109 | ||
110 | Int_t i = 0; | |
111 | Int_t ntracks = event->GetNumberOfTracks(); | |
112 | TArrayI array(100); | |
113 | ||
114 | for (i = 0; i < ntracks; i++) { | |
115 | AliVParticle *track = event->GetTrack(i); | |
116 | if (TMath::Abs(track->GetLabel()) != label) continue; | |
117 | return i; | |
118 | } | |
119 | ||
120 | return -1; | |
121 | } |