* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.2 2000/07/11 18:24:55 fca
-Coding convention corrections + few minor bug fixes
+/* $Id$ */
+
+// Parameterisation of pi and K, eta and pt distributions
+// used for the ALICE TDRs.
+// eta: according to HIJING (shadowing + quenching)
+// pT : according to CDF measurement at 1.8 TeV
+// Author: andreas.morsch@cern.ch
-Revision 1.1 2000/06/09 20:20:30 morsch
-Same class as previously in AliSimpleGen.cxx
-All coding rule violations except RS3 corrected (AM)
-*/
-///////////////////////////////////////////////////////////////////
-// //
-// Generate the final state of the interaction as the input //
-// to the MonteCarlo //
-//
//Begin_Html
/*
<img src="picts/AliGeneratorClass.gif">
// //
///////////////////////////////////////////////////////////////////
+#include <TArrayF.h>
+#include <TClonesArray.h>
+#include <TDatabasePDG.h>
+#include <TF1.h>
+#include <TParticle.h>
+#include <TPDGCode.h>
+
+#include "AliConst.h"
+#include "AliDecayer.h"
+#include "AliGenEventHeader.h"
#include "AliGenHIJINGpara.h"
#include "AliRun.h"
-#include "AliMC.h"
-#include "AliConst.h"
-#include "AliPDG.h"
ClassImp(AliGenHIJINGpara)
-AliGenHIJINGpara::AliGenHIJINGpara(const AliGenHIJINGpara & para)
+
+AliGenHIJINGpara::AliGenHIJINGpara(const AliGenHIJINGpara & para):
+ AliGenerator(para)
{
-// copy constructor
+// Copy constructor
+ para.Copy(*this);
}
//_____________________________________________________________________________
//
// Default constructor
//
- fPtpi = 0;
- fPtka = 0;
- fETApic = 0;
- fETAkac = 0;
+ fPtpi = 0;
+ fPtka = 0;
+ fETApic = 0;
+ fETAkac = 0;
+ fDecayer = 0;
+ fNt = -1;
+ SetCutVertexZ();
+ SetPtRange();
+ SetPi0Decays();
}
//_____________________________________________________________________________
//
// Standard constructor
//
- fName="HIGINGpara";
+ fName="HIJINGpara";
fTitle="HIJING Parametrisation Particle Generator";
- fPtpi = 0;
- fPtka = 0;
- fETApic = 0;
- fETAkac = 0;
+ fPtpi = 0;
+ fPtka = 0;
+ fETApic = 0;
+ fETAkac = 0;
+ fDecayer = 0;
+ fNt = -1;
+ SetCutVertexZ();
+ SetPtRange();
+ SetPi0Decays();
}
//_____________________________________________________________________________
TMath::Min((Double_t)fThetaMax/2,TMath::Pi()/2-1.e-10)));
Float_t etaMax = -TMath::Log(TMath::Tan(
TMath::Max((Double_t)fThetaMin/2,1.e-10)));
- fPtpi = new TF1("ptpi",&ptpi,0,20,0);
- fPtka = new TF1("ptka",&ptka,0,20,0);
+ fPtpi = new TF1("ptpi",&ptpi,0,20,0);
+ fPtka = new TF1("ptka",&ptka,0,20,0);
fETApic = new TF1("etapic",&etapic,etaMin,etaMax,0);
fETAkac = new TF1("etakac",&etakac,etaMin,etaMax,0);
- TF1 *etaPic0 = new TF1("etapic",&etapic,-7,7,0);
- TF1 *etaKac0 = new TF1("etakac",&etakac,-7,7,0);
- Float_t intETApi = etaPic0->Integral(-0.5, 0.5);
- Float_t intETAka = etaKac0->Integral(-0.5, 0.5);
- Float_t scalePi=7316/(intETApi/1.5);
- Float_t scaleKa= 684/(intETAka/2.0);
-
- Float_t intPt = (0.877*etaPic0->Integral(0, 15)+
- 0.123*etaKac0->Integral(0, 15));
- Float_t intPtSel = (0.877*etaPic0->Integral(fPtMin, fPtMax)+
- 0.123*etaKac0->Integral(fPtMin, fPtMax));
- Float_t ptFrac = intPtSel/intPt;
-
-
- Float_t intETASel = (scalePi*etaPic0->Integral(etaMin, etaMax)+
- scaleKa*etaKac0->Integral(etaMin, etaMax));
- Float_t phiFrac = (fPhiMax-fPhiMin)/2/TMath::Pi();
- fParentWeight = Float_t(fNpart)/intETASel*ptFrac*phiFrac;
-
- printf("\n The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ", 100.*fParentWeight);
+
+ TF1 etaPic0("etapic",&etapic,-7,7,0);
+ TF1 etaKac0("etakac",&etakac,-7,7,0);
+
+ TF1 ptPic0("ptpi",&ptpi,0.,15.,0);
+ TF1 ptKac0("ptka",&ptka,0.,15.,0);
+
+ Float_t intETApi = etaPic0.Integral(-0.5, 0.5);
+ Float_t intETAka = etaKac0.Integral(-0.5, 0.5);
+ Float_t scalePi = 7316/(intETApi/1.5);
+ Float_t scaleKa = 684/(intETAka/2.0);
+
+// Fraction of events corresponding to the selected pt-range
+ Float_t intPt = (0.877*ptPic0.Integral(0, 15)+
+ 0.123*ptKac0.Integral(0, 15));
+ Float_t intPtSel = (0.877*ptPic0.Integral(fPtMin, fPtMax)+
+ 0.123*ptKac0.Integral(fPtMin, fPtMax));
+ Float_t ptFrac = intPtSel/intPt;
+
+// Fraction of events corresponding to the selected eta-range
+ Float_t intETASel = (scalePi*etaPic0.Integral(etaMin, etaMax)+
+ scaleKa*etaKac0.Integral(etaMin, etaMax));
+// Fraction of events corresponding to the selected phi-range
+ Float_t phiFrac = (fPhiMax-fPhiMin)/2/TMath::Pi();
+
+ fParentWeight = Float_t(fNpart)/(intETASel*ptFrac*phiFrac);
+ printf("%s: The number of particles in the selected kinematic region corresponds to %f percent of a full event\n ",
+ ClassName(),100.*fParentWeight);
+
+// Issue warning message if etaMin or etaMax are outside the alowed range
+// of the parametrization
+ if (etaMin < -8.001 || etaMax > 8.001) {
+ printf("\n \n WARNING FROM AliGenHIJINGPara !");
+ printf("\n YOU ARE USING THE PARAMETERISATION OUTSIDE ");
+ printf("\n THE ALLOWED PSEUDORAPIDITY RANGE (-8. - 8.)");
+ printf("\n YOUR LIMITS: %f %f \n \n ", etaMin, etaMax);
+ }
+//
+//
+ if (fPi0Decays && gMC)
+ fDecayer = gMC->GetDecayer();
}
+
//_____________________________________________________________________________
void AliGenHIJINGpara::Generate()
{
Float_t pt, pl, ptot;
Float_t phi, theta;
Float_t p[3];
- Int_t i, part, nt, j;
+ Int_t i, part, j;
//
TF1 *ptf;
TF1 *etaf;
Float_t random[6];
//
for (j=0;j<3;j++) origin[j]=fOrigin[j];
- if(fVertexSmear==kPerEvent) {
- gMC->Rndm(random,6);
- for (j=0;j<3;j++) {
- origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
- TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
- }
- }
+
+ if(fVertexSmear == kPerEvent) {
+ Vertex();
+ for (j=0; j < 3; j++) origin[j] = fVertex[j];
+ } // if kPerEvent
+ TArrayF eventVertex;
+ eventVertex.Set(3);
+ eventVertex[0] = origin[0];
+ eventVertex[1] = origin[1];
+ eventVertex[2] = origin[2];
+
for(i=0;i<fNpart;i++) {
while(1) {
- gMC->Rndm(random,3);
+ Rndm(random,3);
if(random[0]<kBorne) {
part=kPions[Int_t (random[1]*3)];
ptf=fPtpi;
- etaf=fETApic;
+ etaf=fETApic;
} else {
part=kKaons[Int_t (random[1]*4)];
ptf=fPtka;
p[1]=pt*TMath::Sin(phi);
p[2]=pl;
if(fVertexSmear==kPerTrack) {
- gMC->Rndm(random,6);
+ Rndm(random,6);
for (j=0;j<3;j++) {
origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
}
}
- gAlice->SetTrack(fTrackIt,-1,part,p,origin,polar,0,"Primary",nt,fParentWeight);
+ if (part == kPi0 && fPi0Decays){
+//
+// Decay pi0 if requested
+ PushTrack(0,-1,part,p,origin,polar,0,kPPrimary,fNt,fParentWeight);
+ KeepTrack(fNt);
+ DecayPi0(origin, p);
+ } else {
+ PushTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,fNt,fParentWeight);
+ KeepTrack(fNt);
+ }
+
break;
}
+ SetHighWaterMark(fNt);
}
+//
+
+// Header
+ AliGenEventHeader* header = new AliGenEventHeader("HIJINGparam");
+// Event Vertex
+ header->SetPrimaryVertex(eventVertex);
+ gAlice->SetGenEventHeader(header);
}
-AliGenHIJINGpara& AliGenHIJINGpara::operator=(const AliGenHIJINGpara& rhs)
-{
-// Assignment operator
- return *this;
+void AliGenHIJINGpara::SetPtRange(Float_t ptmin, Float_t ptmax) {
+ AliGenerator::SetPtRange(ptmin, ptmax);
}
+void AliGenHIJINGpara::DecayPi0(Float_t* orig, Float_t * p)
+{
+//
+// Decay the pi0
+// and put decay products on the stack
+//
+ static TClonesArray *particles;
+ if(!particles) particles = new TClonesArray("TParticle",1000);
+//
+ const Float_t kMass = TDatabasePDG::Instance()->GetParticle(kPi0)->Mass();
+ Float_t e = TMath::Sqrt(p[0] * p[0] + p[1] * p[1] + p[2] * p[2]+ kMass * kMass);
+//
+// Decay the pi0
+ TLorentzVector pmom(p[0], p[1], p[2], e);
+ fDecayer->Decay(kPi0, &pmom);
+
+//
+// Put decay particles on the stack
+//
+ Float_t polar[3] = {0., 0., 0.};
+ Int_t np = fDecayer->ImportParticles(particles);
+ Int_t nt;
+ for (Int_t i = 1; i < np; i++)
+ {
+ TParticle* iParticle = (TParticle *) particles->At(i);
+ p[0] = iParticle->Px();
+ p[1] = iParticle->Py();
+ p[2] = iParticle->Pz();
+ Int_t part = iParticle->GetPdgCode();
+
+ PushTrack(fTrackIt, fNt, part, p, orig, polar, 0, kPDecay, nt, fParentWeight);
+ KeepTrack(nt);
+ }
+ fNt = nt;
+}
+void AliGenHIJINGpara::Copy(AliGenHIJINGpara &) const
+{
+ Fatal("Copy","Not implemented!\n");
+}