5 #include "DimuonCombinator.h"
9 ClassImp(DimuonCombinator)
13 GParticle* DimuonCombinator::FirstMuon()
16 fmuon1 = (GParticle*) fPartArray->UncheckedAt(fimuon1);
17 while(Type(fmuon1)!=5 && Type(fmuon1)!=6) {
19 if (fimuon1 >= fimax1) {fmuon1=0; break;}
20 fmuon1 = (GParticle*) fPartArray->UncheckedAt(fimuon1);
25 GParticle* DimuonCombinator::FirstMuonSelected()
27 GParticle * muon=FirstMuon();
28 while(muon!=0 && !Selected(muon)) {muon=NextMuon();}
33 GParticle* DimuonCombinator::NextMuon()
36 if (fimuon1>=fNParticle) {fmuon1 = 0; return fmuon1;}
38 fmuon1 = (GParticle*) fPartArray->UncheckedAt(fimuon1);
39 while(Type(fmuon1)!=5 && Type(fmuon1)!=6) {
41 if (fimuon1>=fimax1) {fmuon1 = 0; break;}
42 fmuon1 = (GParticle*) fPartArray->UncheckedAt(fimuon1);
47 GParticle* DimuonCombinator::NextMuonSelected()
49 GParticle * muon=NextMuon();
50 while(muon !=0 && !Selected(muon)) {muon=NextMuon();}
55 void DimuonCombinator::FirstPartner()
62 if (fimuon2 >= fimax2) {fmuon2=0; return;}
63 fmuon2 = (GParticle*) fPartArray->UncheckedAt(fimuon2);
64 while(Type(fmuon2)!=5 && Type(fmuon2)!=6) {
66 if (fimuon2 >= fimax2) {fmuon2=0; break;}
67 fmuon2 = (GParticle*) fPartArray->UncheckedAt(fimuon2);
70 void DimuonCombinator::FirstPartnerSelected()
73 while(fmuon2 !=0 && !Selected(fmuon2)) {NextPartner();}
77 void DimuonCombinator::NextPartner()
80 if (fimuon2>=fimax2) {fmuon2 = 0; return;}
83 fmuon2 = (GParticle*) fPartArray->UncheckedAt(fimuon2);
85 while(Type(fmuon2)!=5 && Type(fmuon2)!=6) {
87 if (fimuon2>=fimax2) {fmuon2 = 0; break;}
88 fmuon2 = (GParticle*) fPartArray->UncheckedAt(fimuon2);
93 void DimuonCombinator::NextPartnerSelected()
96 while(fmuon2 !=0 && !Selected(fmuon2)) {NextPartner();}
100 GParticle* DimuonCombinator::Partner()
105 void DimuonCombinator::FirstMuonPair(GParticle* & muon1, GParticle* & muon2)
112 void DimuonCombinator::NextMuonPair(GParticle* & muon1, GParticle* & muon2)
122 void DimuonCombinator::FirstMuonPairSelected(GParticle* & muon1, GParticle* & muon2)
125 FirstPartnerSelected();
129 void DimuonCombinator::NextMuonPairSelected(GParticle* & muon1, GParticle* & muon2)
131 NextPartnerSelected();
134 FirstPartnerSelected();
139 void DimuonCombinator::ResetRange()
142 fimax1=fimax2=fNParticle;
145 void DimuonCombinator::SetFirstRange(Int_t from, Int_t to)
149 if (fimax1 > fNParticle) fimax1=fNParticle;
152 void DimuonCombinator::SetSecondRange(Int_t from, Int_t to)
156 if (fimax2 > fNParticle) fimax2=fNParticle;
162 Int_t DimuonCombinator::Selected(GParticle* part)
166 if (part==0) {return 0;}
168 if (part->GetPT() > fPtMin && part->GetEta()>fEtaMin && part->GetEta()<fEtaMax) {
177 Int_t DimuonCombinator::Selected(GParticle* part1, GParticle* part2)
179 return Selected(part1)*Selected(part2);
184 Float_t DimuonCombinator::Mass(GParticle* part1, GParticle* part2)
187 px=part1->GetPx()+part2->GetPx();
188 py=part1->GetPy()+part2->GetPy();
189 pz=part1->GetPz()+part2->GetPz();
190 e =part1->GetEnergy()+part2->GetEnergy();
191 Float_t p=px*px+py*py+pz*pz;
195 return TMath::Sqrt(e*e-p);
199 Float_t DimuonCombinator::PT(GParticle* part1, GParticle* part2)
202 px=part1->GetPx()+part2->GetPx();
203 py=part1->GetPy()+part2->GetPy();
204 return TMath::Sqrt(px*px+py*py);
207 Float_t DimuonCombinator::Pz(GParticle* part1, GParticle* part2)
209 return part1->GetPz()+part2->GetPz();
212 Float_t DimuonCombinator::Y(GParticle* part1, GParticle* part2)
215 pz=part1->GetPz()+part2->GetPz();
216 e =part1->GetEnergy()+part2->GetEnergy();
217 return 0.5*TMath::Log((e+pz)/(e-pz));
221 void DimuonCombinator::SmearGauss(Float_t width, Float_t & value)
223 value+=gRandom->Gaus(0, width);
228 Float_t DimuonCombinator::Weight(GParticle* part1, GParticle* part2)
230 if (part1->GetParent() == part2->GetParent()) {
231 return (part1->GetWgt())*fRate1;
233 return (part1->GetWgt())*(part2->GetWgt())*fRate1*fRate2;
237 Float_t DimuonCombinator::Weight(GParticle* part)
239 return part->GetWgt()*fRate1;