]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnPair.cxx
Added a new cut on comparison of daughters' momenta (needed for Deltas)
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPair.cxx
CommitLineData
aec0ec32 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
4fbb2459 15#include <TList.h>
aec0ec32 16
17#include "AliLog.h"
18
2dab9030 19#include "AliRsnMother.h"
4fbb2459 20#include "AliRsnEvent.h"
aec0ec32 21#include "AliRsnFunction.h"
2dab9030 22#include "AliRsnCutSet.h"
2dab9030 23#include "AliRsnValue.h"
24#include "AliRsnCutManager.h"
aec0ec32 25
26#include "AliRsnPair.h"
27
28ClassImp(AliRsnPair)
29
30//_____________________________________________________________________________
2dab9030 31AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) :
2a1c7696 32 TNamed(name, ""),
33 fOnlyTrue(kFALSE),
34 fCheckDecay(kFALSE),
35 fIsMixed(kFALSE),
36 fCount(0),
37 fPairDef(def),
38 fCutManager(Form("cutMgr_%s", name)),
39 fMother()
aec0ec32 40{
41//
42// Default constructor
43//
aec0ec32 44}
413bbf44 45
46//_____________________________________________________________________________
47AliRsnPair::AliRsnPair(const AliRsnPair& copy) :
2a1c7696 48 TNamed(copy),
49 fOnlyTrue(copy.fOnlyTrue),
50 fCheckDecay(copy.fCheckDecay),
51 fIsMixed(copy.fIsMixed),
52 fCount(copy.fCount),
53 fPairDef(copy.fPairDef),
54 fCutManager(copy.fCutManager),
55 fMother(copy.fMother)
413bbf44 56{
57//
58// Default constructor
59//
413bbf44 60}
61
62//_____________________________________________________________________________
63AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy)
64{
2a1c7696 65 fOnlyTrue = copy.fOnlyTrue;
66 fCheckDecay = copy.fCheckDecay;
67 fIsMixed = copy.fIsMixed;
68 fCount = copy.fCount;
69 fPairDef = copy.fPairDef;
70 fMother = copy.fMother;
71 fCutManager = copy.fCutManager;
72
73 return (*this);
413bbf44 74}
75
aec0ec32 76//_____________________________________________________________________________
77AliRsnPair::~AliRsnPair()
78{
79//
80// Destructor
81//
aec0ec32 82}
83
aec0ec32 84//_____________________________________________________________________________
78b94cbd 85void AliRsnPair::Print(Option_t* /*option*/) const
aec0ec32 86{
87//
88// Prints info about pair
89//
2dab9030 90
2a1c7696 91 AliInfo(Form("PDG %d %d", AliPID::ParticleCode(fPairDef->GetPID(0)), AliPID::ParticleCode(fPairDef->GetPID(1))));
92 AliInfo(Form("Masses %f %f", fPairDef->GetMass(0), fPairDef->GetMass(1)));
922688c0 93}
94
95//_____________________________________________________________________________
2dab9030 96Bool_t AliRsnPair::Fill
5faf5a07 97(AliRsnDaughter *daughter0, AliRsnDaughter *daughter1)
922688c0 98{
99//
2dab9030 100// Sets the two passed daughters to the AliRsnMother data member of this object
101// which is used to perform all computations to fill the value list.
102// This operation is done successfully only when the first passed object matches
103// the required object type (track/V0) and the required charge for first element in pair def,
104// and the second passed object does the same w.r. to the second element in pair def.
105// Moreover, all cuts are checked and the operation fails if a cut check is unsuccessful.
106// Finally, if a true pair is required, this is checked at the end.
922688c0 107//
108
2a1c7696 109 AliDebug(AliLog::kDebug + 2, "<-");
110
111 // first of all, compute the 4-momenta of the daughters
112 // and that of the mother, according to current pair def
113 // this could be needed for some cuts
114 fMother.SetDaughters(daughter0, fPairDef->GetMass(0), daughter1, fPairDef->GetMass(1));
115
116 // check for correct type-charge match for first element
117 if (daughter0->RefType() != fPairDef->GetDaughterType(0)) return kFALSE;
118 if (daughter0->ChargeChar() != fPairDef->GetCharge(0)) return kFALSE;
119
120 // check for correct type-charge match for second element
121 if (daughter1->RefType() != fPairDef->GetDaughterType(1)) return kFALSE;
122 if (daughter1->ChargeChar() != fPairDef->GetCharge(1)) return kFALSE;
123
124 // cuts on track #1 & common
125 AliRsnTarget::SwitchToFirst();
126 if (!fCutManager.PassDaughter1Cuts(daughter0)) {
127 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #1 not passed");
128 return kFALSE;
129 }
130 if (!fCutManager.PassCommonDaughterCuts(daughter0)) {
131 AliDebug(AliLog::kDebug + 2, "Common cuts for track #1 not passed");
132 return kFALSE;
133 }
134
135 // cuts on track #2 & common
136 AliRsnTarget::SwitchToSecond();
137 if (!fCutManager.PassDaughter2Cuts(daughter1)) {
138 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #2 not passed");
32992791 139 return kFALSE;
2a1c7696 140 }
141 if (!fCutManager.PassCommonDaughterCuts(daughter1)) {
142 AliDebug(AliLog::kDebug + 2, "Common cuts for track #2 not passed");
32992791 143 return kFALSE;
2a1c7696 144 }
145
146 // point again to first event as reference
147 // and for checking the pair cuts
148 AliRsnTarget::SwitchToFirst();
149 if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
150
151 // if required a true pair, check this here and eventually return a fail message
152 if (fOnlyTrue) {
153 // are the daughters really secondaries (in MC)?
154 Int_t m0, m1;
155 if (!fMother.CommonMother(m0, m1)) return kFALSE;
156 if (m0 < 0 || m1 < 0) return kFALSE;
157
158 AliDebug(AliLog::kDebug + 2, "Checking a true pair...");
159
160 // if they do, is this mother the correct type?
161 Int_t mpdg0 = TMath::Abs(daughter0->GetMotherPDG());
162 Int_t mpdg1 = TMath::Abs(daughter1->GetMotherPDG());
163 Int_t mpdg = TMath::Abs(fPairDef->GetMotherPDG());
164 if (mpdg0 != mpdg) {
165 AliDebug(AliLog::kDebug + 2, Form("Mother of d0 is %d instead of %d", mpdg0, mpdg));
166 return kFALSE;
32992791 167 }
2a1c7696 168 if (mpdg1 != mpdg) {
169 AliDebug(AliLog::kDebug + 2, Form("Mother of d1 is %d instead of %d", mpdg1, mpdg));
170 return kFALSE;
32992791 171 }
2a1c7696 172
173 // do they match the expected decay channel (that is, are they the expected types)?
174 if (fCheckDecay) {
175 AliDebug(AliLog::kDebug, "Checking decay tree...");
176 Int_t pdg0 = TMath::Abs(daughter0->GetPDG());
177 Int_t pdg1 = TMath::Abs(daughter1->GetPDG());
178 if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0) {
179 AliDebug(AliLog::kDebug + 2, Form("PDG0 is %d instead of %d", pdg0, fPairDef->GetPID(0)));
180 return kFALSE;
181 }
182 if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1) {
183 AliDebug(AliLog::kDebug + 2, Form("PDG1 is %d instead of %d", pdg1, fPairDef->GetPID(1)));
184 return kFALSE;
185 }
186 AliDebug(AliLog::kDebug, "Decay tree accepted");
187 }
188
189 // ok... if we arrive here that must really be a true pair! :-)
190 AliDebug(AliLog::kDebug + 2, "Pair accepted");
191 }
192
193 AliDebug(AliLog::kDebug + 2, "->");
194
195 // if pair is accepted, increment counter
196 ++fCount;
197
198 return kTRUE;
aec0ec32 199}
200
201//_____________________________________________________________________________
2dab9030 202void AliRsnPair::Compute()
aec0ec32 203{
204//
2dab9030 205// Virtual method to compute pair quantities of interest
aec0ec32 206//
aec0ec32 207
2a1c7696 208 AliWarning("Implement this method in derived classes");
aec0ec32 209}
210
211//_____________________________________________________________________________
2dab9030 212void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/)
aec0ec32 213{
214//
2dab9030 215// Virtual method to compute pair quantities of interest
aec0ec32 216//
5eb970a4 217
2a1c7696 218 AliWarning("Implement this method in derived classes");
aec0ec32 219}