]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenHIJINGpara.cxx
AliRICHDetectV1 added.
[u/mrichter/AliRoot.git] / EVGEN / AliGenHIJINGpara.cxx
index e5d7bc270e5fcb70b943b82de32a82d01a334e2e..8086a3ad5d0191f307343d8816865e0657baa0ad 100644 (file)
 
 /*
 $Log$
+Revision 1.11.4.1  2002/07/24 08:56:28  alibrary
+Updating EVGEN on TVirtulaMC
+
+Revision 1.12  2002/06/19 06:56:34  hristov
+Memory leak corrected
+
+Revision 1.11  2002/03/20 10:21:13  hristov
+Set fPtMax to 15 GeV in order to avoid some numerical problems
+
+Revision 1.10  2001/10/15 16:44:46  morsch
+- Possibility for vertex distribution truncation.
+- Write mc header with vertex position.
+
+Revision 1.9  2001/07/27 17:09:36  morsch
+Use local SetTrack, KeepTrack and SetHighWaterMark methods
+to delegate either to local stack or to stack owned by AliRun.
+(Piotr Skowronski, A.M.)
+
+Revision 1.8  2001/07/20 11:03:58  morsch
+Issue warning message if used outside allowed eta range (-8 to 8).
+
+Revision 1.7  2001/07/17 12:41:01  morsch
+- Calculation of fraction of event corresponding to selected pt-range corrected
+(R. Turrisi)
+- Parent weight corrected.
+
+Revision 1.6  2001/05/16 14:57:10  alibrary
+New files for folders and Stack
+
+Revision 1.5  2000/12/21 16:24:06  morsch
+Coding convention clean-up
+
+Revision 1.4  2000/11/30 07:12:50  alibrary
+Introducing new Rndm and QA classes
+
 Revision 1.3  2000/10/02 21:28:06  fca
 Removal of useless dependecies via forward declarations
 
@@ -26,11 +61,14 @@ 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                                          //
-//
+
+// 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
+
+
 //Begin_Html
 /*
 <img src="picts/AliGeneratorClass.gif">
@@ -47,11 +85,14 @@ All coding rule violations except RS3 corrected (AM)
 ///////////////////////////////////////////////////////////////////
 
 #include "AliGenHIJINGpara.h"
-#include "TF1.h"
+#include "AliGenEventHeader.h"
 #include "AliRun.h"
 #include "AliConst.h"
 #include "AliPDG.h"
 
+#include <TF1.h>
+#include <TArrayF.h>
+
 ClassImp(AliGenHIJINGpara)
 
 AliGenHIJINGpara::AliGenHIJINGpara(const AliGenHIJINGpara & para)
@@ -166,6 +207,8 @@ AliGenHIJINGpara::AliGenHIJINGpara()
     fPtka = 0;
     fETApic = 0;
     fETAkac = 0;
+    SetCutVertexZ();
+    SetPtRange();
 }
 
 //_____________________________________________________________________________
@@ -181,6 +224,8 @@ AliGenHIJINGpara::AliGenHIJINGpara(Int_t npart)
     fPtka = 0;
     fETApic = 0;
     fETAkac = 0;
+    SetCutVertexZ();
+    SetPtRange();
 }
 
 //_____________________________________________________________________________
@@ -205,31 +250,48 @@ void AliGenHIJINGpara::Init()
        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);
+    }
 }
 
 //_____________________________________________________________________________
@@ -259,13 +321,25 @@ void AliGenHIJINGpara::Generate()
     Float_t random[6];
     //
     for (j=0;j<3;j++) origin[j]=fOrigin[j];
-    if(fVertexSmear==kPerEvent) {
-       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) {
+       Float_t dv[3];
+       dv[2] = 1.e10;
+       while(TMath::Abs(dv[2]) > fCutVertexZ*fOsigma[2]) {
+           Rndm(random,6);
+           for (j=0; j < 3; j++) {
+               dv[j] = fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
+                   TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+           }
        }
-    }
+       for (j=0; j < 3; j++) origin[j] += dv[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) {
            Rndm(random,3);
@@ -295,10 +369,15 @@ void AliGenHIJINGpara::Generate()
                        TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
                }
            }
-           gAlice->SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
+           SetTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
            break;
        }
     }
+// Header
+    AliGenEventHeader* header = new AliGenEventHeader("HIJINGparam");
+// Event Vertex
+    header->SetPrimaryVertex(eventVertex);
+    gAlice->SetGenEventHeader(header); 
 }
 
 AliGenHIJINGpara& AliGenHIJINGpara::operator=(const  AliGenHIJINGpara& rhs)
@@ -307,4 +386,7 @@ AliGenHIJINGpara& AliGenHIJINGpara::operator=(const  AliGenHIJINGpara& rhs)
     return *this;
 }
 
+void AliGenHIJINGpara::SetPtRange(Float_t ptmin, Float_t ptmax) {
+  AliGenerator::SetPtRange(ptmin, ptmax);
+}