]>
Commit | Line | Data |
---|---|---|
2dab9030 | 1 | // |
2 | // *** Class AliRsnPairNtuple *** | |
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 <TList.h> | |
16 | #include <TNtuple.h> | |
17 | ||
18 | #include "AliLog.h" | |
19 | ||
20 | #include "AliRsnMother.h" | |
21 | #include "AliRsnEvent.h" | |
22 | #include "AliRsnFunction.h" | |
23 | #include "AliRsnCutSet.h" | |
24 | #include "AliRsnCutStd.h" | |
25 | #include "AliRsnValue.h" | |
26 | ||
27 | #include "AliRsnPairNtuple.h" | |
28 | ||
29 | ClassImp(AliRsnPairNtuple) | |
30 | ||
31 | //_____________________________________________________________________________ | |
32 | AliRsnPairNtuple::AliRsnPairNtuple(const char *name, AliRsnPairDef *def) : | |
33 | AliRsnPair(name, def), | |
34 | fValues("AliRsnValue", 0), | |
35 | fNtuple(0x0) | |
36 | { | |
37 | // | |
38 | // Default constructor | |
39 | // | |
40 | ||
41 | AliDebug(AliLog::kDebug+2,"<-"); | |
42 | AliDebug(AliLog::kDebug+2,"->"); | |
43 | } | |
44 | ||
45 | //_____________________________________________________________________________ | |
46 | AliRsnPairNtuple::AliRsnPairNtuple(const AliRsnPairNtuple& copy) : | |
47 | AliRsnPair(copy), | |
48 | fValues(copy.fValues), | |
49 | fNtuple(copy.fNtuple) | |
50 | { | |
51 | // | |
52 | // Default constructor | |
53 | // | |
54 | ||
55 | AliDebug(AliLog::kDebug+2,"<-"); | |
56 | AliDebug(AliLog::kDebug+2,"->"); | |
57 | } | |
58 | ||
59 | //_____________________________________________________________________________ | |
60 | AliRsnPairNtuple& AliRsnPairNtuple::operator=(const AliRsnPairNtuple& copy) | |
61 | { | |
62 | AliRsnPair::operator=(copy); | |
63 | ||
64 | Int_t i, n = copy.fValues.GetEntries(); | |
65 | for (i = 0; i < n; i++) | |
66 | { | |
67 | AliRsnValue *fcn = (AliRsnValue*)copy.fValues[i]; | |
68 | if (fcn) AddValue(fcn); | |
69 | } | |
70 | ||
71 | fNtuple = copy.fNtuple; | |
72 | ||
73 | return (*this); | |
74 | } | |
75 | ||
76 | //_____________________________________________________________________________ | |
77 | AliRsnPairNtuple::~AliRsnPairNtuple() | |
78 | { | |
79 | // | |
80 | // Destructor | |
81 | // | |
82 | ||
83 | AliDebug(AliLog::kDebug+2,"<-"); | |
84 | AliDebug(AliLog::kDebug+2,"->"); | |
85 | } | |
86 | ||
87 | //_____________________________________________________________________________ | |
88 | void AliRsnPairNtuple::Compute() | |
89 | { | |
90 | // | |
91 | // Makes computations using the two passed daughter objects. | |
92 | // Checks all cuts and then computes the corresponding pair object | |
93 | // and then fill the list of required values using it. | |
94 | // | |
95 | ||
96 | AliDebug(AliLog::kDebug+2,"<-"); | |
97 | ||
98 | // compute all values | |
99 | Int_t i, n = fValues.GetEntries(); | |
100 | TArrayF values(n); | |
101 | AliRsnValue *value = 0x0; | |
102 | for (i = 0; i < n; i++) | |
103 | { | |
104 | values[i] = -1E10; | |
105 | value = (AliRsnValue*)fValues[i]; | |
106 | if (value->Eval(&fMother, fPairDef, fEvent)) values[i] = (Float_t)value->GetValue(); | |
107 | } | |
108 | ||
109 | fNtuple->Fill(values.GetArray()); | |
110 | ||
111 | AliDebug(AliLog::kDebug+2,"->"); | |
112 | } | |
113 | ||
114 | //_____________________________________________________________________________ | |
115 | void AliRsnPairNtuple::Init(const char *prefix, TList *list) | |
116 | { | |
117 | // | |
118 | // Generates needed histograms, giving them a name based on | |
119 | // the flags defined here, on the pair definition, and attaches | |
120 | // a prefix to it, according to the argument. | |
121 | // | |
122 | // All generated histograms are stored into the output TList. | |
123 | // | |
124 | ||
125 | AliDebug(AliLog::kDebug+2,"<-"); | |
126 | ||
127 | TString nameList(""); | |
128 | ||
129 | Int_t i, n = fValues.GetEntries(); | |
130 | AliRsnValue *val = 0; | |
131 | for (i = 0; i < n; i++) | |
132 | { | |
133 | val = (AliRsnValue*)fValues.At(i); | |
134 | nameList += val->GetName(); | |
135 | if (i < n - 1) nameList += ':'; | |
136 | } | |
137 | ||
138 | if (fNtuple) delete fNtuple; | |
139 | fNtuple = new TNtuple(Form("%sntp%s", prefix, GetName()), "", nameList.Data()); | |
140 | if (list) list->Add(fNtuple); | |
141 | ||
142 | AliDebug(AliLog::kDebug+2,"->"); | |
143 | } | |
144 | ||
145 | //_____________________________________________________________________________ | |
146 | void AliRsnPairNtuple::AddValue(AliRsnValue *const val) | |
147 | { | |
148 | // | |
149 | // Adds a new computing function | |
150 | // | |
151 | ||
152 | AliDebug(AliLog::kDebug+2,"<-"); | |
153 | Int_t size = fValues.GetEntries(); | |
154 | new(fValues[size]) AliRsnValue(*val); | |
155 | AliDebug(AliLog::kDebug+2,"->"); | |
156 | } |