]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/RESONANCES/AliRsnPair.cxx
Where possible, replaced dynamic_cast with ROOT RTTI using TClass.
[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
11ed73f6 90(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2)
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.
99//
100
101 // check matching and exit if one of them fails
102 // if true pair is required, this is taken into account:
103 // if both true pairs and correct decay tree is required,
104 // then we must be sure that also the true PID of daughters matches,
105 // instead if correct decay tree is not required this additional check is not done
106 if (!fPairDef->GetDef1()->MatchesDaughter(daughter1, fOnlyTrue && fCheckDecay)) return kFALSE;
107 if (!fPairDef->GetDef2()->MatchesDaughter(daughter2, fOnlyTrue && fCheckDecay)) return kFALSE;
108
2b0c74c3 109 // if matching is successful
110 // compute 4-momenta of daughters and mother
111 fMother.SetDaughters(daughter1, fPairDef->GetMass1(), daughter2, fPairDef->GetMass2());
112
11ed73f6 113 // if required a true pair, check this here and eventually return a fail message
114 // this is done using the method AliRsnMother::CommonMother with 2 arguments
115 // passed by reference, where the real GEANT label of the particle is stored
116 // and one can check if these tracks are both really secondaries (ID >= 0)
117 if (fOnlyTrue) {
118 Int_t m0, m1, common;
119 common = fMother.CommonMother(m0, m1);
120 if (m0 < 0 || m1 < 0) return kFALSE;
121 if (common != fPairDef->GetMotherPDG()) return kFALSE;
122 }
123
11ed73f6 124 // point to first event as reference
125 // and checks the pair cuts,
126 // (done first because it is more likely
127 // that it is not passed and execution is faster)
128 AliRsnTarget::SwitchToFirst();
129 if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
2a1c7696 130
131 // cuts on track #1 & common
132 AliRsnTarget::SwitchToFirst();
11ed73f6 133 if (!fCutManager.PassDaughter1Cuts(daughter1)) {
2a1c7696 134 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #1 not passed");
135 return kFALSE;
136 }
11ed73f6 137 if (!fCutManager.PassCommonDaughterCuts(daughter1)) {
2a1c7696 138 AliDebug(AliLog::kDebug + 2, "Common cuts for track #1 not passed");
139 return kFALSE;
140 }
141
142 // cuts on track #2 & common
143 AliRsnTarget::SwitchToSecond();
11ed73f6 144 if (!fCutManager.PassDaughter2Cuts(daughter2)) {
2a1c7696 145 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #2 not passed");
32992791 146 return kFALSE;
2a1c7696 147 }
11ed73f6 148 if (!fCutManager.PassCommonDaughterCuts(daughter2)) {
2a1c7696 149 AliDebug(AliLog::kDebug + 2, "Common cuts for track #2 not passed");
32992791 150 return kFALSE;
2a1c7696 151 }
152
2a1c7696 153 // if pair is accepted, increment counter
154 ++fCount;
155
156 return kTRUE;
aec0ec32 157}
158
159//_____________________________________________________________________________
2dab9030 160void AliRsnPair::Compute()
aec0ec32 161{
162//
2dab9030 163// Virtual method to compute pair quantities of interest
aec0ec32 164//
aec0ec32 165
2a1c7696 166 AliWarning("Implement this method in derived classes");
aec0ec32 167}
168
169//_____________________________________________________________________________
2dab9030 170void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/)
aec0ec32 171{
172//
2dab9030 173// Virtual method to compute pair quantities of interest
aec0ec32 174//
5eb970a4 175
2a1c7696 176 AliWarning("Implement this method in derived classes");
aec0ec32 177}