Solved a bug in AliRsnPair and removed an excess of printouts in AliRsnCutSet
[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"
2dab9030 20#include "AliRsnCutSet.h"
aec0ec32 21
22#include "AliRsnPair.h"
23
24ClassImp(AliRsnPair)
25
26//_____________________________________________________________________________
2dab9030 27AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) :
2a1c7696 28 TNamed(name, ""),
29 fOnlyTrue(kFALSE),
30 fCheckDecay(kFALSE),
31 fIsMixed(kFALSE),
32 fCount(0),
33 fPairDef(def),
34 fCutManager(Form("cutMgr_%s", name)),
35 fMother()
aec0ec32 36{
37//
38// Default constructor
39//
aec0ec32 40}
413bbf44 41
42//_____________________________________________________________________________
43AliRsnPair::AliRsnPair(const AliRsnPair& copy) :
2a1c7696 44 TNamed(copy),
45 fOnlyTrue(copy.fOnlyTrue),
46 fCheckDecay(copy.fCheckDecay),
47 fIsMixed(copy.fIsMixed),
48 fCount(copy.fCount),
49 fPairDef(copy.fPairDef),
50 fCutManager(copy.fCutManager),
51 fMother(copy.fMother)
413bbf44 52{
53//
54// Default constructor
55//
413bbf44 56}
57
58//_____________________________________________________________________________
59AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy)
60{
2a1c7696 61 fOnlyTrue = copy.fOnlyTrue;
62 fCheckDecay = copy.fCheckDecay;
63 fIsMixed = copy.fIsMixed;
64 fCount = copy.fCount;
65 fPairDef = copy.fPairDef;
66 fMother = copy.fMother;
67 fCutManager = copy.fCutManager;
68
69 return (*this);
413bbf44 70}
71
aec0ec32 72//_____________________________________________________________________________
73AliRsnPair::~AliRsnPair()
74{
75//
76// Destructor
77//
aec0ec32 78}
79
aec0ec32 80//_____________________________________________________________________________
78b94cbd 81void AliRsnPair::Print(Option_t* /*option*/) const
aec0ec32 82{
83//
84// Prints info about pair
85//
922688c0 86}
87
88//_____________________________________________________________________________
2dab9030 89Bool_t AliRsnPair::Fill
3fe8af3d 90(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2, Bool_t refFirst)
922688c0 91{
92//
11ed73f6 93// Checks that first argument matches definitions for first daughter
94// and the same for second argument, where the order is defined by
95// the AliRsnPairDef data member.
96// If the matching is successful, the AliRsnMother data member is
97// initialized using the mass hypotheses defined here and the momenta
98// in the passed daughters.
3fe8af3d 99// The third argument is necessary to choose which one of the possible two
100// events owning the two daughter will be used as reference.
11ed73f6 101//
102
103 // check matching and exit if one of them fails
104 // if true pair is required, this is taken into account:
105 // if both true pairs and correct decay tree is required,
106 // then we must be sure that also the true PID of daughters matches,
107 // instead if correct decay tree is not required this additional check is not done
108 if (!fPairDef->GetDef1()->MatchesDaughter(daughter1, fOnlyTrue && fCheckDecay)) return kFALSE;
109 if (!fPairDef->GetDef2()->MatchesDaughter(daughter2, fOnlyTrue && fCheckDecay)) return kFALSE;
110
2b0c74c3 111 // if matching is successful
112 // compute 4-momenta of daughters and mother
d7712d44 113 fMother.SetDaughter(0, daughter1);
114 fMother.SetDaughter(1, daughter2);
115 fMother.ComputeSum(fPairDef->GetMass1(), fPairDef->GetMass2());
2b0c74c3 116
2b1a5e62 117 // assign reference event
118 if (refFirst) fMother.SetRefEvent(daughter1->GetOwnerEvent()); else fMother.SetRefEvent(daughter2->GetOwnerEvent());
119
11ed73f6 120 // if required a true pair, check this here and eventually return a fail message
121 // this is done using the method AliRsnMother::CommonMother with 2 arguments
122 // passed by reference, where the real GEANT label of the particle is stored
123 // and one can check if these tracks are both really secondaries (ID >= 0)
124 if (fOnlyTrue) {
125 Int_t m0, m1, common;
126 common = fMother.CommonMother(m0, m1);
127 if (m0 < 0 || m1 < 0) return kFALSE;
128 if (common != fPairDef->GetMotherPDG()) return kFALSE;
129 }
130
11ed73f6 131 // point to first event as reference
132 // and checks the pair cuts,
133 // (done first because it is more likely
134 // that it is not passed and execution is faster)
11ed73f6 135 if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
2a1c7696 136
137 // cuts on track #1 & common
11ed73f6 138 if (!fCutManager.PassDaughter1Cuts(daughter1)) {
2a1c7696 139 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #1 not passed");
140 return kFALSE;
141 }
11ed73f6 142 if (!fCutManager.PassCommonDaughterCuts(daughter1)) {
2a1c7696 143 AliDebug(AliLog::kDebug + 2, "Common cuts for track #1 not passed");
144 return kFALSE;
145 }
146
147 // cuts on track #2 & common
11ed73f6 148 if (!fCutManager.PassDaughter2Cuts(daughter2)) {
2a1c7696 149 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #2 not passed");
32992791 150 return kFALSE;
2a1c7696 151 }
11ed73f6 152 if (!fCutManager.PassCommonDaughterCuts(daughter2)) {
2a1c7696 153 AliDebug(AliLog::kDebug + 2, "Common cuts for track #2 not passed");
32992791 154 return kFALSE;
2a1c7696 155 }
156
2a1c7696 157 // if pair is accepted, increment counter
158 ++fCount;
159
160 return kTRUE;
aec0ec32 161}
162
163//_____________________________________________________________________________
2dab9030 164void AliRsnPair::Compute()
aec0ec32 165{
166//
2dab9030 167// Virtual method to compute pair quantities of interest
aec0ec32 168//
aec0ec32 169
2a1c7696 170 AliWarning("Implement this method in derived classes");
aec0ec32 171}
172
173//_____________________________________________________________________________
2dab9030 174void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/)
aec0ec32 175{
176//
2dab9030 177// Virtual method to compute pair quantities of interest
aec0ec32 178//
5eb970a4 179
2a1c7696 180 AliWarning("Implement this method in derived classes");
aec0ec32 181}