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