]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnPair.cxx
Major upgrade to the package, in order to speed-up the execution and remove some...
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPair.cxx
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 <Riostream.h>
16 #include <TList.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 #include "AliRsnCutManager.h"
27
28 #include "AliRsnPair.h"
29
30 ClassImp(AliRsnPair)
31
32 //_____________________________________________________________________________
33 AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) :
34   TNamed(name, ""),
35   fOnlyTrue(kFALSE),
36   fIsMixed(kFALSE),
37   fPairDef(def),
38   fCutManager(),
39   fMother(),
40   fEvent(0x0)
41 {
42 //
43 // Default constructor
44 //
45
46   AliDebug(AliLog::kDebug+2,"<-");
47   AliDebug(AliLog::kDebug+2,"->");
48 }
49
50 //_____________________________________________________________________________
51 AliRsnPair::AliRsnPair(const AliRsnPair& copy) :
52   TNamed(copy),
53   fOnlyTrue(copy.fOnlyTrue),
54   fIsMixed(copy.fIsMixed),
55   fPairDef(copy.fPairDef),
56   fCutManager(copy.fCutManager),
57   fMother(copy.fMother),
58   fEvent(0x0)
59 {
60 //
61 // Default constructor
62 //
63
64   AliDebug(AliLog::kDebug+2,"<-");
65   AliDebug(AliLog::kDebug+2,"->");
66 }
67
68 //_____________________________________________________________________________
69 AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy)
70 {
71   fOnlyTrue = copy.fOnlyTrue;
72   fIsMixed = copy.fIsMixed;
73   fPairDef = copy.fPairDef;
74   fMother = copy.fMother;
75   fCutManager = copy.fCutManager;
76   fEvent = 0x0;
77
78   return (*this);
79 }
80
81 //_____________________________________________________________________________
82 AliRsnPair::~AliRsnPair()
83 {
84 //
85 // Destructor
86 //
87
88   AliDebug(AliLog::kDebug+2,"<-");
89   AliDebug(AliLog::kDebug+2,"->");
90 }
91
92 //_____________________________________________________________________________
93 void AliRsnPair::Print(Option_t* /*option*/) const
94 {
95 //
96 // Prints info about pair
97 //
98
99   AliDebug(AliLog::kDebug+2,"<-");
100   AliInfo(Form("PDG %d %d", AliPID::ParticleCode(fPairDef->GetPID(0)), AliPID::ParticleCode(fPairDef->GetPID(1))));
101   AliInfo(Form("Masses %f %f", fPairDef->GetMass(0), fPairDef->GetMass(1)));
102
103   AliDebug(AliLog::kDebug+2,"->");
104 }
105
106 //_____________________________________________________________________________
107 Bool_t AliRsnPair::Fill
108 (AliRsnDaughter *daughter0, AliRsnDaughter *daughter1, AliRsnEvent *ev0, AliRsnEvent *ev1)
109 {
110 //
111 // Sets the two passed daughters to the AliRsnMother data member of this object
112 // which is used to perform all computations to fill the value list.
113 // This operation is done successfully only when the first passed object matches
114 // the required object type (track/V0) and the required charge for first element in pair def,
115 // and the second passed object does the same w.r. to the second element in pair def.
116 // Moreover, all cuts are checked and the operation fails if a cut check is unsuccessful.
117 // Finally, if a true pair is required, this is checked at the end.
118 //
119
120   AliDebug(AliLog::kDebug+2,"<-");
121   
122   // check for correct type-charge match for first element
123   if (daughter0->RefType() != fPairDef->GetDaughterType(0)) return kFALSE;
124   if (daughter0->ChargeChar() != fPairDef->GetCharge(0)) return kFALSE;
125   
126   // check for correct type-charge match for second element
127   if (daughter1->RefType() != fPairDef->GetDaughterType(1)) return kFALSE;
128   if (daughter1->ChargeChar() != fPairDef->GetCharge(1)) return kFALSE;
129     
130   // cuts on track #1 & common
131   fCutManager.SetEvent(ev0);
132   if (!fCutManager.PassDaughter1Cuts(daughter0)) return kFALSE;
133   if (!fCutManager.PassCommonDaughterCuts(daughter0)) return kFALSE;
134   
135   // cuts on track #2 & common
136   fCutManager.SetEvent(ev1);
137   if (!fCutManager.PassDaughter2Cuts(daughter1)) return kFALSE;
138   if (!fCutManager.PassCommonDaughterCuts(daughter1)) return kFALSE;
139   
140   // point to first event as reference
141   fEvent = ev0;
142   
143   // define pair & check
144   fMother.SetDaughters(daughter0, fPairDef->GetMass(0), daughter1, fPairDef->GetMass(1));
145   fCutManager.SetEvent(fEvent);
146   if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
147   
148   // if required a true pair, check this here and eventually return a fail message
149   if (fOnlyTrue && !fMother.MatchesDef(fPairDef)) return kFALSE;
150
151   AliDebug(AliLog::kDebug+2,"->");
152   
153   return kTRUE;
154 }
155
156 //_____________________________________________________________________________
157 void AliRsnPair::Compute()
158 {
159 //
160 // Virtual method to compute pair quantities of interest
161 //
162
163   AliWarning("Implement this method in derived classes");
164 }
165
166 //_____________________________________________________________________________
167 void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/)
168 {
169 //
170 // Virtual method to compute pair quantities of interest
171 //
172
173   AliWarning("Implement this method in derived classes");
174 }