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) :
43 // Default constructor
46 AliDebug(AliLog::kDebug+2,"<-");
47 AliDebug(AliLog::kDebug+2,"->");
50 //_____________________________________________________________________________
51 AliRsnPair::AliRsnPair(const AliRsnPair& copy) :
53 fOnlyTrue(copy.fOnlyTrue),
54 fIsMixed(copy.fIsMixed),
55 fPairDef(copy.fPairDef),
56 fCutManager(copy.fCutManager),
57 fMother(copy.fMother),
61 // Default constructor
64 AliDebug(AliLog::kDebug+2,"<-");
65 AliDebug(AliLog::kDebug+2,"->");
68 //_____________________________________________________________________________
69 AliRsnPair& AliRsnPair::operator=(const AliRsnPair& copy)
71 fOnlyTrue = copy.fOnlyTrue;
72 fIsMixed = copy.fIsMixed;
73 fPairDef = copy.fPairDef;
74 fMother = copy.fMother;
75 fCutManager = copy.fCutManager;
81 //_____________________________________________________________________________
82 AliRsnPair::~AliRsnPair()
88 AliDebug(AliLog::kDebug+2,"<-");
89 AliDebug(AliLog::kDebug+2,"->");
92 //_____________________________________________________________________________
93 void AliRsnPair::Print(Option_t* /*option*/) const
96 // Prints info about pair
99 AliDebug(AliLog::kDebug+2,"<-");
100 AliInfo(Form("PDG %d %d", AliPID::ParticleCode(fPairDef->GetPID(0)), AliPID::ParticleCode(fPairDef->GetPID(1))));
101 AliInfo(Form("Masses %f %f", fPairDef->GetMass(0), fPairDef->GetMass(1)));
103 AliDebug(AliLog::kDebug+2,"->");
106 //_____________________________________________________________________________
107 Bool_t AliRsnPair::Fill
108 (AliRsnDaughter *daughter0, AliRsnDaughter *daughter1, AliRsnEvent *ev0, AliRsnEvent *ev1)
111 // Sets the two passed daughters to the AliRsnMother data member of this object
112 // which is used to perform all computations to fill the value list.
113 // This operation is done successfully only when the first passed object matches
114 // the required object type (track/V0) and the required charge for first element in pair def,
115 // and the second passed object does the same w.r. to the second element in pair def.
116 // Moreover, all cuts are checked and the operation fails if a cut check is unsuccessful.
117 // Finally, if a true pair is required, this is checked at the end.
120 AliDebug(AliLog::kDebug+2,"<-");
122 // check for correct type-charge match for first element
123 if (daughter0->RefType() != fPairDef->GetDaughterType(0)) return kFALSE;
124 if (daughter0->ChargeChar() != fPairDef->GetCharge(0)) return kFALSE;
126 // check for correct type-charge match for second element
127 if (daughter1->RefType() != fPairDef->GetDaughterType(1)) return kFALSE;
128 if (daughter1->ChargeChar() != fPairDef->GetCharge(1)) return kFALSE;
130 // cuts on track #1 & common
131 fCutManager.SetEvent(ev0);
132 if (!fCutManager.PassDaughter1Cuts(daughter0))
134 AliDebug(AliLog::kDebug+2, "Specific cuts for track #1 not passed");
137 if (!fCutManager.PassCommonDaughterCuts(daughter0))
139 AliDebug(AliLog::kDebug+2, "Common cuts for track #1 not passed");
143 // cuts on track #2 & common
144 fCutManager.SetEvent(ev1);
145 if (!fCutManager.PassDaughter2Cuts(daughter1))
147 AliDebug(AliLog::kDebug+2, "Specific cuts for track #2 not passed");
150 if (!fCutManager.PassCommonDaughterCuts(daughter1))
152 AliDebug(AliLog::kDebug+2, "Common cuts for track #2 not passed");
156 // point to first event as reference
159 // define pair & check
160 fMother.SetDaughters(daughter0, fPairDef->GetMass(0), daughter1, fPairDef->GetMass(1));
161 fCutManager.SetEvent(fEvent);
162 if (!fCutManager.PassMotherCuts(&fMother)) return kFALSE;
164 // if required a true pair, check this here and eventually return a fail message
167 // are we in a MonteCarlo?
168 if (!daughter0->GetParticle() || !daughter1->GetParticle()) return kFALSE;
170 // are the daughters really secondaries (in MC)?
171 Int_t m0 = daughter0->GetParticle()->GetFirstMother();
172 Int_t m1 = daughter1->GetParticle()->GetFirstMother();
173 if (m0 < 0 || m1 < 0) return kFALSE;
175 // if they are, do they come from the same mother?
176 if (m0 != m1) return kFALSE;
178 // if they do, is this mother the correct type?
179 if (daughter0->GetMotherPDG() != fPairDef->GetMotherPDG()) return kFALSE;
180 if (daughter1->GetMotherPDG() != fPairDef->GetMotherPDG()) return kFALSE;
182 // do they match the expected decay channel (that is, are they the expected types)?
183 Int_t pdg0 = TMath::Abs(daughter0->GetParticle()->GetPdgCode());
184 Int_t pdg1 = TMath::Abs(daughter1->GetParticle()->GetPdgCode());
185 if (AliPID::ParticleCode(fPairDef->GetPID(0)) != pdg0) return kFALSE;
186 if (AliPID::ParticleCode(fPairDef->GetPID(1)) != pdg1) return kFALSE;
188 // ok... if we arrive here that must really be a true pair! :-)
191 AliDebug(AliLog::kDebug+2,"->");
196 //_____________________________________________________________________________
197 void AliRsnPair::Compute()
200 // Virtual method to compute pair quantities of interest
203 AliWarning("Implement this method in derived classes");
206 //_____________________________________________________________________________
207 void AliRsnPair::Init(const char* /*prefix*/, TList* /*list*/)
210 // Virtual method to compute pair quantities of interest
213 AliWarning("Implement this method in derived classes");