2 // *** Class AliRsnPairFunctions ***
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)
11 // authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
12 // M. Vala (email: martin.vala@cern.ch)
19 #include "AliRsnMother.h"
20 #include "AliRsnEvent.h"
21 #include "AliRsnFunction.h"
22 #include "AliRsnCutSet.h"
23 #include "AliRsnValue.h"
25 #include "AliRsnPairFunctions.h"
27 ClassImp(AliRsnPairFunctions)
29 //_____________________________________________________________________________
30 AliRsnPairFunctions::AliRsnPairFunctions(const char *name, AliRsnPairDef *def) :
31 AliRsnPair(name, def),
32 fFunctions("AliRsnFunction", 0)
35 // Default constructor
39 //_____________________________________________________________________________
40 AliRsnPairFunctions::AliRsnPairFunctions(const AliRsnPairFunctions& copy) :
42 fFunctions(copy.fFunctions)
45 // Default constructor
49 //_____________________________________________________________________________
50 AliRsnPairFunctions& AliRsnPairFunctions::operator=(const AliRsnPairFunctions& copy)
52 AliRsnPair::operator=(copy);
54 Int_t i, n = copy.fFunctions.GetEntries();
55 for (i = 0; i < n; i++) {
56 AliRsnFunction *fcn = (AliRsnFunction*)copy.fFunctions[i];
57 if (fcn) AddFunction(fcn);
63 //_____________________________________________________________________________
64 AliRsnPairFunctions::~AliRsnPairFunctions()
71 //_____________________________________________________________________________
72 void AliRsnPairFunctions::Compute()
75 // Makes computations using the two passed daughter objects.
76 // Checks all cuts and then computes the corresponding pair object
77 // and then fill the list of required values using it.
80 TObjArrayIter nextFcn(&fFunctions);
81 AliRsnFunction *fcn = 0x0;
83 while ((fcn = (AliRsnFunction*)nextFcn())) {
84 fcn->SetPairDef(fPairDef);
85 fcn->SetPair(&fMother);
90 //_____________________________________________________________________________
91 void AliRsnPairFunctions::Init(const char *prefix, TList *list)
94 // Generates needed histograms, giving them a name based on
95 // the flags defined here, on the pair definition, and attaches
96 // a prefix to it, according to the argument.
98 // All generated histograms are stored into the output TList.
103 AliRsnFunction *fcn = 0;
104 for (i = 0; i < fFunctions.GetEntries(); i++) {
105 fcn = (AliRsnFunction*)fFunctions.At(i);
110 hName += fcn->GetName();
111 if (fcn->IsUsingTH1()) list->Add(fcn->CreateHistogram(hName.Data(), ""));
112 else list->Add(fcn->CreateHistogramSparse(hName.Data(), ""));
116 //_____________________________________________________________________________
117 void AliRsnPairFunctions::AddFunction(AliRsnFunction *const fcn)
120 // Adds a new computing function
123 Int_t size = fFunctions.GetEntries();
124 new (fFunctions[size]) AliRsnFunction(*fcn);