1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 // Generator for particle pairs in a preset
19 // ranges can be set for invariant mass, pair pT, pair rapidity
23 // Comments and suggestions: markus.konrad.kohler@cern.ch
27 #include <TDatabasePDG.h>
28 #include "AliGenEventHeader.h"
31 #include "AliGenPairFlat.h"
33 ClassImp(AliGenPairFlat)
35 //_____________________________________________________________________________
36 AliGenPairFlat::AliGenPairFlat()
42 fPairPhiMax(TMath::TwoPi()),
54 // Default constructor
59 //_____________________________________________________________________________
60 AliGenPairFlat::~AliGenPairFlat()
69 //_____________________________________________________________________________
70 void AliGenPairFlat::Generate()
73 // Generate a random pair of particles
76 Float_t polar[3]= {0,0,0};
82 Double_t phi, y, mass, mt, e, pt;
84 Double_t pt1, pt2, y1, y2;
86 TLorentzVector mother, dau1, dau2;
89 fPol = new TF1("fPol","1.+[0]*x*x",-1.,1.);
90 fPol->SetParameter(0, fAlpha);
93 for (j=0;j<3;j++) origin[j]=fOrigin[j];
95 if(fVertexSmear==kPerEvent) {
97 for (j=0;j<3;j++) origin[j]=fVertex[j];
102 printf("\n\n------------------GENERATOR SETTINGS------------------\n\n");
103 printf("You choosed for the mother the Mass range %f - %f \n",fPairMassMin,fPairMassMax);
104 printf("You choosed for the mother the transverse Momentum range %f - %f \n",fPairPtMin,fPairPtMax);
105 printf("You choosed for the mother the Phi range %f - %f \n",fPairPhiMin,fPairPhiMax);
106 printf("The Particle will decay in (pdg) %i and %i\n \n",fLegPdg1, fLegPdg2);
107 printf("The rest Mass of first daughter (%s) is %f \n",
108 TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg1))->GetTitle(),
109 TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg1))->Mass());
110 printf("The rest Mass of second daughter (%s) is %f \n",
111 TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg2))->GetTitle(),
112 TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg2))->Mass());
113 printf("polarization factor is alpha == %lf \n",fAlpha);
114 printf("vertex is at x == %f || y == %f || z == %f \n",origin[0],origin[1],origin[2]);
115 printf("\n----------------------------------------------------------\n");
118 for(i=0;i<fPairNpart;i++) {
122 mass = fPairMassMin+random[0]*(fPairMassMax-fPairMassMin);
123 pt = fPairPtMin+random[1]*(fPairPtMax-fPairPtMin);
124 y = fPairYMin+random[2]*(fPairYMax-fPairYMin);
125 phi = fPairPhiMin+random[3]*(fPairPhiMax-fPairPhiMin);
127 mt = TMath::Sqrt(pt*pt + mass*mass);
128 p[0] = pt*TMath::Cos(phi);
129 p[1] = pt*TMath::Sin(phi);
130 p[2] = mt*TMath::SinH(y);
131 e = mt*TMath::CosH(y);
133 mother.SetPxPyPzE(p[0],p[1],p[2],e);
136 if (fDebug == 2) printf("p = (%+11.4e,%+11.4e,%+11.4e) GeV || pt = %+11.4e || y = %+11.4e || weight=%+11.4e || E= %+11.4e\n",p[0],p[1],p[2],pt, y,weight,e);
139 if(!Decay(mother,dau1,dau2,fPol))continue;
143 y1 = dau1.Rapidity();
144 y2 = dau2.Rapidity();
152 if(fVertexSmear==kPerTrack) {
155 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
156 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
160 time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
161 TMath::Cos(2*random[0]*TMath::Pi())*
162 TMath::Sqrt(-2*TMath::Log(random[1]));
165 PushTrack(fTrackIt,-1,fLegPdg1,p,origin,polar,time,kPPrimary,nt, weight);
166 if (fDebug == 2) printf("dau1-->id=%+3d, p = (%+11.4e,%+11.4e,%+11.4e) GeV || pt = %+11.4e || weight=%+11.4e || E= %+11.4e\n",fLegPdg1,p[0],p[1],p[2],pt1,weight,e);
174 if(fVertexSmear==kPerTrack) {
177 origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
178 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
182 time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
183 TMath::Cos(2*random[0]*TMath::Pi())*
184 TMath::Sqrt(-2*TMath::Log(random[1]));
187 PushTrack(fTrackIt,-1,fLegPdg2,p,origin,polar,time,kPPrimary,nt,weight);
188 if (fDebug == 2) printf("dau2-->id=%+3d, p = (%+11.4e,%+11.4e,%+11.4e) GeV || pt = %+11.4e || weight=%+11.4e || E= %+11.4e\n",fLegPdg2,p[0],p[1],p[2],pt2, weight,e);
194 //_____________________________________________________________________________
195 void AliGenPairFlat::Init()
201 printf("AliGenPairFlat::Init() not implemented!!!\n");
206 //_____________________________________________________________________________
207 Bool_t AliGenPairFlat::Decay(const TLorentzVector& mother, TLorentzVector &dau1, TLorentzVector &dau2, TF1* polfactor)
213 Double_t mp, md1, md2, ed1, ed2, pd1, pd2;
214 Double_t costheta, sintheta, phi;
217 md1 = TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg1))->Mass();
218 md2 = TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg2))->Mass();
221 printf("Daughters are heavier than Mother!! Check Kinematics!! \n");
225 ed1 = (mp*mp + md1*md1 - md2*md2)/(2.*mp);
227 pd1 = TMath::Sqrt((ed1+md1)*(ed1-md1));
228 pd2 = TMath::Sqrt((mp*mp-(md1+md2)*(md1+md2))*(mp*mp -(md1-md2)*(md1-md2)))/(2.*mp);
230 costheta = polfactor->GetRandom(); //polarization
231 sintheta = TMath::Sqrt((1.+costheta)*(1.-costheta));
232 phi = 2.0*TMath::Pi()*gRandom->Rndm();
234 dau1.SetPxPyPzE(pd1*sintheta*TMath::Cos(phi),
235 pd1*sintheta*TMath::Sin(phi),
239 dau2.SetPxPyPzE((-1.)*pd1*sintheta*TMath::Cos(phi),
240 (-1.)*pd1*sintheta*TMath::Sin(phi),
244 TVector3 boost = mother.BoostVector();