]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnPairFunctions.cxx
Removed old ME classes, since the nex event mixing has been introduced and is integra...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPairFunctions.cxx
CommitLineData
2dab9030 1//
2// *** Class AliRsnPairFunctions ***
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
17#include "AliLog.h"
18
19#include "AliRsnMother.h"
20#include "AliRsnEvent.h"
21#include "AliRsnFunction.h"
22#include "AliRsnCutSet.h"
2dab9030 23#include "AliRsnValue.h"
24
25#include "AliRsnPairFunctions.h"
26
27ClassImp(AliRsnPairFunctions)
28
29//_____________________________________________________________________________
30AliRsnPairFunctions::AliRsnPairFunctions(const char *name, AliRsnPairDef *def) :
2a1c7696 31 AliRsnPair(name, def),
32 fFunctions("AliRsnFunction", 0)
2dab9030 33{
34//
35// Default constructor
36//
37
2a1c7696 38 AliDebug(AliLog::kDebug + 2, "<-");
39 AliDebug(AliLog::kDebug + 2, "->");
2dab9030 40}
41
42//_____________________________________________________________________________
43AliRsnPairFunctions::AliRsnPairFunctions(const AliRsnPairFunctions& copy) :
2a1c7696 44 AliRsnPair(copy),
45 fFunctions(copy.fFunctions)
2dab9030 46{
47//
48// Default constructor
49//
50
2a1c7696 51 AliDebug(AliLog::kDebug + 2, "<-");
52 AliDebug(AliLog::kDebug + 2, "->");
2dab9030 53}
54
55//_____________________________________________________________________________
56AliRsnPairFunctions& AliRsnPairFunctions::operator=(const AliRsnPairFunctions& copy)
57{
2a1c7696 58 AliRsnPair::operator=(copy);
2dab9030 59
2a1c7696 60 Int_t i, n = copy.fFunctions.GetEntries();
61 for (i = 0; i < n; i++) {
62 AliRsnFunction *fcn = (AliRsnFunction*)copy.fFunctions[i];
63 if (fcn) AddFunction(fcn);
64 }
2dab9030 65
2a1c7696 66 return (*this);
2dab9030 67}
68
69//_____________________________________________________________________________
70AliRsnPairFunctions::~AliRsnPairFunctions()
71{
72//
73// Destructor
74//
75
2a1c7696 76 AliDebug(AliLog::kDebug + 2, "<-");
77 AliDebug(AliLog::kDebug + 2, "->");
2dab9030 78}
79
80//_____________________________________________________________________________
81void AliRsnPairFunctions::Compute()
82{
83//
84// Makes computations using the two passed daughter objects.
85// Checks all cuts and then computes the corresponding pair object
86// and then fill the list of required values using it.
87//
2a1c7696 88
89 AliDebug(AliLog::kDebug + 2, "<-");
90
91 TObjArrayIter nextFcn(&fFunctions);
92 AliRsnFunction *fcn = 0x0;
93
94 while ((fcn = (AliRsnFunction*)nextFcn())) {
95 fcn->SetPairDef(fPairDef);
96 fcn->SetPair(&fMother);
97 fcn->Fill();
98 }
99
100 AliDebug(AliLog::kDebug + 2, "->");
2dab9030 101}
102
103//_____________________________________________________________________________
104void AliRsnPairFunctions::Init(const char *prefix, TList *list)
105{
106//
107// Generates needed histograms, giving them a name based on
108// the flags defined here, on the pair definition, and attaches
109// a prefix to it, according to the argument.
110//
111// All generated histograms are stored into the output TList.
112//
113
2a1c7696 114 AliDebug(AliLog::kDebug + 2, "<-");
115
116 Int_t i;
117 TString hName("");
118 AliRsnFunction *fcn = 0;
119 for (i = 0; i < fFunctions.GetEntries(); i++) {
120 fcn = (AliRsnFunction*)fFunctions.At(i);
121 hName += prefix;
122 hName += '_';
123 hName += GetName();
124 hName += '_';
125 hName += fcn->GetName();
126 if (fcn->IsUsingTH1()) list->Add(fcn->CreateHistogram(hName.Data(), ""));
127 else list->Add(fcn->CreateHistogramSparse(hName.Data(), ""));
128 }
129
130 AliDebug(AliLog::kDebug + 2, "->");
2dab9030 131}
132
133//_____________________________________________________________________________
134void AliRsnPairFunctions::AddFunction(AliRsnFunction *const fcn)
135{
136//
137// Adds a new computing function
138//
139
2a1c7696 140 AliDebug(AliLog::kDebug + 2, "<-");
141
142 fFunctions.Print();
143 Int_t size = fFunctions.GetEntries();
144 new(fFunctions[size]) AliRsnFunction(*fcn);
145
146 AliDebug(AliLog::kDebug + 2, "->");
2dab9030 147}