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