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)
15 #include <Riostream.h>
20 #include "AliRsnMother.h"
21 #include "AliRsnEvent.h"
22 #include "AliRsnFunction.h"
23 #include "AliRsnCutSet.h"
24 #include "AliRsnCutStd.h"
25 #include "AliRsnValue.h"
26 #include "AliRsnCutManager.h"
28 #include "AliRsnPair.h"
32 //_____________________________________________________________________________
33 AliRsnPair::AliRsnPair(const char *name, AliRsnPairDef *def) :
44 // Default constructor
47 AliDebug(AliLog::kDebug+2,"<-");
48 AliDebug(AliLog::kDebug+2,"->");
51 //_____________________________________________________________________________
52 AliRsnPair::AliRsnPair(const AliRsnPair& copy) :
54 fOnlyTrue(copy.fOnlyTrue),
55 fCheckDecay(copy.fCheckDecay),
56 fIsMixed(copy.fIsMixed),
57 fPairDef(copy.fPairDef),
58 fCutManager(copy.fCutManager),
59 fMother(copy.fMother),
63 // Default constructor
66 AliDebug(AliLog::kDebug+2,"<-");
67 AliDebug(AliLog::kDebug+2,"->");
70 //_____________________________________________________________________________
71 AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy)
73 fOnlyTrue = copy.fOnlyTrue;
74 fCheckDecay = copy.fCheckDecay;
75 fIsMixed = copy.fIsMixed;
76 fPairDef = copy.fPairDef;
77 fMother = copy.fMother;
78 fCutManager = copy.fCutManager;
84 //_____________________________________________________________________________
85 AliRsnPair::~AliRsnPair()
91 AliDebug(AliLog::kDebug+2,"<-");
92 AliDebug(AliLog::kDebug+2,"->");
95 //_____________________________________________________________________________
96 void AliRsnPair::Print(Option_t* /*option*/) const
99 // Prints info about pair
102 AliDebug(AliLog::kDebug+2,"<-");
103 AliInfo(Form("PDG %d %d", AliPID::ParticleCode(fPairDef->GetPID(0)), AliPID::ParticleCode(fPairDef->GetPID(1))));
104 AliInfo(Form("Masses %f %f", fPairDef->GetMass(0), fPairDef->GetMass(1)));
106 AliDebug(AliLog::kDebug+2,"->");
109 //_____________________________________________________________________________
110 Bool_t AliRsnPair::Fill
111 (AliRsnDaughter *daughter0, AliRsnDaughter *daughter1, AliRsnEvent *ev0, AliRsnEvent *ev1)
114 // Sets the two passed daughters to the AliRsnMother data member of this object
115 // which is used to perform all computations to fill the value list.
116 // This operation is done successfully only when the first passed object matches
117 // the required object type (track/V0) and the required charge for first element in pair def,
118 // and the second passed object does the same w.r. to the second element in pair def.
119 // Moreover, all cuts are checked and the operation fails if a cut check is unsuccessful.
120 // Finally, if a true pair is required, this is checked at the end.
123 AliDebug(AliLog::kDebug+2,"<-");
125 // first of all, compute the 4-momenta of the daughters
126 // and that of the mother, according to current pair def
127 // this could be needed for some cuts
128 fMother.SetDaughters(daughter0, fPairDef->GetMass(0), daughter1, fPairDef->GetMass(1));
130 // check for correct type-charge match for first element
131 if (daughter0->RefType() != fPairDef->GetDaughterType(0)) return kFALSE;
132 if (daughter0->ChargeChar() != fPairDef->GetCharge(0)) return kFALSE;
134 // check for correct type-charge match for second element
135 if (daughter1->RefType() != fPairDef->GetDaughterType(1)) return kFALSE;
136 if (daughter1->ChargeChar() != fPairDef->GetCharge(1)) return kFALSE;
138 // cuts on track #1 & common
139 fCutManager.SetEvent(ev0);
140 if (!fCutManager.PassDaughter1Cuts(daughter0))
142 AliDebug(AliLog::kDebug+2, "Specific cuts for track #1 not passed");
145 if (!fCutManager.PassCommonDaughterCuts(daughter0))
147 AliDebug(AliLog::kDebug+2, "Common cuts for track #1 not passed");
151 // cuts on track #2 & common
152 fCutManager.SetEvent(ev1);
153 if (!fCutManager.PassDaughter2Cuts(daughter1))
155 AliDebug(AliLog::kDebug+2, "Specific cuts for track #2 not passed");
158 if (!fCutManager.PassCommonDaughterCuts(daughter1))
160 AliDebug(AliLog::kDebug+2, "Common cuts for track #2 not passed");
164 // point to first event as reference
167 // define pair & check
168 fCutManager.SetEvent(fEvent);
169 if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
171 // if required a true pair, check this here and eventually return a fail message
174 // are we in a MonteCarlo?
175 if (!daughter0->GetParticle() || !daughter1->GetParticle()) return kFALSE;
177 // are the daughters really secondaries (in MC)?
178 Int_t m0 = daughter0->GetParticle()->GetFirstMother();
179 Int_t m1 = daughter1->GetParticle()->GetFirstMother();
180 if (m0 < 0 || m1 < 0) return kFALSE;
182 // if they are, do they come from the same mother?
183 if (m0 != m1) return kFALSE;
185 //cout << "Checking a true pair..." << endl;
187 // if they do, is this mother the correct type?
188 Int_t mpdg0 = TMath::Abs(daughter0->GetMotherPDG());
189 Int_t mpdg1 = TMath::Abs(daughter1->GetMotherPDG());
190 Int_t mpdg = TMath::Abs(fPairDef->GetMotherPDG());
191 if (mpdg0 != mpdg) return kFALSE; //{cout << "Mother of d0 is " << mpdg0 << " instead of " << mpdg << endl; return kFALSE;}
192 if (mpdg1 != mpdg) return kFALSE; //{cout << "Mother of d1 is " << mpdg1 << " instead of " << mpdg << endl; return kFALSE;}
194 // do they match the expected decay channel (that is, are they the expected types)?
197 //cout << "Checking decay tree..." << endl;
198 Int_t pdg0 = TMath::Abs(daughter0->GetParticle()->GetPdgCode());
199 Int_t pdg1 = TMath::Abs(daughter1->GetParticle()->GetPdgCode());
200 if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0) return kFALSE; // {cout << "PDG0 is " << pdg0 << " instead of " << fPairDef->GetPID(0) << endl; return kFALSE;};
201 if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1) return kFALSE; // {cout << "PDG1 is " << pdg1 << " instead of " << fPairDef->GetPID(1) << endl; return kFALSE;};
202 //cout << "Decay tree accepted!" << endl;
205 // ok... if we arrive here that must really be a true pair! :-)
206 //cout << "Pair accepted!" << endl;
209 AliDebug(AliLog::kDebug+2,"->");
214 //_____________________________________________________________________________
215 void AliRsnPair::Compute()
218 // Virtual method to compute pair quantities of interest
221 AliWarning("Implement this method in derived classes");
224 //_____________________________________________________________________________
225 void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/)
228 // Virtual method to compute pair quantities of interest
231 AliWarning("Implement this method in derived classes");