Line data Source code
1 : /**************************************************************************
2 : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 : * *
4 : * Author: The ALICE Off-line Project. *
5 : * Contributors are mentioned in the code where appropriate. *
6 : * *
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 : **************************************************************************/
15 :
16 :
17 : // Generator for particle pairs in a preset
18 : // kinematic range
19 : // ranges can be set for invariant mass, pair pT, pair rapidity
20 : // and pair azimuth
21 :
22 : //
23 : // Comments and suggestions: markus.konrad.kohler@cern.ch
24 : //
25 :
26 : #include "TPDGCode.h"
27 : #include <TDatabasePDG.h>
28 : #include "AliGenEventHeader.h"
29 : #include "TF1.h"
30 :
31 : #include "AliGenPairFlat.h"
32 :
33 6 : ClassImp(AliGenPairFlat)
34 :
35 : //_____________________________________________________________________________
36 : AliGenPairFlat::AliGenPairFlat()
37 0 : :AliGenerator(),
38 0 : fPairNpart(10),
39 0 : fPairYMin(-10.),
40 0 : fPairYMax(10.),
41 0 : fPairPhiMin(0.),
42 0 : fPairPhiMax(TMath::TwoPi()),
43 0 : fPairPtMin(0.001),
44 0 : fPairPtMax(50.),
45 0 : fPairMassMin(0.),
46 0 : fPairMassMax(10.),
47 0 : fLegPdg1(11),
48 0 : fLegPdg2(-11),
49 0 : fAlpha(0.),
50 0 : fDebug(0),
51 0 : fPol(0)
52 0 : {
53 : //
54 : // Default constructor
55 : //
56 0 : }
57 :
58 :
59 : //_____________________________________________________________________________
60 0 : AliGenPairFlat::~AliGenPairFlat()
61 0 : {
62 : //
63 : // Destructor
64 : //
65 0 : delete fPol;
66 :
67 0 : }
68 :
69 : //_____________________________________________________________________________
70 : void AliGenPairFlat::Generate()
71 : {
72 : //
73 : // Generate a random pair of particles
74 : //
75 :
76 0 : Float_t polar[3]= {0,0,0};
77 0 : Float_t origin[3];
78 : Float_t time;
79 :
80 0 : Float_t p[3];
81 0 : Int_t i, j, nt;
82 : Double_t phi, y, mass, mt, e, pt;
83 : Float_t weight = 1.;
84 : Double_t pt1, pt2;
85 :
86 0 : TLorentzVector mother, dau1, dau2;
87 0 : Float_t random[6];
88 :
89 0 : fPol = new TF1("fPol","1.+[0]*x*x",-1.,1.);
90 0 : fPol->SetParameter(0, fAlpha);
91 :
92 :
93 0 : for (j=0;j<3;j++) origin[j]=fOrigin[j];
94 0 : time = fTimeOrigin;
95 0 : if(fVertexSmear==kPerEvent) {
96 0 : Vertex();
97 0 : for (j=0;j<3;j++) origin[j]=fVertex[j];
98 0 : time = fTime;
99 0 : }
100 :
101 0 : if(fDebug == 2){
102 0 : printf("\n\n------------------GENERATOR SETTINGS------------------\n\n");
103 0 : printf("You choosed for the mother the Mass range %f - %f \n",fPairMassMin,fPairMassMax);
104 0 : printf("You choosed for the mother the transverse Momentum range %f - %f \n",fPairPtMin,fPairPtMax);
105 0 : printf("You choosed for the mother the Phi range %f - %f \n",fPairPhiMin,fPairPhiMax);
106 0 : printf("The Particle will decay in (pdg) %i and %i\n \n",fLegPdg1, fLegPdg2);
107 0 : printf("The rest Mass of first daughter (%s) is %f \n",
108 0 : TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg1))->GetTitle(),
109 0 : TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg1))->Mass());
110 0 : printf("The rest Mass of second daughter (%s) is %f \n",
111 0 : TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg2))->GetTitle(),
112 0 : TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg2))->Mass());
113 0 : printf("polarization factor is alpha == %lf \n",fAlpha);
114 0 : printf("vertex is at x == %f || y == %f || z == %f \n",origin[0],origin[1],origin[2]);
115 0 : printf("\n----------------------------------------------------------\n");
116 : }
117 :
118 0 : for(i=0;i<fPairNpart;i++) {
119 :
120 : // mother properties
121 0 : Rndm(random,4);
122 0 : mass = fPairMassMin+random[0]*(fPairMassMax-fPairMassMin);
123 0 : pt = fPairPtMin+random[1]*(fPairPtMax-fPairPtMin);
124 0 : y = fPairYMin+random[2]*(fPairYMax-fPairYMin);
125 0 : phi = fPairPhiMin+random[3]*(fPairPhiMax-fPairPhiMin);
126 :
127 0 : mt = TMath::Sqrt(pt*pt + mass*mass);
128 0 : p[0] = pt*TMath::Cos(phi);
129 0 : p[1] = pt*TMath::Sin(phi);
130 0 : p[2] = mt*TMath::SinH(y);
131 0 : e = mt*TMath::CosH(y);
132 :
133 0 : mother.SetPxPyPzE(p[0],p[1],p[2],e);
134 :
135 :
136 0 : 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);
137 :
138 : //decay procedure
139 0 : if(!Decay(mother,dau1,dau2,fPol))continue;
140 :
141 0 : pt1 = dau1.Pt();
142 0 : pt2 = dau2.Pt();
143 : // y1 = dau1.Rapidity();
144 : // y2 = dau2.Rapidity();
145 :
146 : //first daughter
147 0 : p[0] = dau1.Px();
148 0 : p[1] = dau1.Py();
149 0 : p[2] = dau1.Pz();
150 0 : e = dau1.E();
151 :
152 0 : if(fVertexSmear==kPerTrack) {
153 0 : Rndm(random,6);
154 0 : for (j=0;j<3;j++) {
155 0 : origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
156 0 : TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
157 : }
158 :
159 0 : Rndm(random,2);
160 0 : time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
161 0 : TMath::Cos(2*random[0]*TMath::Pi())*
162 0 : TMath::Sqrt(-2*TMath::Log(random[1]));
163 0 : }
164 :
165 0 : PushTrack(fTrackIt,-1,fLegPdg1,p,origin,polar,time,kPPrimary,nt, weight);
166 0 : 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);
167 :
168 : //second daughter
169 0 : p[0] = dau2.Px();
170 0 : p[1] = dau2.Py();
171 0 : p[2] = dau2.Pz();
172 0 : e = dau2.E();
173 :
174 0 : if(fVertexSmear==kPerTrack) {
175 0 : Rndm(random,6);
176 0 : for (j=0;j<3;j++) {
177 0 : origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
178 0 : TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
179 : }
180 :
181 0 : Rndm(random,2);
182 0 : time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
183 0 : TMath::Cos(2*random[0]*TMath::Pi())*
184 0 : TMath::Sqrt(-2*TMath::Log(random[1]));
185 0 : }
186 :
187 0 : PushTrack(fTrackIt,-1,fLegPdg2,p,origin,polar,time,kPPrimary,nt,weight);
188 0 : 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);
189 :
190 : }//particle loop
191 :
192 0 : }
193 :
194 : //_____________________________________________________________________________
195 : void AliGenPairFlat::Init()
196 : {
197 : //
198 : // Init
199 : //
200 :
201 0 : printf("AliGenPairFlat::Init() not implemented!!!\n");
202 :
203 0 : }
204 :
205 :
206 : //_____________________________________________________________________________
207 : Bool_t AliGenPairFlat::Decay(const TLorentzVector& mother, TLorentzVector &dau1, TLorentzVector &dau2, TF1* polfactor)
208 : {
209 : //
210 : // decay procedure
211 : //
212 :
213 : Double_t mp, md1, md2, ed1, ed2, pd1;
214 : Double_t costheta, sintheta, phi;
215 :
216 0 : mp = mother.M();
217 0 : md1 = TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg1))->Mass();
218 0 : md2 = TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg2))->Mass();
219 :
220 0 : if(mp < md1+md2){
221 0 : printf("Daughters are heavier than Mother!! Check Kinematics!! \n");
222 0 : return 0;
223 : }
224 :
225 0 : ed1 = (mp*mp + md1*md1 - md2*md2)/(2.*mp);
226 0 : ed2 = mp-ed1;
227 0 : 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);
229 :
230 0 : costheta = polfactor->GetRandom(); //polarization
231 0 : sintheta = TMath::Sqrt((1.+costheta)*(1.-costheta));
232 0 : phi = 2.0*TMath::Pi()*gRandom->Rndm();
233 :
234 0 : dau1.SetPxPyPzE(pd1*sintheta*TMath::Cos(phi),
235 0 : pd1*sintheta*TMath::Sin(phi),
236 0 : pd1*costheta,
237 : ed1);
238 :
239 0 : dau2.SetPxPyPzE((-1.)*pd1*sintheta*TMath::Cos(phi),
240 0 : (-1.)*pd1*sintheta*TMath::Sin(phi),
241 0 : (-1.)*pd1*costheta,
242 : ed2);
243 :
244 0 : TVector3 boost = mother.BoostVector();
245 :
246 0 : dau1.Boost(boost);
247 0 : dau2.Boost(boost);
248 :
249 : return 1;
250 :
251 0 : }
252 :
253 :
254 :
|