5 #include "AliDimuCombinator.h"
9 ClassImp(AliDimuCombinator)
13 TParticle* AliDimuCombinator::FirstMuon()
16 fmuon1 = (TParticle*) fPartArray->UncheckedAt(fimuon1);
17 while(Type(fmuon1)!=5 && Type(fmuon1)!=6) {
19 if (fimuon1 >= fimax1) {fmuon1=0; break;}
20 fmuon1 = (TParticle*) fPartArray->UncheckedAt(fimuon1);
25 TParticle* AliDimuCombinator::FirstMuonSelected()
27 TParticle * muon=FirstMuon();
28 while(muon!=0 && !Selected(muon)) {muon=NextMuon();}
33 TParticle* AliDimuCombinator::NextMuon()
36 if (fimuon1>=fNParticle) {fmuon1 = 0; return fmuon1;}
38 fmuon1 = (TParticle*) fPartArray->UncheckedAt(fimuon1);
39 while(Type(fmuon1)!=5 && Type(fmuon1)!=6) {
41 if (fimuon1>=fimax1) {fmuon1 = 0; break;}
42 fmuon1 = (TParticle*) fPartArray->UncheckedAt(fimuon1);
47 TParticle* AliDimuCombinator::NextMuonSelected()
49 TParticle * muon=NextMuon();
50 while(muon !=0 && !Selected(muon)) {muon=NextMuon();}
55 void AliDimuCombinator::FirstPartner()
62 if (fimuon2 >= fimax2) {fmuon2=0; return;}
63 fmuon2 = (TParticle*) fPartArray->UncheckedAt(fimuon2);
64 while(Type(fmuon2)!=5 && Type(fmuon2)!=6) {
66 if (fimuon2 >= fimax2) {fmuon2=0; break;}
67 fmuon2 = (TParticle*) fPartArray->UncheckedAt(fimuon2);
70 void AliDimuCombinator::FirstPartnerSelected()
73 while(fmuon2 !=0 && !Selected(fmuon2)) {NextPartner();}
77 void AliDimuCombinator::NextPartner()
80 if (fimuon2>=fimax2) {fmuon2 = 0; return;}
83 fmuon2 = (TParticle*) fPartArray->UncheckedAt(fimuon2);
85 while(Type(fmuon2)!=5 && Type(fmuon2)!=6) {
87 if (fimuon2>=fimax2) {fmuon2 = 0; break;}
88 fmuon2 = (TParticle*) fPartArray->UncheckedAt(fimuon2);
93 void AliDimuCombinator::NextPartnerSelected()
96 while(fmuon2 !=0 && !Selected(fmuon2)) {NextPartner();}
100 TParticle* AliDimuCombinator::Partner()
105 void AliDimuCombinator::FirstMuonPair(TParticle* & muon1, TParticle* & muon2)
112 void AliDimuCombinator::NextMuonPair(TParticle* & muon1, TParticle* & muon2)
122 void AliDimuCombinator::FirstMuonPairSelected(TParticle* & muon1, TParticle* & muon2)
125 FirstPartnerSelected();
129 void AliDimuCombinator::NextMuonPairSelected(TParticle* & muon1, TParticle* & muon2)
131 NextPartnerSelected();
134 FirstPartnerSelected();
139 void AliDimuCombinator::ResetRange()
142 fimax1=fimax2=fNParticle;
145 void AliDimuCombinator::SetFirstRange(Int_t from, Int_t to)
149 if (fimax1 > fNParticle) fimax1=fNParticle;
152 void AliDimuCombinator::SetSecondRange(Int_t from, Int_t to)
156 if (fimax2 > fNParticle) fimax2=fNParticle;
162 Bool_t AliDimuCombinator::Selected(TParticle* part)
166 if (part==0) {return 0;}
168 if (part->Pt() > fPtMin && part->Eta()>fEtaMin && part->Eta()<fEtaMax) {
177 Bool_t AliDimuCombinator::Selected(TParticle* part1, TParticle* part2)
179 return Selected(part1)*Selected(part2);
184 Float_t AliDimuCombinator::Mass(TParticle* part1, TParticle* part2)
187 px=part1->Px()+part2->Px();
188 py=part1->Py()+part2->Py();
189 pz=part1->Pz()+part2->Pz();
190 e =part1->Energy()+part2->Energy();
191 Float_t p=px*px+py*py+pz*pz;
195 return TMath::Sqrt(e*e-p);
199 Float_t AliDimuCombinator::PT(TParticle* part1, TParticle* part2)
202 px=part1->Px()+part2->Px();
203 py=part1->Py()+part2->Py();
204 return TMath::Sqrt(px*px+py*py);
207 Float_t AliDimuCombinator::Pz(TParticle* part1, TParticle* part2)
209 return part1->Pz()+part2->Pz();
212 Float_t AliDimuCombinator::Y(TParticle* part1, TParticle* part2)
215 pz=part1->Pz()+part2->Pz();
216 e =part1->Energy()+part2->Energy();
217 return 0.5*TMath::Log((e+pz)/(e-pz));
221 void AliDimuCombinator::SmearGauss(Float_t width, Float_t & value)
223 value+=gRandom->Gaus(0, width);
228 Float_t AliDimuCombinator::Decay_Prob(TParticle* part)
230 Float_t d, h, theta, CTau;
231 TParticle* parent = Parent(part);
232 Int_t ipar=Type(parent);
233 if (ipar==8 || ipar==9) {
235 } else if (ipar==11 || ipar==12) {
242 Float_t GammaBeta=(parent->P())/(parent->GetMass());
244 // this part is still very ALICE muon-arm specific
246 theta=parent->Theta();
247 h=90*TMath::Tan(theta);
250 d=4/TMath::Sin(theta);
252 d=90/TMath::Cos(theta);
256 return 1-TMath::Exp(-d/CTau/GammaBeta);
262 Float_t AliDimuCombinator::Weight(TParticle* part1, TParticle* part2)
264 Float_t wgt=(part1->GetWeight())*(part2->GetWeight());
266 if (Correlated(part1, part2)) {
267 return wgt/(Parent(part1)->GetWeight())*fRate1;
269 return wgt*fRate1*fRate2;
274 Float_t AliDimuCombinator::Weight(TParticle* part)
276 return (part->GetWeight())*(Parent(part)->GetWeight())*fRate1;
278 Bool_t AliDimuCombinator::Correlated(TParticle* part1, TParticle* part2)
280 if (Origin(part1) == Origin(part2)) {
287 TParticle* AliDimuCombinator::Parent(TParticle* part)
289 return (TParticle*) (fPartArray->UncheckedAt(part->GetFirstMother()));
292 Int_t AliDimuCombinator::Origin(TParticle* part)
294 Int_t iparent= part->GetFirstMother();
295 if (iparent < 0) return iparent;
298 ip=((TParticle*) fPartArray->UncheckedAt(iparent))->GetFirstMother();