2 // *** Class AliRsnPair ***
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)
11 // authors: A. Pulvirenti (email: alberto.pulvirenti@ct.infn.it)
12 // M. Vala (email: martin.vala@cern.ch)
19 #include "AliRsnMother.h"
20 #include "AliRsnEvent.h"
21 #include "AliRsnFunction.h"
22 #include "AliRsnCutSet.h"
23 #include "AliRsnValue.h"
24 #include "AliRsnCutManager.h"
26 #include "AliRsnPair.h"
30 //_____________________________________________________________________________
31 AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) :
38 fCutManager(Form("cutMgr_%s", name)),
42 // Default constructor
46 //_____________________________________________________________________________
47 AliRsnPair::AliRsnPair(const AliRsnPair& copy) :
49 fOnlyTrue(copy.fOnlyTrue),
50 fCheckDecay(copy.fCheckDecay),
51 fIsMixed(copy.fIsMixed),
53 fPairDef(copy.fPairDef),
54 fCutManager(copy.fCutManager),
58 // Default constructor
62 //_____________________________________________________________________________
63 AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy)
65 fOnlyTrue = copy.fOnlyTrue;
66 fCheckDecay = copy.fCheckDecay;
67 fIsMixed = copy.fIsMixed;
69 fPairDef = copy.fPairDef;
70 fMother = copy.fMother;
71 fCutManager = copy.fCutManager;
76 //_____________________________________________________________________________
77 AliRsnPair::~AliRsnPair()
84 //_____________________________________________________________________________
85 void AliRsnPair::Print(Option_t* /*option*/) const
88 // Prints info about pair
91 AliInfo(Form("PDG %d %d", AliPID::ParticleCode(fPairDef->GetPID(0)), AliPID::ParticleCode(fPairDef->GetPID(1))));
92 AliInfo(Form("Masses %f %f", fPairDef->GetMass(0), fPairDef->GetMass(1)));
95 //_____________________________________________________________________________
96 Bool_t AliRsnPair::Fill
97 (AliRsnDaughter *daughter0, AliRsnDaughter *daughter1)
100 // Sets the two passed daughters to the AliRsnMother data member of this object
101 // which is used to perform all computations to fill the value list.
102 // This operation is done successfully only when the first passed object matches
103 // the required object type (track/V0) and the required charge for first element in pair def,
104 // and the second passed object does the same w.r. to the second element in pair def.
105 // Moreover, all cuts are checked and the operation fails if a cut check is unsuccessful.
106 // Finally, if a true pair is required, this is checked at the end.
109 AliDebug(AliLog::kDebug + 2, "<-");
111 // first of all, compute the 4-momenta of the daughters
112 // and that of the mother, according to current pair def
113 // this could be needed for some cuts
114 fMother.SetDaughters(daughter0, fPairDef->GetMass(0), daughter1, fPairDef->GetMass(1));
116 // check for correct type-charge match for first element
117 if (daughter0->RefType() != fPairDef->GetDaughterType(0)) return kFALSE;
118 if (daughter0->ChargeChar() != fPairDef->GetCharge(0)) return kFALSE;
120 // check for correct type-charge match for second element
121 if (daughter1->RefType() != fPairDef->GetDaughterType(1)) return kFALSE;
122 if (daughter1->ChargeChar() != fPairDef->GetCharge(1)) return kFALSE;
124 // cuts on track #1 & common
125 AliRsnTarget::SwitchToFirst();
126 if (!fCutManager.PassDaughter1Cuts(daughter0)) {
127 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #1 not passed");
130 if (!fCutManager.PassCommonDaughterCuts(daughter0)) {
131 AliDebug(AliLog::kDebug + 2, "Common cuts for track #1 not passed");
135 // cuts on track #2 & common
136 AliRsnTarget::SwitchToSecond();
137 if (!fCutManager.PassDaughter2Cuts(daughter1)) {
138 AliDebug(AliLog::kDebug + 2, "Specific cuts for track #2 not passed");
141 if (!fCutManager.PassCommonDaughterCuts(daughter1)) {
142 AliDebug(AliLog::kDebug + 2, "Common cuts for track #2 not passed");
146 // point again to first event as reference
147 // and for checking the pair cuts
148 AliRsnTarget::SwitchToFirst();
149 if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
151 // if required a true pair, check this here and eventually return a fail message
153 // are the daughters really secondaries (in MC)?
155 if (!fMother.CommonMother(m0, m1)) return kFALSE;
156 if (m0 < 0 || m1 < 0) return kFALSE;
158 AliDebug(AliLog::kDebug + 2, "Checking a true pair...");
160 // if they do, is this mother the correct type?
161 Int_t mpdg0 = TMath::Abs(daughter0->GetMotherPDG());
162 Int_t mpdg1 = TMath::Abs(daughter1->GetMotherPDG());
163 Int_t mpdg = TMath::Abs(fPairDef->GetMotherPDG());
165 AliDebug(AliLog::kDebug + 2, Form("Mother of d0 is %d instead of %d", mpdg0, mpdg));
169 AliDebug(AliLog::kDebug + 2, Form("Mother of d1 is %d instead of %d", mpdg1, mpdg));
173 // do they match the expected decay channel (that is, are they the expected types)?
175 AliDebug(AliLog::kDebug, "Checking decay tree...");
176 Int_t pdg0 = TMath::Abs(daughter0->GetPDG());
177 Int_t pdg1 = TMath::Abs(daughter1->GetPDG());
178 if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0) {
179 AliDebug(AliLog::kDebug + 2, Form("PDG0 is %d instead of %d", pdg0, fPairDef->GetPID(0)));
182 if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1) {
183 AliDebug(AliLog::kDebug + 2, Form("PDG1 is %d instead of %d", pdg1, fPairDef->GetPID(1)));
186 AliDebug(AliLog::kDebug, "Decay tree accepted");
189 // ok... if we arrive here that must really be a true pair! :-)
190 AliDebug(AliLog::kDebug + 2, "Pair accepted");
193 AliDebug(AliLog::kDebug + 2, "->");
195 // if pair is accepted, increment counter
201 //_____________________________________________________________________________
202 void AliRsnPair::Compute()
205 // Virtual method to compute pair quantities of interest
208 AliWarning("Implement this method in derived classes");
211 //_____________________________________________________________________________
212 void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/)
215 // Virtual method to compute pair quantities of interest
218 AliWarning("Implement this method in derived classes");