]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - PWG2/RESONANCES/AliRsnPair.cxx
Solved a bug in AliRsnPair and removed an excess of printouts in AliRsnCutSet
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPair.cxx
... / ...
CommitLineData
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
15#include <TList.h>
16
17#include "AliLog.h"
18
19#include "AliRsnMother.h"
20#include "AliRsnCutSet.h"
21
22#include "AliRsnPair.h"
23
24ClassImp(AliRsnPair)
25
26//_____________________________________________________________________________
27AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) :
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()
36{
37//
38// Default constructor
39//
40}
41
42//_____________________________________________________________________________
43AliRsnPair::AliRsnPair(const AliRsnPair& copy) :
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)
52{
53//
54// Default constructor
55//
56}
57
58//_____________________________________________________________________________
59AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy)
60{
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);
70}
71
72//_____________________________________________________________________________
73AliRsnPair::~AliRsnPair()
74{
75//
76// Destructor
77//
78}
79
80//_____________________________________________________________________________
81void AliRsnPair::Print(Option_t* /*option*/) const
82{
83//
84// Prints info about pair
85//
86}
87
88//_____________________________________________________________________________
89Bool_t AliRsnPair::Fill
90(AliRsnDaughter *daughter1, AliRsnDaughter *daughter2, Bool_t refFirst)
91{
92//
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// The third argument is necessary to choose which one of the possible two
100// events owning the two daughter will be used as reference.
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
111 // if matching is successful
112 // compute 4-momenta of daughters and mother
113 fMother.SetDaughter(0, daughter1);
114 fMother.SetDaughter(1, daughter2);
115 fMother.ComputeSum(fPairDef->GetMass1(), fPairDef->GetMass2());
116
117 // assign reference event
118 if (refFirst) fMother.SetRefEvent(daughter1->GetOwnerEvent()); else fMother.SetRefEvent(daughter2->GetOwnerEvent());
119
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
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)
135 if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
136
137 // cuts on track #1 & common
138 if (!fCutManager.PassDaughter1Cuts(daughter1)) {
139 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #1 not passed");
140 return kFALSE;
141 }
142 if (!fCutManager.PassCommonDaughterCuts(daughter1)) {
143 AliDebug(AliLog::kDebug + 2, "Common cuts for track #1 not passed");
144 return kFALSE;
145 }
146
147 // cuts on track #2 & common
148 if (!fCutManager.PassDaughter2Cuts(daughter2)) {
149 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #2 not passed");
150 return kFALSE;
151 }
152 if (!fCutManager.PassCommonDaughterCuts(daughter2)) {
153 AliDebug(AliLog::kDebug + 2, "Common cuts for track #2 not passed");
154 return kFALSE;
155 }
156
157 // if pair is accepted, increment counter
158 ++fCount;
159
160 return kTRUE;
161}
162
163//_____________________________________________________________________________
164void AliRsnPair::Compute()
165{
166//
167// Virtual method to compute pair quantities of interest
168//
169
170 AliWarning("Implement this method in derived classes");
171}
172
173//_____________________________________________________________________________
174void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/)
175{
176//
177// Virtual method to compute pair quantities of interest
178//
179
180 AliWarning("Implement this method in derived classes");
181}