]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/AliRsnPair.cxx
PWG2rsnextra:
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / AliRsnPair.cxx
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
24 ClassImp(AliRsnPair)
25
26 //_____________________________________________________________________________
27 AliRsnPair::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 //_____________________________________________________________________________
43 AliRsnPair::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 //_____________________________________________________________________________
59 AliRsnPair& 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 //_____________________________________________________________________________
73 AliRsnPair::~AliRsnPair()
74 {
75 //
76 // Destructor
77 //
78 }
79
80 //_____________________________________________________________________________
81 void AliRsnPair::Print(Option_t* /*option*/) const
82 {
83 //
84 // Prints info about pair
85 //
86 }
87
88 //_____________________________________________________________________________
89 Bool_t AliRsnPair::Fill
90 (AliRsnDaughter *daughter1, AliRsnDaughter *daughter2)
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 //
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    
109    // if matching is successful
110    // compute 4-momenta of daughters and mother
111    fMother.SetDaughters(daughter1, fPairDef->GetMass1(), daughter2, fPairDef->GetMass2());
112    
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    
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;
130
131    // cuts on track #1 & common
132    AliRsnTarget::SwitchToFirst();
133    if (!fCutManager.PassDaughter1Cuts(daughter1)) {
134       AliDebug(AliLog::kDebug + 2, "Specific cuts for track #1 not passed");
135       return kFALSE;
136    }
137    if (!fCutManager.PassCommonDaughterCuts(daughter1)) {
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();
144    if (!fCutManager.PassDaughter2Cuts(daughter2)) {
145       AliDebug(AliLog::kDebug + 2, "Specific cuts for track #2 not passed");
146       return kFALSE;
147    }
148    if (!fCutManager.PassCommonDaughterCuts(daughter2)) {
149       AliDebug(AliLog::kDebug + 2, "Common cuts for track #2 not passed");
150       return kFALSE;
151    }
152
153    // if pair is accepted, increment counter
154    ++fCount;
155
156    return kTRUE;
157 }
158
159 //_____________________________________________________________________________
160 void AliRsnPair::Compute()
161 {
162 //
163 // Virtual method to compute pair quantities of interest
164 //
165
166    AliWarning("Implement this method in derived classes");
167 }
168
169 //_____________________________________________________________________________
170 void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/)
171 {
172 //
173 // Virtual method to compute pair quantities of interest
174 //
175
176    AliWarning("Implement this method in derived classes");
177 }