4 #include <TGenPhaseSpace.h>
5 #include "TDatabasePDG.h"
7 #include <TDecayChannel.h>
17 mFileName=TString(file);
20 cout<<
"construct"<<endl;
24 cout<<
"destruct"<<endl;
27 TObjArray *MyDecay::decay(TParticle *part)
29 Float_t frac=gRandom->Rndm();
30 TParticlePDG *part_pdg=part->GetPDG();
33 while(i_dec<part_pdg->NDecayChannels())
35 sum_br+=part_pdg->DecayChannel(i_dec)->BranchingRatio();
36 if(frac<sum_br)
break;
39 if(i_dec==part_pdg->NDecayChannels())
return 0;
41 TDecayChannel *decay=part_pdg->DecayChannel(i_dec);
42 Int_t n_part=decay->NDaughters();
44 Double_t *mass_arr=
new Double_t[n_part];
45 for (Int_t i=0; i<n_part; i++)
47 mass_arr[i]=TDatabasePDG::Instance()->GetParticle(decay->DaughterPdgCode(i))->Mass();
50 TGenPhaseSpace *gs=
new TGenPhaseSpace();
51 Double_t mass=part_pdg->Mass();
54 v.SetE(sqrt(mass*mass+v.P()*v.P()));
55 gs->SetDecay(v,n_part,mass_arr);
57 Float_t max_wt=gs->GetWtMax();
58 while(gRandom->Rndm()*max_wt>gs->Generate());
60 TObjArray *dec_part=
new TObjArray(n_part);
61 for(Int_t i_part=0;i_part<n_part;i_part++)
63 TParticle *dght=
new TParticle(decay->DaughterPdgCode(i_part),0,0,0,0,0,0,0,0,0,0,0,0,0);
64 dght->SetMomentum(*gs->GetDecay(i_part));
72 void MyDecay::doDecay(Int_t ndecays)
75 cout<<
"label not set"<<endl;
82 Double_t ptmaxbin=15.;
84 Double_t phimin=-TMath::Pi();
85 Double_t phimax=TMath::Pi();
93 TParticle *part=
new TParticle(111,0,0,0,0,0,0,0,0,0,0,0,0,0);
94 TLorentzVector *v=
new TLorentzVector();
96 TParticle *part2=
new TParticle(221,0,0,0,0,0,0,0,0,0,0,0,0,0);
97 TLorentzVector *v2=
new TLorentzVector();
99 TParticle *part3=
new TParticle(223,0,0,0,0,0,0,0,0,0,0,0,0,0);
100 TLorentzVector *v3=
new TLorentzVector();
103 TH1F *pion=
new TH1F(
"pion",
"# versus pT",ptbins,ptminbin,ptmaxbin);
104 TH1F *etameson=
new TH1F(
"etameson",
"# versus pT",ptbins,ptminbin,ptmaxbin);
105 TH1F *omega=
new TH1F(
"omega",
"# versus pT",ptbins,ptminbin,ptmaxbin);
106 TH1F *gamma=
new TH1F(
"gamma",
"# versus pT",ptbins,ptminbin,ptmaxbin);
107 TH1F *gamma2=
new TH1F(
"gamma2",
"# versus pT",ptbins,ptminbin,ptmaxbin);
108 TH1F *gamma3=
new TH1F(
"gamma3",
"# versus pT",ptbins,ptminbin,ptmaxbin);
110 for(Int_t i=0;i<ndecays;i++)
112 if(i%10000==0) cout<<i<<endl;
115 Float_t pT=ptmin+gRandom->Rndm()*(ptmax-ptmin);
116 Float_t phi=phimin+gRandom->Rndm()*(phimax-phimin);
117 Float_t eta=etamin+gRandom->Rndm()*(etamax-etamin);
118 Float_t mass=part->GetMass();
119 Float_t mass2=part2->GetMass();
120 Float_t mass3=part3->GetMass();
121 v->SetPtEtaPhiM(pT,eta,phi,mass);
122 v2->SetPtEtaPhiM(pT,eta,phi,mass2);
123 v3->SetPtEtaPhiM(pT,eta,phi,mass3);
124 part->SetMomentum(*v);
125 part2->SetMomentum(*v2);
126 part3->SetMomentum(*v3);
128 Float_t WEIGHT=ptweight(pT)*phiweight(phi)*etaweight(eta);
129 Float_t WEIGHT2=ptweightETA(pT)*phiweight(phi)*etaweight(eta);
130 Float_t WEIGHT3=ptweightOMEGA(pT)*phiweight(phi)*etaweight(eta);
132 if(v->PseudoRapidity()>rapmin && v->PseudoRapidity()<rapmax) pion->Fill(v->Pt(),WEIGHT);
133 if(v2->PseudoRapidity()>rapmin && v2->PseudoRapidity()<rapmax) etameson->Fill(v2->Pt(),WEIGHT2);
134 if(v3->PseudoRapidity()>rapmin && v3->PseudoRapidity()<rapmax) omega->Fill(v3->Pt(),WEIGHT3);
137 TObjArray *dec_dght=decay(part);
138 TObjArray *dec_dght2=decay(part2);
139 TObjArray *dec_dght3=decay(part3);
142 Int_t nD=dec_dght->GetEntries();
143 for(Int_t j=0;j<nD;j++)
147 TParticle *d=(TParticle*)dec_dght->At(j);
148 if(d->GetPdgCode()==22 && d->Eta()>rapmin && d->Eta()<rapmax)
150 gamma->Fill(d->Pt(),WEIGHT);
155 TParticle *d=(TParticle*)dec_dght->At(j);
156 if(d->GetPdgCode()==22 && d->Eta()>rapmin && d->Eta()<rapmax)
158 gamma->Fill(d->Pt(),WEIGHT);
167 Int_t nD2=dec_dght2->GetEntries();
168 for(Int_t j=0;j<nD2;j++)
172 TParticle *d=(TParticle*)dec_dght2->At(j);
173 if(d->GetPdgCode()==22 && d->Eta()>rapmin && d->Eta()<rapmax)
175 gamma2->Fill(d->Pt(),WEIGHT2);
180 TParticle *d=(TParticle*)dec_dght2->At(j);
181 if(d->GetPdgCode()==22 && d->Eta()>rapmin && d->Eta()<rapmax)
183 gamma2->Fill(d->Pt(),WEIGHT2);
193 Int_t nD3=dec_dght3->GetEntries();
194 for(Int_t j=0;j<nD3;j++)
198 TParticle *d=(TParticle*)dec_dght3->At(j);
199 if(d->GetPdgCode()==22 && d->Eta()>rapmin && d->Eta()<rapmax)
201 gamma3->Fill(d->Pt(),WEIGHT3);
206 TParticle *d=(TParticle*)dec_dght3->At(j);
207 if(d->GetPdgCode()==22 && d->Eta()>rapmin && d->Eta()<rapmax)
209 gamma3->Fill(d->Pt(),WEIGHT3);
220 TCanvas *c=
new TCanvas(
"c",
"c",600,900);
224 gamma->SetTitle(
"pion(daughters) vs pT");
226 gamma->SetLineStyle(2);
230 gamma2->SetTitle(
"eta(daughters) vs pT");
232 gamma2->SetLineStyle(2);
233 etameson->Draw(
"same");
236 gamma3->SetTitle(
"omega782(daughters) vs pT");
238 gamma3->SetLineStyle(2);
242 pion->SetTitle(
"pions/etas/omegas vs pT");
244 pion->SetLineColor(2);
245 etameson->Draw(
"same");
246 etameson->SetLineColor(4);
248 omega->SetLineColor(3);
251 TH1F *f=
new TH1F(*gamma);
253 TH1F *f2=
new TH1F(*gamma2);
255 TH1F *f3=
new TH1F(*gamma3);
257 TH1F *fsum=
new TH1F(*f);
260 TH1F *g=
new TH1F(*pion);
266 fsum->SetTitle(
"bg photons per pion");
273 fsum->SetMinimum(.001);
275 TH1F *etatopi=
new TH1F(*etameson);
276 TH1F *omegatopi=
new TH1F(*omega);
277 etatopi->Divide(pion);
278 omegatopi->Divide(pion);
279 omegatopi->SetTitle(
"ratio of #eta/#omega to #pi");
281 etatopi->Draw(
"same");
283 c->SaveAs((mFileName+
".ps").Data());
284 c->SaveAs((mFileName+
".root").Data());
286 TFile *dec_out=
new TFile((mFileName+
"Sum.root").Data(),
"recreate");
288 f->Write(
"gamma_pion");
289 f2->Write(
"gamma_eta");
290 f3->Write(
"gamma_omega");
294 Double_t MyDecay::ptweight(Double_t x)
299 weight=300.*x*pow(1.+x,-9.0);
302 weight=8.24601e-02*x*pow(1.+x,-9.01897e+00);
306 Double_t MyDecay::ptweightETA(Double_t x)
310 Float_t weight=fETAMTSCALE * x/sqrt(x*x + ME*ME - MP*MP) * ptweight(sqrt(x*x + ME*ME - MP*MP));
313 Double_t MyDecay::ptweightOMEGA(Double_t x)
317 Float_t weight=1. * x/sqrt(x*x + MO*MO - MP*MP) * ptweight(sqrt(x*x + MO*MO - MP*MP));
320 Double_t MyDecay::etaweight(Double_t )
324 Double_t MyDecay::phiweight(Double_t )