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 "AliRsnCutStd.h"
24 #include "AliRsnValue.h"
26 #include "AliRsnPairFunctions.h"
28 ClassImp(AliRsnPairFunctions)
30 //_____________________________________________________________________________
31 AliRsnPairFunctions::AliRsnPairFunctions(const char *name, AliRsnPairDef *def) :
32 AliRsnPair(name, def),
33 fFunctions("AliRsnFunction", 0)
36 // Default constructor
39 AliDebug(AliLog::kDebug+2,"<-");
40 AliDebug(AliLog::kDebug+2,"->");
43 //_____________________________________________________________________________
44 AliRsnPairFunctions::AliRsnPairFunctions(const AliRsnPairFunctions& copy) :
46 fFunctions(copy.fFunctions)
49 // Default constructor
52 AliDebug(AliLog::kDebug+2,"<-");
53 AliDebug(AliLog::kDebug+2,"->");
56 //_____________________________________________________________________________
57 AliRsnPairFunctions& AliRsnPairFunctions::operator=(const AliRsnPairFunctions& copy)
59 AliRsnPair::operator=(copy);
61 Int_t i, n = copy.fFunctions.GetEntries();
62 for (i = 0; i < n; i++)
64 AliRsnFunction *fcn = (AliRsnFunction*)copy.fFunctions[i];
65 if (fcn) AddFunction(fcn);
71 //_____________________________________________________________________________
72 AliRsnPairFunctions::~AliRsnPairFunctions()
78 AliDebug(AliLog::kDebug+2,"<-");
79 AliDebug(AliLog::kDebug+2,"->");
82 //_____________________________________________________________________________
83 void AliRsnPairFunctions::Compute()
86 // Makes computations using the two passed daughter objects.
87 // Checks all cuts and then computes the corresponding pair object
88 // and then fill the list of required values using it.
91 AliDebug(AliLog::kDebug+2,"<-");
93 TObjArrayIter nextFcn(&fFunctions);
94 AliRsnFunction *fcn = 0x0;
96 while ((fcn = (AliRsnFunction*)nextFcn()))
98 fcn->SetPairDef(fPairDef);
99 fcn->SetPair(&fMother);
100 fcn->SetEvent(fEvent);
104 AliDebug(AliLog::kDebug+2,"->");
107 //_____________________________________________________________________________
108 void AliRsnPairFunctions::Init(const char *prefix, TList *list)
111 // Generates needed histograms, giving them a name based on
112 // the flags defined here, on the pair definition, and attaches
113 // a prefix to it, according to the argument.
115 // All generated histograms are stored into the output TList.
118 AliDebug(AliLog::kDebug+2,"<-");
122 AliRsnFunction *fcn = 0;
123 for (i = 0; i < fFunctions.GetEntries(); i++)
125 fcn = (AliRsnFunction*)fFunctions.At(i);
126 sprintf(hName, "%s_%s_%s", prefix, GetName(), fcn->GetName());
128 if (fcn->IsUsingTH1()) list->Add(fcn->CreateHistogram(hName, ""));
129 else list->Add(fcn->CreateHistogramSparse(hName, ""));
132 AliDebug(AliLog::kDebug+2,"->");
135 //_____________________________________________________________________________
136 void AliRsnPairFunctions::AddFunction(AliRsnFunction *const fcn)
139 // Adds a new computing function
142 AliDebug(AliLog::kDebug+2,"<-");
145 Int_t size = fFunctions.GetEntries();
146 new(fFunctions[size]) AliRsnFunction(*fcn);
148 AliDebug(AliLog::kDebug+2,"->");